filter_and_transform_events_for_client computes the requesting user's
membership (MSC4115) from the state after each event, fetched only for
non-outlier events. An event let through by always_include_ids therefore
has no state to look in if it is flagged as an outlier — which happens
when an out-of-band membership event is later de-outliered (we are also
in the room and received it over federation) and enters the current
state (sync's always_include_ids), while the copy being filtered (e.g.
from a worker's not-yet-invalidated cache) still carries the outlier
flag. This hit the 'unreachable' raise, failing the whole /sync with a
500. Return the event without a membership annotation instead (MSC4115
permits omitting it), and downgrade the neighbouring call-invite assert
with the same reachability hole to a guard.
Fixes#19858.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uk8aPxHn3BHCe52L226jdG