Skip to content

Keep the preflight guard test's checkout on the tree's volume - #1233

Merged
GLinnik21 merged 1 commit into
mainfrom
fix/disk-preflight-cross-volume
Nov 4, 2026
Merged

GLinnik21 merged 1 commit into
mainfrom
fix/disk-preflight-cross-volume

Conversation

@GLinnik21

Copy link
Copy Markdown
Collaborator

What failed

ci/test_disk_preflight.py::Preflight::test_a_checkout_outside_the_named_roots_is_not_planned_under_an_override fails with AssertionError: 1 != 2 when TMPDIR is on a different volume than the checkout (checkout on /Volumes/DAS, default TMPDIR on the internal disk). It fails the same way at main; it passes when TMPDIR is on the checkout's volume, as in CI.

$ python3 ci/test_disk_preflight.py        # default TMPDIR (internal disk), checkout on /Volumes/DAS
FAIL: test_a_checkout_outside_the_named_roots_is_not_planned_under_an_override
AssertionError: 1 != 2 : disk-preflight: only 2.0 GiB free for ~/main/rust-modules/target; this build needs ~1.0 GiB plus a 3.0 GiB reserve (4.0 GiB). ...
  the tree is on another volume than the checkout, so nothing the ladder holds helps
Ran 30 tests ... FAILED (failures=1)

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_preflight asks device_of(tree) != device_of(root) before it reaches refuse_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, and Pieces.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.

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 wherever TMPDIR is), 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.py is unchanged.

Proof

  • Before, default TMPDIR: the failure above.
  • After, default TMPDIR (internal disk): python3 ci/test_disk_preflight.py -> Ran 30 tests ... OK.
  • After, TMPDIR=/Volumes/DAS/.../tmp (the checkout's volume): Ran 30 tests ... OK.
  • python3 ci/test_disk_budget.py (default TMPDIR): Ran 97 tests ... OK.
  • make check on this tree: the cargo half is green (==== check: cargo — ok (4538s) ====); the python half stopped on tools/test_pr_land.py MergeTests.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, on ci/test_tv_session.py HeartbeatWords.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

`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]>
@GLinnik21
GLinnik21 merged commit 5d89ff1 into main Nov 4, 2026
16 checks passed
@GLinnik21
GLinnik21 deleted the fix/disk-preflight-cross-volume branch November 4, 2026 18:31
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.

1 participant