From b50b7b0dd6fe56b88a3c415ba1f07e8032c744b2 Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Thu, 12 Nov 2026 17:34:23 +0000 Subject: [PATCH] Make the invite rescission test cover initial sync deterministically The test's final sync loop started with an initial sync, so whether it exercised initial or incremental sync depended on when the rescission arrived. It now waits for the rescission with an incremental sync, then checks that a fresh initial sync also includes it. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01FqDpJa1cp5hHXwmcMbEPJm --- tests/federation_rooms_invite_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/federation_rooms_invite_test.go b/tests/federation_rooms_invite_test.go index cff49d64a..8359a9599 100644 --- a/tests/federation_rooms_invite_test.go +++ b/tests/federation_rooms_invite_test.go @@ -159,15 +159,20 @@ func TestFederationRoomsInvite(t *testing.T) { "preset": "private_chat", "invite": []string{bob.UserID}, }) - bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID)) + since := bob.MustSyncUntil(t, client.SyncReq{}, client.SyncInvitedTo(bob.UserID, roomID)) alice.MustDo(t, "POST", []string{"_matrix", "client", "v3", "rooms", roomID, "kick"}, client.WithJSONBody(t, map[string]interface{}{ "user_id": bob.UserID, "reason": "testing", }), ) + bob.MustSyncUntil(t, client.SyncReq{Since: since, Filter: includeLeaveSyncFilter}, client.SyncLeftFrom(bob.UserID, roomID)) - bob.MustSyncUntil(t, client.SyncReq{Filter: includeLeaveSyncFilter}, client.SyncLeftFrom(bob.UserID, roomID)) + // bob's server already has the rescission, so an initial sync must include it. + syncResp, _ := bob.MustSync(t, client.SyncReq{Filter: includeLeaveSyncFilter}) + if err := client.SyncLeftFrom(bob.UserID, roomID)(bob.UserID, syncResp); err != nil { + t.Fatalf("initial sync is missing the rescinded invite: %s", err) + } }) t.Run("Non-invitee user cannot rescind invite over federation", func(t *testing.T) {