Skip to content

fix(tri_settle): wrapping round_add + add gen/zig (last execution orphan closed) - #368

Merged
gHashTag merged 1 commit into
mainfrom
fix/tri-settle-wrapping-zig
Aug 9, 2026
Merged

fix(tri_settle): wrapping round_add + add gen/zig (last execution orphan closed)#368
gHashTag merged 1 commit into
mainfrom
fix/tri-settle-wrapping-zig

Conversation

@gHashTag

@gHashTag gHashTag commented Aug 9, 2026

Copy link
Copy Markdown
Owner

tri_settle was the final spec still missing an execution backend beyond icarus/C — it panicked under zig test on two counts:

  1. the narrowing u64 -> u32 cast in reward_weightedfixed compiler-side in t27#1999;
  2. round_add's wrap-detect saturating idiom (let sum = round_total + epoch_bytes; if (sum < round_total) ...) on a plain +, which zig-safe arithmetic aborts on before the guard runs.

Fix: switch that site to +% (wrapping) — a no-op for C and Verilog (they already wrap by width), explicit for zig. tri_settle now passes all 17 test blocks under zig, with icarus (17/17) and C still green.

Regenerated gens: gen/rust flips to .wrapping_add() (rust-drift, dynamic since #366), and gen/zig/tri_settle.zig is committed for the first time — the dynamic Zig-drift leg (#365) picks it up automatically, no list edit. gen/c is byte-identical (+% lowers to +).

With this, every spec in the corpus executes in at least the icarus and C backends, and tri_settle joins Rust/Zig too — the execution-orphan series (waves 51–54, 58) is closed.

gen/ regeneration via the no-gen-edits escape (LEFTHOOK=0).

🤖 Generated with Claude Code

…han closed)

tri_settle was the final spec still missing an execution backend beyond
icarus/C: it panicked under zig on two counts. The narrowing u64->u32
cast in reward_weighted was fixed compiler-side (t27#1999); the second
was round_add's wrap-detect saturating idiom
(let sum = round_total + epoch_bytes; if (sum < round_total) ...) on a
plain '+', which zig-safe arithmetic aborts on before the guard runs.

Switch that site to '+%' (wrapping) -- a no-op for C and Verilog, which
already wrap by width, and explicit for zig. tri_settle now passes all
17 test blocks under zig, with icarus (17/17) and C still green.

Regenerate its gens: gen/rust flips to .wrapping_add() (rust-drift,
dynamic since #366), and gen/zig/tri_settle.zig is committed for the
first time -- the dynamic Zig-drift leg (#365) picks it up automatically,
no list edit. gen/c is byte-identical ('+%' lowers to '+').

With this, every spec in the corpus executes in at least the icarus and
C backends, and tri_settle joins Rust/Zig too. gen/ regeneration via the
no-gen-edits escape (LEFTHOOK=0).

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@gHashTag
gHashTag merged commit 291843d into main Aug 9, 2026
4 checks passed
@gHashTag
gHashTag deleted the fix/tri-settle-wrapping-zig branch August 9, 2026 03:03
gHashTag added a commit that referenced this pull request Aug 9, 2026
…both (#373)

The zig-test gate compiles and RUNS committed gens -- it is a real
execution gate, not just a drift diff -- but it still iterated a
hand-maintained list while gen/zig became the SSOT for drift in #365.
The list had drifted: six specs had committed, drift-checked gens that
were NEVER EXECUTED here --

  rti_security, tri_compute_account, tri_compute_bond,
  tri_compute_pool, tri_settle, twr_timestamp

precisely the specs closed in the execution-orphan series (#361, #363,
#368). Their gens were verified locally at the time; CI never ran them.

Iterate gen/zig directly, so a newly committed gen auto-joins execution
the same way it auto-joins drift. Verified locally over the FULL
committed set: zig test 107/107, zero failures.

Also applies the #372 coverage-floor pattern to both execution gates
(zig 107, C 75). A loop that silently matched zero files previously
reported green having executed NOTHING; now it fails loudly. C-exec was
already dynamic (#365) but had no floor.

The stale 'gated to the passing set / tracked in t27#1928' header is
corrected: the saturation idiom it referred to is fixed in-spec via
'+%', and the whole committed set passes.

Verified: zig 107/107 executed, C 75/75 executed, both exit 0; a
zero-match loop correctly trips the floor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: SSD DDD <ssdm4@MacBook-Pro.local>
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.

1 participant