mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 13:28:04 +00:00
The seventh commit of phase 2, which completes it. The Rust transaction now covers the whole of `_persist_events_txn`, so at the `transaction` level every chunk Rust prepared is written in Rust, including on a server with `include_profile_updates_in_sync`. - `txn/profile.rs` ports `_record_profile_updates_for_state_delta_txn` and the helpers it calls: the joined room updates of local members who joined, and the left room updates, both ways, of members who left or were state reset out of the room, with the deletes of the rows they replace. It runs at the end of `update_current_state`, as in Python. - Its rows take IDs from the profile updates stream inside the transaction, through a third `TxnStream` over the tracker of `_profile_updates_id_gen`. `PersistEffects.profile_stream_ids` hands them to the applier, which finishes them as `get_next_mult_txn` does, as it does the sticky events stream's. The two share `_finish_txn_stream_ids`. - The controller no longer falls back to Python on a server that records profile updates. - The Python helpers take the members in user ID order where they took a set's order, so both sides take the stream IDs in the same order. - `Persister.persist_events_txn` resolves with the effects alone. The events left and the redacted copies were only for the Python steps after Rust's in the twin test, which are gone. The twin test compares the profile updates rows each twin's persists wrote, and the rows of each twin's own users from outside them, which a leave deletes. Those are compared without `inserted_ts`, as each twin writes them at a different time. New scenarios, with members of each twin's own, cover: - joins, a change of display name, and leaves - several members in one chunk - a member state reset out of the room - a remote member state reset out of it, which writes nothing, as only local members have membership snapshots - a leave while still sharing another room with some members, and with all of them - a leave deleting the rows about earlier profile changes - the last local member leaving Making the Rust shared room query match nothing, dropping the reverse left room rows, or skipping the delete of the leaver's rows about the others, fails the scenarios that cover it. The prereqs test now checks that a server recording profile updates writes the rows in Rust and finishes the stream IDs. These suites pass at `SYNAPSE_TEST_RUST_PERSIST=transaction` on the native driver: `tests.handlers` (including the profile and sync tests that record profile updates), `tests.federation`, `tests.replication`, `tests.rest.client.sliding_sync` (including the profiles extension), the phase 2 storage suites, and the `tests.rest.client` group but for the two `test_rooms` tests that count database transactions, which fail the same way at `prepare`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXMkcZVkcZhi21augBff4a