Skip to content

Warn when an encrypted search runs before the index has finished building#34001

Open
hayaksi1 wants to merge 1 commit into
element-hq:developfrom
hayaksi1:pr/search-incomplete-warning
Open

Warn when an encrypted search runs before the index has finished building#34001
hayaksi1 wants to merge 1 commit into
element-hq:developfrom
hayaksi1:pr/search-incomplete-warning

Conversation

@hayaksi1

Copy link
Copy Markdown
Contributor

Problem

When a search runs in an encrypted room while the local Seshat index is still being
built (crawling not-yet-indexed history), the search can silently return partial
results, with nothing to tell the user that more matches may appear once indexing
finishes (#32253).

Fix

SearchWarning now observes the event index's crawl progress:

  • A new useIsCrawlInProgress hook subscribes to the index's changedCheckpoint event
    (emitted as each checkpoint drains) and tracks whether currentRoom() is still
    non-null — i.e. the crawl is still running.
  • While a crawl is in progress and the warning is being shown for a search
    (WarningKind.Search), a polite live-region notice — "Results may be incomplete
    because your search index is still being built."
    — is rendered with role="status",
    so a screen reader announces it if it appears while a search panel is already open.
  • The notice clears automatically the moment indexing finishes (the hook re-evaluates on
    every checkpoint change), and the listener is removed on unmount.

No behaviour changes for unencrypted rooms, for the no-index / index-error paths, or for
the files warning.

Tests

SearchWarning-test.tsx covers: no warning when the index is complete, the partial-results
warning while crawling, auto-clear when the crawl finishes, listener cleanup, and that the
notice is scoped to search rather than the files warning.

Fixes #32253

Checklist

…ding

When a search runs in an encrypted room while the local Seshat index is still
crawling not-yet-indexed history, results can silently come back partial.
SearchWarning now subscribes to the event index's changedCheckpoint progress and
shows a polite (role=status) notice while the crawl is in progress, clearing
automatically the moment indexing finishes.
@hayaksi1 hayaksi1 requested a review from a team as a code owner June 27, 2026 08:06
@hayaksi1 hayaksi1 requested review from Half-Shot and t3chguy June 27, 2026 08:06
@github-actions github-actions Bot added the Z-Community-PR Issue is solved by a community member's PR label Jun 27, 2026
@t3chguy

t3chguy commented Jul 6, 2026

Copy link
Copy Markdown
Member

Please include a screenshot of the warning for design to review

@t3chguy t3chguy requested a review from a team July 6, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Z-Community-PR Issue is solved by a community member's PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Searching encrypted rooms does not warn you if indexing is incomplete

3 participants