Commit 906a8b0
authored
test(fixtures): move more1 from jelly-micro to javascript-pts (#1411)
* fix(native): prefer local dev binary over npm package in load order
When a locally compiled `crates/codegraph-core/*.node` binary exists it
is now loaded before the published npm platform package. This ensures
that Rust changes (like the prototype-method extraction from PR #1339)
are picked up immediately in development without waiting for a new
npm release.
Load order is now:
1. NAPI_RS_NATIVE_LIBRARY_PATH env var — explicit override
2. crates/codegraph-core/<platform>.node — freshly compiled dev binary
3. @optave/codegraph-<platform> npm pkg — published production binary
Closes #1361
* fix(native): fail loudly on bad NAPI_RS_NATIVE_LIBRARY_PATH; fix JSDoc (#1389)
* feat(resolver): resolve super.method() dispatch via class expression + static block + field def
- Add `(class name: ...)` query patterns for JS/TS class expressions so that
`return class Foo extends Bar { ... }` records the extends relationship in
ctx.classes — previously only class_declaration was captured, leaving class
expressions invisible to resolveThisDispatch.
- Add `class_static_block` → `ClassName.<static>` synthetic method definition
in both query path (extractClassMembersWalk) and walk path (walkJavaScriptNode).
Calls inside `static { super.f(); }` blocks are now attributed to a method-kind
node so the CHA parents map can resolve `super.f()` to the parent class.
- Add `field_definition`/`public_field_definition` → `ClassName.fieldName` method
definition when the field value is an arrow function or function expression.
`static f = () => { ... }` becomes a resolvable `A.f` node so
`resolveThisDispatch` can emit the `B.<static> → A.f` edge.
- Mirror all three changes in the native Rust extractor for parity.
- Add 6 parser unit tests and import Jelly micro-test fixtures for super,
super2, super3, super4, super5 as ground-truth benchmarks.
Benchmark result: super fixture 31% → 38% recall (B.<static> → A.f now resolved).
docs check acknowledged
Closes #1377
* fix(incremental): port same-class this.method() and defineProperty fallbacks into buildCallEdges
After resolveCallTargets returns empty:
1. Retry with class-qualified name (ClassName.method) for this-receiver calls
2. Resolve via Object.defineProperty accessor receiver typeMap or same-file lookup
These two blocks existed in buildFileCallEdges (build-edges.ts) but were missing
from the incremental path, causing divergence between full and watch-mode builds.
Also adds the missing callerName argument to resolveCallTargets.
Closes #1384
* fix(native): use resolvePlatformPackage() in loadNative step 3 (#1389)
PLATFORM_PACKAGES[platformKey] was inlined in loadNative() while
getNativePackageVersion() used resolvePlatformPackage(). Any future
change to the lookup (fallback key, default value) would only apply
to one site. Call resolvePlatformPackage() consistently in both places.
* fix(incremental): seed callee::restName typeMap keys and pass callerName in buildCallEdges
Incremental rebuilds using buildCallEdges (incremental.ts) were missing two
things needed for Phase 8.3f scoped-key resolution (#1358 / #1369):
1. The typeMap was not seeded with callee::restName entries from
objectRestParamBindings × paramBindings. Without this seeding the scoped
key `callee::restName` (e.g. `f2::rest`) is absent from the map, so
resolveByMethodOrGlobal's third fallback (`typeMap.get(callerName::receiver)`)
has nothing to find and the rest-param call goes unresolved.
2. caller.callerName was not passed to resolveCallTargets, so even if the
scoped key was present in the typeMap (e.g. from WASM extraction), the
`${callerName}::${effectiveReceiver}` lookup in resolveByMethodOrGlobal
never fired.
Fix: mirror what buildObjectRestParamPostPass (native full-build post-pass)
and buildCallEdgesJS (WASM full-build path) already do:
- Compute restNameCallees to know how many callees share a rest name.
- Seed typeMap[callee::restName] for each objectRestParamBinding × paramBinding pair.
- Also seed the unscoped key when only one callee uses that rest name, so
resolution still works when callerName is null (findCaller couldn't match).
- Pass caller.callerName to resolveCallTargets (already present from #1389).
Also syncs call-resolver.ts and build-edges.ts with the scoped-key changes
from PR #1368 (merged to main separately), which this branch was missing.
docs check acknowledged
Closes #1369
* refactor(extractor): align typeMapWalk currentClass reset with returnTypeMapWalk
Add explicit early return with null currentClass when descending into
function_declaration, generator_function_declaration, and method_definition
bodies in extractTypeMapWalk.walk.
This mirrors the established pattern in extractReturnTypeMapWalk (lines ~1431-1446)
and eliminates a maintenance hazard: previously the null reset was implicit
(childClass defaulted to null for non-class nodes), meaning future extensions
could silently inherit wrong class context without noticing the gap.
Behavior is unchanged for current use cases.
Closes #1386
* test(fixtures): move more1 from jelly-micro to javascript-pts fixture
more1 was hand-authored to cover for-of/Set/Array.from/spread call
patterns and has no connection to Jelly's micro-test corpus. Moving it
to a dedicated javascript-pts fixture directory keeps jelly-micro/ pure
Jelly imports and gives the pts patterns their own benchmark entry.
Changes:
- Rename jelly-micro/more1/ → javascript-pts/ (new top-level fixture)
- Fix function name mismatch: _iterPlain/_iterSet → iterPlain/iterSet to
match expected-edges.json source names
- Update $schema path from ../../ to ../
- Add javascript-pts to THRESHOLDS with recall:1.0 (codegraph already
resolves all 10 edges via array/closure tracking)
- Add pts-for-of/pts-set/pts-array-from/pts-spread to TECHNIQUE_MAP
Closes #1388
* fix(extractor): add class-expression to walkJavaScriptNode; fix static-block kind in test
- Add `case 'class':` to `walkJavaScriptNode` so class expressions
(e.g. `return class Foo extends Bar { ... }`) are passed through
`handleClassDecl` in the walk path, recording the extends relationship
in ctx.classes (was only covered by the query path before).
- Fix unit test assertion: `handleStaticBlock` emits `kind: 'function'`
(consistent with the existing assertion at line 112 and the static block
handler implementation). The test added in ca3123f incorrectly expected
`kind: 'method'`.
* fix(incremental): remove duplicate this-dispatch resolution blocks in buildCallEdges
The same two if-blocks (class-method lookup and definePropertyReceivers fallback)
appeared twice in sequence at lines 551-593 and 595-637. Both pairs are guarded
by targets.length === 0 and call.receiver === 'this', so the second pair was
dead code — the first pair already exhausts all resolution paths. Remove the
second pair.
* fix(bench): widen WASM timing threshold to 75% to absorb observed CI jitter
Empirical data showed WASM Build ms/file can hit +72% on shared runners
(run 27193750125: 18.7 → 32.2ms). The WASM_TIMING_THRESHOLD was set at 70%
based on a ≤67% jitter assumption; raising to 75% keeps the canary for
gross WASM regressions (100–220% blowups seen in v3.0.1–v3.4.0) while
correctly absorbing the observed variance floor.1 parent 117ac5b commit 906a8b0
2 files changed
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
852 | 852 | | |
853 | 853 | | |
854 | 854 | | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
855 | 859 | | |
856 | 860 | | |
857 | 861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
88 | 89 | | |
89 | | - | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
0 commit comments