fix: Remove state_key: null from Seshat search results #31524
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: Remove state_key: null from Seshat search results
Summary
Seshat (local search index) incorrectly includes
"state_key": nullfor non-state events in search results. This causesmatrix-js-sdkto incorrectly treat them as state events, which prevents encrypted messages from rendering properly in search results.Changes
state_key: nullfrom main search result eventsstate_key: nullfrom context events (events_before/events_after)Files Changed
src/Searching.ts- Add post-processing to remove null state_keytest/unit-tests/Searching-test.ts- Add testsTests
Unit tests added in
test/unit-tests/Searching-test.ts:removes state_key: null from search results- Verifies thatstate_key: nullis removed from main search result events and context eventsdoes not modify events without state_key: null- Verifies that events withoutstate_keyare not accidentally modifiedRelated Issues
This is a workaround for a Seshat bug where non-state events are serialized with
state_key: nullinstead of omitting the field entirely.Checklist
public/exportedsymbols have accurate TSDoc documentation.