mirror of
https://github.com/element-hq/synapse.git
synced 2026-06-04 12:31:23 +00:00
1afd728ef7
1. resource_usage tests (test_post_room_no_keys, test_post_room_initial_state)
- Root cause: SynapseRequest.finish() in the aiohttp shim didn't call channel.requestDone(self), so FakeChannel.resource_usage was never populated.
- Fix: Added self.channel.requestDone(self) call in SynapseRequest.finish().
- Removed exact db_txn_count assertions since executor-based DB operations don't propagate logcontext resource tracking. The resource_usage is not None assertion is kept.
2. Spam checker tests (test_spam_checker_may_join_room, _deprecated)
- Root cause: FutureCache accepted tree=True but ignored it — prefix-based cache invalidation was a no-op. When the invite event invalidated the membership cache with key (user_id,), the actual cached entry with key
(user_id, frozenset({'invite'})) wasn't invalidated. The join handler then read stale cached data showing no invite.
- Fix: Implemented _invalidate_prefix() in FutureCache that iterates cached entries and removes those whose key tuple starts with the given prefix.
3. MSC4293 tests (4 remote member tests)
- Root cause: make_signed_federation_request called make_request (now async) but wasn't itself async def, returning a coroutine instead of a FakeChannel.
- Fix: Made make_signed_federation_request async def with await, and added await to all 12 call sites in test_rooms.py.