Verification wrappers capture the compiler's output and throw it away - #2188
Merged
Conversation
…tem broke Root-caused while fixing #2185. The four-day misdiagnosis was the wrappers, not the missing brace. An AST scan over tools/*.py found two patterns: run(..., capture_output=True).returncode 9 sites exit code read, message dropped run(..., capture_output=True).stdout 18 sites NEITHER exit code nor stderr read The second is what cost the days. When t27c gen-c failed to parse the spec, .stdout was the empty string, it flowed downstream, and the failure surfaced as 'FAIL: C backend failed to build/run' -- naming a subsystem that had never been reached. The compiler's message named file, function, line and token, and capture_output collected it so it could be discarded. Two self-contained helpers per script, since these tools are deliberately import-free: _build prints a compiler's message on failure; _gen returns None and prints the reason when t27c gen-<mode> exits non-zero. Call sites handle None so the run ends cleanly rather than with a traceback. Verified by planting the original fault. With a brace removed, the output now leads with the compiler's own message before the misleading summary. Self-critical: my first attempt fixed the wrong nine sites -- the .returncode ones -- and changed the output not at all, because the failure was upstream in the .stdout calls my scan had not been written to find. The negative control caught that. The scan alone would have let me report a fix that fixed nothing. Closes #2187 Refs #2185 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root-caused while fixing #2185. The four-day misdiagnosis was not caused by the missing brace — it was caused by the wrappers around the compiler.
Two distinct patterns, found by AST scan over
tools/*.py:run(..., capture_output=True).returncoderun(..., capture_output=True).stdoutThe second is worse. When
t27c gen-cfailed to parse the spec,.stdoutwas"", the empty string flowed downstream, and the failure surfaced asFAIL: C backend failed to build/run— naming a subsystem that had never been reached. The compiler's message named the file, the function, the line and the token. It was collected bycapture_outputand dropped on the floor.Fix: two small self-contained helpers per script (these tools are deliberately import-free):
_build(cmd, cwd, what)— runs a compiler, prints its message on failure_gen(t27c, mode, spec, root)— runst27c gen-<mode>, returnsNoneand prints the reason on a non-zero exitBefore / after, with a brace removed from
ternary_mac.t27:The true cause is now printed before the misleading summary, and the run exits 1 cleanly rather than with a traceback.
Self-critical note. My first attempt fixed the wrong 9 sites — the
.returncodeones — and changed nothing, because the failure happened upstream in the.stdoutcalls my scan did not look for. The negative control (remove a brace, run, read the output) is what caught that; the scan alone would have let me report a fix that fixed nothing.Refs #2185, #2184
Closes #2187
🤖 Generated with Claude Code