8000 fix(boxes): a box's disk figure counts only what is on the box directory's own device by minimal-foundry[bot] · Pull Request #3390 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(boxes): a box's disk figure counts only what is on the box directory's own device - #3390

Merged
norrietaylor merged 4 commits into
mainfrom
agent/3379-a-box-s-disk-figure-counts-only-what-is-on-the-b
Nov 13, 2026
Merged

norrietaylor merged 4 commits into
mainfrom
agent/3379-a-box-s-disk-figure-counts-only-what-is-on-the-b

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

Defect

Fixes #3379

Task marker
### D3090 — A box's disk figure counts only what is on the box directory's own device
  kind: task
  size: S
  est: 6 code, 45 tests
  executor: agent
  defect: bug
  epic: 2236
  layers:
    - boxes:
      - crates/boxes/src/store.rs: adds .same_file_system(true) to the walk in allocated_bytes_under, updates the disk_bytes doc comment, and adds a bind-mount test that skips with a reason where the harness cannot mount
      test: cargo test -p boxes box_dir_disk_stays_on_its_own_device
      test: cargo test -p boxes box_dir_disk_counts_what_a_reap_frees
  proof: With a bind mount under a box's tree, BoxDir::disk_bytes returns the same figure as without the mount.

Proof

With a tmpfs bind-mounted under a box's tree, BoxDir::disk_bytes does not count the 4 MiB file on the mount. The new test box_dir_disk_stays_on_its_own_device shows this. Without the fix, the same test fails with 4263936 against 69632.

Notes from the agent: Besides .same_file_system(true), allocated_bytes_under also skips any entry whose device is not the root's device. walkdir does not descend into the mount point, but it still yields it, with the mounted root's metadata. The mount point counts nothing, because the directory under it is hidden. So the figure with the mount is the figure without it, less the blocks of the empty mount-point directory. The test asserts this exact relation. On a tmpfs that directory holds 0 blocks, so the two figures are equal there. Limitation: a bind mount from the box directory's own filesystem has the same st_dev, so neither check sees it, and its files still count. The doc comment says so. A full fix needs a mount id (statx STATX_MNT_ID) or /proc/self/mountinfo. The test runs its own test binary again under unshare --user --map-root-user --mount, and prints a skip reason when unshare cannot run. I checked that the test fails with the fix disabled, and then restored the fix. cargo clippy -p boxes --all-targets is clean.

Tests

line exit tail
cargo test -p boxes box_dir_disk_stays_on_its_own_device 0 running 1 test test store::tests::box_dir_disk_stays_on_its_own_device ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 603 filtered out; finished in 0.02s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00s running
cargo test -p boxes box_dir_disk_counts_what_a_reap_frees 0 running 1 test test store::tests::box_dir_disk_counts_what_a_reap_frees ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 603 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00s running

Verify

min task run agent-verify passed ([tasks.verify]).

Base

The base branch moved while the coder worked; it was merged in before the tests ran.

BoxDir::disk_bytes walked into a mount under the box's tree and counted
what another device holds, which a reap does not free. The walk now
stays on the box directory's own device and skips the mount point.

A new test bind-mounts a tmpfs under a box's tree inside a mount
namespace, and skips with the reason where unshare cannot run.
@coderabbitai
coderabbitai Bot commented Nov 13, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d21fd8aa-04c5-440f-8212-56fd8097e6ed

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry
minimal-foundry Bot commented Nov 13, 2026 •
Copy link
Copy Markdown
Contributor Author

Approved: every review thread resolved at 20ae468072d4.

@norrietaylor resolved the last thread, which releases the approval this review had withheld.

Nothing to do.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — advisory review

Verdict COMMENT — 1 finding, 1 inline.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

Comment thread crates/boxes/src/store.rs Resolved
A host can allow a mount namespace and still refuse a mount. The probe
now mounts a tmpfs in a scratch directory, so the test skips there.
@minimal-foundry
Copy link
Copy Markdown
Contributor Author

Round 1 of 10 on a failed check suite, pushed as 20ae468072d4.

line exit tail
cargo test -p boxes box_dir_disk_stays_on_its_own_device 0 running 1 test test store::tests::box_dir_disk_stays_on_its_own_device ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 603 filtered out; finished in 0.02s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00s running
cargo test -p boxes box_dir_disk_counts_what_a_reap_frees 0 running 1 test test store::tests::box_dir_disk_counts_what_a_reap_frees ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 603 filtered out; finished in 0.00s running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00s running

Verify min task run agent-verify passed.

Review threads the coder judged:

  • 👍 valid — crates/boxes/src/store.rs:2511: The skip probe now runs mount -t tmpfs in a scratch directory inside the namespace, so a host that refuses the mount skips the test.

With a tmpfs bind-mounted under a box's tree, BoxDir::disk_bytes returns the same figure as without the mount, and box_dir_disk_stays_on_its_own_device checks it.

Notes from the agent: This round changes only the test's skip probe. The probe now runs mount -t tmpfs inside the namespace, so a host that refuses the mount skips the test. The failed checks look unrelated to this diff. The e2e job failed on a ConfigureLoadout RPC timeout during daemon auto-spawn. The boxes disk walk is not on that path. ci-macos-success is only the aggregator of that failure. I did not change code for them, and I cannot run the macOS e2e on this box.

@minimal-arch minimal-arch Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arch-review: PASS · the full ruling

The change conforms to architecture.md line 502. The disk figure for a box now counts only what a reap frees on the box directory's own device. The new commit changes only the skip probe of the test. The probe now mounts a tmpfs, as the test body does. The production code is the same as at the head that got the prior PASS.

Ruled at 20ae468 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APPROVE withheld: 1 unresolved thread — minimal-foundry[bot] crates/boxes/src/store.rs:2511.

minimal-review — advisory review

Verdict COMMENT — No findings.

Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.

@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against D3090 at 20ae4680. allocated_bytes_under walks with .same_file_system(true) and skips any entry whose device is not the root's, so a mount under the box and its mount point count nothing. The doc comment states the same-device bind-mount limit. box_dir_disk_stays_on_its_own_device runs in its own mount namespace, binds a tmpfs under the box tree, and checks the figure drops by exactly the mount point's blocks and comes back after umount. It skips with the reason where the host cannot mount a tmpfs in a namespace. The LOW probe thread is fixed by 20ae4680 (the probe now mounts a tmpfs).

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minimal-review — approved

Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of 20ae468072d4 withheld this approval on the threads open then. Posted as a comment, as the review itself was; the check and the label carry it.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 13, 2026
@norrietaylor
norrietaylor added this pull request to the merge queue Nov 13, 2026
Merged via the queue into main with commit 767d9be Nov 13, 2026
40 checks passed
@norrietaylor
norrietaylor deleted the agent/3379-a-box-s-disk-figure-counts-only-what-is-on-the-b branch November 13, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

D3090 — A box's disk figure counts only what is on the box directory's own device

2 participants

0