feat(javascript): link assignment right-hand sides to their writes (#6206)

* feat(javascript): link assignment right-hand sides to their writes

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
#4342 intact.

Fixes #6193

* fix(javascript): preserve computed key assignment ownership

* test(javascript): retain nested callback assignment ownership

* docs(javascript): record assignment influence verification

* test(mcp): isolate mocks and acknowledge cancellation boundaries

* test(javascript): retain CLI diagnostics and current-main verification

---------

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
Iven Kooandgensokyo-dev authored and GitHub committed 2026-10-24 10:04:38 +08:00
1 parent 2968d1e932
commit 9df94a62cd
17 files changed
+702 -35

No files matched your search

@@ -100,6 +100,8 @@ export interface JavaScriptSemanticCallable {
readonly containerScopeId: string;
readonly bodyScopeId: string | null;
readonly location: JavaScriptSourceRange;
/** Evaluated by the enclosing callable, before this method is invoked. */
readonly computedKeyLocation: JavaScriptSourceRange | null;
readonly returnSites: readonly JavaScriptSemanticReturnSite[];
readonly returnCoverage: JavaScriptSemanticReturnCoverage;
}
@@ -424,6 +426,15 @@ export interface JavaScriptSemanticModuleLink {
readonly location: JavaScriptSourceRange;
}
/** Syntactic influence into one simple assignment target; no value evaluation. */
export interface JavaScriptSemanticAssignmentFlow {
readonly target: JavaScriptSourceRange;
readonly source: JavaScriptSourceRange;
readonly sourceIsReference: boolean;
readonly operator: string;
readonly ownerCallableId: string | null;
}
/** Provider-neutral JavaScript semantic IR. */
export interface JavaScriptSemanticIr {
readonly schema: "JavaScriptSemanticIR";
@@ -446,6 +457,7 @@ export interface JavaScriptSemanticIr {
readonly requestOperations: readonly JavaScriptSemanticRequestOperation[];
readonly boundaryOperations: readonly JavaScriptSemanticBoundaryOperation[];
readonly resourceOperations: readonly JavaScriptSemanticResourceOperation[];
readonly assignmentFlows: readonly JavaScriptSemanticAssignmentFlow[];
readonly objectOperations: readonly JavaScriptSemanticObjectOperation[];
readonly functionFingerprints: readonly JavaScriptSemanticFunctionFingerprint[];
readonly frontiers: readonly JavaScriptSemanticFrontier[];
@@ -475,6 +487,7 @@ export const failedJavaScriptSemanticIr = (): JavaScriptSemanticIr => ({
requestOperations: [],
boundaryOperations: [],
resourceOperations: [],
assignmentFlows: [],
objectOperations: [],
functionFingerprints: [],
frontiers: [],