Repository navigation
[AUTOMATED] fix(cli): handle closed output — a broken pipe suppresses the diagnostic, not the verdict (DIV-89) - #336
Conversation
- Treat broken pipes as clean termination. - Keep other output failures visible.
|
@phix33, after a quick review (human), this looks good. Thanks for the contribution (and donated tokens of effort)! |
…e verdict (DIV-89) Review amendments to the broken-pipe fix. The core of it is right and verified: every stdout print site in kuna-cli now renders into a string and goes through the fallible boundary, and across 24 command invocations the output is byte-identical to the parent commit in stdout, stderr AND exit code. Three things needed correcting before it lands. 1. A broken pipe was collapsing every exit code to 0, which converts a false red into a false green. `kuna test` against a REGRESSED baseline exited 0 once its reader closed, and `kuna decompile` lost both the exit 1 and the `error: ...` line of the DIV-45 failure contract. The write failed because nobody was reading, which is orthogonal to whether the work succeeded, and stderr is still open -- so `error_status(err)` becomes `status_after(err, status)`: BrokenPipe keeps the verdict the command reached, anything else still reports and forces 1. decompile.rs reports and returns its failure whether or not stdout survived, emitting first so the stdout-then-stderr order is unchanged. 2. `kuna specs` had been switched from `.status()` to `.output()`, which turned a streaming passthrough into a captured one: a 148-spec run went silent for 17.2s and then printed all 1004 stderr lines ahead of all 149 stdout lines -- detaching 615 warnings that carry no filename from the `Compiling <spec>:` line that was their only attribution. It now streams the child's stdout through the same boundary with stderr left inherited, so the interleaving matches the old passthrough (time-to-first-line 17.2s -> 0.01s) and `kuna specs | head` still exits quietly. Past a write failure the reads continue to EOF so slacomp finishes its .sla files instead of dying on EPIPE. 3. The repo requires a DIV row and owning-spec prose for a driver-tier behavior change (cf. DIV-66 Noelo-Lab#270, DIV-68 Noelo-Lab#277): adds DIV-89, the stdout-boundary section in docs/spec/00-overview.md beside the DIV-45 arm it qualifies, and reconciles the docs/cli.md paragraph with the exit-code contract 60 lines below it. Tests: broken_pipe.rs gains the immediate-close case pinning that a REGRESSED parity run still exits 1 (exit 0 before this commit, 1 after), plus unit coverage of status_after; both file headers added. The two tests already here fail on main with exit 101, so the suite is a real regression net in both directions. All four gates green: make test PARITY OK, make test-stages PARITY OK, make check-spec OK (strict too), make rust-test green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GgH79MoS51D7LX3J5WpoRd
|
[AUTOMATED] Reviewed and amended in 1. A broken pipe was collapsing every exit code to
2.
615 of those 1004 warnings ( 3. Driver-tier conventions. A behavior change at this tier takes a DIV row and prose in the owning spec chapter (cf. DIV-66 #270, DIV-68 #277). Added DIV-89, the stdout-boundary section in Tests gained the immediate-close case pinning that a REGRESSED parity run still exits All four gates green locally on the amended branch: Thanks for the fix — every |
…IV-90) (#341) [AUTOMATED] `kuna decompile` is the only surface that drives `decomp_dbg` as a subprocess, so it holds no error object and has to recover what failed from the transcript. `kuna-cli/src/decompile.rs (check_errors)` threw that away twice over. 1. GH-337 — the binary-load failure. The arm matched the trigger line `Could not create architecture` and answered `could not build an architecture for <binary> (unsupported/!recognized binary)` no matter what had actually happened, while the three in-process surfaces formatted the escaped `LowlevelError`. Sometimes that is an actively wrong diagnosis: `--sleighpath /nonexistent` masked `No sleigh specification for x86:LE:64:default`, a specs problem reported as a problem with the user's binary. It also made DIV-88's `symbolnamerepair` symptom — the exact string `docs/options.md` publishes as the flip trigger — unmatchable from this surface. `IfcLoadFile`'s error arm prints `{e.explain()}` and then the trigger on the next line, both to stdout, so `arch_failure_reason` reads the preceding line and the four surfaces now converge byte for byte. The generic wording survives only as the fallback for a transcript that printed no reason (the command echo is not a reason). 2. GH-339's silent half — the analysis commit. A failed `read symbols` is an `Execution error:` the console prints while keeping the session alive, so `print C` still rendered C, the out-file was non-empty, and `kuna decompile` printed quietly degraded output and exited 0 — while `functions`, `decompile-all` and `decompile-project` exited 1 with `read symbols (analysis commit) failed: <reason>`. The commit is not transactional and is unretryable, so a partial commit is a failed load, not a degraded one; exit 0 there is indistinguishable from a binary that simply has no symbols. `read_symbols_failure` attributes each console diagnostic to the command echo above it and reports a `read symbols` failure with the in-process surfaces' message and exit code. Driver tier, the DIV-89/#336 precedent: no option, no stages XML, no catalog counts. `scripts/decompile.py (_check_errors)`, the Python library shim that mirrors this function for `scripts/pipeline/`, carries both recoveries so the two drivers do not disagree again (new `AnalysisCommitError`, a `DecompileError` subclass every pipeline caller already catches). Claude-Session: https://claude.ai/code/session_011KpG7qK6BDFZyPnyo4r1c1 Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
Tests