feat(ffi): expose required_state configuration on SyncServiceBuilder#6431
Draft
lucasfeijo wants to merge 5 commits intomatrix-org:mainfrom
Draft
feat(ffi): expose required_state configuration on SyncServiceBuilder#6431lucasfeijo wants to merge 5 commits intomatrix-org:mainfrom
lucasfeijo wants to merge 5 commits intomatrix-org:mainfrom
Conversation
Add SyncServiceBuilder.withRequiredState() so FFI consumers can request additional state events during sliding sync beyond the hardcoded defaults. The extra entries are merged with DEFAULT_REQUIRED_STATE, ensuring essential events (encryption, tombstone, etc.) are always present. Made-with: Cursor
Made-with: Cursor
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6431 +/- ##
=======================================
Coverage 89.83% 89.83%
=======================================
Files 378 378
Lines 104214 104256 +42
Branches 104214 104256 +42
=======================================
+ Hits 93616 93658 +42
- Misses 7008 7010 +2
+ Partials 3590 3588 -2 ☔ View full report in Codecov by Sentry. |
Collapse function signatures and destructures that fit on one line, merge duplicate ruma imports, and reorder iterator chains per rustfmt. Made-with: Cursor
bnjbvr
requested changes
Apr 13, 2026
Member
bnjbvr
left a comment
There was a problem hiding this comment.
The feature makes sense to me, but at this point it's badly implemented (by the AI):
- the introduced test doesn't really test the new feature, as it doesn't check the request received by the server. Look at other tests which do that, and make sure to assert on the extra requested states in the mock server's received requests.
- it isn't clear if the extra required states applies to all rooms or only rooms that one is subscribed to. Make it clearer in the function name, and make sure to add a test that the extra requested state events aren't requested in the other mode.
- it isn't clear if a state event type that was already present in the required list will be duplicated, or overridden (and which one will be overridden; the user-provided one, or the default). I think one reasonable behavior would be that the user-provided ones should override the predefined ones. Please add a test asserting this.
Make the sync service required_state configuration apply only to ALL_ROOMS and add request-level tests for scope and override behavior. Made-with: Cursor
Made-with: Cursor
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.
Add SyncServiceBuilder::with_required_state() so FFI consumers can request additional state events during sliding sync beyond the hardcoded defaults.
Motivation
The RoomListService hardcodes DEFAULT_REQUIRED_STATE and DEFAULT_ROOM_SUBSCRIPTION_EXTRA_REQUIRED_STATE, which cover common Matrix state events. However, applications that use custom state events have no way to include them in the sliding sync request through the FFI layer.
Tested by integrating a build into our iOS application with custom state event types.
CHANGELOG.mdfiles.Signed-off-by: