Repository navigation
fix(mctx,mfile,minimal): an invalid minimal.toml prints its TOML parse error once - #3243
Conversation
ProjectFileInvalid and mfile's Error::Format both returned the parse
error from source() and also wrote it in Display, so the {e:#} printer
showed the snippet twice. Display now leaves the detail to source().
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
/revise |
|
Approved: every review thread resolved at @norrietaylor resolved the last thread, which releases the approval this review had withheld. Nothing to do. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms. An invalid minimal.toml still ends with exit 3, as the Exit codes table at line 364 requires. The CLI text printer and the machine-mode message both format with {e:#}, so the snippet prints one time. The design states no rule on the message text. One risk is outside the design. minimald write_error_tagged prints with to_string(), so an in-box min task run now shows invalid TOML with no snippet. Fix that printer, or file an issue for it.
Ruled at 4b21257 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
Error::MFile wrote the mfile error in Display and also returned it from source(), so a chain printer showed 'invalid TOML' twice. Display now renders the mfile error with its cause chain, and the variant has no source().
bryan-minimal
left a comment
There was a problem hiding this comment.
Read at the current head. The duplication came from two Display impls each inlining an error their source() already returned, and the fix is the right one: both now print their own words only, and the {:#} printer walks the chain once. The new test pins all three counts (one "TOML parse error", one "invalid TOML", one snippet) and the exit code, and find_init_mfile was moved to the chain printer for the same reason.
One note, not blocking: mctx::Error::MFile displays as minimal.toml: {0}, so any site that stringifies an mctx error with {} or to_string() rather than {:#} now shows "minimal.toml: invalid TOML" with no snippet. I did not find one on the CLI's activate path, which goes through the chain printer, but it is worth a grep when a report of a bare "invalid TOML" comes in.
|
Round 1 of 10 on a /revise note, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. When min session activate runs on a minimal.toml that does not parse, it prints the TOML parse error snippet once and exits 3. An mctx::Error::MFile rendered with {:#} now also shows 'invalid TOML' and the parse error once each. Notes from the agent: This round touches crates/mctx/src/error.rs. That file is outside the task's layers, but the /revise note asks for this exact change, and the layer files cannot fix it. Error::MFile no longer uses #[from]. It has a manual From impl and no source(). Its Display now renders the mfile error and its full cause chain, so {} and {:#} both show the snippet once. NotFound still prints 'minimal.toml: not found'. Nothing in minimal or minimald downcasts the chain to mfile::Error, so the dropped source() changes no exit code. The new test in mctx walks source() by hand: mctx::Error is not Send (nickel types), so anyhow::Error cannot hold it. A defect remains and this round does not fix it: mfile::Error::IO writes its io::Error in Display and also returns it from source(), so an I/O error can still print its cause twice under {:#}. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The design does not state a rule on the text of a configuration error, so this is a PASS by absence. The compare changes only mctx::Error::MFile, which no longer returns its mfile error from source(). No code in the tree finds the mfile error through a chain. An invalid minimal.toml still exits 3, as the Exit codes table requires. The ruling on 4b21257b stands for the other files.
Ruled at bfa98e2 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
APPROVE withheld: 3 unresolved threads — minimal-arch[bot] crates/mfile/src/error.rs:137, minimal-foundry[bot] crates/mfile/src/error.rs:137, minimal-foundry[bot] crates/minimal/src/cmd/boxes/create.rs:104.
minimal-review — advisory review
Verdict COMMENT — No findings.
Panel: 2 of 3 personas ran (correctness, supply-chain); did not complete: security.
|
/revise This round covers the three open review threads. Change only Problem. At Fix. In
Tests. Add to the test module in
Run |
…-minimal-toml-prints-its-toml-parse-er
Error::Format printed only 'invalid TOML' and moved the parse error to
source(), so callers that print with {} lost the line and snippet.
Display now carries the cause for Format and IO, and source() returns
none for both, so {} and {:#} each print it once.
|
Round 2 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:
min session activate on a minimal.toml that does not parse prints 'Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...' with the snippet once, and exits 3. Callers that print an mfile error with {} or to_string(), such as decode's Layer::new, now show the line, column and snippet again. Notes from the agent: This round changed only crates/mfile/src/error.rs, as the directive asked. Error::Format Display is 'invalid TOML: {e}' again. source() returns None for Format and IO, so {} and {:#} each print the cause once. Two tests are new in the mfile error module. One checks the Format text and source(). The other walks the source() chain by hand for an IO error. The existing tests in mctx and minimal pass with no change. |
The TOML fix only needs Error::Format to drop its source. Restore Some(e) for Error::IO so chain walkers still see the io kind.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The change conforms. An invalid minimal.toml still ends with exit 3, as the Exit codes table says at line 364. The exit code comes from the ProjectFileInvalid downcast, not from the source() chain that this push changes. The design states no rule on the text of the error. The PR body note about invalid TOML two times describes an earlier head. Update it when you next edit the body.
Ruled at 89d19b3 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
|
Round 3 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
min session activate on a minimal.toml that does not parse prints the TOML parse error snippet once and exits 3. An mfile I/O error still carries its std::io::Error as its source. Notes from the agent: This round restores Error::IO's source() to Some(e) and removes the io_error_chain_prints_io_error_once test. The change is scoped to Error::Format, as the task describes. Under {:#}, an mfile I/O error prints its io text twice again, the same as on main. cargo clippy -p mfile --all-targets printed no warnings. |
…-minimal-toml-prints-its-toml-parse-er
ProjectFileInvalid now carries its cause in Display and returns no source. Error::IO keeps the io error in both its Display and its source, so a chain printer showed that io error twice. Plain Display printers of ProjectFileInvalid also get the cause back.
|
Round 4 of 10 on a failed check suite, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
min session activate on a minimal.toml that does not parse prints 'Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...' with the snippet once, and exits 3. An unreadable minimal.toml now also prints its io error once, not twice. Notes from the agent: Revise round 4. ProjectFileInvalid now puts the mfile error in its Display and returns no source(). Nothing in crates/minimal walks the chain under ProjectFileInvalid for an mfile or io error. The exit 3 mapping downcasts ProjectFileInvalid itself. I also ran activation_refuses_unloadable_project_file_before_create, init_invalid_mfile_exit3_appends_nothing and project_egress_table_reaches_box_policy, and they pass. clippy -p minimal --all-targets is clean. Failed checks: ci-linux-native-success is the lane aggregator and its excerpt shows no failing job. native-daemon-e2e failed on a DNS lookup for e2e-nnat-a.min.internal after activate. That path is not in this diff, which only changes how an invalid minimal.toml error prints, so I made no change for it. A re-run will show whether it is a flake. |
There was a problem hiding this comment.
arch-review: PASS · the full ruling
This head conforms. The new commit puts the mfile error into the ProjectFileInvalid message and removes its source(), so each printer shows the cause one time. The exit code stays 3, as Exit codes line 364 requires, because failure_exit_code() finds the error by downcast. The merge of main is clean. The earlier PASS on 89d19b35 stands for the rest.
Ruled at 0b6da95 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
The MFile variant walked the mfile error's source() chain after its Display. Error::IO prints its io error in Display and returns it as source(), so the io error printed twice. Every mfile Display already carries its cause, so print Display alone.
There was a problem hiding this comment.
arch-review: PASS · the full ruling
The compare from the last ruled head changes one file, crates/mctx/src/error.rs. It removes the chain walker and prints the mfile error with its own Display. Every mfile error Display already prints its cause, so each cause still shows once. The exit-3 mapping (architecture.md line 364) does not change. The earlier PASS stands, and this head conforms.
Ruled at 827cc99 against gominimal/arch@15b603e6afb8 by claude-opus-5-5.
There was a problem hiding this comment.
APPROVE withheld: 2 unresolved threads — minimal-arch[bot] crates/mfile/src/error.rs, minimal-foundry[bot] crates/mctx/src/error.rs.
minimal-review — advisory review
Verdict COMMENT — No findings.
Panel: 2 of 3 personas ran (correctness, security); did not complete: supply-chain.
|
Round 5 of 10 on the runtime's review findings, pushed as
Verify Outside the task's
Converted to a draft: something above needs a person before review. Review threads the coder judged:
min session activate on a minimal.toml that does not parse prints the TOML parse error snippet once and exits 3. An unreadable minimal.toml that reaches an mctx error now prints its io error once, not twice. Notes from the agent: crates/mctx/src/error.rs is outside the task's layers. Earlier rounds of this pull request already changed it, and the review thread points at it. This round removes the MFileDisplay chain walk, so the MFile variant prints the mfile Display alone and returns no source(). Every mfile Display already prints its cause, so no cause is lost. cargo clippy -p mctx --all-targets printed no warnings. |
norrietaylor
left a comment
There was a problem hiding this comment.
Babysitter review at 827cc991, against T1's plan block and its test line.
- Proof.
ProjectFileInvalidcarries its mfile error in its text and returns nosource().mfile::Error::Formatprintsinvalid TOML: <parse error>and returns nosource(). So{:#}printsCannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...once, and the exit-3 mapping (a downcast ofProjectFileInvalid) is unchanged.invalid_project_file_prints_toml_error_onceincrates/minimal/src/main.rschecks this throughanswer_failure, with one count each forTOML parse error,invalid TOMLand the snippet, plus the exit code. - Plain-
{}callers keep the snippet:crates/decode/src/lib.rs:184(e.to_string()) andwrite_error_taggedincrates/minimald/src/env.rs(throughmctx::Error::MFile, now{prefix}: {0}with no source). - IO.
mfile::Error::IOkeeps its io error assource(), so chain readers still see the io kind.ProjectFileInvalidandmctx::Error::MFilestop the chain, so an unreadable minimal.toml prints the io error once. Tests:invalid_project_file_prints_toml_error_once_for_ioandmfile_io_error_prints_io_error_once. - Scope.
crates/mctx/src/error.rsis outside the layers. It is the in-box printer's half of the same defect, which arch raised on the first head.
All six review threads are addressed at this head. No change requested.
There was a problem hiding this comment.
minimal-review — approved
Verdict APPROVE — every review thread is resolved; @norrietaylor closed the last one. The review of 827cc9918812 withheld this approval on the threads open then. Posted as a comment, as the review itself was; the check and the label carry it.
Defect
Fixes #3242
Charged to epic #1501. Size S.
May touch:
crates/minimal/src/cmd/boxes/create.rscrates/mfile/src/error.rscrates/minimal/src/cmd/project.rscrates/minimal/src/main.rsTask marker
Proof
When min session activate meets a minimal.toml that does not parse, it prints one line: 'error: Cannot start the box: the project's minimal.toml does not load: invalid TOML: TOML parse error ...'. The snippet shows one time and the command exits 3. The test invalid_project_file_prints_toml_error_once in crates/minimal/src/main.rs checks this through the real stderr printer, answer_failure.
Notes from the agent: ProjectFileInvalid's Display and mfile's Error::Format Display no longer include the source error, because source() already returns it and the printer uses {e:#}. The min init refusal in cmd/project.rs printed the mfile error with to_string(). It now prints the whole source chain with {:#}, so its message still has the TOML snippet. The existing test still finds 'invalid TOML' in it. Other code that prints an mfile::Error with plain Display, and does not walk source(), now shows 'invalid TOML' with no snippet. Examples are mctx::Error::MFile ('minimal.toml: {0}') when a caller prints it without {:#}. Those callers are outside this task's layers and I did not audit each one. mctx::Error::MFile also returns the mfile error from source(), so its {:#} output still shows 'invalid TOML' two times, but the snippet only one time. I also ran the related tests init_invalid_mfile_exit3_appends_nothing and activation_refuses_unloadable_project_file_before_create, the mfile test suite, and cargo clippy -p minimal -p mfile --all-targets. All passed with no warnings. I did not run min session activate against a real daemon.
Tests
cargo test -p minimal invalid_project_file_prints_toml_error_onceVerify
min task run agent-verifyexited 101 under rustc 1.99.0, which the repository does not pin (1.99.1 in rust-toolchain.toml); the PR is not a draft on that alone — CI, which honours the pin, is the gate.