Repository navigation
refactor(boxes): make the box id the one key for every record - #2485
Conversation
SessionId is now an alias of BoxId, a UUIDv7 newtype. A record keeps writing its id in the hyphenated form and its handed box_id as 32 hex digits, and reads either spelling, so records written before the merge round-trip unchanged. The store files a record under the id the VM host handed it when there is one, and refuses an id a retained record already holds.
The box control fields spell the box id as 32 hex digits through boxes::box_id_hex, so every reply carries the bytes it carried before the id types merged. A test pins each pre-merge reply byte for byte.
The manager's running map is keyed by the one box id, a UUIDv7, so it holds boxes in creation order. A create logs the id the record is filed under, and a test pins the holder's order and the handed key.
The VM host mints a boxes::BoxId, the record key type, and hands the switch its bytes. Log lines spell the id the way the in-VM daemon's record and log do.
Filing a VM box's record under the id its host handed back refused the box_actor tests that hand one fixture id to every box, and the refusal surfaced as a name collision. That is the BOX-002 change and needs its own task, so the store mints the key as before, now in the one box id type.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Approved: no findings at Nothing to do. Clobber: none seen. |
There was a problem hiding this comment.
arch-review: CONDITIONS · 3 conditions · the full ruling
The type merge conforms, and the box-control wire bytes do not change. On a VM guest, the in-VM store still mints Record::id, because the last commit reverted the BOX-002 work. The PR documents that id as the box's one key and logs it as box_id. Architecture line 495 says minvmd mints the box_id outside the VM, and Record::box_id holds that id. Make the log field exact (C1) and the docs true (C2). File the reverted work as an issue and link it from the PR (C3).
Ruled at 8c8e7d4 against gominimal/arch@109541a48c31 by claude-opus-5-5.
The audit subject and the box control wire spell a box id as 32 hex digits. Log lines from the VM host now use the same form, so a tail can match one box across them.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The record key is still not the box id. DiskLoader::create mints record.id in minimald, which runs inside the VM on a LocalVM host. Line 495 of architecture.md says a party outside the host VM mints the box_id, and ids key every record. The PR names the revert but links no issue. Make C1: file the record under the handed id and refuse a duplicate. Make C2: give each box_actor test box its own minted id, and add that test file to the task layers. The minvmd log spelling change in this push conforms.
Outside the diff
crates/minimald/src/box_actor/tests.rs:3365: C2 · Every test box shares this one id. Mint a freshBoxIdfor each box, so the C1 refusal does not fire. Do not relax the refusal.
Ruled at bdeaeb7 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 1 of 10 on the runtime's review findings, pushed as
Verify Review threads the coder judged:
Records and replies written before the merge read back and write the same bytes. The record, the wire, the daemon and the VM host all use the one boxes::BoxId type. The VM host log now spells a box id as 32 hex digits, the same form as the audit subject and the box control wire. Notes from the agent: Revise round 1: BoxIdText in minvmd goes back to 32 lowercase hex digits through BoxId::simple(). The test now pins that form. The minvmd crate does not depend on bep, so the test compares against a hex rendering of the raw bytes, not bep::listener::box_id_text. The record on disk and the in-VM daemon log still use the hyphenated form, as boxes::BoxId documents. Clippy on minvmd shows one warning in crates/minimald-rpc/src/trace.rs (chunks_exact_to_as_chunks). That file is outside this branch's diff. |
The merged box id type prints hyphenated, and minvmd's control tests compare its log and audit lines against that spelling. minimald now logs the id the VM host handed in, and the id docs say that the in-VM store still mints the record key until BOX-002.
There was a problem hiding this comment.
arch-review: CONDITIONS · 2 conditions · the full ruling
The box id type merge conforms off a VM guest, and the code is in the right crates. On a VM guest the in-VM store still mints the record key, but architecture.md line 495 says a party outside the VM mints the box_id. The head documents this as "until BOX-002", but it links no issue. C1 adds the issue URL, the flip condition and a residual in the PR body. The ask audit record's box_id changes to the hyphenated form, but the BEP audit subject stays 32 hex. Line 495 says ids key every audit entry, so C2 keeps audit records in 32 hex.
Ruled at 731c8cf against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Round 2 of 10 on a failed check suite, pushed as
Verify Review threads the coder judged:
A box record or a reply written before the merge still reads back and writes the same bytes. Every crate names a box with the one boxes::BoxId type. A minimald log line and a minvmd log or audit line print a box id in the same hyphenated form. Notes from the agent: CI failure: minvmd control::tests::ask_outcomes_written_to_host_audit and box_addresses_allocated_on_host_and_handed_to_daemon compare log and audit lines with the Display of the merged BoxId, which is hyphenated. BoxIdText printed 32 hex digits. BoxIdText now prints the hyphenated form, and both tests pass. Follow-up outside the layers: bep::listener::box_id_text (crates/bep/src/listener.rs:64) still prints 32 hex digits in the proxy's log lines. C1 (the in-VM store files the record under the handed box id) is not done: crates/minimald/src/box_actor/tests.rs gives one HANDED_BOX_ID to every box, so the store refuses the second creation. That test file is outside this task's layers. The BOX-002 work needs a task that includes it. I cannot file an issue, so a person must file it and link it from the pull request. Pre-existing clippy warnings in minimald-rpc/src/trace.rs, minimald/src/box_runtime/handle.rs and minimald/src/net/switch.rs are in files this branch does not touch. |
|
/revise Apply the two conditions from the C1. Give the VM-guest interim its owner, #2397. That is T13 in this epic, "Mint every box's id in the VM host and take it only from there" (covers BOX-002). Its
C2. Keep one spelling of the box id in audit records.
Run the plan's test lines and |
Audit records keep the 32-hex spelling that every BEP audit subject and older box-admissions.log lines carry. Log lines keep the hyphenated form. The VM-guest interim docs now link #2397.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head resolves the two open points of the ruling on 731c8cf. The ask audit record writes the box id as 32 hex again, which is the same form as on base and in each BEP audit subject. The VM-guest record-key interim now links issue 2397 and states the condition that ends it. The change agrees with architecture.md line 495 and Gatehouse §5.2 line 244. Issue 2397 is a residual.
Ruled at 1e04eb7 against gominimal/arch@109541a48c31 by claude-opus-5-5.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 16 unresolved threads — minimal-foundry[bot] crates/minvmd/src/bep_attach.rs, minimal-arch[bot] crates/minimald/src/box_manager.rs, minimal-arch[bot] crates/boxes/src/lib.rs, minimal-arch[bot] crates/boxes/src/lib.rs, minimal-arch[bot] crates/minvmd/src/bep_attach.rs, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
|
Round 3 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
Records and replies written before the merge still read back as the same id. Log lines spell a box id in the hyphenated form. Every audit record, including the ask audit line's box_id, spells it as 32 lowercase hex. The VM-guest interim, where Record::id is still minted inside the VM, now links #2397 and states its flip condition. Notes from the agent: Out of layers: crates/minvmd/src/control.rs. The /revise note C2 named it explicitly. AskAudit::with_facts now writes minimald_rpc::BoxId::from_bytes(facts.box_id).simple(). The new test ask_audit_line_spells_box_id_as_32_hex is in control.rs tests. The existing test ask_outcomes_written_to_host_audit pinned the hyphenated form, so it now matches web.box_id.simple(). The first full minvmd run had one failure in cmd::run::tests::concurrent_boots_never_draw_the_same_proxy_port (a port race). It passed on the two runs after that, and this change does not touch that code. C1 PR body: the runner writes the body, so I did not add a Residuals section. Add this text to the body: '## Residuals — #2397 (T13). On a VM guest, Record::id is still minted inside the VM, so the title's "one key" holds only off a VM guest until #2397 lands.' |
…ox-id-the-one-key-for-every-record
|
A merge of main before round 4, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Outside the task's
Converted to a draft: something above needs a person before review. The branch merges main without conflicts. Record JSON written before the merge and every RPC reply id still round-trip. The box id is the one id type that the store, the wire, the daemon and minvmd use. Notes from the agent: This round resolved the merge conflict in crates/minimald/src/box_manager/tests.rs. The resolution keeps both tests: this branch's creation_order_holder_follows_box_id_time_order and main's sealed_deliveries_ride_the_record_to_the_host_params. The merge commit is c013190. The other files in the merge commit come from main, not from this task. sealed_deliveries_ride_the_record_to_the_host_params also passes on the merged tree. No thread verdict changed this round. |
mitodrummer
left a comment
There was a problem hiding this comment.
Babysit review on ae9fe70 against T45's plan block.
- Type:
SessionIdis nowpub type SessionId = BoxId, andBoxIdwraps a UUIDv7Uuid. Its derivedOrdfollows creation time, which the creation-order holder relies on. - Spellings: the default serde form and
Displayare the hyphenated UUID, asSessionIdhad. Every field that carried 32 hex (recordbox_id, BoxConfig, the box-control requests and replies) keeps it throughbox_id_hex. The deserializer accepts both spellings. Only JSON and TOML carry these ids, so moving fromUuid's derived serde to text parsing loses nothing. No binary serde format is in the workspace. - Proofs:
record_json_written_before_the_merge_round_tripschecks that an old record reads back and rewrites unchanged.every_reply_id_round_trips_byte_for_bytedoes the same for replies, andminted_box_id_is_the_record_key_typeties minvmd's mint to the record key type. - Arch conditions: "filed the box record" logs the VM-handed id when there is one (C1). Audit records keep 32 hex (C2,
control.rs, accepted outside the layers). The VM-guest interim is owned by #2397 (Residuals). - CI: green on this head, and arch-review is PASS on the change before the merge of main.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head merges main twice into the branch. The PR's own change lines did not change since the PASS on 1e04eb7, so that ruling stands. I checked the new BEP-007 code from main. It accepts the hyphenated box id that Display now prints, and the proxy still gets 32 hex digits. The VM-guest interim stays the filed residual #2397. CI is the compile gate for the merged tree.
Ruled at ae9fe70 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
/revise Merge the current |
|
Round 4 of 10 on a /revise note: the coder changed nothing. every commit this round put on the branch above ae9fe70 is a merge of the base branch, so it carries no work of its own |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head merges main into the branch. The lines that the PR adds and removes are the same as on ae9fe701, which passed. The new proxy grant code from main sends the box id through mint::box_id_hex, so the hyphenated Display does not change the id that the proxy sees. The PASS stands. The VM-guest record key stays the filed interim in #2397.
Ruled at 21c8592 against gominimal/arch@109541a48c31 by claude-opus-5-5.
|
Revise round 2 ran against |
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter verification at 21c8592. This head is GitHub's merge of main fa31776 onto the reviewed head; arch ruled PASS and minimal-review concluded. I read the full diff at this head: every BoxId field on the minimald-rpc wire (BoxConfig, RegisteredBox, WithdrawBoxRequest, ResumeBoxRequest, RowStandingRequest, BoxRow, SubscribeAsksRequest, PendingAskOffer, BoxControlReply::AsksSubscribed) carries the box_id_hex adapter, so the 32-hex bytes stay as they were while Record::id and the session replies keep the hyphenated form; every_reply_id_round_trips_byte_for_byte and record_json_written_before_the_merge_round_trips pin both. The minvmd ids stay the switch's raw 16 bytes, so no other wire changes. One visible change, as the body says: BoxIdText log lines and the two NotTheBoxId refusals now print the hyphenated id, while the ask audit record keeps 32 hex (pinned by ask_audit_line_spells_box_id_as_32_hex). Zero open threads; ci-success, native, kvm, shell-installer, cargo-deny and commitlint green; ci-macos-success queued behind the single runner. Squash title refactor(boxes): make the box id the one key for every record passes commitlint. The hex dependency of the boxes crate is now unused in its sources; a nit for a later cleanup, not this PR. Residual #2397 (VM guest record key) is filed and linked from the body.
Generated by Claude Code
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter approval at 21c8592: every merge gate passes at this head (arch PASS, zero open threads, every lane aggregator green including ci-macos-success, bot resolutions re-verified). Squash title refactor(boxes): make the box id the one key for every record and the squashed message pass commitlint. Queued for squash merge.
Generated by Claude Code
Policy and destroy resolve a box's VM from its name, as attach, exec, run and net forward do. A box no running VM holds names --vm, a box on a stopped VM names the command that starts it, and a name any two VMs hold, running or stopped, is refused with every VM listed. A relay failure writes the unwind before the attach error prints, so the error stays on screen. Backport of #2811. Adapted to the line: cmd/boxes/attach.rs and policy.rs hunks land in cmd/session.rs. Dropped, because the line has no stopped session status (#2676) and keeps box ids apart from session ids (#2485): min ls rows for a stopped VM's boxes, vm_running in its JSON, and id-prefix matching against a stopped VM's records, which match by name only here. (cherry picked from commit 2e3962f)
Policy and destroy resolve a box's VM from its name, as attach, exec, run and net forward do. A box no running VM holds names --vm, a box on a stopped VM names the command that starts it, and a name any two VMs hold, running or stopped, is refused with every VM listed. A relay failure writes the unwind before the attach error prints, so the error stays on screen. Backport of #2811. Adapted to the line: cmd/boxes/attach.rs and policy.rs hunks land in cmd/session.rs. Dropped, because the line has no stopped session status (#2676) and keeps box ids apart from session ids (#2485): min ls rows for a stopped VM's boxes, vm_running in its JSON, and id-prefix matching against a stopped VM's records, which match by name only here. (cherry picked from commit 2e3962f)
T45 — Make the box id the one key for every record
slice: S0
kind: enablement
covers: none
size: L
est: 420 code, 300 tests
executor: agent
difficulty: needs care
model: strongest
diagnostics: daemon log names boxes by one id
observability: spans and log lines carry box id
layers:
- record:
- crates/boxes/src/lib.rs: box id is the key; alias kept
- crates/boxes/src/store.rs: keyed by box id; reads old records
test: cargo nextest run -p boxes record_json_written_before_the_merge_round_trips
- wire:
- crates/minimald-rpc/src/lib.rs: reply ids convert, bytes unchanged
- crates/minimald-rpc/src/tests.rs: reply id round-trips
test: cargo nextest run -p minimald-rpc every_reply_id_round_trips_byte_for_byte
- daemon:
- crates/minimald/src/box_manager.rs: holder keeps id time order
- crates/minimald/src/box_manager/tests.rs: tests
test: cargo nextest run -p minimald creation_order_holder_follows_box_id_time_order
- vm-host:
- crates/minvmd/src/bep_attach.rs: mints the one id type
test: cargo nextest run -p minvmd minted_box_id_is_the_record_key_type
produces: none
consumes: none
proof: Old records and replies round-trip; one id everywhere.
depends on:
- blocked by #2375
- blocked by #2380
- blocked by #2383
- blocked by #2381
- blocked by #2376
- blocked by #2377
- blocked by #2378
- blocked by #2379
- blocked by #2384
Proof
The tree has one box id type. boxes::BoxId wraps a UUIDv7. SessionId is now an alias of it, and minimald-rpc and minvmd mint and carry that same type. A record.json written before the merge loads from disk under the same id and saves back with both id spellings unchanged. That is the hyphenated record id and the 32-hex box_id. Each session reply and each VM host box control reply decodes and re-encodes byte for byte. The daemon's map of live boxes holds them in box id time order, which is creation order. A minimald log line and a minvmd log line spell a box id in the same hyphenated form.
Notes from the agent: Design: BoxId is now a Uuid newtype with mint, nil, is_nil, parse_str, simple, From and AsRef.
pub type SessionId = BoxIdkeeps the 600-odd SessionId uses outside the layers compiling unchanged. The default serde form and Display are the hyphenated UUID, so record files, session replies and printed ids stay the same. The fields that carried the 32-hex spelling (Record.box_id and the minimald-rpc box control fields) use the new boxes::box_id_hex adapter, so their bytes stay the same. A reader accepts either spelling.One visible change: Display of a value that was a BoxId now prints the hyphenated form, not 32 hex digits. This changes the minimal-client registration log line and the minvmd log lines through BoxIdText, including the box_id string on a minvmd ask record. The bep and switch crates keep their own [u8; 16] and hex text, outside the layers.
Reverted inside this branch: the first commit also filed a VM box's record under the id the VM host handed it, and refused a duplicate id. The full minimald run then failed 10 box_actor tests, because they hand the one fixture id [0x42; 16] to every box. Also, the AlreadyExists refusal reached the client as "A session with that name already exists", which is wrong. That is BOX-002 and BOX-001's collision refusal, which this task does not cover. It needs crates/minimald/src/box_actor/te…[truncated]
Residuals
Record::idinside the VM. The minvmd-minted id is held inRecord::box_id. So the title's "one key for every record" holds only off a VM guest until T13 — Mint every box's id in the VM host and take it only from there #2397 lands. The interim ends whenDiskLoader::createkeys a record by a handedconfig.box_idinstead of minting one. TheBoxIdandRecord::iddocs and theBoxManagercreate comment link T13 — Mint every box's id in the VM host and take it only from there #2397. Two follow-ups from this PR's arch review are noted on T13 — Mint every box's id in the VM host and take it only from there #2397: distinct ids for thebox_actortest fixtures in place of the shared[0x42; 16], and a duplicate-id refusal message of its own.Tests
cargo nextest run -p boxes record_json_written_before_the_merge_round_tripscargo nextest run -p minimald-rpc every_reply_id_round_trips_byte_for_bytecargo nextest run -p minimald creation_order_holder_follows_box_id_time_ordercargo nextest run -p minvmd minted_box_id_is_the_record_key_typeVerify
min task run agent-verifyexited 101 under rustc 1.98.1, which the repository does not pin (1.97.0 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.Closes #2385
Undrafted 2026-10-24. The one edit outside the layers,
crates/minvmd/src/control.rs(AskAudit::with_factswrites the ask auditbox_idas 32 hex, with a pin test), is the one the arch review's C2 named. A maintainer accepted it.