matrix-org / matrix-org/matrix-rust-sdk

timeline: aggregated events aren't well ordered

Open
#4,161 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-Timeline
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

Aggregation events (edits, reactions) aren't well ordered in the timeline: we don't really know how to order them relative to each other. In the general case, it won't be a problem, but it might lead to discrepancies in a few cases:

- when we have a bundled edit, for instance, right now we'll always prefer it to a pending edit. This might be wrong if the pending edit is more up-to-date than the bundled edit (i.e. the related pending edit is *after* the bundled edit event, in the overall ordering).
- when we already have a pending edit and another comes in, we do some best-effort guessing if the new pending edit overrides the previous one or would be overridden by the previous one.

Ideally, the protocol would give us some perfect ordering over events, so we don't have to do any kind of guessing / rejiggering ourselves, e.g. with something akin to [MSC4033](https://github.com/matrix-org/matrix-spec-proposals/pull/4033). Otherwise, we may be able to use the `all_events` internal ordering (or the ordering provided by the [Event cache](https://github.com/matrix-org/matrix-rust-sdk/issues/3058), in some future).

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

No files or tests are named. Start by tracing timeline aggregation and the all_events ordering mentioned in the issue, then review MSC4033 and Event cache issue 3058. Done means the ordering of aggregated and pending events is deterministic and no longer relies on the described best-effort guesses.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.