Repository navigation
fix: T46 — The refusals that exit 1 end with the table's code - #3436
mitodrummer merged 9 commits into
Conversation
The store's name check said session for the box. The refusal now says box, and `min box rename` can read its lead to exit 2 (BCLI-058).
A missing minimal.toml, --loadout file or local host now exits 4. A minimal.toml that does not load for a task exits 3. The --ingress, --dynamic-ingress and --network none refusals, an invalid rename and a bad --allow-dns-hosts value now exit 2 (BCLI-034, BCLI-058, BCLI-078).
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Round 1 of 10 on a failed check suite: the coder changed nothing. No change this round. Two checks failed: ci-linux-native-success and native-daemon-e2e. ci-linux-native-success is the lane aggregator, and it fails only because native-daemon-e2e failed. The e2e failure is in native_names_answer_on_time. 'min session activate --network own_ip' of e2e-nnat-a failed with 'Failed to connect to minimald: ssh connect: Connection reset by peer'. That activation runs just after 'mnl stop --force', so it auto-spawns a fresh daemon. It passes only --allow-subnets and --allow-protocols. This branch does not change daemon start-up, the SSH connect path, the answerer or minzoned. The daemon-side change is only the text of the name refusal in validate_session_name, and no e2e script or test outside this task pins 'invalid session name'. The --allow-dns-hosts value_parser accepts every host the e2e script passes. The failure looks like a start-up race or a runner flake, not a defect in this diff. A re-run of native-daemon-e2e is the next step. If it fai…[truncated] |
…ls-that-exit-1-end-with-the-table-s-co # Conflicts: # crates/minimal/src/cmd/boxes/create.rs # crates/minimal/src/tests.rs
|
A merge of main before round 2, not counted against the cap (1 of 3), pushed as Resolved conflicts in:
Verify Converted to a draft: something above needs a person before review. For each row of the table, the command named in that finding ends with the row's exit code and prints the row's text, and none of them ends with 1. The merge with main keeps this, and refusals_exit_with_the_table_code still passes. Notes from the agent: Conflict round. I merged origin/main and resolved both conflicts by keeping both sides. In create.rs the branch's NetworkFlagRefusal type stays beside main's new refuse_file_ingress_off_own_ip, session_box_network, union_ingress and cli_network_mode. In tests.rs the branch's refusals_exit_with_the_table_code stays beside main's new session_entry_network_mode_and_ingress, and that test also passes. The merge commit is 4373292. The other files in the merge came from main without conflicts. Main's new refusal for a network.ingress in minimal.toml on a box without own_ip uses anyhow::bail, so it exits 1. No finding in this task covers it, so I left it unchanged. |
|
Reviewed: 2 findings, none blocking at Address the comments on the diff. Clobber: none seen. |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling
The change conforms to the exit-code table. Each refusal the task names now ends with code 2, 3 or 4, as architecture.md lines 363–365 assign. Two items remain. The proof checks a copy of the mapping in tests.rs, and not failure_exit_code itself. Add the direct tests in main.rs (C1). An unknown task name and a missing default_loadouts name still exit 1, and row 365 gives them 4. File an issue for them and link it from the PR body (C2).
Ruled at 4373292 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
|
||
| /// The exit code `main`'s `failure_exit_code` gives the refusals that | ||
| /// `refusals_exit_with_the_table_code` checks, and 1 for anything else. | ||
| fn table_refusal_code(error: &anyhow::Error) -> u8 { |
There was a prob 8000 lem hiding this comment.
C1 · This helper is a copy of failure_exit_code. If an arm in main.rs is missing, this test still passes. Add tests in the main.rs tests module that call failure_exit_code on each new type, wrapped in .context(..).
There was a problem hiding this comment.
Addressed in 0eee23259a2a: Added refusals_exit_with_the_table_code_through_failure_exit_code in main.rs's tests. It calls the real failure_exit_code on each new type, bare and under .context(..). The tests.rs helper doc now points to it.
| { | ||
| return minimal::task::RunFlagMisplaced::EXIT_CODE; | ||
| } | ||
| // BCLI-034: a network flag the box's network mode refuses is a usage |
There was a problem hiding this comment.
C1 · These four arms have no test that calls failure_exit_code. Add one test for each arm in this file's tests module: 2 for NetworkFlagRefusal and 4 for each not-found type.
There was a problem hiding this comment.
Addressed in 0eee23259a2a: The new main.rs test covers all four arms with literal codes: 2 for NetworkFlagRefusal, and 4 for ProjectFileNotFound, LoadoutNotFound and LocalHostNotFound.
| } | ||
| .into()); | ||
| } | ||
| // BCLI-078: a project file that does not load exits 3. |
There was a problem hiding this comment.
C2 · Two lines below, the unknown task name (None => bail!(unknown_task_message(..))) still exits 1. Architecture.md line 365 gives an entry that is not found exit 4. File an issue for it and link it from the PR body.
There was a problem hiding this comment.
Disputed — not addressed: The gap is real: an unknown task name still exits 1. It is not one of this task's findings, so no change this round. This session cannot file issues, so the result notes ask a person to file one and link it.
There was a problem hiding this comment.
Filed as #3443 (an unknown task name and a default_loadouts name with no file exit 4), and linked from the PR body's Gaps section.
There was a problem hiding this comment.
Disputed — not addressed: Outside this task's findings. The unknown task name that still exits 1 is tracked in #3443.
| .map(|(loadout, _layout)| loadout) | ||
| .map_err(|e| anyhow::anyhow!("{e}")) | ||
| .map_err(|e| match e { | ||
| boxes::client::disk::LoadError::NotFound { .. } if source == "--loadout" => { |
There was a problem hiding this comment.
C2 · Only the --loadout source gets exit 4. A default_loadouts name with no file still exits 1. Name it in the C2 issue, and give the table row it takes.
There was a problem hiding this comment.
Disputed — not addressed: The gap is real: a default_loadouts name with no file still exits 1. The task scopes exit 4 to --loadout, and the row for a configured default (3 or 4) is not settled. This session cannot file issues, so the result notes ask a person to file one.
There was a problem hiding this comment.
Filed as #3443 (an unknown task name and a default_loadouts name with no file exit 4), and linked from the PR body's Gaps section.
There was a problem hiding this comment.
Disputed — not addressed: Outside this task's findings. A default_loadouts name with no file that still exits 1 is tracked in #3443.
| Err(error) => return Err(crate::ProjectFileInvalid { error }.into()), | ||
| }; |
There was a problem hiding this comment.
LOW · correctness · confidence 0.55 · in declared_task
A broken minimal.toml now prints through ProjectFileInvalid. The text becomes 'Cannot start the box: the project's minimal.toml does not load: ...'. The old text was 'found a broken minimal.toml while resolving tasks: ...'. The PR says each refusal keeps its text. declared_task also serves min task run, which does not start a box, so the new prefix misleads.
What the reviewer checked
task.rs: Err(error) => return Err(crate::ProjectFileInvalid { error }.into()); create.rs:230 Display 'Cannot start the box: the project's {name} does not load: {error}'
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/task.rs
Lines: 680-681
Category: correctness
Severity: low (reviewer confidence 0.55)
Finding:
A broken minimal.toml now prints through `ProjectFileInvalid`. The text becomes 'Cannot start the box: the project's minimal.toml does not load: ...'. The old text was 'found a broken minimal.toml while resolving tasks: ...'. The PR says each refusal keeps its text. `declared_task` also serves `min task run`, which does not start a box, so the new prefix misleads.
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 — not addressed: The task's task.rs layer requires declared_task to return ProjectFileInvalid, which is the same refusal min box start prints for the same file. min task run creates a task box, so 'Cannot start the box' is true there.
There was a problem hiding this comment.
Addressed in ac272215a775: ac27221: declared_task returns task::TaskFileInvalid, which prints found a broken minimal.toml while resolving tasks: <error> and exits 3. Tests pin the text.
…ls-that-exit-1-end-with-the-table-s-co
The tests.rs helper copies the mapping in main.rs, so a missing arm there did not fail a test. A test in main.rs now calls the real function for each new refusal type, with and without context.
|
/revise Head 1. Arch C1, and finding PRRT_kwDOPdfcxM63bvWX: test 2. Arch C2: the two exit-1 cases are #3443. 3. Finding PRRT_kwDOPdfcxM63bvWR: a broken minimal.toml in Change nothing else. |
|
That Nothing to type again: the command gets a rocket when its round starts, or a refusal that names the reason. No round was counted for it yet. |
|
Round 2 of 10 on the runtime's review findings, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
For each row of the table, the command in that finding ends with the row's exit code (2 for the network flags and the rename, 3 for a minimal.toml that does not load, 4 for no minimal.toml, no loadout file or no local host) and prints the row's text. A test in main.rs now checks the real failure_exit_code for each new type, so none of them can end with 1 without a failing test. Notes from the agent: Round 2. Added a main.rs test that calls failure_exit_code on each new refusal type, bare and under .context(..), with literal codes. Its name starts with the test: filter, so the test: line runs it. Two gaps the reviewer found remain open and need an issue from a person, because this session has no credential to file one: (1) an unknown task name in declared_task (task.rs, |
There was a problem hiding this comment.
minimal-review — approval withheld
Verdict COMMENT — APPROVE withheld: 6 unresolved threads — minimal-arch[bot] crates/minimal/src/tests.rs:20006, minimal-arch[bot] crates/minimal/src/main.rs:293, minimal-arch[bot] crates/minimal/src/task.rs:679, minimal-arch[bot] crates/minimal/src/loadouts.rs:300, minimal-foundry[bot] crates/minimal/src/task.rs:681, …. No findings.
Panel: 3 of 3 personas ran (correctness, security, supply-chain).
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling
The new commit tests the real failure_exit_code, and that closes the proof gap in the tests.rs mirror. Each refusal that the change touches now ends with the code that the exit-code table gives (architecture.md lines 362-365). Two outcomes still end with exit 1: an unknown task name and a default_loadouts name with no file. The table gives 4 to an entry that is not found. File an issue for each and link it in the PR body (C1, C2). Then they are residuals, and the change can merge.
Ruled at 0eee232 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| Err(error) => return Err(crate::ProjectFileInvalid { error }.into()), | ||
| }; | ||
| match file.task(task) { | ||
| Some(t) => Ok(t), |
There was a problem hiding this comment.
C1 · The next arm, None => bail!(unknown_task_message(..)), still ends with exit 1. The exit-code table gives 4 to an entry that is not found (architecture.md line 365). File an issue that makes it a typed not-found refusal, and link it in the PR body.
There was a problem hiding this comment.
Filed as #3443 (an unknown task name and a default_loadouts name with no file exit 4), and linked from the PR body's Gaps section.
There was a problem hiding this comment.
Addressed in 71a9a50a946a: declared_task now returns a typed TaskNotFound (same text) for an unknown task name, and failure_exit_code maps it to exit 4. Pinned in refusals_exit_with_the_table_code and task_not_found_exits_4.
| message: e.to_string(), | ||
| }) | ||
| } | ||
| e => anyhow::anyhow!("{e}"), |
There was a problem hiding this comment.
C2 · A default_loadouts name with no loadout file comes to this arm and ends with exit 1. Exit 1 is unspecified (architecture.md line 362). File an issue that names the row, 3 or 4, and link it in the PR body.
There was a problem hiding this comment.
Filed as #3443 (an unknown task name and a default_loadouts name with no file exit 4), and linked from the PR body's Gaps section.
There was a problem hiding this comment.
Addressed in 71a9a50a946a: A default_loadouts name with no loadout file now returns LoadoutNotFound and exits 4 (the not-found row). A test row pins it.
`declared_task` also serves `min task run`, which starts no box, so a broken minimal.toml says "found a broken minimal.toml while resolving tasks:" again. The new TaskFileInvalid type still exits 3. The tests.rs copy of the exit-code mapping is gone. main.rs tests call failure_exit_code once for each new arm, through context.
|
Round 3 of 10 on a /revise note, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
3 threads were already answered in earlier rounds, with nothing new on them since. For each row of the table, the command named in that finding ends with the row's exit code and prints the row's text, and none of them ends with 1. Notes from the agent: Revise round 3. Item 1: deleted table_refusal_code from tests.rs. The table test now asserts the refusal type and its EXIT_CODE. The combined main.rs test from the earlier commit is replaced by one test for each arm: network_flag_refusal_exits_2, project_file_not_found_exits_4, loadout_not_found_exits_4, local_host_not_found_exits_4, task_file_invalid_exits_3. Item 2: no code change. The unknown task name and the default_loadouts name with no file still exit 1, and #3443 tracks them. The runner must list #3443 under the PR body's gaps. Item 3: declared_task now returns a new task::TaskFileInvalid with the old text, and failure_exit_code maps it to 3, the same code ProjectFileInvalid gives. This adds one arm in main.rs. Commit ac27221. just clippy-strict was not run. |
There was a problem hiding this comment.
arch-review: PASS_WITH_CONDITIONS · 2 conditions · the full ruling
This head conforms to the exit-code table for BCLI-034, BCLI-058 and BCLI-078. A minimal.toml that does not load now returns TaskFileInvalid. It exits 3, as line 364 gives, and keeps its old text. The tests now assert each refusal's type, and main.rs pins each type's code through failure_exit_code. Two not-found paths still exit 1 where line 365 gives 4: an unknown task name (C1) and a default_loadouts name with no file (C2). Both are filed in #3443 and can stay open at merge.
Outside the diff
crates/minimal/src/task.rs:715: C1 · An unknown task name still exits 1 here. Line 365 of the exit-code table gives 4 to an entry that is not found. Return a typed not-found refusal with the same text, and map it to 4 infailure_exit_code. This is filed in #3443.
Ruled at ac27221 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| .map(|(loadout, _layout)| loadout) | ||
| .map_err(|e| anyhow::anyhow!("{e}")) | ||
| .map_err(|e| match e { | ||
| boxes::client::disk::LoadError::NotFound { .. } if source == "--loadout" => { |
There was a problem hiding this comment.
C2 · The source == "--loadout" guard leaves a default_loadouts name with no file at exit 1. Line 365 gives 4 to a thing not found. Remove the guard so both sources return LoadoutNotFound. This is filed in #3443.
There was a problem hiding this comment.
Addressed in 71a9a50a946a: Removed the source == "--loadout" guard, so both sources return LoadoutNotFound. Added a default_loadouts row to refusals_exit_with_the_table_code.
|
/review |
| impl std::error::Error for ProjectFileNotFound {} | ||
|
|
||
| /// `min task run` or `min box run` with a `minimal.toml` that does not | ||
| /// load. The run ends with exit 3 (`main.rs`), the code the architecture | ||
| /// gives an invalid project file, as for `crate::ProjectFileInvalid`. | ||
| #[derive(Debug)] | ||
| pub struct TaskFileInvalid { | ||
| /// Why the file did not load. | ||
| pub error: mfile::Error, | ||
| } | ||
|
|
||
| impl TaskFileInvalid { | ||
| /// The architecture's exit code for an invalid project file. | ||
| pub const EXIT_CODE: u8 = 3; | ||
| } | ||
|
|
||
| impl std::fmt::Display for TaskFileInvalid { | ||
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| // The cause is in this text and `source()` returns none, so the | ||
| // printer's `{:#}` shows it once. | ||
| write!( | ||
| f, | ||
| "found a broken {name} while resolving tasks: {error}", | ||
| name = mfile::MFILE_NAME, | ||
| error = self.error, | ||
| ) | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
LOW · correctness · confidence 0.60 · in TaskFileInvalid
TaskFileInvalid is a second type for an invalid minimal.toml with exit 3. crate::ProjectFileInvalid (cmd/boxes/create.rs) already exists and box_spec.rs uses it. The PR body says this path now prints the Cannot start the box: ... text, but the code and the test keep found a broken minimal.toml while resolving tasks:. Reuse ProjectFileInvalid, or fix the PR text. Otherwise the same file error prints two different texts by command.
What the reviewer checked
task.rs: 'Err(error) => return Err(TaskFileInvalid { error }.into())'; main.rs test asserts !printed.contains("Cannot start the box").
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/task.rs
Lines: 646-674
Category: correctness
Severity: low (reviewer confidence 0.60)
Finding:
`TaskFileInvalid` is a second type for an invalid minimal.toml with exit 3. `crate::ProjectFileInvalid` (cmd/boxes/create.rs) already exists and `box_spec.rs` uses it. The PR body says this path now prints the `Cannot start the box: ...` text, but the code and the test keep `found a broken minimal.toml while resolving tasks:`. Reuse `ProjectFileInvalid`, or fix the PR text. Otherwise the same file error prints two different texts by command.
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.
Addressed in 71a9a50a946a: The PR text was wrong. The code keeps TaskFileInvalid on purpose so that min task run keeps its found a broken minimal.toml while resolving tasks: text, as the task's diagnostics line requires. This round's notes correct the PR text.
Drop the --loadout guard so both loadout sources return LoadoutNotFound, and move parse_dns_host above the --network doc comment.
declared_task returns a typed TaskNotFound with the same text, and failure_exit_code maps it to the not-found code.
|
Round 4 of 10 on the runtime's review findings, pushed as
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
For each row of the table, the command in that finding ends with the row's exit code and prints the row's text, and none ends with 1. This round adds two rows: Notes from the agent: Correction to the earlier PR text: a |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head closes the two open conditions from the earlier rulings. An unknown task name now exits 4 through TaskNotFound. A default_loadouts name with no file now exits 4 through LoadoutNotFound. The exit-code table gives 4 to a thing not found (architecture.md line 365). No condition is open. The PR body still lists #3443 as a gap. Update the body, and close #3443 with this PR.
Ruled at 71a9a50 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
| // BCLI-034: a task name the file does not declare is a thing not | ||
| // found (exit 4). The text is the same as before. | ||
| None => Err(TaskNotFound { | ||
| message: unknown_task_message(&file, task), | ||
| } | ||
| .into()), | ||
| } |
There was a problem hiding this comment.
LOW · correctness · confidence 0.60 · in declared_task
An unknown task name now exits 4 through TaskNotFound. The PR body says it still exits 1 and lists it as gap #3443. A test in tests.rs pins exit 4. Either remove TaskNotFound to match the body, or fix the body and close the gap.
What the reviewer checked
task.rs:739 None => Err(TaskNotFound { message: unknown_task_message(&file, task) }); tests.rs ~20041 assert_eq!(task::TaskNotFound::EXIT_CODE, 4)
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/task.rs
Lines: 737-743
Category: correctness
Severity: low (reviewer confidence 0.60)
Finding:
An unknown task name now exits 4 through `TaskNotFound`. The PR body says it still exits 1 and lists it as gap #3443. A test in tests.rs pins exit 4. Either remove `TaskNotFound` to match the body, or fix the body and close the gap.
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 — not addressed: The code is correct as it is. An unknown task name exits 4 through TaskNotFound, and the test pins it. The PR body was stale and now says exit 4 and closes #3443. No code change.
| // BCLI-034: a loadout name with no loadout file is not found | ||
| // (exit 4), from `--loadout` and `default_loadouts` alike. The | ||
| // text is the same as before. | ||
| boxes::client::disk::load_loadout(loadouts_dir.as_utf8_path().as_std_path(), &name) | ||
| .map(|(loadout, _layout)| loadout) | ||
| .map_err(|e| anyhow::anyhow!("{e}")) | ||
| .map_err(|e| match e { | ||
| boxes::client::disk::LoadError::NotFound { .. } => { | ||
| anyhow::Error::new(LoadoutNotFound { | ||
| message: e.to_string(), | ||
| }) | ||
| } | ||
| e => anyhow::anyhow!("{e}"), | ||
| }) |
There was a problem hiding this comment.
LOW · correctness · confidence 0.60 · in resolve_active_loadouts
The not-found mapping applies to every loadout name, so a missing default_loadouts file also exits 4. The PR body says it still exits 1 and that it only covers --loadout. The code comment says both. The behaviour and the PR body disagree.
What the reviewer checked
loadouts.rs:295 comment 'from
--loadoutanddefault_loadoutsalike'; the closure does not usesource
Hand this to an agent
Act on a code-review finding.
File: crates/minimal/src/loadouts.rs
Lines: 295-307
Category: correctness
Severity: low (reviewer confidence 0.60)
Finding:
The not-found mapping applies to every loadout name, so a missing `default_loadouts` file also exits 4. The PR body says it still exits 1 and that it only covers `--loadout`. The code comment says both. The behaviour and the PR body disagree.
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.
The code is right, and the body was stale. The PR body now says a loadout name with no file exits 4 from --loadout and default_loadouts alike, and it closes #3443.
There was a problem hiding this comment.
Disputed — not addressed: The code is correct as it is. An earlier review asked for exit 4 from --loadout and default_loadouts alike. The PR body was stale and now says this and closes #3443. No code change.
|
Round 5 of 10 on the runtime's review findings: the coder changed nothing. Revise round 5. No code change this round. Both findings report that the pull request body is stale, and the code is correct. The body must now say this: an unknown task name exits 4 through |
…ls-that-exit-1-end-with-the-table-s-co # Conflicts: # crates/minimal/src/tests.rs
|
A merge of main before round 6, not counted against the cap (2 of 3), pushed as Resolved conflicts in:
Verify Converted to a draft: something above needs a person before review. Review threads the coder judged:
For each row of the table, the command named in that finding ends with the row's exit code and prints the row's text. None of them ends with 1. refusals_exit_with_the_table_code pins this at the branch head after the merge with main. Notes from the agent: This round resolved the merge conflict in crates/minimal/src/tests.rs. Both sides added a test at the same place: this branch added refusals_exit_with_the_table_code, and main added box_messages_name_the_box_and_the_next_step. The resolution keeps both tests. box_messages_name_the_box_and_the_next_step also passes (1 passed). There is no other code change this round. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The new head only merges main into the head that this review passed before. The PR's own diff is the same. T50 on main changes the rename success line, not the rename refusal, so the exit codes still follow the table in the design at lines 362-365. The PASS on 71a9a50a stands.
Ruled at 3acabef against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
T46 — The refusals that exit 1 end with the table's code
slice: S3
kind: task
covers: BCLI-034, BCLI-058, BCLI-078
size: M
est: 110 code, 150 tests
executor: agent
difficulty: routine
model: standard
diagnostics: each refusal keeps its text, except the rename refusal, which says
invalid box name:in place ofinvalid session name:; the bad --allow-dns-hosts value is refused by clap, quoting the value; refusals_exit_with_the_table_code pins each code and each changed textobservability: the command's existing tracing span records the verb and the outcome; no new log line
layers:
- client:
- crates/minimal/src/task.rs:
declared_taskreturnsProjectFileInvalidfor a minimal.toml that does not load, and a typed not-found refusal (exit 4) when no minimal.toml exists- crates/minimal/src/cmd/boxes/create.rs: the
--ingress,--dynamic-ingressand--network nonerefusals are one typed usage refusal that exits 2, with their text unchanged- crates/minimal/src/cmd/boxes/lifecycle.rs:
BoxRenameRefusal::from_erroralso reads the daemon'sinvalid box name:refusal, so it exits 2- crates/minimal/src/cmd/hosts.rs:
named_hostreturns a typed not-found refusal that exits 4- crates/minimal/src/loadouts.rs: a
--loadoutname with no loadout file returns a typed not-found refusal that exits 4- crates/minimal/src/cli.rs:
--allow-dns-hoststakes a value_parser overboxes::is_valid_dns_host, so a bad host fails as a usage error before anything runs- crates/minimal/src/main.rs:
failure_exit_codemaps the new typed refusals to their codes- crates/minimal/src/tests.rs: the in-process minimald test harness gains this layer's tests, one row per finding
test: cargo nextest run -p minimal refusals_exit_with_the_table_code
- daemon:
- crates/boxes/src/store.rs:
validate_session_namerefuses withinvalid box name:, notinvalid session name:- crates/minimald/src/box_manager/tests.rs: the test that pins the old name refusal reads
invalid box nametest: cargo nextest run -p boxes invalid_box_name_refusal_says_box
produces: none
consumes: none
proof: For each row of the table, the command named in that finding ends with the row's exit code and prints the row's text, and none of them ends with 1.
Proof
Each refusal in the table now ends with its own exit code, and none ends with 1.
min task runormin box runwith no minimal.toml exits 4, and with a minimal.toml that does not load it exits 3.--ingress,--dynamic-ingress/--dynamic-rangeoff own_ip and egress on--network noneexit 2.min box renameto an invalid name exits 2 and saysinvalid box name:.min host start|stop <unknown>exits 4.--loadout <missing>exits 4. A bad--allow-dns-hostsvalue is a clap usage error (exit 2) that quotes the value. refusals_exit_with_the_table_code pins each code and text.Notes from the agent: Text changes beyond the rename: (1) A minimal.toml that does not load for
min task run/min box runreturnsTaskFileInvalid. It exits 3 and keeps the old text,found a broken minimal.toml while resolving tasks: <error>. (2) The bad --allow-dns-hosts refusal is new clap text:invalid value 'bad host' for '--allow-dns-hosts <HOST>': not a valid DNS hostname. Wildcards are not supported. Write an internationalized name in its punycode xn-- form.The--network noneegress refusal is built in task.rs (refuse_egress_on_none), not in create.rs, so the typed NetworkFlagRefusal lives in create.rs and task.rs uses it.named_host,BoxRenameRefusal::from_errorandrefuse_ingress_off_own_ipbecame pub(crate) so tests.rs can reach them.failure_exit_codeis in the binary, so tests.rs mirrors its mapping in a localtable_refusal_codehelper, asexec_failure_codealready does. An unknown task name returnsTaskNotFound, and a loadout name with no file returnsLoadoutNotFound, from--loadoutanddefault_loadoutsalike. Both exit 4 with their old text, which closes #3443. Th…[truncated]Tests
cargo nextest run -p minimal refusals_exit_with_the_table_codecargo nextest run -p boxes invalid_box_name_refusal_says_boxVerify
min task run agent-verifyexited 101, so this PR is a draft.Closes #3419
Closes #3443