Skip to content

fix(gen-zig): @intCast runtime shift amounts; pin bare-literal shift LHS - #1933

Merged
gHashTag merged 1 commit into
masterfrom
fix/zig-shift-rhs
Aug 8, 2026
Merged

fix(gen-zig): @intCast runtime shift amounts; pin bare-literal shift LHS#1933
gHashTag merged 1 commit into
masterfrom
fix/zig-shift-rhs

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Closes #1932

Third Zig emission class from the #1928 ledger. Zig wants the shift RHS Log2-typed (u5 for u32) and a fixed-width LHS when the amount is runtime-known; gen-zig emitted both raw, blocking 13 tri-net specs including the tri_* crypto line.

  • Runtime amounts → @intCast(rhs); bare-literal LHS under a runtime amount → @as(u32, lit) (u64 above u32 range)
  • Literal amounts untouched — existing gens byte-identical (verified: zero drift on the committed tri-net corpus outside the affected specs)

tri-net corpus: 6 specs newly pass zig test end-to-end (packet_loss_injection, tri_a2a_card, tri_compute_gfvalid, tri_gft_ladder, tri_gft_add, tri_gft_sub), 7 advance to their runtime layer (checked-add overflow in hash mixing — the spec-side +% idiom, tracked tri-net-side). Unit suite: only pre-existing red is bitnet_layer (iverilog, fails on pristine master). FROZEN_HASH resealed; NOW.md entries added.

🤖 Generated with Claude Code

Closes #1932

Zig requires the shift RHS to be Log2(LHS-width)-typed (u5 for u32) and
a fixed-width LHS when the amount is runtime-known. gen-zig emitted both
raw, blocking 13 tri-net specs (the tri_* crypto line among them):

- runtime amounts now emit `@intCast(rhs)`
- a bare integer-literal LHS under a runtime amount pins `@as(u32, lit)`
  (u64 when the literal exceeds u32)
- literal amounts stay untouched, so existing gens remain byte-identical

tri-net corpus: both shift error classes gone; 6 specs newly pass zig
test end-to-end, 7 advance to their runtime layer (checked-add overflow
in hash mixing -- the documented spec-side +% idiom). FROZEN_HASH
resealed; only unit red is the pre-existing bitnet_layer iverilog test.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) August 8, 2026 11:36
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-08-08 11:36:41 UTC

Summary

Status Count
Total Open PRs 14
PRs with Failing Checks 1
PRs with All Checks Green 13
READY 5
FAILING 1
PENDING 0

Seal Status

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

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@gHashTag
gHashTag merged commit 63d5669 into master Aug 8, 2026
23 checks passed
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.

gen-zig: runtime shift amounts emit untyped RHS (u5 mismatch) and comptime_int LHS — 13 tri-net specs blocked

1 participant