8000 T63 — Preview a prune with the disk each box holds, and report a stopped box's disk by minimal-foundry[bot] · Pull Request #3078 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

T63 — Preview a prune with the disk each box holds, and report a stopped box's disk - #3078

Merged
agent-137 merged 4 commits into
mainfrom
agent/3076-preview-a-prune-with-the-disk-each-box-holds-and
Nov 6, 2026
Merged

agent-137 merged 4 commits into
mainfrom
agent/3076-preview-a-prune-with-the-disk-each-box-holds-and

Conversation

@minimal-foundry
Copy link
Copy Markdown
Contributor

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: None to compile after the new field. No other change there. cargo clippy -p minimal --all-targets is clean. No CLI renders the preview or the figure yet: there is no min box prune --dry-run flag and no disk column in min 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, so just lint-prose did not run on the spec edit. The local-only just clippy-strict and the whole-crate test suites did not run.

Tests

line exit tail
cargo nextest run -p boxes box_dir_disk_counts_what_a_reap_frees 0 Applying loadouts: default Running task runtime-implement-test-0 in session task-runtime-implement-test-0-7533... Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling paths v0.0.1 (/workbench/crates/paths) Compiling client-config v0.0.1 (/wo
cargo nextest run -p minimald prune_dry_run_lists_matches_with_disk 0 Applying loadouts: default Running task runtime-implement-test-1 in session task-runtime-implement-test-1-ac52... Compiling paths v0.0.1 (/workbench/crates/paths) Compiling args v0.0.1 (/workbench/crates/args) Compiling ot v0.0.1 (/workbench/crates/ot) Compiling stdlib v0.0.22 (/workbenc
cargo nextest run -p minimald prune_dry_run_reaps_none 0 Applying loadouts: default Running task runtime-implement-test-2 in session task-runtime-implement-test-2-1a9d... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.
cargo nextest run -p minimald prune_dry_run_matches_what_prune_reaps 0 Applying loadouts: default Running task runtime-implement-test-3 in session task-runtime-implement-test-3-fcdc... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.
cargo nextest run -p minimald show_reports_disk_a_reap_frees 0 Applying loadouts: default Running task runtime-implement-test-4 in session task-runtime-implement-test-4-3ba3... Compiling stdlib v0.0.22 (/workbench/crates/stdlib) Compiling version v0.8.0 (/workbench/crates/version) Compiling decode v0.0.1 (/workbench/crates/decode) Compiling mlog v0.
cargo nextest run -p minimald-rpc preview_prune_and_show_disk_round_trip 0 Applying loadouts: default Running task runtime-implement-test-5 in session task-runtime-implement-test-5-52bb... Compiling common v0.0.1 (/workbench/crates/common) Compiling boxes v0.0.1 (/workbench/crates/boxes) Compiling minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc) Finished '

Verify

min task run agent-verify timed out after 1800s, so this PR is a draft.

v0.33.0
   Compiling hakoniwa v1.7.2 (https://github.com/souk4711/hakoniwa.git?rev=0810ffa37620ef5c57de263c8eaa1f4d7633c14a#0810ffa3)
   Compiling json-subscriber v0.3.1
   Compiling tracing-appender v0.2.5
   Compiling ssh-cipher v0.3.0
   Compiling opentelemetry-appender-tracing v0.33.1
   Compiling hash32 v0.3.1
   Compiling ssh-key v0.7.0-rc.11
   Compiling mlog v0.0.1 (/workbench/crates/mlog)
   Compiling heapless v0.9.3
   Compiling russh-cryptovec v0.62.0
   Compiling yasna v0.6.0
   Compiling russh-util v0.52.0
   Compiling bitflags v1.3.2
   Compiling managed v0.8.0
   Compiling russh v0.65.0
   Compiling smoltcp v0.14.0
   Compiling moka v0.12.16
   Compiling dashmap v6.2.1
   Compiling rcgen v0.14.10
   Compiling async-compression v0.4.50
   Compiling async-tar v0.6.1
   Compiling is_executable v1.0.6
   Compiling rusty-fork v0.3.1
   Compiling russh-sftp v2.4.0
   Compiling clap_complete v4.6.11
   Compiling bep v0.0.1 (/workbench/crates/bep)
   Compiling switch v0.0.1 (/workbench/crates/switch)
   Compiling proptest v1.12.0
   Compiling nickel-lang-core v0.19.0
   Compiling diagnostics v0.0.1 (/workbench/crates/diagnostics)
   Compiling vsock v0.5.4
   Compiling async-dialog v0.0.1 (/workbench/crates/async-dialog)
   Compiling castaway v0.2.4
   Compiling tokio-vsock v0.7.2
   Compiling strum v0.28.0
   Compiling compact_str v0.9.1
   Compiling signal-hook v0.3.18
   Compiling kasuari v0.4.12
   Compiling args v0.0.1 (/workbench/crates/args)
   Compiling unicode-truncate v2.0.1
   Compiling lru v0.18.2
   Compiling signal-hook-mio v0.2.5
   Compiling derive_more v2.1.1
   Compiling common v0.0.1 (/workbench/crates/common)
   Compiling ratatui-core v0.1.2
   Compiling line-clipping v0.3.8
   Compiling crossterm v0.29.0
   Compiling minvmd v0.8.0 (/workbench/crates/minvmd)
   Compiling ratatui-widgets v0.3.2
   Compiling ratatui-crossterm v0.1.2
   Compiling fuzzy-matcher v0.3.7
   Compiling similar v2.7.0
   Compiling inquire v0.9.4
   Compiling ratatui-macros v0.7.2
   Compiling insta v1.49.0
   Compiling ratatui v0.30.2
   Compiling serial_test v4.0.1
   Compiling boxes v0.0.1 (/workbench/crates/boxes)
   Compiling sandbox v0.0.1 (/workbench/crates/sandbox)
   Compiling mfile v0.0.1 (/workbench/crates/mfile)
   Compiling minimald-rpc v0.0.1 (/workbench/crates/minimald-rpc)
   Compiling checkouts v0.0.1 (/workbench/crates/checkouts)
   Compiling decode v0.0.1 (/workbench/crates/decode)
   Compiling minimal-client v0.8.0 (/workbench/crates/minimal-client)
   Compiling graph v0.0.1 (/workbench/crates/graph)
   Compiling lcache v0.0.1 (/workbench/crates/lcache)
   Compiling rcache v0.0.1 (/workbench/crates/rcache)
   Compiling op v0.0.1 (/workbench/crates/op)
   Compiling check v0.0.1 (/workbench/crates/check)
   Compiling orchestrator v0.0.1 (/workbench/crates/orchestrator)
   Compiling mctx v0.0.1 (/workbench/crates/mctx)
   Compiling minimald v0.8.0 (/workbench/crates/minimald)
   Compiling minimal v0.8.0 (/workbench/crates/minimal)

Out of scope

These files are outside the task's layers:, so this PR is a draft:

  • crates/minimal/src/cmd/boxes/list.rs

Closes #3076

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.
@coderabbitai
coderabbitai Bot commented Nov 6, 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: bb6a0396-6eca-400b-8d9d-e5580c0d140c

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

@github-actions
github-actions Bot commented Nov 6, 2026
Copy link
Copy Markdown
Contributor

Spec lint

docs/specs/29-spec-box-local-first/29-spec-box-local-first.md — 35 finding(s)

docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:98: P004 BOX-007 names test 'self_as_name_is_exit3', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:195: P004 BOX-028 names test 'hooks_on_resume_reruns_on_activate', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:206: P004 BOX-037 names test 'until_complete_timeout_terms_then_kills_box_and_execs_reason_timeout', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:259: P004 BOX-046 names test 'type_noun_tables_are_boxes_sugar', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:266: P004 BOX-048 names test 'defaults_merge_lists_union_scalars_replace', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:271: P004 BOX-049 names test 'flat_per_entry_keys_and_legacy_keys_keep_meaning', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:275: P004 BOX-050 names test 'legacy_session_table_reads_as_defaults_session_with_hint', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:282: P004 BOX-165 names test 'no_session_entry_expands_implicit_default_session', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:289: P004 BOX-051 names test 'legacy_defaults_task_keys_with_hint', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:293: P004 BOX-052 names test 'legacy_params_reads_as_args_with_hint', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:297: P004 BOX-054 names test 'interactive_task_exit3_names_session', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:301: P004 BOX-059 names test 'box_type_resolves_to_builtin_root', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:310: P004 BOX-061 names test 'expanded_spec_violating_constraint_exit3_names_type_and_layer', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:315: P004 BOX-156 names test 'derived_type_loosening_constraint_exit3_names_type_key_parent', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:320: P004 BOX-160 names test 'admission_refuses_spec_breaching_builtin_root_constraint_exit3', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:324: P004 BOX-062 names test 'constraint_never_adds_package_port_or_egress', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:329: P004 BOX-063 names test 'session_and_task_entries_expand_and_validate', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:336: P004 BOX-064 names test 'expansion_order_and_merge_rules', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:341: P004 BOX-065 names test 'expansion_is_byte_identical_across_runs', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:346: P004 BOX-066 names test 'invalid_key_exit3_names_key_and_layer', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:350: P004 BOX-161 names test 'expansion_reports_layer_and_type_per_value_outside_spec_bytes', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:361: P004 BOX-071 names test 'projection_is_the_6_3_2_field_set', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:375: P004 BOX-072 names test 'projection_digest_mismatch_refuses_create', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:380: P004 BOX-073 names test 'unenrolled_evaluates_no_policy', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:384: P004 BOX-074 names test 'get_version_reports_expander_version', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:391: P004 BOX-145 names test 'example_expansion_matches_golden_vectors', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:395: P004 BOX-076 names test 'sections_follow_box_toml_with_nested_egress', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:417: P004 BOX-079 names test 'network_mode_legacy_spelling_hint_and_canonical_value', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:421: P004 BOX-157 names test 'flat_egress_keys_hint_and_canonical_nested_keys', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:425: P004 BOX-080 names test 'network_bep_secrets_passed_unchanged', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:432: P004 BOX-081 names test 'broker_secret_unenrolled_exit5', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:436: P004 BOX-085 names test 'params_accepted_and_rendered', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:493: P004 BOX-140 names test 'unenrolled_operations_over_file_mode_trust', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:497: P004 BOX-141 names test 'store_secret_passed_through_unenrolled', which was not found in the repository
docs/specs/29-spec-box-local-first/29-spec-box-local-first.md:501: P004 BOX-142 names test 'enrolled_and_unenrolled_expansion_identical', which was not found in the repository

Advisory. None of this blocks the merge; the review decides.

Advisory, and never a merge gate. Linter: gominimal/foundry@fb5932b8, spec format: How Minimal Writes Specs.

@agent-137
agent-137 marked this pull request as ready for review November 6, 2026 05:19
@agent-137
agent-137 requested a review from a team as a code owner November 6, 2026 05:19
@agent-137
Copy link
Copy Markdown
Member

/review

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

Approved: no findings at 71dfcf719fc5.

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.

@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 — No findings.

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

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 6, 2026
@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 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.

@agent-137 agent-137 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 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.

@agent-137
agent-137 added this pull request to the merge queue Nov 6, 2026
Merged via the queue into main with commit a00f3d2 Nov 6, 2026
36 of 37 checks passed
@agent-137
agent-137 deleted the agent/3076-preview-a-prune-with-the-disk-each-box-holds-and branch November 6, 2026 06:17
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.

T63 — Preview a prune with the disk each box holds, and report a stopped box's disk

1 participant

0