Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK: Ignore the discovered/custom sliding sync proxy when using SSS. #3743

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

pixlwave
Copy link
Member

@pixlwave pixlwave commented Jul 19, 2024

Oversight on my part in #3723, this code needed to handle the discovered proxy as well as the custom one.

Copy link

codecov bot commented Jul 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.00%. Comparing base (5242f64) to head (886054e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3743      +/-   ##
==========================================
- Coverage   84.02%   84.00%   -0.03%     
==========================================
  Files         260      260              
  Lines       26712    26719       +7     
==========================================
  Hits        22446    22446              
- Misses       4266     4273       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this fix should not happen only for FFI users, but for all users of the SDK (and then we can even include a test \o/ a very simple one). It should happen around here, where we'd set the proxy to None if the boolean is set. Can you implement that and add a test please?

@pixlwave pixlwave force-pushed the doug/sss-discovered-proxy branch 2 times, most recently from a08b4b8 to 7920ea0 Compare July 22, 2024 12:09
@pixlwave pixlwave changed the title ffi: Remove the discovered sliding sync proxy when using SSS. SDK: Ignore the discovered/custom sliding sync proxy when using SSS. Jul 22, 2024
@pixlwave pixlwave force-pushed the doug/sss-discovered-proxy branch from 7920ea0 to 86b8b96 Compare July 22, 2024 12:23
@pixlwave pixlwave force-pushed the doug/sss-discovered-proxy branch 4 times, most recently from 5a41c33 to 7023036 Compare July 22, 2024 13:06
@pixlwave
Copy link
Member Author

Oh yeah good point, updated.

Copy link
Member Author

@pixlwave pixlwave Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we weren't using the SDK logic for the custom proxy, so now we are!

@pixlwave pixlwave requested a review from bnjbvr July 22, 2024 13:27
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing a test!

Comment on lines 491 to 497
#[cfg(feature = "experimental-sliding-sync")]
if self.requires_sliding_sync && sliding_sync_proxy.is_none() {
// In the future we will need to check for native support on the homeserver too.
return Err(ClientBuildError::SlidingSyncNotAvailable);
if self.requires_sliding_sync {
if self.is_simplified_sliding_sync_enabled {
// TODO: The server doesn't yet expose the availability of SSS.
} else if sliding_sync_proxy.is_none() {
return Err(ClientBuildError::SlidingSyncNotAvailable);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would coalesce all these checks together, since it's not clear that we'd keep requires_sliding_sync for is_simplified_sliding_sync (at least we'd have some method named after it). Instead, we could even throw an error when requires_sliding_sync and is_simplified_sliding_sync are set at the same time, because it sounds like a misconfigure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I imagined that requires_sliding_sync would make sure you build a client with support for the type of sliding sync you configured it with but I see the confusion there. For now I'll revert this change and we can think about it when SSS is a bit more mature.

Comment on lines 1217 to 1220
/// The FFI's build has SSS disabled by default, but the SDK has it enabled
/// by default. The tests are aligned with the FFI for now (until we remove
/// regular sliding sync).
fn make_ffi_builder() -> ClientBuilder {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't mention FFI here, because it's not clear for a usual reader what FFI we're referring to, and we need to keep a clear separation of concerns. Maybe rename it make_non_sss_client_builder?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, my brain wasn't helping me with names when I was doing this 🫠

let _client = builder.build().await.unwrap();

// Then a client should not use the discovered sliding sync proxy.
#[cfg(feature = "experimental-sliding-sync")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: don't need this cfg because the test is guarded against the same cfg guard

Then we could rename _client to client since it'd be always used.

@pixlwave pixlwave force-pushed the doug/sss-discovered-proxy branch from 7023036 to ae2cc31 Compare July 22, 2024 14:00
@pixlwave pixlwave requested a review from bnjbvr July 22, 2024 14:09
Copy link
Member

@bnjbvr bnjbvr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks

crates/matrix-sdk/src/client/builder.rs Outdated Show resolved Hide resolved
Update crates/matrix-sdk/src/client/builder.rs

Co-authored-by: Benjamin Bouvier <[email protected]>
Signed-off-by: Doug <[email protected]>
@pixlwave pixlwave force-pushed the doug/sss-discovered-proxy branch from b4d6cb9 to 886054e Compare July 23, 2024 09:19
@bnjbvr bnjbvr enabled auto-merge (rebase) July 23, 2024 09:26
@bnjbvr bnjbvr merged commit dfdea0c into main Jul 23, 2024
40 checks passed
@bnjbvr bnjbvr deleted the doug/sss-discovered-proxy branch July 23, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants