fix(codegen): all-vouched guarded '+' tree lowers unguarded — un-ICEs the pi and cc builds - #9069
Conversation
…d of ICEing The guarded add lowering bailed when NO leaf needed a runtime test — a drift tripwire from when the routing predicates and the vouching predicate could not overlap. They can now: a call with a declared numeric return is flagged declared-only by numeric_proof_is_declared_only (routing the tree into the guarded lowering) while integer-literal returns make the same leaf provenance-vouched by expr_produces_canonical_raw_f64 (nothing left to test). The corner became reachable from ordinary code this week — 'width += eaw(c)' inside a for-of loop, i.e. pi's graphemeWidth and a closure in the cc cli bundle — and the tripwire took both application builds down with 'guarded + tree has no testable leaf'. Emitting the unguarded fast tree is not new trust: the MIXED case already fadds every vouched leaf without a runtime test, so an unsound vouching predicate ships wrong answers there regardless; the predicate's own tests are the guard, not this bail. Pinned by a gap-suite fixture with the load-bearing shape (call-in-loop compound add; 'width += 1' alone does not route into the guarded lowering), byte-identical to node. Claude-Session: https://claude.ai/code/session_01Ay8VyLkKbm8Hkc1xmvTEsP
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe guarded numeric addition lowering now compiles all-vouched addition trees by emitting an unguarded ChangesGuarded numeric addition
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The change prevents a specific guarded numeric-add compilation failure by emitting the existing fast path when all leaves are proven safe, with a regression fixture covering the failing shape. No actionable merge-blocking risk remains beyond normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the failure, reproducing code shape, mechanism, fix rationale, regression test, and verification results. It does not use the template headings or provide a related issue and checklist, but the required technical information is mostly complete.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merged. Reproduced the ICE on and it compiles and runs byte-identical to node afterwards, including the wide-character path ( The diagnosis is satisfying because the two predicates are individually right and only wrong together: This is the seam I flagged when auditing #9033, which extended Added the missing Validation: |
Both application bundles fail to compile on current main with
guarded + tree has no testable leaf(pi dies ingraphemeWidth, the cc cli bundle in a closure). Minimized to 13 lines — the load-bearing shape is a compound add in a for-of loop where the RHS is a call:Mechanism: the call leaf is flagged by
numeric_proof_is_declared_only(declared numeric return ⇒ the tree routes intolower_guarded_numeric_add) while its integer-literal returns make the same leaf provenance-vouched byexpr_produces_canonical_raw_f64(⇒ no leaf needs a runtime test). The lowering's all-vouched corner was a deliberatebail!tripwire against predicate drift — this week's provenance widening made it reachable from ordinary code, and it fails whole builds.Fix: all leaves proven ⇒ emit the fast tree unguarded. This is not new trust: the mixed case already
fadds every vouched leaf untested, so an unsound vouching predicate ships wrong answers there regardless — the predicate's own tests are the guard, not the bail (rationale in the code comment).Verification: the 13-line repro and the full extracted
graphemeWidth+eastAsianWidthpair compile and print node-identical output; gap-suite fixturetest_gap_9050_all_vouched_guarded_add.tspins the shape (verified still-ICE on5792671server-side before fixing); perry-codegen lib 1344/0; fmt green. Un-blocks recompiling both pi and cc for the GC-share measurement.Summary by CodeRabbit
Bug Fixes
Tests