Repository navigation
feat(javascript): link assignment right-hand sides to their writes - #6206
Conversation
A declaration carries its value forward, but a later assignment to a variable, a property or through a compound operator stopped the forward trace at the right-hand-side read. The semantic IR now records one syntactic assignment flow per simple assignment target (ranges, operator, owning callable), and the graph projection connects each retained read of the right-hand side to the write occurrence through a defines relation. Compound assignments also consume the previous value of the target; the written value itself stays unknown, keeping the boundary of morluto#4342 intact. Fixes morluto#6193
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. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The change affects JavaScript semantic tracing within a bounded analysis workflow. Fix the ownership mismatch for computed method keys before merging. FindingsFix with agent prompt### Issue 1
src/application/javascript/JavaScriptSemanticGraphAssignmentProjection.ts:25-27
For `const accel = 0.001; let speed = 6; const obj = { [speed = accel]() {} };`, the callable stack assigns the assignment to the enclosing scope. But `callableOwnerAt` assigns the `accel` reference to the method because its range includes the key. This filter rejects the read, so the trace misses the write to `speed` and its later uses.
Use the same ownership rules for reference nodes and assignment flows, including computed keys.
### Issue 2
src/application/javascript/JavaScriptSemanticGraphAssignments.test.ts:40-43
This negative test leaves `include_ambiguous_dynamic_edges` off. Without the owner filter, the callback's `accel` read would produce a `candidate` edge because the right side is an arrow function. The query would hide that incorrect edge, so the test would still pass.
Enable ambiguous edges for this assertion, or check directly that no assignment edge links the callback-body read to the write.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryAdds assignment records to the semantic IR and links retained input reads to binding or property writes.
Security audit: no concrete security issue was identified. Superseded status could not be checked because GitHub authentication was unavailable. Checks were source-based; no runtime tests were run. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Assignment syntax] --> B[IR assignmentFlows]
B --> C[Match reads and writes]
R[Identifier and property reads] --> C
C --> D[defines edge]
D --> W[Write occurrence]
W --> T[Binding or property slot]
C --> U[Unknown resulting value]
Reviews (1) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile |
baron
left a comment
There was a problem hiding this comment.
AI-assisted review independently confirms both open ownership/test findings despite all nine committed tests and main CI passing.
For const accel=0.001; let speed=6; const obj={ [speed=accel](){} }; export const after=speed;, the computed key runs in the enclosing evaluation context. The assignment collector records that owner, but lexical references use the smallest enclosing callable source range. The new equality filter therefore drops the accel read and produces zero assignment edges; a candidate-enabled trace cannot reach speed. Carry one producer-established evaluation owner through reference/assignment IR and graph projection, including computed object/class keys. Do not simply remove the guard, which reintroduces deferred-callback false edges.
The review also removed that guard experimentally: the existing callback test still passed because its query hides candidate edges; the strengthened candidate-enabled control failed. Assert absence with candidates enabled or inspect edges directly.
These are executed exact-head graph/query and controlled-mutation probes, with source restored afterward—not compiled CLI/MCP validation. Green CI does not cover these defects; fix the owner representation and durable negative test before approval. No duplicate inline threads added.
CassieFox23
left a comment
There was a problem hiding this comment.
TL;DR: Main has no assignment links today. This PR adds them for variables, properties and compound assignments, with a unit test for each case. baron and Greptile already found two real problems: computed keys, and a weak negative test. I did not repeat them. What I add: the body skips most of the repo template, and two claims in the body are not pinned by a test.
Findings
Should fix
- The body does not keep the repo template. It has "Summary", "Evidence", "Testing" and "Author readiness". Please restore these parts of the template, in order:
- Add the part "Problem and expected behavior".
- "Change and scope", with the "Follow the contribution scope" paragraph. This is a
feat, so the link to the maintainer scope decision matters. Issue #6193 itself says the scope must be reviewed before integration. - "Contract and boundary impact" (seven lines).
- The "Expected effects" lead-in and its eight boxes. The change reads source files only, so the first box applies.
- "Evidence and regression coverage" in place of "Evidence". It has four labels. They are tests added, base reproduction, CLI/MCP output, and remaining proof gaps. It also has three checkboxes.
- "Validation performed" in place of "Testing". The template asks for each command with its result. The body gives test counts but no command lines.
- Add the part "Compatibility, safety, and release".
- "Before merge" (eight boxes).
- The "Author readiness" part is present and filled in.
Worth a look
- Already raised, and I agree after reading the code. See baron's review, which asks for changes and Greptile's two threads. These are computed keys and negative test hides candidate edges. The owner filter at
AssignmentProjection.tslines 25 to 27 is the spot they mean. I did not run their probes. Neither thread has a reply, and the head has not moved since baron's review. - The body's table says a forward trace from
0.001in thevariablecase reachesbinding:speed,expression:speedandreturnwith the default query. No test pinsreturnin default mode. The unit test setsinclude_ambiguous_dynamic_edges: truefor all six cases. The CLI test's default pass only checks that a node namedspeedis reached. It checksreturnonly after turning ambiguous edges on. I did not run it, so I do not know whether the table is true. A default-modereturnassertion would settle it. - The body says logical assignments (
&&=,||=,??=) mark the right-hand read as a candidate. The code that setsresolvedorcandidateis at lines 41 to 47. No test file in the PR mentionsresolutionorcandidate. The first unit test only checks that some edge has anassignment_operatorproperty, for any operator. A test that reads theresolutionof the edge for=,+=and||=would pin the rule. - Which reads get an edge is wide.
readsWithin(flow.source)returns every retained read inside the right-hand range, and the only filter is the owner. So forspeed = f(accel)orspeed = cond ? a : b, the reads offandcondalso get acandidateedge tospeed. I read this from the code and did not run it. Is that intended? If it is, one line in the body saying "any read inside the right-hand side" would help readers. - Main has moved 445 commits since the merge base (compare API), and 20 commits touched
src/application/javascriptor the semantic IR files. GitHub reports the branch as mergeable. The helpers the PR imports (sourceRangesEqual,range,createSemanticNodeRangeLookup) still exist on main by name (grep). I did not typecheck a rebase. CI on this head is green (run 39709223420, test shards included), but it ran on 22 Oct. A rebase and rerun would show whether it still holds.
Nits
- The body ends its Testing list with "Not exercised: none". Please name what was not run, such as default-mode traces for the compound cases. This is also a template point ("Remaining proof gaps").
Looks good
- Main still has no
assignmentFlows(grep on main), so the feature is not already there. - No other open PR links #6193 (search on the number found only this one), so there is nothing to compare.
- The design matches the issue. The write stays an unknown (
unknown-value, lines 50 to 60), so the PR keeps the #4342 line: influence only, no arithmetic. Destructuring is left out on purpose, with a comment saying it has its own owner. - Assignment syntax is collected once in the IR (
collectAssignmentFlows), so graph code never reparses source. The pass yields every 64 flows like its neighbors. failedJavaScriptSemanticIrwas updated withassignmentFlows: []. A grep forresourceOperations: [insrcandtestsat the head finds only that one construction site.- The compound test checks both operands. It finds exactly two
+=edges, one fromacceland one fromspeeditself. It also finds the unknown on the written binding. - The CLI test goes through the real
analyze-javascript-applicationandtrace-javascript-semanticscommands for all four fixtures in the issue. - Scope is small: 8 files, +306/-2.
Not run
- No checkout, no build, no tests, no formatter.
- I did not run baron's or Greptile's probes, or any trace.
- I did not check the body's test counts (9 unit tests, 526 and 3,378 neighbor tests,
tsc,knip). - I did not typecheck the branch against current main.
Thanks, IvenKooLab, for the PR and the issue fixtures. Thanks also to jacobmalibiran for the clear request in #6193.
Test setup
🤖 Written with Claude Code (Sonnet 5.5, verified by Opus 5.5), posted with my OK 🦊
|
Current head A focused production-composition control on exact CI main The current-main local checks remain: full static/docs/discovery pass, 526 expanded checks pass and the complete public assignment CLI case passes after build completion. The earlier overlapped-build failed attempt remains recorded. This PR's two review threads are resolved. The human owner's initial readiness is preserved. Per the maintainer's explicit authorization, merge may bypass this established main failure and its aggregation/fail-fast consequences. |
|
Main |
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.
Post-declaration object and array stores such as `Game.config = { ACCEL:
0.001 }` now retain their literal descendants in the semantic analyzer's
immutable binding facts, so the existing property, read and return graph can
reach them. Both function and object receivers feed that graph; the graph-side
assigned-value evaluator and its duplicate IR representation are gone.
Rebased onto current main: the merged change keeps this branch's stored-slot
retention and passes the retained writes to
`applySemanticBindingReferenceEffects`, which main had meanwhile moved into the
effect-log owner, as an explicit exclusion set instead of filtering at the call
site. The member-mutation fixture keeps one `onlyBinding` import.
Fixes morluto#6192. Refs morluto#6206.
Verified on the merged tree: the semantic suites 255 tests
(`javascriptSemanticAnalysis.member_mutations`, `JavaScriptSemanticGraphPropertyObjects`)
and `check:fast` pass. The compiled CLI case could not run on this host: the
analysis workflow stops in its cleanup phase with the sandbox's process-table
`EPERM`, before projection, so CI owns that step.

