Repository navigation
fix(ts): check every held value against the names its statement writes - #235
Conversation
Quest-Claim: 0c06b5a34fda696f
A temporary held back for its one read is flushed before any statement that assigns a name it reads, found from the statement itself rather than a local each caller passes. An `rt.Place` through a fixed object holds each index the path goes through, not only the last. Neither changes any fixture or moq's output: the lang fixture's `holds` case covers each hold site, reassigning a name between the hold and the read, in and across loop iterations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 121143f
No actionable bugs found. The emission change derives assigned names from the statements instead of trusting one caller-supplied destination, and applies overwrite protection in hold mode too. The fixed-object path traversal now holds nested indices in evaluation order while retaining the existing eager capture of nonfixed objects. The new differential fixture covers indexed borrows, reassigned references, copies, loop captures, aggregate parts and range stepping; its generated captures appear consistent with the Rust cases.
Direction: centralizing this invariant and removing the repeated writes parameter is a reasonable simplification. These are defensive guards rather than evidence of a newly reproduced current miscompile: the PR explicitly reports that the added guard paths do not fire on the tested corpus.
Verification: static changed-code and surrounding emission/place-lifetime review, including an independent pass. I did not run differential tests, mutation checks, snapshots, the census, benchmarks or repository gates, and have not independently verified their reported results.
(Written by review (OpenAI))
# Conflicts: # ts/fixtures/lang/expected/harness.ts # ts/fixtures/lang/src/harness.rs # ts/fixtures/lang/src/lib.rs
Problem
quest/m2/ts-aliases.md collected three reports of one shape: a value the lowering holds back, instead of reading it once, names a variable that is assigned again before the read. It asked for an audit of every hold site against one check.
stable_pathholds only the last index of anrt.Place's path (#176).alias()'s copy arm trusts a held-back source (#148).Findings
None of the three miscompiles today. I couldn't reproduce any of them after 24 probe shapes, all exact against native wasm32 over 50k differential cases:
consts. Names that stay hoisted (_N = start++in a loop header, a scalarOption's payload) are never what an escaping closure orrt.Placereads.Two guards depended on those MIR shapes rather than on what the held value reads:
emitcaller passed the one local it assigned (writes). A write anywhere else in the statements, such as inpre, a branch, orx++, didn't flush a temporary that readsx.stable_path. Their inner indices weren't held.Approach
emitfinds the written names itself. It scans its statements for every name they assign, then flushes any pending temporary that reads one (or is one), in hold mode too. Thewritesparameter and its 28 call-site arguments are gone.stable_pathholds every index. Through a fixed object it holds each index the path goes through (stable_object), not only the last.holdscase (fixtures/lang/src/holds.rs) covers each hold site, reassigning a name between the hold and the read, in and across loop iterations:rt.Places, and a place through a reassigned&mut [u8]Options thatnextreassignsnextheld_nowhold nothing, makes the lang differential differ from native.Impact
harness.tsrenumbering for the new case.just ts moq.just ts census, against main at a8e75f2, before the merges): identical. moq-net 1614, model 541, kio 154.Alternatives
preor a branch would bring back the miscompile with nothing to flag it.constand keeps a correct translation, so there's nothing to refuse.Choices made without asking
emitloses a parameter in the process.Follow-ups
None. Finishes the quest, deleting
quest/m2/ts-aliases.mdand its link inquest/m2/README.md.Checks
just checkandjust testpass on 121143f, and again on 4c10383, which merges main through #232. That merge resolves the lang fixture's case list and crate doc by hand to keep bothholdsandstatics.Review
quest review.ffi/src/collect.rs:2200, refuted. It came from main's #233 landing after this branch's base. Main is merged in, andgit diff origin/main...HEAD -- ffiis empty.(written by Claude Opus 5.5)
🤖 Generated with Claude Code