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

Regression test for /sync returning 404 for redactions #386

Merged
merged 3 commits into from
Jun 13, 2022

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented May 29, 2022

Lots more detail in the code, but this is a regression test for matrix-org/synapse#12864: Synapse would return a 404 from /sync if given a since token which pointed to a redaction of an unknown event.

Lots more detail in the code, but this is a regression test for a bug in
Synapse where it would return a 404 from /sync if given a since token which
pointed to a redaction of an unknown event.
Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

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

Some clarifications would be good but overall this is pretty clear!

tests/csapi/sync_test.go Outdated Show resolved Hide resolved
tests/csapi/sync_test.go Outdated Show resolved Hide resolved
tests/csapi/sync_test.go Show resolved Hide resolved
nextBatch := alice.MustSyncUntil(t, client.SyncReq{}, client.SyncTimelineHasEventID(roomID_2, sentinelEvent.EventID()))

// one more sync, to get the latest sync token
_, nextBatch = alice.MustSync(t, client.SyncReq{Since: nextBatch})
Copy link
Member

Choose a reason for hiding this comment

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

It's unclear why this is necessary. We sent the redaction then the sentinel event, so if :322 is returning the sentinel event then surely this sync will just do nothing..?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, but I got this wrong because the documentation on MustSyncUntil is unclear. I fixed it in ed0c3a7.

Comment on lines 248 to 249
// In the unlikely event that you need ordering on your checks, call MustSyncUntil multiple times
// with a single checker, and reuse the returned since token, as in the "Incremental sync" example.
Copy link
Member Author

Choose a reason for hiding this comment

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

aside: does this actually work? Suppose you have two tests A and B, and you need to make sure that A happens before B. But presumably it's legitimate for them to happen in the same sync batch? In which case the suggested approach will fail, because the test for A will pass, but we'll miss B happening so the test for B will never pass.

@richvdh
Copy link
Member Author

richvdh commented May 30, 2022

@kegsay would you mind taking another look at this, particularly to check you agree with ed0c3a7?

@richvdh richvdh requested a review from kegsay May 30, 2022 10:26
@richvdh
Copy link
Member Author

richvdh commented May 30, 2022

(thanks for the excellent review comments btw)

@richvdh richvdh merged commit d842670 into main Jun 13, 2022
@richvdh richvdh deleted the rav/fix_sync_404 branch June 13, 2022 10:32
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