Skip to content

JS/TS parity: .js to .tsx, SFC language family, new X() and import() - #113

Merged
cdobbyn merged 15 commits into
mainfrom
jsts-parity-k7q2
Nov 12, 2026
Merged

cdobbyn merged 15 commits into
mainfrom
jsts-parity-k7q2

Conversation

@cdobbyn

@cdobbyn cdobbyn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Matches upstream graphify 0.9.92 for JS/TS on three beads: './x.js' falls back to x.tsx (vi5.66), .vue/.svelte/.astro/.ejs join the jsts family (vi5.106), and new X() becomes a calls edge while import() emits dynamic_import plus deferred imports_from (vi5.14). I ran go test ./..., diffed graph.json against main on curl, redis, graphify, typescript and vscode, compared with upstream 0.9.92 on fixtures and corpora, and benchmarked six corpora plus k8s; numbers are in the comment below. Cache schema goes to 23.

chris added 14 commits October 17, 2026 02:39
TypeScript names the output file, so './x.js' can be x.tsx. Mirrors upstream resolution.py.
Stops component calls binding to same-named Python defs. Cross-family import edges from components now drop in build, as upstream does.
A new X() binds like a bare call, across files only with an import, and skips upstream's builtin names. import() gives a file-level dynamic_import plus a deferred imports_from from the enclosing function; ImportCycles ignores deferred edges and affected walks dynamic_import. Cache schema 22.
Bind new X() in namespaces and by the class's own name, keep a
nested-block class from shadowing an import, keep dynamic_import for
externals behind a static import, and let a deferred import win its pair.
Cache schema is 23 because csharp-parity and xfile-returns branches use 22.
…ge review defects

Drop import("/x") from dynamic_import as upstream does. Count namespaces,
values and class members when a new X() is ambiguous. A ./x.js that falls
back to its importer makes no edge and no external stub. Keep SFC edges in
the graph build, as upstream's edge family map has no SFC entries.
…d comments

Nested callable signatures and malformed generic type arguments no longer give a deferred edge. Self .js/.jsx import() keeps its edges. dynamic_import carries no location, as upstream.
Nested function bodies keep the caller, masked generics climb parens and tuples, file closures bind new X(), x.js swaps before extension probing, import() site wins a merge, spec spaces trimmed.
A same-file new X() with two nodes of that label dropped its edge. It now binds the last one in source order, as upstream's label map does, ignoring a namespace twin of a plain class.
Cuts the no-change update on typescript. Output is byte-identical.
Replaces the per-call Parent() climb in jsCall and shrinks the refd map. Output is byte-identical on the corpora and fixtures checked.
@cdobbyn

cdobbyn commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Numbers for HEAD 524e949 against main e989b75.

Output diff vs main (raw edge counts, graph.json from fresh builds):

corpus calls dynamic_import imports imports_from imports_from deferred
curl, redis 0 0 0 0 0
graphify 0 +3 -2 0 +3
typescript +1436 +627 -295 -26 +220
vscode +18889 / -1 +349 +2 / -148 +2 / -117 +354

Every change traces to one of the three beads. The removed imports/imports_from are main's old file-level edges for import(), now dynamic_import or deferred. The one removed vscode call (createMatcher to matchesUrlPattern) lost its only import evidence, a type-position import(); upstream has no edge there either. No corpus has .vue/.svelte/.astro/.ejs files, so vi5.106 is covered by fixtures only.

Parity vs upstream 0.9.92, up-only/go-only by (source_file, normalised label):

source relation main branch
24 fixtures calls from new X() 13/0 0/0
24 fixtures dynamic_import 10/0 1/1
24 fixtures imports_from deferred 9/0 1/1
typescript calls from new X() 1024/0 40/45
vscode src/vs/base calls from new X() 679/1 14/6

The typescript row was measured at the round-7 commit; a later fix added 46 more upstream-matching edges. Remaining mismatches belong to filed beads (external target naming vi5.42/vi5.65, var-assigned callers vi5.136, node-id collisions vi5.13).

Benchmark, exact Mann-Whitney, branch vs main:

cell wall user CPU peak RSS
typescript cold (n=17) -2.9% -5.5% +0.8% (p=0.45)
typescript no-change update (n=27 pooled) -2.3% -0.1% +3.0% (p<0.0001)
vscode cold (n=17) -22.3% -30.6% +0.4%
vscode no-change update (n=17) -7.1% +0.1% +1.0%
redis no-change update (n=20) -0.4% +0.8% (p=0.63)
k8s cold (n=18) -0.3% +0.3% rss_max 0.0%, rss_tree +2.7% (p=0.11)
curl, graphify, opencv (n=7) within 1% within 1.1% within 1.5%

graph.json grows 0.37% on typescript and 1.78% on vscode, and is byte-identical on curl, redis, opencv and k8s.

The typescript no-change update peak RSS cell fails the 2% gate. Live heap is the same as main at every phase boundary except resolve, where the new-call index adds 3 to 5 MB. That shifts when the collector runs around the resolve to build boundary, and on darwin the mapped address space then peaks 15 to 25 MB higher. A runtime.GC() before graph build brought it to +0.5% (p=0.70), but that commit was dropped by decision. This PR stays a draft until that cell is accepted or fixed.

# Conflicts:
#	internal/cache/cache.go
#	internal/extract/resolve.go
#	internal/query/affected.go
@cdobbyn
cdobbyn marked this pull request as ready for review November 12, 2026 18:11
@cdobbyn
cdobbyn merged commit 35fcd9e into main Nov 12, 2026
2 checks passed
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.

2 participants