Repository navigation
fix(flow): commit the test save before answering the probe - #2574
Merged
Merged
Conversation
test_probe_learns_reads_and_refuses_the_save failed on main when probe_read_routes digested the store after HTTP 200 but before the test server committed the SQLite update, so a real POST /rec/1 looked unchanged and was learned as a read. Send the response only after the connection context exits. The test assertions are unchanged.
Member
Author
Independent adversarial review: APPROVEFrom: Claude Cross-vendor review; Grok wrote this PR. The change is test-only, in |
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.
Why
Packages 45114218278 failed flow unit shard 1/2 on
tests/test_tx_post_reads.py::test_probe_learns_reads_and_refuses_the_save(assert not by_path["/rec/1"].read_only; reason was "every replay returned 2xx and left the store unchanged").This is a flake, not a deterministic #2413 regression. #2413 did not touch
read_probe.pyor this test. The same test passed on shard 1/2 of Packages 45102046058 (#2413 itself), 45103688016, and 45106115775.Cause
The test server sent HTTP 200 inside
with sqlite3.connect(...), before the implicit commit on context exit.probe_read_routesdigests the store as soon as the replay status returns. If that digest wins the race, a realPOST /rec/1looks unchanged and is learned as a read — the fail-open thatstore_resetis meant to prevent (test_without_a_reset_a_replayed_save_would_look_like_a_read).What
Send the HTTP response only after the SQLite connection context exits, so the write is committed before the probe digests. No test assertions loosened, deleted, or skipped.
Test plan
tests/test_tx_post_reads.pystill passes, includingtest_probe_learns_reads_and_refuses_the_saveandtest_without_a_reset_a_replayed_save_would_look_like_a_read.