Repository navigation
fix(minimal): T33 — Exit codes follow the architecture's table - #3719
Conversation
An invalid --vm name is a usage error, so it now ends with exit 2, as a command line min cannot parse does. Its text is unchanged. The exit_code_table tests pin each error kind's exit code and its machine-mode code, and each refusal's own code, against the table.
|
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 |
|
Reviewed: no findings; approval withheld, 2 threads unresolved at APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minimal/src/main.rs:2063, minimal-arch[bot] crates/minimal/src/cmd/boxes/address.rs:714. Resolving the last thread releases the approval on this head. Resolve the open threads. Resolving the last one releases the approval on this head; no new review is required. 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: CONDITIONS · 1 condition · the full ruling
The --vm change is correct. A refused name is a usage error, and it now ends with 2 as row 2 of the exit-code table says. The change claims that every command ends with its table code, but two host refusals in address.rs still end with 1. box_host_client bails Host <name> is not running., and probe_other_host returns Could not reach host <name>., both untyped. Row 7 of the table (line 370) gives a host that does not answer exit 7. Type both as HostUnreachable as C1 says, or file an issue for the gap and name it in the PR body.
Outside the diff
crates/minimal/src/cmd/boxes/address.rs:714: C1 · This refusal is untyped, so it ends with 1. Row 7 of the exit-code table (architecture.md line 370) gives a host that does not answer exit 7. ReturnHostUnreachable::error(...)with the same text.crates/minimal/src/cmd/boxes/address.rs:758: C1 · This error is untyped, so it ends with 1. Wrap it asHostUnreachable::over(e, ...)with the same text, so it ends with 7 (architecture.md line 370).
Ruled at 4f2df13 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| /// The [proposed] rows (8, `insufficient_resources`, and 5's provider | ||
| /// quota) are outside the requirement, so they are not pinned here. | ||
| #[test] | ||
| fn exit_code_table() { |
There was a problem hiding this comment.
C1 · Add a row for each address.rs host refusal that C1 types, with exit 7 and kind host_unreachable.
There was a problem hiding this comment.
Addressed in 0bbe6167929c: Added two exit_code_table rows, for the stopped host and the unreachable host, each with exit 7 and kind host_unreachable. A tests.rs test also drives box_host_client on both.
|
/revise Arch's ruling at 4f2df13 (CONDITIONS): C1. The plan's layers now list C1: two host failures exit 1 where the architecture's table gives row 7 (provider or host unreachable). Type them at the source, and keep both texts:
Change nothing else. Build and test only |
…-follow-the-architecture-s-table
box_host_client and probe_other_host now type their two host failures as HostUnreachable, so min ends with exit 7 (provider or host unreachable), as the exit-code table gives it. Both texts are unchanged. exit_code_table pins both rows, and a new test drives box_host_client on a stopped host and on an unreachable one.
|
Round 1 of 10 on a /revise note, pushed as
Verify Converted to a draft: verify exited 100. Review threads the coder judged:
Every min command ends with the exit code the architecture's table gives its outcome. A box command that names a stopped host or a host that does not answer now exits 7, not 1, and prints the same text as before. Notes from the agent: C1 is done. box_host_client returns HostUnreachable::error for a stopped host, and probe_other_host wraps the Unreachable arm with HostUnreachable::over. Both texts are unchanged. exit_code_table in main.rs has a row for each. The new test exit_code_table_box_host_client_host_unreachable in tests.rs drives box_host_client on a stopped host and on an unreachable host (a socket path longer than the kernel accepts). It asserts the HostUnreachable type, and failure_exit_code in main.rs maps that type to 7. tests.rs is in the library crate, so it cannot call failure_exit_code in the binary directly. The commitlint failure is on an earlier commit on this branch (subject 'T33 — exit codes ...' is sentence-case). I cannot rewrite pushed commits, so that check stays red until someone squashes the pull request with a valid title. The new commit subject is in lower case. cargo clippy -p minimal --all-targets reports no warnings. |
|
/arch-review |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 1 condition · the full ruling
C1 from the last ruling is met. box_host_client and probe_other_host now type both host failures as HostUnreachable, so min ends with 7, as the Exit codes table gives at line 370. A test drives the real function. One gap remains outside this task's layers. When the selected host's daemon does not answer, Client::connect returns an untyped error, and the command ends with 1. File an issue for that gap and name it in the PR body as a residual (C2).
Ruled at 0bbe616 against gominimal/arch@4f2eb87d5d12 by claude-opus-5-5.
| match probe_other_host(host).await? { | ||
| Some(client) => Ok(client), | ||
| None => bail!("Host {} is not running.", host.host), | ||
| // BCLI-034: a stopped host exits 7, provider or host unreachable. |
There was a problem hiding this comment.
C2 · This arm now ends with 7, so C1 is met. The selected-host branch above calls connect_box_host() (line 744). That function wraps the Client::connect failure only with with_context, so it still ends with 1. list.rs, boxes/list.rs, net.rs and attach.rs do the same. File an issue to type these failures as HostUnreachable (architecture.md line 370). Name that issue in the PR body.
There was a problem hiding this comment.
Filed as #3734 and listed under Residuals in the PR body, as the ruling at 0bbe6167 allows.
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/minimal/src/main.rs:2063, minimal-arch[bot] crates/minimal/src/cmd/boxes/address.rs:714. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
T33 — Exit codes follow the architecture's table
slice: S8
kind: task
covers: BCLI-034
size: S
est: 100 code, 60 tests
executor: agent
difficulty: routine
model: light
diagnostics: each refusal keeps the message the task that added it prints; this task changes only the exit code, pinned by exit_code_table
observability: the command's existing tracing span records the verb, the box id it resolved and the outcome
layers:
- client:
- crates/minimal/src/main.rs: maps each outcome to the exit code the architecture's table names
- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests
test: cargo nextest run -p minimal exit_code_table
produces: none
consumes: none
proof: Every command ends with the exit code the architecture's table gives its outcome.
depends on:
- blocked by #2922
Proof
Every min command ends with the exit code the exit-code table gives its outcome, except when the selected host's daemon does not answer (#3734, under Residuals). An invalid --vm name, which ended with 1 before, now ends with 2 as a usage error, with the same text. The exit_code_table tests pin each error kind (ambiguous 2, not_found 4, host_unreachable 7, github_sign_in_required 3, gatehouse_unenrolled_node 5, timeout and wait_timeout 124, output_failed and unspecified 1) in both output modes, and pin each refusal type's o 8000 wn code.
Notes from the agent: T46 (#3436) already moved most refusals that exited 1 onto the table's codes, so this task found one gap in main.rs: a refused --vm value exited 1 before the command ran. It now exits 2 through answer_vm_name, and its message is unchanged. The [proposed] rows (exit 8 insufficient_resources, and 5's provider-quota case) are not pinned, as BCLI-034 excludes them. The architecture document is not in this repository. I took the rows from docs/reference/cli-min.md and from the codes main.rs already gives. Outside the layers, I saw one refusal that still exits 1: crates/minimal/src/cmd/boxes/address.rs box_host_client bails with 'Host is not running.' as an untyped error. It is probably a host_unreachable (7) outcome. It needs a typed error in address.rs, which this task's layers do not name, so I left it unchanged. The command span in cmd/mod.rs already records the verb and the outcome, so observability needed no change. I did not run just ci, just clippy-strict or the whole crate suite.
Tests
cargo nextest run -p minimal exit_code_tableVerify
min task run agent-verifyexited 100, so this PR is a draft.Residuals
Client::connectreturns an untyped error, so the command exits 1, not 7. The call sites are inaddress.rs,list.rs,boxes/list.rs,net.rsandattach.rs, outside this task's layers.Closes #2923