Files
synapse/tests/storage
Erik JohnstonandClaude Opus 5.5 fd8c19ed2c Run what follows each chunk's write in Rust at rust_event_persistence: full
`_after_persisting_events` moves into the batch step, after the write
and before Python applies the chunk and finishes its stream orderings,
as it ran inside `get_next_mult` in Python:

- The persisted events, by type and origin, and the persisted position
  go to the Rust metrics that `flush_rust_persist_metrics` reports.
- With MSC4293, a join, or a leave by someone else, ends the redaction
  of the target's events. A ban or kick with `redact_events` set, by a
  sender who may redact (`_can_sender_redact`, read from the current
  state), starts it. Python then drops the room's events from its event
  cache, through a new `event_cache_room_invalidations` effect, even if
  a later event of the chunk fails, as Python drops them right after
  each start.
- The forward extremities prefill moves into the effects.

The MSC4293 flag goes with each batch, as Python reads it per chunk and
tests change it at runtime.

If what follows the write fails, the chunk is still written, so Python
applies its effects and finishes its orderings as a failure, as
`get_next_mult` does when its block raises, then raises the error and
releases the batch's state groups as a failed persist does.

Where Python would raise on odd power levels or memberships, Rust is
more lenient: it reads a level that is a string of an integer as that
number (Python compares two strings, or raises), a null default as 0
and a `users` or `events` that is not an object as missing, and skips a
member event without a membership. Numbers, floats and bools compare as
in Python.

The chunk path, for chunks Rust hands back, keeps the Python block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LXMkcZVkcZhi21augBff4a
2026-10-17 23:41:30 +00:00
..
2014-08-12 15:10:52 +01:00