Add test for non-member state events in /batch_send state_events_at_start#354
Conversation
| // historical batch | ||
| "limit": []string{fmt.Sprintf("%d", len(expectedEventIDOrder))}, | ||
| // We add these options to the filter so we get member events in the state field | ||
| "filter": []string{"{\"lazy_load_members\":true,\"include_redundant_members\":true}"}, |
There was a problem hiding this comment.
/messages was only returning member state events and only because we passed this special filter. Now that we're testing with non-member state events, we need an endpoint which will show us them.
We can instead simplify and just use /context directly 🎉
There was a problem hiding this comment.
Bear in mind that /context does not work over federation. That is, if server A is in room X and sends 100 messages, then server B joins room X and hits /context for an event early in the timeline (so not backfilled) it will 404.
There was a problem hiding this comment.
I moved the validateState block (which calls /context) after we call /messages which will backfill any of the potential gaps 👍
Part of #12110 Complement test: matrix-org/complement#354 Previously, they didn't resolve because async `filter_events_for_client` removes all outlier state except for out-of-band membership.
| eventIdBefore := eventIDsBefore[0] | ||
| timeAfterEventBefore := time.Now() | ||
|
|
||
| state_events_at_start := createJoinStateEventsForBatchSendRequest([]string{virtualUserID}, timeAfterEventBefore) |
There was a problem hiding this comment.
Is there a linter/autoformatter to use to avoid these kinds of mistakes?
There was a problem hiding this comment.
There is, but I don't think it's built into CI. Added it to #290
| // historical batch | ||
| "limit": []string{fmt.Sprintf("%d", len(expectedEventIDOrder))}, | ||
| // We add these options to the filter so we get member events in the state field | ||
| "filter": []string{"{\"lazy_load_members\":true,\"include_redundant_members\":true}"}, |
There was a problem hiding this comment.
Bear in mind that /context does not work over federation. That is, if server A is in room X and sends 100 messages, then server B joins room X and hits /context for an event early in the timeline (so not backfilled) it will 404.
…nts (MSC2716) (#12329) Part of #12110 Complement test: matrix-org/complement#354 Previously, they didn't resolve because async `filter_events_for_client` removes all outlier state except for out-of-band membership. And fundamentally, we have the state at these events so they shouldn't be marked as outliers.
|
Thanks for the review @kegsay 🐬 Was waiting for matrix-org/synapse#12329 to merge 🚢 |
Add test for non-member state events in
/batch_sendstate_events_at_startTests for matrix-org/synapse#12110
Synapse changes: matrix-org/synapse#12329