test: re-read instead of trusting the partial-update write response - #149
Merged
Merged
Conversation
PartialUpdateChannel asserted the custom field straight off the UpdateChannelPartial response, which the server can hydrate from a read replica that has not observed the write. That made it the longest-running flake in this suite: it failed on main in the runs for #137 and #142, and again after the unset half was fixed, this time on the set half instead. The unset half already re-reads with require.Eventually for exactly this reason. The set half now does the same, so both halves are symmetric and neither depends on read-after-write. No coverage is lost. Asserting the value still catches a Set map serialized under the wrong key or a Custom map that fails to deserialize, which is the bug this test exists for, and the write response and GetOrCreate deserialize the same ChannelResponse type. Only the assumption that the write response is immediately consistent is gone.
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
mogita
temporarily deployed
to
feeds-enabled-shard
August 27, 2026 12:49 — with
GitHub Actions
Inactive
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestChatChannelIntegration/PartialUpdateChannelis the longest-running flake in this suite. It failed onmainin the runs for #137 and #142, the unset half was later fixed, and it now fails on the set half instead:The assertion reads
Custom["color"]straight off theUpdateChannelPartialresponse, and the server can hydrate that response from a read replica that has not observed the write yet.Solution
Assert the value by re-reading with
require.Eventually, which is exactly what the unset half of the same test already does, and for the same stated reason. Both halves are now symmetric and neither depends on read-after-write.No coverage is lost. The value assertion still catches a
Setmap serialized under the wrong key or aCustommap that fails to deserialize, which is the bug this test exists for, and the write response andGetOrCreatedeserialize the sameChannelResponsetype. Only the assumption that the write response is immediately consistent is gone.How to verify
go test -run 'TestChatChannelIntegration/PartialUpdateChannel' .passes. I ran it 10 times in a row against the integration app: 10 pass, 0 fail.Setkey or theCustomdeserialization and theEventuallynever satisfies, so the test fails after 5s withcolor should be set to red.