matrix-org / matrix-org/complement-crypto

Add waiters to events

Open
#193 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
18
Forks
12
Avg merge
2d 12h
Merged PRs (30d)
6

Description

We currently need to do things like https://github.com/matrix-org/complement-crypto/blob/f8712271d573f4f0a33240ab9c1a2fdb4372bd91/tests/to_device_test.go#L186 because we don't listen for changes to the state of an event. This is flakey and has caused intermittent failures in this test and likely others.

Instead, we should hook into the timeline update code and every time we see our target event ID we should emit an update on a channel for it. That way, we can use the waiter pattern of "wait until this happens and give up after N seconds" which is far more reliable as N can be large without affecting the runtime of the test in the happy case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/to_device_test.go around line 186 and trace the timeline update code that observes event state. Determine how a target event ID can notify a channel and how callers can wait with a timeout. Done means the test no longer relies on flaky polling and the waiter gives up after the requested timeout.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.