feat: /search groupings, include_state, left-room search#240
Merged
Conversation
completes the spec surface of POST /search: groupings.group_by (room_id / sender), include_state (current state of the joined rooms in the results), and searching rooms the user has left — bounded to what they could see before leaving via the per-event leave-cap. include_state is gated to currently-joined rooms so a departed member never learns how a room's state changed after they left. and the shared read gate now fails closed for a departed caller with no recorded leave position (legacy rooms): it applies the per-event history-visibility filter instead of returning post-departure events — reachable now that search auto-enumerates every left room.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 3 (final polish) of the full-text search feature. Adds the remaining spec surface of
POST /v3/search.What's added
groupings.group_by): partitions results byroom_idand/orsenderinto thegroupsblock ({group_value: {results, order}}),order= best member rank.include_state: returns the current state of each joined room in the results. Gated to currently-joined rooms — a departed member must not learn how a room's state changed after they left (Synapse never hits this since it doesn't search left rooms).Hardening (found by review): the shared read gate (
resolve_reader, used by/messages,/context,/eventtoo) now fails closed for a departed caller with no recorded leave position — it applies per-event history-visibility instead of returning post-departure events. Latent before, but reachable now that search auto-enumerates every left room.Tests: groupings partition-by-room/sender, include_state returns m.room.create-bearing state, left-room search bounded by leave (and no state leak), banned-user search capped at ban (no post-ban events, no state).
Known limitation (documented in code): a very active left room can under-return — the newest-1000 candidate window may be all post-leave. Fine for quiet/small left rooms and still ahead of Synapse (no left-room search at all); a leave-cap-relative scan bound is a possible follow-up.