Fixes #6193.
A forward trace from
0.001could stop at a read instead of reachingspeed = accel, a property write or a compound write. The semantic IR now records assignment inputs once; projection links reads to writes and retains both compound operands. Logical right-hand inputs remain candidates. These relations do not evaluate arithmetic or establish execution order or the resulting value.Computed method keys use the enclosing callable's ownership. The parser retains their ranges, the shared graph lookup consumes that fact, and the strict worker schema carries it across processes. Method parameters/body and nested callbacks retain their own ownership. Assignment collection uses the existing cooperative traversal. No cache or execution authority is added.
Integration coverage also fixes two module-mock tests' ownership: Evidence-bundle headroom and SDK cancellation now use the existing isolated process-global project. The SDK fixture holds its selected progress boundary until cancellation is acknowledged through an ordered ping, releases that gate during cleanup, and checks that the gate actually participated. A stale native introductory-text precheck was removed from the oversized discovery workflow; its metadata/schema/paging assertions remain.
Validation on main
85e38ac1integration:npm run check, documentation and test-discovery checks pass; all 2,314 test files have one owner. The expanded selection passes 526 checks, including all 15 assignment, 22 MCP view, worker/cancellation and 14 test-policy cases. The complete five-fixture public assignment CLI workflow passes separately after build completion.85e38ac1and actual merge96723aa9. Aggregation repeats it; other jobs are fail-fast cancellations. Cancelled jobs do not establish unexecuted coverage. The maintainer explicitly authorizes bypass for established main failures.Three alternating pairs per fixture use two fresh CLI commands per answer and compare complete semantic answers, provenance and coverage:
These are
tokenxestimates, not model usage. Saved query payload costs are separate in the report. No speedup is claimed: elapsed ranges overlap; the 32-function CPU median increases about 0.30 s (4.0%), RSS about 4.5 MiB (0.8%). The host was shared, OS caches were not flushed, and later main-integration performance was not remeasured.Verification report pins revisions, fixtures, complete controls and measurement limitations.
Author readiness
Human owner: @IvenKooLab