Repository navigation
Keep the preflight guard test's checkout on the tree's volume - #1233
Merged
Merged
Conversation
`test_a_checkout_outside_the_named_roots_is_not_planned_under_an_override` failed with
`AssertionError: 1 != 2` whenever TMPDIR and the checkout were on different volumes (a checkout on
/Volumes/DAS, the default TMPDIR on the internal disk), at main as well. The test builds its tree
under the fixture's temp directory but passed the REAL checkout as `--root`, and `cmd_preflight`
asks "is the tree on another volume than the checkout?" before it reaches
`refuse_pretend_emergency`: the tree is then judged on its own free space and never planned (exit 1,
"the tree is on another volume than the checkout"), so the guard the test means to exercise is never
reached. CI has both on one volume, which is why it never showed.
The tool is right: a tree on another volume is judged on its own free space and nothing is planned,
so there is nothing for the pretend-emergency guard to guard, and
`test_a_tree_on_another_volume_is_judged_on_its_own_free_space_and_not_planned` already pins that
path. The fixture was wrong to depend on where the real checkout lives. It now names a stand-in
checkout made beside the fixture (outside the roots' common parent, which is the point of the test),
asserts it shares the tree's volume so a future layout change fails with a sentence rather than a
return code, and checks the guard's own wording ("lies outside") instead of any "outside" (the old
assertion would have matched a path containing the word).
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.
What failed
ci/test_disk_preflight.py::Preflight::test_a_checkout_outside_the_named_roots_is_not_planned_under_an_overridefails withAssertionError: 1 != 2whenTMPDIRis on a different volume than the checkout (checkout on/Volumes/DAS, defaultTMPDIRon the internal disk). It fails the same way atmain; it passes whenTMPDIRis on the checkout's volume, as in CI.Cause: the fixture, not the tool
The test builds its tree under the fixture's temp directory (
self.main/rust-modules/target) but passes the real checkout (ROOT) as--root.tools/disk-budget.py cmd_preflightasksdevice_of(tree) != device_of(root)before it reachesrefuse_pretend_emergency; on two volumes it judges the tree on its own free space (judge, exit 1) and plans nothing, so the guard the test means to exercise (a checkout outside the named roots, exit 2, "lies outside") is never reached.The tool's order is right: that branch never calls
collect/plan/run_evict, so there is nothing for the pretend-emergency guard to protect, andPieces.test_a_tree_on_another_volume_is_judged_on_its_own_free_space_and_not_plannedalready pins that path. The fixture was wrong to depend on where the real checkout lives.Fix
The test now makes a stand-in checkout beside the fixture (
tempfile.mkdtemp(dir=dirname(self.tmp)): outside the roots' common parent, which is the point of the test, and on the tree's volume whereverTMPDIRis), asserts that it shares the tree's volume so a future layout change fails with a sentence instead of a return code, and checks the guard's own wording ("lies outside") instead of any"outside"(the old assertion would also have matched a path containing the word).tools/disk-budget.pyis unchanged.Proof
TMPDIR: the failure above.TMPDIR(internal disk):python3 ci/test_disk_preflight.py->Ran 30 tests ... OK.TMPDIR=/Volumes/DAS/.../tmp(the checkout's volume):Ran 30 tests ... OK.python3 ci/test_disk_budget.py(defaultTMPDIR):Ran 97 tests ... OK.make checkon this tree: the cargo half is green (==== check: cargo — ok (4538s) ====); the python half stopped ontools/test_pr_land.pyMergeTests.test_a_merge_call_that_hangs_is_not_retried(AssertionError: 0 != 1, the step took 2562 s on a Mac running three checks at once) and, in the earlier run, onci/test_tv_session.pyHeartbeatWords.test_a_bare_host_page_is_not_the_sheet_that_was_asked_for(a 10 s subprocess timeout). Both timing tests pass alone on this tree (MergeTests.test_a_merge_call_that_hangs_is_not_retried: OK in 7.6 s;ci/test_tv_session.py: 47 tests OK). No file either exercises is touched here.🤖 Generated with Claude Code