feat(stats): by_technique breakdown in codegraph stats (Phase 8.6 follow-up)#1303
Conversation
…-to analysis
Walk assignment_expression nodes in extractTypeMapWalk (WASM) and
match_js_type_map (native). When LHS is a simple member_expression
(obj.prop) and RHS is an identifier, seed typeMap['obj.prop'] = { type:
fn, confidence: 0.85 }. This covers patterns like:
handlers.auth = authMiddleware;
router.use(handlers.auth); // -> edge: caller -> authMiddleware
Extend resolveByMethodOrGlobal (TS) and resolve_call_targets (Rust) with
a composite key lookup (step 4.5): when a call has receiver + name, check
typeMap['receiver.name'] for a direct pts target before falling through to
the no-match return. Skips BUILTIN_GLOBALS / builtin objects (console,
Math, etc.) and chained writes (a.b.c = x).
Closes #1292
…BALS (#1295) Adds the four names present in Rust's is_js_builtin_global but absent from the TypeScript BUILTIN_GLOBALS set, restoring dual-engine parity for property-write pts tracking. Also adds prop.type guard in handlePropWriteTypeMap consistent with the adjacent fnRefBindings block.
…romotion test (#1295) Renames 'higher-confidence entry wins' to accurately describe equal-confidence first-write behavior. Removes stale inner comment. Adds explicit test for strict-higher-confidence promotion via setTypeMapEntry. Extends BUILTIN_GLOBALS test to cover process/window/document/globalThis.
…low-up) Closes #1300 - DB migration v17: adds `technique TEXT` column + index to `edges` table - Tags call edges at insertion: `ts-native` for direct/native-path calls, `points-to` for pts post-pass and pts-fallback edges; non-call edges get NULL - Upgrades pts edges to `ts-native` in-place when a direct call supersedes them - Native bulkInsertEdges path: technique is backfilled via a post-insert SQL UPDATE (pts edges targeted first; remaining NULL calls tagged ts-native as baseline) - Preserves technique through incremental-build reverse-dep edge reconnection - `computeQualityMetrics` / `buildStatsFromNative` expose `byTechnique` in `callerCoverage`; the JSON output and `printQuality` display it when present docs check acknowledged Impact: 20 functions changed, 23 affected
Greptile SummaryThis PR adds a
Confidence Score: 5/5Safe to merge. The technique backfill logic is well-scoped, the two global-UPDATE mis-tagging issues from the prior review cycle are both resolved, and technique values survive incremental purge/reconnect correctly. All three insert paths (JS batch, native bulkInsert in build-edges, native Rust orchestrator) now correctly tag or backfill technique on call edges. The incremental-safety properties (quiet-incremental no-op, changed-file scoping, reverse-dep technique round-trip) are all addressed. The migration is additive and nullable with no risk of breaking existing data. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Edge rows built in-memory"] --> B{Insert path?}
B -->|JS batchInsertEdges| C["technique written directly to DB"]
B -->|Native bulkInsertEdges| D["Edges inserted, technique = NULL"]
D --> E["applyEdgeTechniquesAfterNativeInsert scoped to batch sourceIds"]
E --> F["UPDATE: explicit technique rows first"]
F --> G["Catch-all UPDATE: remaining NULL calls tagged ts-native"]
H["Native Rust Orchestrator"] --> I["backfillEdgeTechniquesAfterNativeOrchestrator"]
I --> J{Build type?}
J -->|Full build| K["Global UPDATE all NULL calls"]
J -->|Quiet incremental| L["No-op"]
J -->|Incremental with changes| M["Scoped UPDATE via subquery"]
N["Reverse-dep edge save"] --> O["technique saved"]
O --> P["Reconnect: technique restored"]
P --> B
C --> Q["countCallEdgesByTechnique"]
G --> Q
K --> Q
M --> Q
Q --> R["callerCoverage.byTechnique in stats"]
Reviews (5): Last reviewed commit: "fix(stats): guard quiet incremental in b..." | Re-trigger Greptile |
Codegraph Impact Analysis23 functions changed → 24 callers affected across 13 files
|
…lter (#1303) - applyEdgeTechniquesAfterNativeInsert: scope the catch-all 'ts-native' UPDATE to source_ids in the current batch — prevents mis-tagging pre-migration NULL-technique edges from unchanged files on the first incremental build after a v16->v17 migration - countCallEdgesByTechnique: accept testFilter (JOIN on source node) so byTechnique counts are consistent with --no-tests - buildStatsFromNative: thread noTests into countCallEdgesByTechnique
- readCallEdges: SELECT e.technique in addition to existing columns - readEngine: read build_meta engine to detect native vs WASM path - Assertions check technique is 'ts-native' (native orchestrator) or 'points-to' (JS path), confirming the technique backfill is working
|
Addressed all findings from the review: Bug: Global UPDATE mis-tags pre-migration pts edges (P1 from Greptile, Red from Claude)
Issue: byTechnique ignores noTests filter (Yellow from Claude)
Issue: Integration test missing technique assertions (P2 from Greptile)
Misleading label callerCoverage.byTechnique (Low/cosmetic, Claude) |
|
Claude finished @carlos-alm's task —— View job Re-review: feat(stats): by_technique breakdown in codegraph statsTasks
Follow-up ReviewAll three substantive issues from the initial review have been correctly addressed. Here is a targeted assessment of each fix: Fix 1: Global UPDATE scoped in
|
Quiet incremental builds (no files changed) insert no new edges — running the global UPDATE would mis-tag pre-migration NULL-technique edges from unchanged files as 'ts-native'. Return early when changedFiles is defined but empty.

Summary
Closes #1300
technique TEXTnullable column + index toedgestablets-native— direct static/same-file calls (native engine + JS direct resolution)points-to— parameter-flow pts post-pass and pts-fallback edgesnull— import, reexport, extends, implements, and receiver edges (not call edges)points-totots-nativein-placebulkInsertEdges(which doesn't writetechnique), a post-insert SQL UPDATE backfills techniques — pts edges by (source_id, target_id) first, then remaining NULL calls edges asts-nativebaselinetechniqueis saved and restored through reverse-dep edge reconnectioncallerCoverage.byTechniqueis now included incodegraph stats --jsonand displayed in the human-readable output under the caller coverage lineJSON output shape
(
type-propagation,cha-rta, andbarrelare reserved labels for future work — they require threading resolution-source information throughresolveCallTargets.)Test plan
npx vitest run)npm run build)npx biome checkon staged files)