Repository navigation
fix(boxes,minimal,minimal-client): the box record keeps its name origin, and min box list and show - #3788
Conversation
The record keeps name_origin (written or derived), project_name and entry, stamped by the daemon at create. A rename sets the origin to written. A record without the fields reads as written, with no project name and no entry. ListBoxes and ShowBox return the three fields.
min box list adds an ENTRY column after NAME. Its PROJECT column shows the project name, else the project root. min box show prints the name origin, the entry and the project name. The min/v1/box object of both carries entry, project_name and name_origin, and project stays the root.
|
Important Review skippedBot user detected. Ask an organization administrator to verify that this bot has an active assigned CodeRabbit review seat. See the seat-assignment guide. After the seat is confirmed, request a review again.
|
|
/arch-review |
|
/review |
|
Reviewed: 2 findings, none blocking at Address the comments on the diff. Clobber: none seen. |
| let mut lines = vec![ | < 10000 /tr>||
| ("ID", record.box_id.to_string()), | ||
| ("Name", or_none(record.name.clone())), | ||
| ("Name origin", record.name_origin.to_string()), |
There was a problem hiding this comment.
LOW · correctness · confidence 0.50 · in render_box_show
Name origin prints written for a box with no name, and for an old record that was derived. The code cannot prove either. The record default is Written for old records. Print - when the record has no name, so the line says only what the record holds.
What the reviewer checked
("Name origin", record.name_origin.to_string()), next to Name: - in the test output
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/cmd/boxes/show.rs
Lines: 566-566
Category: correctness
Severity: low (reviewer confidence 0.50)
Finding:
`Name origin` prints `written` for a box with no name, and for an old record that was derived. The code cannot prove either. The record default is `Written` for old records. Print `-` when the record has no name, so the line says only what the record holds.
First verify this against the code yourself. It is model output and
may be wrong. If it is wrong, or the tradeoff was deliberate, say so
and change nothing.
👍 useful · 👎 noise — react to tell the reviewer. Replying works too, and says more.
There was a problem hiding this comment.
Disputed. Spec 29 BOX-158 (sub-bullet, line 348) requires it: "a missing name origin as written (BOX-228), in the listing and in BOX-159's read alike". So min box show printing written for an old record is the specified answer, not a guess. Every box has a name (BOX-163: the requested name, else a derived one), so the no-name case does not arise. Printing - would contradict BOX-158 and BOX-159.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms to architecture.md §Addressing. The box record now holds the project name, the entry and the name origin (line 401). minimald alone stamps them at create (line 407). The list shows the project name as the box's project (line 1248). Both rename paths set the origin to written, and old records read as written with no project name and no entry. The Verify step in the PR body failed to compile. The last commit adds the missing test record, but CI must show that the head builds.
Ruled at 2f65e07 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
Follow-up
Fixes #3785
Closes #3754
crates/boxes/src/lib.rscrates/boxes/src/store.rscrates/minimald/src/box_actor/naming.rscrates/minimald/src/box_manager.rscrates/minimald-rpc/src/lib.rscrates/minimald/src/box_manager/tests.rscrates/minimal-client/src/box_registration.rscrates/minimal/src/cmd/box_audit.rscrates/minimal/src/cmd/boxes/vm_host.rscrates/minimal/src/cmd/mod.rscrates/minimal/src/dash/render.rscrates/minimal/src/dash/rpc.rscrates/minimal/src/tests.rscrates/minimal/tests/dash_snapshots.rscrates/minimald-rpc/src/tests.rscrates/minimald/src/box_actor/host.rscrates/minimald/src/box_actor/setup.rscrates/minimald/src/box_actor/tests.rscrates/minimald/src/box_manager/composables.rscrates/minimald/src/box_runtime.rscrates/minimald/src/box_runtime/tests.rscrates/minimald/src/build_boxes/tests.rscrates/minimald/src/exec/tests.rscrates/minimald/src/store.rscrates/minimal/src/cmd/boxes/list.rscrates/minimal/src/cmd/boxes/show.rscrates/minimal/src/cmd/boxes/address.rscrates/minimal/src/cmd/session.rsTask marker
Proof
min box list now prints the columns ID NAME ENTRY TYPE PARENT PROJECT STATE PROVIDER HOST. PROJECT shows the project name, or the project root for an old record. With -o json, each min/v1/box object carries entry, project_name and name_origin, and project stays the root. A box renamed with min box rename reads name_origin "written". min box show prints Name origin, Entry and Project name, and its -o json/yaml object has the same three fields.
Notes from the agent: crates/minimald/src/box_actor/setup.rs and crates/minimald/src/box_manager/composables.rs have no boxes::Record literal, so they did not change. Record gains project_name and entry, because #3752 did not add them. A new NameOrigin enum (written, derived) in the boxes crate is the type of name_origin on the record and on the wire. The daemon stamps project_name as the project name a derived name uses: the request's project name, else the project root directory name. It also does this when the request wrote the name. entry is the stored spec's entry key as written, so a session entry reads "default". It is absent when the box has no spec. A rename to the same name returns early in the store and leaves the origin unchanged. min box show widens its label column from 11 to 13 characters for 'Project name:'. That changed pinned spacing in list.rs tests and in three assertions in crates/minimal/src/tests.rs, and box_show_output_yaml_matches_json gained the three new keys. These are test-only edits in layer files. The BOX-164 test checks attrs and a planted record.json in the project directory. It does not run a process inside a real sandbox. Extra runs: cargo nextest run -p minimal (1278 passed), -p minimald-rpc (97 passed), -p boxes rename (16 passed), -p minimal-client box_registration (19 passed). clippy --all-targets is clean on boxes, minimald, minimald-rpc, minimal and minimal-client.
Tests
cargo nextest run -p minimald record_keeps_name_origin_written_or_derivedcargo nextest run -p minimald list_returns_every_retained_record_with_state_project_and_entrycargo nextest run -p minimald legacy_record_lists_and_reads_missing_name_fields_as_absentcargo nextest run -p minimald box_managercargo nextest run -p minimal box_json_carries_project_name_entry_and_name_origincargo nextest run -p minimal box_show_renders_project_entry_and_name_originVerify
min task run agent-verifyexited 101, so this PR is a draft.