mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 17:47:28 +00:00
Port `_calculate_new_extremities`, `_calculate_new_state_dag_extremities` and `_prune_extremities` from the persist events controller to `rust/src/persist/extremities.rs`. They read through an `ExtremityReads` trait, which the `PersistReader` implements and the unit tests implement over an in-memory DAG. Metrics go to a `PersistCounts` the caller owns, so shadow mode can drop them. Missing prev state events fail with `MissingPrevStateEvents`, which `persist_error_to_py` turns into the same 500 `SynapseError` as Python. `PersistReaderForTest` gains the three calculations, and `test_persist_reader.py` compares each with the Python method on the same database and the same new events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHKYPSc37kWqGACn9aKxKL