Skip to content

fix(gen-zig): test and bench blocks may shadow module names and write module vars (owner exception, #5980) - #6596

Merged
gHashTag merged 2 commits into
masterfrom
claude/gen-zig-shadowing
Oct 5, 2026
Merged

gHashTag merged 2 commits into
masterfrom
claude/gen-zig-shadowing

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Closes #6295

What

Zig refused a test or bench block whose local shadowed a module declaration ("local constant shadows declaration of 'HITS'"), and a write to a module var inside a test came out as a fresh const. Test and bench blocks now:

  • rename a local that shadows a module name (x -> x_lv, the same scheme the fn bodies use);
  • write a module var in place instead of re-declaring it;
  • (bench only) choose var or const from the assignment count.

specs/compiler/zig_test_shadowing.t27 is the regression spec: module vars HITS/READY, fns twice/hit, three tests (module_var_write, local_shadows_module_names, reassign_declared_local) and a bench. On master it is BLOCKED with the shadowing error; with this fix 3/3 pass.

Owner exception

This PR edits hand-written Rust (bootstrap/src/compiler.rs), which the only-t27 rule forbids. The owner approved it on 2026-10-05, relayed by the coordinator ("fix it and do not stop, do what is best"), with the label owner-approved-foreign. The debt is #5980 (t27core self-host). The entry in tools/policy/foreign-exceptions.txt (bootstrap/src/compiler.rs) landed with #6579, so this PR does not change that file. After the last gen-zig PR (#6533) lands, the owner should remove it.

File classification

File(s) Kind
bootstrap/src/compiler.rs hand-written Rust, owner exception (#5980)
bootstrap/stage0/FROZEN_HASH derived: sha256 of compiler.rs
specs/compiler/zig_test_shadowing.t27 .t27 regression spec
.trinity/seals/*.json (about 75) generated on the Railway t27c lab (tri seals drift --fix, t27c seal --save --force, tri seals sync-twins)
tools/seal_baseline.txt ledger data: 15 tests-fail rows
docs/now/2026-10-06-gen-zig-test-shadowing.md NOW prose

Lab numbers (t27c reference: gen-zig + zig test over specs/, Railway t27c lab)

run sha pass blocked fail timeout
before: #6585's head 5dc5f52 770 484 28 2
this PR, on that base 485e388 776 472 35 4
  • blocked->pass: formal_tb, vcd_trace_tb and port/fpga/verilog/ternary_mac_synth, plus the new spec. aggregate-experience and generate_episodes also show up as passing, but they came in from master and are not part of this fix.
  • 0 regressions (no pass -> non-pass).
  • 7 blocked->fail and 2 blocked->timeout. These specs now compile, and it is their own tests that fail or hang: bridge_tb 4/7, hir_tb 1/8, integration_tb 2/7, spi_tb 6/7, ternary_isa_tb 6/11, gen_w368 1/8, vsa_simple/vsa 1/7; apb_bridge_tb and axi4_tb time out. These are tracked on gen-zig: same-width sign cast panics (tri27_machine); trios config test contradicts its default #6560.

Seals

Seals were regenerated on the lab. Nine specs now compile but fail their own tests. They were sealed with --force, which records the failures in each seal's tests object, and their 15 seals (twins included) are ledgered as tests-fail in tools/seal_baseline.txt with #6560. On the lab, check_seal_currency passes and check_seal_coverage reports OK (1454 seals, 1310 hold, 144 known-broken).

CI notes

The same failures as master: test-ratchet (the_dead_code_census_names_what_it_skipped and corpus_classifier_matches_lean_completeness), spec-guards (ring-096-rust DRIFTED, #6553), duplicate-bodies, fpga-conformance, and build-and-test (cargo install wasm-objdump).

🤖 Generated with Claude Code

gHashTag and others added 2 commits October 6, 2026 01:57
…e a module var

Closes #6295

Zig refused a test block whose local const shadowed a module declaration
("local constant shadows declaration of 'HITS'"). Test and bench blocks now
rename locals that shadow module names (_lv), write module vars in place, and
bench blocks choose var or const from the assignment count.
specs/compiler/zig_test_shadowing.t27 is the regression spec.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d tests-fail seals

Refs #6295

Regenerated on the Railway t27c lab (tri seals drift --fix, sync-twins). Nine
specs now compile but their own tests fail or hang; sealed with --force
(failures recorded in the seal) and ledgered as tests-fail (#6560).
check_seal_currency and check_seal_coverage pass on the lab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag gHashTag added the owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR label Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-05 18:58:27 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 41
PRs with All Checks Green 9
READY 9
FAILING 41
PENDING 0
NO CHECKS YET 0

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=ab873301be9c != 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

t27c gen (Zig): test bindings shadow module vars, redeclare locals, and inherit param renames

1 participant