mirror of
https://github.com/element-hq/synapse.git
synced 2026-05-25 16:24:06 +00:00
8e64822538
Replace the abstract `synapse.events.EventBase` and the concrete `FrozenEvent`, `FrozenEventV2`, `FrozenEventV3`, `FrozenEventV4`, and `FrozenEventVMSC4242` Python classes with a single Rust-backed `Event`, exposed via `synapse.synapse_rust.events.Event`. `EventBase` becomes a `TypeAlias` for `Event` so that the existing type annotations across the codebase keep working. Notable behavioural notes: - `make_event_from_dict()` now constructs the Rust class. Event IDs for v3+ formats are computed in the constructor (instead of lazily on first access). - `clone_event()` is now a single `event.deep_copy()` call. The old shallow copy of `unsigned` was effectively a deep copy in practice; `deep_copy()` matches that. - The third-party event-rules callback no longer needs to call `event.freeze()` — Events are immutable from Python by construction. - A small `assert_never` is added in `events_worker.py` to make the `redact_behaviour` switch exhaustive now that the type checker can see all branches. All test fixtures that constructed `FrozenEventV3` etc. directly are updated to construct `Event` instead.