Skip to content

Add clarification and test to fixed SSS behaviour#19734

Open
erikjohnston wants to merge 9 commits intodevelopfrom
erikj/sss_clarification
Open

Add clarification and test to fixed SSS behaviour#19734
erikjohnston wants to merge 9 commits intodevelopfrom
erikj/sss_clarification

Conversation

@erikjohnston
Copy link
Copy Markdown
Member

@erikjohnston erikjohnston commented Apr 27, 2026

@erikjohnston erikjohnston force-pushed the erikj/sss_clarification branch 2 times, most recently from 1d9fdc1 to 3149105 Compare April 27, 2026 10:03
Comment thread synapse/handlers/sliding_sync/__init__.py Outdated
Comment thread synapse/handlers/sliding_sync/__init__.py Outdated
Comment thread changelog.d/19734.bugfix Outdated
Comment on lines +2291 to +2292
# Advance past the timeout to make sure the request finishes. (We do this
# to ensure log contexts don't leak between tests).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Which logcontext is being leaked here?


Here was my gut reaction:

Overall, we shouldn't be worrying about LoggingContext problems in the tests,

[...] it's expected that test things run outside of Synapse and by their nature should happen in the sentinel logcontext. And if we really don't want to see these kind of errors, we would need to refactor get_success(...) to look more like get_success(func, OTHER_SERVER, ev) where we call the function with some homeserver_test_case logcontext instead of passing in an awaitable.

-- @MadLittleMods, #18937 (comment)

Copy link
Copy Markdown
Member Author

@erikjohnston erikjohnston Apr 29, 2026

Choose a reason for hiding this comment

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

This was causing test failures. I'm not entirely sure what was going on, but the trial jobs started failing when running in parallel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Finishing a request to be a good citizen seems fine. The extra complexity in the test is a bit distracting and slightly tricky to figure out that it isn't related to what we're testing. Perhaps a better comment could dispel things better as I read but the current language is fine ⏩

Also makes me wonder what happens if the test fails in the middle of a request (seems like we would run into the same problem).

Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
response_body["rooms"][room_id]["required_state"][0]["event_id"],
first_event_id,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We even have a relevant test for this scenario. i.e. we should have a new test just like that but without the # Send a message so the room comes down sync.

-- @MadLittleMods, #18844 (comment)

Thoughts?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Isn't that basically what we're testing here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, but this reinvents the wheel. And it would be nice to see the same thing pass without message sending or possibly adapt it so that it doesn't send messages.

At the very least, we should update the comments there to indicate that the message sending isn't necessary anymore (see this test) and move this test closer and possibly align the name better to 'expand'/'retract' just to connect them better (although the current name is fine if it were standalone)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think having the test cases be separate makes sense. The other ones are testing that we include/exclude the required_state even when the room does appear in the response (due to there being a message). The fact that we immediately return is a very related but distinct thing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should at-least point out the new test (test_changing_required_state_returns_immediately) in the docstring for test_rooms_required_state_expand_retract_expand

Comment thread tests/rest/client/sliding_sync/test_sliding_sync.py Outdated
Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
response_body["rooms"][room_id]["required_state"][0]["event_id"],
first_event_id,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, but this reinvents the wheel. And it would be nice to see the same thing pass without message sending or possibly adapt it so that it doesn't send messages.

At the very least, we should update the comments there to indicate that the message sending isn't necessary anymore (see this test) and move this test closer and possibly align the name better to 'expand'/'retract' just to connect them better (although the current name is fine if it were standalone)

Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
Comment on lines +2291 to +2292
# Advance past the timeout to make sure the request finishes. (We do this
# to ensure log contexts don't leak between tests).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Finishing a request to be a good citizen seems fine. The extra complexity in the test is a bit distracting and slightly tricky to figure out that it isn't related to what we're testing. Perhaps a better comment could dispel things better as I read but the current language is fine ⏩

Also makes me wonder what happens if the test fails in the middle of a request (seems like we would run into the same problem).

Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
Comment thread synapse/handlers/sliding_sync/__init__.py Outdated
Comment thread tests/rest/client/sliding_sync/test_rooms_required_state.py Outdated
)

# We should see the new `required_state` immediately without waiting
# (for the full timeout, we may need to wait briefly).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# (for the full timeout, we may need to wait briefly).
# (for the full timeout, we may need to wait briefly just for the response to be assembled).

Although this may not be true, see other discussion


# We should see the new `required_state` immediately without waiting
# (for the full timeout, we may need to wait briefly).
channel.await_result(timeout_ms=100)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Perhaps this would pass if we just use 0? Are there any clock.call_later things we wait for in /sync response assembly?

Suggested change
channel.await_result(timeout_ms=100)
channel.await_result(timeout_ms=0)

response_body["rooms"][room_id]["required_state"][0]["event_id"],
first_event_id,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should at-least point out the new test (test_changing_required_state_returns_immediately) in the docstring for test_rooms_required_state_expand_retract_expand

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants