Repository navigation
fix(minvmd): move a renamed own_ip box's host row to its new name - #3175
Conversation
A session rename changes only the in-VM record: the VM host keeps the box's row, its creation and its published address under the name the box was registered by. The destroy then withdrew under the new name with no box id, the host refused it as another box's row, and the ingress forward, the old name's answer and the name itself stayed held for good (gominimal/inbox#1116). The destroy, `min box rm`, `min box prune` and the dashboard's destroy now present the record's box id beside the pair. The host accepts the row's own id in place of its name, finds a dormant creation by the id first (as a resume does), and releases the published address under the name the host held the box by. A withdrawal without the id is still held to the name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An attach that ends with the session gone (the shell-exit Delete, ends_with_run, or a destroy from another shell) withdrew the row with the pair alone, under the session's current name. After a rename that is refused with NotTheCreatorsRow, and the row, its ingress forward and the old name stay (#1116). The CLI's attach and the dashboard's now read the box id off the record beside the pair, before the attach, and present it; the id still goes only with a pair. minvmd's withdrawal hands back the name the host held the box under, and the guest-audit flush after it is labelled with that name rather than the one the request presented. New tests pin box_addresses.and(box_id) on destroy_box: a pair and an id send the id; an id with no pair sends no withdrawal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`min session rename` reached only the in-VM daemon. The VM host kept the box's row, its creation (box-registry.json) and its published address under the name the box was registered by, so the old name kept answering the box's address and the new one was NXDOMAIN until the destroy (#1116). A new host-door verb, rename_box, carries the old and new names, the pair and the box id. minvmd re-keys the row (and its task rows) in place, re-keys the creation found by the id, persists, and pings the table: the zone answers under the new name, the answerer's book moves the address on the re-publish, and the gate's name rules read the new name. Another box's id or pair is refused; a name another row holds is refused; a dormant creation under it is superseded. The row's name is now behind its own lock and `BoxRecord::name` returns an `Arc<str>`, so the callers that took `&str` borrow it. `min session rename`, `min box rename` and the dashboard's rename all send the verb for an own_ip box; `host_ip` and `none` boxes keep the hold move. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… by value The two rename tests checked `.is_err()`, which clippy's assertions_on_result_states flags. The pair refusal now matches `RenameError::NotTheHandedPair`, and the id-less parse uses `expect_err`. The previous commit's "(#1116)" means gominimal/inbox#1116, not a minimal issue. Refs: gominimal/inbox#1116 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…daemon connections The lab prepush (job 05240) failed only on every_daemon_connection_is_classified: the new vm_host test fixture connects to the daemon and belongs in the inventory as ungated, like box_record_by. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… rename re-key Reading a row's name as it is now (an Arc<str>) turned the deny-all DNS drop line's `namespace` field into a Display field, so it logged `namespace=sealed` where it had logged `namespace="sealed"`. The host-side gate test that greps the line caught it; Debug keeps the quoted form every other string field has. The rename test's `matches!(.., Ok(_))` is `.is_ok()`, as clippy asks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 10 billable files and costs up to $2.50.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 57 minutes for your next included review. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Approved: no findings at Nothing to do. Clobber: not checked in depth. If that was not intentional, restore the earlier change. |
agent-137
left a comment
There was a problem hiding this comment.
Review on Karl's behalf, at 284c3f50a. This is a comment, not an approval. Nothing was built for it: every point comes from reading the code, and each finding says how it was checked.
- CI at head
284c3f50a: all green. Every lane aggregator passed (ci-success,ci-linux-native-success,ci-linux-kvm-success,ci-macos-success,ci-shell-installer-success), and so didci-kani-success. - Existing reviews: minimal-review APPROVE at head, with all 3 of 3 personas run. CodeRabbit APPROVED at head, and a real review exists on that commit. No humans have reviewed.
Should-fix: none.
Nit
crates/minimal/src/cmd/boxes/vm_host.rs:264: this doc comment, and the PR body, say the dashboard's rename "go[es] through this, so the three cannot drift". It does not.crates/minimal/src/dash/rpc.rs:446-459copies theholds_namebranch inline: it callshold_box_nametwice for the hold case andrename_box_row_with_vm_hostdirectly for the row case. The behaviour matches today, but a future change torename_box_with_vm_hostwill skip the dashboard. Either callrename_box_with_vm_hostfrom the dashboard or fix the comment. (Read both call sites.)crates/minvmd/src/control.rs:1738: theresume_replydoc comment still says the creation's own name is one "which a rename does not change". This PR'srename_client_boxnow changes it (it re-inserts the creation undernew_keywithcreation.name = new_name). The comment came over unchanged frommain. (Greppedmain, #3172 and #3175.)crates/minvmd/src/net/egress_gate.rs:7403: the commit changednamespace = refusal.record.name()tonamespace = ?refusal.record.name(). In the fmt file log that prints the same quoted string as before. minvmd also runstracing-opentelemetry(crates/minvmd/Cargo.toml:107), though, and there a?field arrives throughrecord_debug. The OTelnamespaceattribute is now"web"with the quotes inside the value, where before it wasweb.namespace = &*refusal.record.name()keeps thestrpath for both layers. (Read the diff. I did not check what the exporter emits.)crates/minimal/src/cmd/boxes/vm_host.rs:323-330: on a timeout (Err(_)) or a transport error after the request was written, the warning says "the box answers under its old name until it is destroyed". In those cases minvmd may already have applied the rename in its turn. AGENTS.md says "Say only what the code can prove". For those branches, say that the move may not have happened.
Checked and found fine:
rename_client_box(box_registry.rs): the id and pair proof,NameHeldagainst non-task rows, a standing creation under the new name being refused, a dormant one being superseded, the re-key of a creation found by id or among the superseded, the task-row rename, persist and ping.- Register and rename both run under
order.apply, so a registration's name check and its insert cannot interleave with a rename. BoxRecord::nameasRwLock<Arc<str>>: every call site I grepped was updated, and the attachment's copiednameis only read by diagnostics and tests.- The client sends
RenameBoxonly when the record carries bothbox_addressesandbox_id. minimald/src/rpc.rsrefuses the verb on the answerer-only socket.- The answerer race (a destroy before the re-publish) is a known gap the PR body already declares.
Verdict: ready to approve, with the nits optional. Merge it after #3172, or merge it in place of #3172 and close #3172.
agent-137
left a comment
There was a problem hiding this comment.
Approving at 284c3f50a. The earlier comment review found nothing that needs fixing, and its nits are optional.
Resolves crates/minvmd/src/box_registry.rs and control.rs: #3172 landed on main with `Record::name` returning `&str`, so this branch's rename path and its tests take a name as main does, with no borrow of the returned slice. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Merged main into the branch (64d3ef4), resolved by hand: this branch makes a row's |
Refs gominimal/inbox#1116 (the rename half; #3172 is the teardown half).
This PR follows #3172 and includes its commits.
c48d70f66,98c2838a5and3a1312c79are #3172's three commits (3a1312c79is the same diff as #3172's1cbcf5f92, on this branch's parent). This PR's own change is857232c3b,032245842and284c3f50a(the last keeps the deny-all DNS drop line'snamespacefield quoted now that a row's name is read as anArc<str>; the host-side gate test that greps the line caught the Display form). Once #3172 merges, this branch is rebased onto main and keeps only those three.min session renamereached only the in-VM daemon. The VM host kept the box's row, its creation (box-registry.json) and its published address under the name the box was registered by, so the old name kept answering the box's address and the new one was NXDOMAIN until the destroy (gominimal/inbox#1116).A new host-door verb,
rename_box, carries the old and new names, the pair and the box id. minvmd re-keys the row (and its task rows) in place, re-keys the creation found by the id, persists, and pings the table: the zone answers under the new name, the answerer's book moves the address on the re-publish, and the gate's name rules read the new name. Another box's id or pair is refused; a name another row holds is refused; a dormant creation under it is superseded.The change
Wire (
minimald-rpc):BoxControlRequest::RenameBox(RenameBoxRequest { name, new_name, switch_address, loopback_address, box_id }), tagrename_box.box_idis required, because the id is the proof. It answersBoxControlReply::Addressesechoing the pair, orError. An older minvmd refuses the line at the parse, and the client warns.Host (minvmd):
BoxRecord::nameis nowRwLock<Arc<str>>, renamed in place on the sameArc, so liveness, attribution, runtime ports, relays'Weakmarks and the proxy attachment keep their identity.BoxRegistry::rename_client_boxworks under one write of the row lock. It refuses another box's row at the pair (NotTheBoxId), another loopback, a creation of the id at another pair (NotTheHandedPair), and a new name another non-task row holds in any folded spelling (NameHeld). It finds the creation by id, re-inserts it under the new canonical key, supersedes a dormant creation of another box there (a standing one is refused), renames the row and its task rows, persists, and pings. It returns the old held name, orNonewhen the host holds neither a row nor a creation of the id (nothing moves; the reply is still the echo).control.rsdispatches(RenameBox, Host)underorder.apply, like hold/withdraw, and logs both names.AddressBook::claim_atoverwrites the holder record with the new name, so the destroy's release by the new name frees the address.RenameBox(minimald/src/rpc.rs).Client (minimal):
rename_box_with_vm_hostmoves the zone hold as before when the recordholds_name; otherwise it sendsRenameBoxonly when the record carries bothbox_addressesandbox_id, so native hosts and other modes stay silent. It is warn-only and bounded byBOX_CONTROL_TIMEOUT.min session rename,min box renameand the dashboard's rename all go through it.Tests
box_registry::a_rename_re_keys_the_row_and_its_creation_by_box_id(refusals; the move; the follow-on withdraw and the old name's reuse) andbox_registry::a_rename_re_keys_a_dormant_creation_by_box_id.control::a_rename_moves_the_row_and_the_destroy_releases_the_new_name.answerer::a_publish_under_a_new_name_moves_the_address_to_it.vm_host::an_own_ip_rename_moves_its_host_row_by_pair_and_box_id.minimald-rpc::rename_box_tests::rename_box_request_round_trips_and_requires_the_box_id.Scope and follow-up
host_ip/nonepath (the hold move), and ahost_ipbox whose record carriesbox_addressesandbox_id(which now takes theRenameBoxbranch), are unit-tested only.857232c3b's body writes a bare "(fix: document powershell in completions and add a session policy reference #1116)"; it means gominimal/inbox#1116 (032245842says so). The squash message should spell it in full.Verification
OK: 841b-rename-rekey-284c3f50: 4 expectation(s) on ubuntu-24.04, fedora: 841b-rename-moves-own-ip-name:fail->pass 841-rename-destroy-own-ip-row:pass 727-host-ip-egress-fail-open:pass 723-vm-host-ip-name-502:same
min-regress batch
841b-rename-rekey-284c3f50: baserel-6a01d5aevs the candidatecand-841b-rename-rekey-284c3f50-d0e280ed, per distro:Lab evidence (min-regress batch
841b-rename-rekey-284c3f50on the lab box, fedora, ubuntu-24.04)Head:
284c3f50a35ddf7a83fcc46cd2dfedd389c8cff7at 284c3f5 (lab namecand-841b-rename-rekey-284c3f50-d0e280ed). Base:rel-6a01d5ae(rel-6a01d5ae).session policybut never enforced (fail-open)session policybut never enforced (fail-open)Fixed since base: 4. Still reproducing on both: 1. Regressed: 0. Passing on both: 4. Inconclusive cells (an environment or setup failure on a side, not counted): 1. A scenario that fails on both sides is the environment or main, not this candidate: read its evidence lines before reading it as the candidate's. A verdict links to the run's trace in Cloud Trace (project access needed); the scenario link is its source with the
# issue:it reproduces.Why each failed run failed: what the scenario measured, then what its trace recorded (error spans and warnings, most frequent first):
answer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0; trace: no error span and no warning in the traceanswer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0; trace: no error span and no warning in the tracedestroy_warn=1 port_listening=1 old_name_answer=127.0.64.3 reactivate_rc=2 already_exists=1 destroy_rc=0 registry_names_old=1 answer_before=127.0.64.3 port_before=1; trace:2x minimal-cli span error cmd;1x minimal-cli span error activation_stepanswer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0; trace: no error span and no warning in the traceanswer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0; trace: no error span and no warning in the tracedestroy_warn=1 port_listening=1 old_name_answer=127.0.64.3 reactivate_rc=2 already_exists=1 destroy_rc=0 registry_names_old=1 answer_before=127.0.64.3 port_before=1; trace:2x minimal-cli span error cmd;1x minimal-cli span error activation_stepbody_bytes=1000 curl_rc=0 cli_addr_bytes=0 cli_name_bytes=0 inbox_bytes=1060 web_ip=100.64.127.255 tcpdump=no syn=0 synack=0 rst=0; trace:3x minimald WARN exec: ended while its command was starting; the start is ended when it returns;1x minimald WARN the box's classifier cover fell back to an empty read-only tmpfs: the kernel refused the design's cgroup<n> mount of the box's namespace roo;1x minimald WARN exec: ssh client disconnected; killing childbody_bytes=1000 curl_rc=0 cli_addr_bytes=0 cli_name_bytes=0 inbox_bytes=1060 web_ip=100.64.127.255 tcpdump=no syn=0 synack=0 rst=0; trace:3x minimald WARN exec: ended while its command was starting; the start is ended when it returns;1x minimald WARN the box's classifier cover fell back to an empty read-only tmpfs: the kernel refused the design's cgroup<n> mount of the box's namespace roo;1x minimald WARN exec: ssh client disconnected; killing childEach cited run's verdict and evidence
Each cited run's last VERDICT or ENV line and its EVIDENCE line (the results.jsonl rows of batch
841b-rename-rekey-284c3f50):VERDICT: after rename a841y20973 -> b841y20973: old-name-answers-127.0.64.3 new-name-nxdomain-not-127.0.64.3 registry-keeps-a841y20973 registry-lacks-b841y20973 ingress-port-20973-after-destroy;EVIDENCE: answer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0VERDICT: after rename a841y25534 -> b841y25534: old-name-answers-127.0.64.3 new-name-nxdomain-not-127.0.64.3 registry-keeps-a841y25534 registry-lacks-b841y25534 ingress-port-25534-after-destroy;EVIDENCE: answer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0VERDICT: rename moved the name: b841y19446 answers 127.0.64.3, a841y19446 answers nxdomain, the registry names b841y19446; after the destroy b841y19446 answers nxdomain;EVIDENCE: answer_before=127.0.64.3 old_after_rename=nxdomain new_after_rename=127.0.64.3 registry_old=0 registry_new=1 new_after_destroy=nxdomain port_after_destroy=0 destroy_rc=0VERDICT: rename moved the name: b841y17878 answers 127.0.64.3, a841y17878 answers nxdomain, the registry names b841y17878; after the destroy b841y17878 answers nxdomain;EVIDENCE: answer_before=127.0.64.3 old_after_rename=nxdomain new_after_rename=127.0.64.3 registry_old=0 registry_new=1 new_after_destroy=nxdomain port_after_destroy=0 destroy_rc=0VERDICT: after rename a841y23751 -> b841y23751: old-name-answers-127.0.64.3 new-name-nxdomain-not-127.0.64.3 registry-keeps-a841y23751 registry-lacks-b841y23751 ingress-port-23751-after-destroy;EVIDENCE: answer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0VERDICT: after rename a841y29727 -> b841y29727: old-name-answers-127.0.64.3 new-name-nxdomain-not-127.0.64.3 registry-keeps-a841y29727 registry-lacks-b841y29727 ingress-port-29727-after-destroy;EVIDENCE: answer_before=127.0.64.3 old_after_rename=127.0.64.3 new_after_rename=nxdomain registry_old=1 registry_new=0 new_after_destroy=nxdomain port_after_destroy=1 destroy_rc=0VERDICT: rename moved the name: b841y32798 answers 127.0.64.3, a841y32798 answers nxdomain, the registry names b841y32798; after the destroy b841y32798 answers nxdomain;EVIDENCE: answer_before=127.0.64.3 old_after_rename=nxdomain new_after_rename=127.0.64.3 registry_old=0 registry_new=1 new_after_destroy=nxdomain port_after_destroy=0 destroy_rc=0VERDICT: rename moved the name: b841y28680 answers 127.0.64.3, a841y28680 answers nxdomain, the registry names b841y28680; after the destroy b841y28680 answers nxdomain;EVIDENCE: answer_before=127.0.64.3 old_after_rename=nxdomain new_after_rename=127.0.64.3 registry_old=0 registry_new=1 new_after_destroy=nxdomain port_after_destroy=0 destroy_rc=0VERDICT: after rename a841x22632 -> b841x22632 and destroy, left behind: ingress-port-22632 old-name-answers-127.0.64.3 reactivation-refused (destroy warned: 1);EVIDENCE: destroy_warn=1 port_listening=1 old_name_answer=127.0.64.3 reactivate_rc=2 already_exists=1 destroy_rc=0 registry_names_old=1 answer_before=127.0.64.3 port_before=1VERDICT: rename then destroy left nothing behind: port 38101 closed, a841x18101 answers nxdomain, re-activation under a841x18101 succeeded;EVIDENCE: destroy_warn=0 port_listening=0 old_name_answer=nxdomain reactivate_rc=0 already_exists=0 destroy_rc=0 registry_names_old=0 answer_before=127.0.64.3 port_before=1VERDICT: after rename a841x10812 -> b841x10812 and destroy, left behind: ingress-port-30812 old-name-answers-127.0.64.3 reactivation-refused (destroy warned: 1);EVIDENCE: destroy_warn=1 port_listening=1 old_name_answer=127.0.64.3 reactivate_rc=2 already_exists=1 destroy_rc=0 registry_names_old=1 answer_before=127.0.64.3 port_before=1VERDICT: rename then destroy left nothing behind: port 32466 closed, a841x12466 answers nxdomain, re-activation under a841x12466 succeeded;EVIDENCE: destroy_warn=0 port_listening=0 old_name_answer=nxdomain reactivate_rc=0 already_exists=0 destroy_rc=0 registry_names_old=0 answer_before=127.0.64.3 port_before=1VERDICT: host_ip: allow-list refused up front; deny-all egress is enforced (1.1.1.1:443 blocked); no EVIDENCE lineVERDICT: host_ip: allow-list refused up front; deny-all egress is enforced (1.1.1.1:443 blocked); no EVIDENCE lineVERDICT: host_ip: allow-list refused up front; deny-all egress is enforced (1.1.1.1:443 blocked); no EVIDENCE lineVERDICT: host_ip: allow-list refused up front; deny-all egress is enforced (1.1.1.1:443 blocked); no EVIDENCE lineVERDICT: the session name reaches its 0.0.0.0 dev server through the proxy and a 127.0.0.1-only port is refused naming the fix (ok: local.min.internal min.internal);EVIDENCE: min.internal loopback-only :P -> GET 403 The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name. | 0.0.0.0 :Q -> GET 200 WILD-33897VERDICT: the session name reaches its 0.0.0.0 dev server through the proxy and a 127.0.0.1-only port is refused naming the fix (ok: local.min.internal min.internal);EVIDENCE: min.internal loopback-only :P -> GET 403 The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name. | 0.0.0.0 :Q -> GET 200 WILD-36363VERDICT: the session name reaches its 0.0.0.0 dev server through the proxy and a 127.0.0.1-only port is refused naming the fix (ok: local.min.internal min.internal);EVIDENCE: min.internal loopback-only :P -> GET 403 The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name. | 0.0.0.0 :Q -> GET 200 WILD-18405VERDICT: the session name reaches its 0.0.0.0 dev server through the proxy and a 127.0.0.1-only port is refused naming the fix (ok: local.min.internal min.internal);EVIDENCE: min.internal loopback-only :P -> GET 403 The box listens on this port at 127.0.0.1 only. Bind it to 0.0.0.0 to reach it by name. | 0.0.0.0 :Q -> GET 200 WILD-12169The 790d control (own_ip ingress, unchanged by this PR) is left out of the expectation above: its runs on one distro ended ENV on both sides before any probe, which is no evidence either way; the other distro read FAIL on both sides, as expected.
🤖 Generated with Claude Code
Summary by CodeRabbit