Repository navigation
T63 — Preview a prune with the disk each box holds, and report a stopped box's disk - #3078
Conversation
BoxDir::disk_bytes counts the allocated blocks under the box directory, once per inode, and leaves out files with a link outside it.
PreviewPrune lists each box a prune matches with the disk it holds. ShowBoxResponse carries disk_bytes, absent and never zero when unknown. The min tests that build a ShowBoxResponse set the new field.
Prune and the new PreviewPrune share one candidate step, so a preview lists what a prune reaps. ShowBox gives the disk of a stopped or exited box. The daemon measures off the manager loop and logs a box it cannot measure.
BOX-021 gains a preview sub-bullet and BOX-159 a disk figure for a stopped or exited box. Design reasoning says why the figure counts allocated blocks.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
Spec lint
Advisory. None of this blocks the merge; the review decides. Advisory, and never a merge gate. Linter: |
|
/review |
|
Approved: no findings at Nothing to do. Verdict APPROVE, posted as a comment: the App cannot review its own pull request; the check and the label carry it. Clobber: none seen. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to the design. Line 501 of architecture.md says that --dry-run lists what a prune takes and the disk each box holds. PreviewPrune does this with the match step that the prune uses, and it reaps nothing. The figure counts the directory that a reap deletes, and the walk does not follow links. Spec 28 BCLI-006 owns the CLI rendering. No condition.
Ruled at 71dfcf7 against gominimal/arch@7a86ec7bb3c0 by claude-opus-5-5.
There was a problem hiding this comment.
Reviewed 71dfcf7 against T63's plan block and test lines. PreviewPrune is a separate RPC (an old daemon refuses it rather than reaping), prune and preview share prune_candidates, disk is measured off the manager loop via spawn_blocking and is absent (never 0) when unmeasurable with a warn naming the box, sparse files and hard links count as a reap frees, and disk_bytes is given only for stopped/exited boxes. The list.rs change outside the layers is four disk_bytes: None test literals. One plan deviation, not blocking today: the walk does not stay on the box directory's device (no same_file_system), and the planned bind-mount test is absent; tracked as a follow-up. Arch PASS, minimal-review approved, required lanes green.
T63 — Preview a prune with the disk each box holds, and report a stopped box's disk
slice: S1
kind: task
covers: BOX-021, BOX-159
size: M
est: 230 code, 250 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: daemon log names each box whose disk it could not measure, with the error; the figure is then absent, never 0
observability: box.prune_preview span records the selectors, matched and unmeasured counts; box.show span records whether a disk figure was returned
layers:
- daemon:
- crates/boxes/src/store.rs: BoxDir::disk_bytes, the allocated bytes a reap of the box directory frees
- crates/minimald/src/box_manager.rs: one candidate step for prune and preview, preview_prune, show_box disk, measured off the manager loop
- crates/minimald/src/rpc.rs: PreviewPrune handler and dispatch name
- crates/minimald/src/box_manager/tests.rs: tests
test: cargo nextest run -p boxes box_dir_disk_counts_what_a_reap_frees
test: cargo nextest run -p minimald prune_dry_run_lists_matches_with_disk
test: cargo nextest run -p minimald prune_dry_run_reaps_none
test: cargo nextest run -p minimald prune_dry_run_matches_what_prune_reaps
test: cargo nextest run -p minimald show_reports_disk_a_reap_frees
- wire:
- crates/minimald-rpc/src/lib.rs: PreviewPrune RPC, ShowBoxResponse disk_byte 8000 s
- crates/minimald-rpc/src/tests.rs: tests
test: cargo nextest run -p minimald-rpc preview_prune_and_show_disk_round_trip
- docs:
- docs/specs/29-spec-box-local-first/29-spec-box-local-first.md: BOX-021 dry-run and BOX-159 disk sub-bullets, and the preview's Design reasoning paragraph
produces: none
consumes: none
proof: A prune preview lists every stopped or exited box the selectors match, with the disk each holds, and reaps none; reading a stopped or exited box's record returns the same disk figure.
depends on:
Proof
A client that sends the new PreviewPrune RPC with the prune selectors (older_than_secs, parent) gets back every stopped or exited box that a PruneBoxes with the same selectors reaps. Each box comes with disk_bytes, the allocated bytes a reap of its directory frees. No box is reaped. A ShowBox read of a stopped or exited box returns the same disk_bytes figure. A running box has no figure. The daemon tests show this, and they show that the preview and the prune match the same boxes for each set of selectors.
Notes from the agent: Outside the layers: crates/minimal/src/cmd/boxes/list.rs. Its four test literals of ShowBoxResponse needed
disk_bytes: Noneto compile after the new field. No other change there.cargo clippy -p minimal --all-targetsis clean. No CLI renders the preview or the figure yet: there is nomin box prune --dry-runflag and no disk column inmin box show. A later task must add them. The daemon gives the figure only for stopped or exited boxes. It measures in crate::traced::spawn_blocking, off the manager loop. A box it cannot measure gets no figure and a warn-level log line that names the box and the error ('box disk: the disk the box holds cannot be measured; it has no figure'). No test covers this unmeasured path: on this box the tests can run as root, and root ignores the file permissions that would make a measurement fail. Spans: box.prune_preview records older_than_secs, parent, matched and unmeasured. box.show records disk (true or false). The PreviewPrune request type is PruneBoxesRequest. Vale is not installed on this box, sojust lint-prosedid not run on the spec edit. The local-onlyjust clippy-strictand the whole-crate test suites did not run.Tests
cargo nextest run -p boxes box_dir_disk_counts_what_a_reap_freescargo nextest run -p minimald prune_dry_run_lists_matches_with_diskcargo nextest run -p minimald prune_dry_run_reaps_nonecargo nextest run -p minimald prune_dry_run_matches_what_prune_reapscargo nextest run -p minimald show_reports_disk_a_reap_freescargo nextest run -p minimald-rpc preview_prune_and_show_disk_round_tripVerify
min task run agent-verifytimed out after 1800s, so this PR is a draft.Out of scope
These files are outside the task's
layers:, so this PR is a draft:crates/minimal/src/cmd/boxes/list.rsCloses #3076