Skip to content

Verification wrappers capture the compiler's output and throw it away - #2188

Merged
gHashTag merged 1 commit into
masterfrom
loop/t27-mute-diag
Aug 18, 2026
Merged

Verification wrappers capture the compiler's output and throw it away#2188
gHashTag merged 1 commit into
masterfrom
loop/t27-mute-diag

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

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:

pattern what it does sites
run(..., capture_output=True).returncode inspects the exit code, discards the message 9
run(..., capture_output=True).stdout takes stdout, checks neither exit code nor stderr 18

The second is worse. When t27c gen-c failed to parse the spec, .stdout was "", the empty string 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 the file, the function, the line and the token. It was collected by capture_output and 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) — runs t27c gen-<mode>, returns None and prints the reason on a non-zero exit

Before / after, with a brace removed from ternary_mac.t27:

before:  FAIL: C backend failed to build/run

after:   t27c gen-c specs/igla/race/ternary_mac.t27: exited 1
             Error: Compile error: parse error in fn '..._invariant_1' near line 1810:
             unexpected token after expression statement: KwTest
         FAIL: C backend failed to build/run

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 .returncode ones — and changed nothing, because the failure happened upstream in the .stdout calls 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

…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>
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-18 12:41:05 UTC

Summary

Status Count
Total Open PRs 29
PRs with Failing Checks 12
PRs with All Checks Green 17
READY 9
FAILING 12
PENDING 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=cd2822f290eb != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 66dc4ce into master Aug 18, 2026
19 checks passed
@gHashTag
gHashTag deleted the loop/t27-mute-diag branch August 18, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Verification wrappers capture the compiler's output and throw it away

1 participant