Skip to content

Commit 906a8b0

Browse files
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

File tree

src/domain/graph/builder/stages/build-edges.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,10 @@ function buildObjectRestParamPostPass(
852852
typeMap.set(orpb.restName, { type: pb.argName, confidence: 0.65 });
853853
}
854854
}
855+
// restNames tracks every rest-parameter name found, regardless of whether the
856+
// scoped key was already in typeMap. This ensures the post-pass (below) processes
857+
// all calls whose receiver matches a known rest binding — not just those whose
858+
// typeMap entry was seeded in this iteration.
855859
restNames.add(orpb.restName);
856860
}
857861
}

tests/benchmarks/regression-guard.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,12 @@ const NOISY_METRICS = new Set<string>(['No-op rebuild', '1-file rebuild', 'fnDep
8282
* *real* algorithmic regression shows up on the native numbers too — and native
8383
* keeps the strict 25% / 50% thresholds. Native is the canary. WASM timing only
8484
* needs to catch gross WASM-specific catastrophes (the 100–220% blowups seen in
85-
* v3.0.1–3.4.0), which 70% still flags, while absorbing the ≤67% shared-runner
86-
* jitter. Size metrics (DB bytes/file) are engine-independent and excluded from
87-
* this widening via SIZE_METRICS below — they keep the strict threshold.
85+
* v3.0.1–3.4.0), which 75% still flags, while absorbing observed shared-runner
86+
* jitter (measured up to 72% on sub-30ms WASM metrics). Size metrics (DB
87+
* bytes/file) are engine-independent and excluded from this widening via
88+
* SIZE_METRICS below — they keep the strict threshold.
8889
*/
89-
const WASM_TIMING_THRESHOLD = 0.7;
90+
const WASM_TIMING_THRESHOLD = 0.75;
9091

9192
/**
9293
* Metric labels that measure size/count rather than wall-clock time. These are

0 commit comments

Comments
 (0)