mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 13:28:04 +00:00
Port `_get_new_state_after_events`, `_calculate_state_delta`, `_is_server_still_joined` and the two steps that call them with the extremity calculations, `_calculate_new_forward_extremities_and_state_delta` and `_process_state_dag_forward_extremities_and_state_delta`, to `rust/src/persist/state_delta.rs`. Reads go through a `StateDeltaReads` trait on top of `ExtremityReads`, and state resolution through a `StateResolver`, so the unit tests can fake both. `NativeStateResolver` checks and bumps the input state groups as `check_state_groups_and_bump_deletion` does, then resolves with the Rust state resolution on the native pool, through `resolve_on_pool`, which is split out of `StateResolutionHandler::start_converted`. The persister shares the handler's conflict cache. There is no `_state_cache` of whole resolutions. Rooms on state resolution v1 or without a chain cover index fail with `StateResFallback`, for the caller to run the Python step. `NewEvent` gains the fields the state delta reads from an event and its context. `PersistReaderForTest` gains the five calculations, and `test_persist_reader.py` compares each with the Python method on events built by the event creation handler, including a resolved fork and an MSC4242 room. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UHKYPSc37kWqGACn9aKxKL