Repository navigation
The quoll's phantom card was a fixture choosing an arbitrary source, not an unboxed test - #161
Conversation
…not a committed row After #160 the suite still failed, once in the first five runs on main, on word_page_test.exs:324 with `["wordnet", "poetrydb"]`. The async phase commits nothing (watched from a second connection, and ExUnit 1.19's runner waits for every async module before it starts a sync one), and replaying the failing seed four times did not bring it back. The row was the test's own. `link!/3` makes a naming sense when it is given none, and `any_source_id/0` chose that sense's source with a bare `limit: 1`: the first row in the heap. On a table only one run writes to, that is WordNet, the first source seeded, and the sense folds into the WordNet card. Under the async suite, other sandboxes' rows and the holes their rollbacks leave reorder the heap. A probe counted 9 of 68 calls in one full run returning `bierce`, `poetrydb` or `wikipedia`, and the naming sense became a card of its own. That is the `artsy` and `wiktionary` of the original report as well. `order_by: s.id` makes it WordNet every time, which is what the test always got alone. Reproduced deterministically by rewriting the wordnet row inside the sandbox so it is no longer first in the heap: `["wordnet", "wiktionary"]` before, green after. Five full precommit runs at load 11–25, the last two beside a second full suite on another partition: 1,736 tests, 0 failures each, 85–90 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Essentials Run ID: 📒 Files selected for processing (1)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughThe ChangesFixture source selection
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~5 minutes Change: Other Merge Risk: ⚪ Minimal · up to This fixture change makes source selection deterministic; no remaining merge-blocking risk is evident. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Follow-up to #160. The brief for this work said the flakes came from an unboxed test (
@tag :unboxed) running inside anasync: truemodule. There is no such test. At 4ede8b6 and at main,word_page_test.exsandword_live_test.exsmention@tag :unboxedonly in comments.runner.ex:122in ExUnit 1.19 waits for every async module before it starts any sync one. #160 had already made the rest of the requested changes:setup_sandbox/1refuses unboxed-in-async, unboxed tests truncate on setup,claim_database!/0locks and empties the database at startup, and thequery_canceledcame from the 15 s DBConnection default (now 60 s). This PR fixes the one flake that survived all of that.The unboxed explanation, and why the flake was something else
If you searched "unboxed" to get here: an unboxed test commits real rows, so it's the obvious suspect when a sandboxed test sees rows it never made. For
word_page_test.exs:324it wasn't the cause.WordFixtures.link!/3makes a naming sense when it's given none.any_source_id/0picked that sense's source with an unorderedlimit: 1, so it got whichever row comes first in the heap. Running alone, that's WordNet, the first source seeded, and the sense folds into the WordNet card. Under the async suite, rows from concurrent sandboxes and the holes their rollbacks leave reorder the heap. The naming sense then belongs topoetrydb,artsyorwiktionaryand becomes a card of its own.order_by: s.idmakes the fixture pick WordNet every time, which is what the test always got alone. No test changes.Reproduction
psqlpolledsources/lexemes/sensestwice a second. The counts stayed at 0 throughout the async phase, and the first committed rows appeared with the syncdeferred_constraints_test. Replaying seed 205211 four times did not fail again, so the failure depends on timing, not on test order.any_source_id/0againstmin(id)for one full run. 9 of 68 calls returnedbierce×7,poetrydborwikipedia.:324, preceded byupdate sources set name = name where slug = 'wordnet'. That moves the wordnet tuple to the end of the heap inside the sandbox. Before the fix:unordered limit 1 now returns: [["wiktionary"]],left: ["wordnet", "wiktionary"], which is the second example in the original report. After the fix: the same unordered query still sayswiktionary, and the test passes.Run log
Main, before the fix (
MIX_TEST_PARTITION=_flaky7c mix precommit)::324,poetrydb)This branch:
_flaky7c_reprorunning beside it (0 / 1,736)🤖 Generated with Claude Code
Summary by CodeRabbit