fix(perf): pass symbolsOnly through parseFilesWasmInline#1489
fix(perf): pass symbolsOnly through parseFilesWasmInline#1489carlos-alm wants to merge 13 commits into
Conversation
… diff Adds snapshot-pre-bash.sh (PreToolUse Bash) + track-bash-writes.sh (PostToolUse Bash): the pre-hook captures git status --porcelain to a per-worktree temp file before each Bash call; the post-hook diffs the before/after state and appends newly modified or created files to .claude/session-edits.log. This closes the gap where files written by sed -i, printf redirects, tee, heredocs, or build tools (Cargo.lock, lockfiles) were never recorded, causing guard-git.sh to emit false-positive BLOCKED errors. Closes #1457
- clojure.rs: annotate lifetime-anchor assignment to silence false-positive - cfg.rs: remove never-called start_line_of method - complexity.rs: remove never-constructed NotHandled variant; convert irrefutable if-let patterns to plain let destructures - dataflow.rs: remove never-read callee fields from CallReturn/Destructured - incremental.rs: remove never-read lang field from CacheEntry cargo check and cargo clippy both clean after these changes.
Adds .github/workflows/perf-canary.yml — a path-filtered workflow that fires on PRs touching src/extractors/, src/domain/graph/, or crates/** and runs only the incremental-benchmark suite (full build + no-op + 1-file rebuild, both engines). Catches the class of regressions that accumulated invisibly across the Phase 8.x PRs and were only detected at v3.12.0 publish time. The regression guard gains BENCH_CANARY=1 mode: raises thresholds to 50%/100%/150% (standard/noisy/WASM) and skips the build, query, and resolution suites — only incremental checks run. This absorbs shared- runner timing variance while still blocking catastrophic regressions (+98% full build, +1827% 1-file rebuild from v3.12.0). Closes #1433
|
Claude finished @carlos-alm's task —— View job PR Review — fix(perf): pass symbolsOnly through parseFilesWasmInline
Root Cause AnalysisProblem Being Solved: Why This Approach: The fix is minimal and correct — add Risk Assessment: Low. The change path is Phase 2: Configuration Change Detection
Phase 3: Test Integrity
Coverage gap: There are no new unit tests specifically for the Phase 4: Code Quality
if (!symbolsOnly) {
symbols._tree = extracted.tree;
}correctly gates the
Phase 5: Backlog Compliance
Critical Concerns1. WASM tree leak on 2. Scope broadening of this PR: Final Recommendation |
Greptile SummaryThis PR fixes the
Confidence Score: 5/5Safe to merge — the change is a targeted one-line propagation of an existing flag, with correct WASM tree disposal and a clean Rust refactor alongside it. The core change in parser.ts is minimal and correct: a default-false parameter is threaded through, the tree is explicitly freed on the new code path, and the worker-pool path is unchanged. The build-edges.ts sort is logically sound (descending + first-wins = highest confidence wins). All surrounding benchmark and CI changes are additive and guarded behind environment flags. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller as Orchestrator (post-pass)
participant BF as parseFilesWasmForBackfill
participant IL as parseFilesWasmInline
participant WP as parseFilesWasm (worker pool)
participant WE as wasmExtractSymbols
Caller->>BF: "filePaths, rootDir, { symbolsOnly: true }"
alt "filePaths.length <= 16 (INLINE_BACKFILL_THRESHOLD)"
BF->>IL: "filePaths, rootDir, symbolsOnly=true"
loop each file
IL->>WE: parsers, filePath, code
WE-->>IL: "{ symbols, tree, langId }"
alt "symbolsOnly=true"
IL->>IL: tree.delete() — free WASM heap
note over IL: _tree NOT set on symbols
else "symbolsOnly=false"
IL->>IL: "symbols._tree = tree"
end
end
IL-->>BF: "Map<relPath, ExtractorOutput>"
else "filePaths.length > 16"
BF->>WP: filePaths, rootDir, EXTRACT_ONLY
WP-->>BF: "Map<relPath, ExtractorOutput>"
end
BF-->>Caller: "Map<relPath, ExtractorOutput>"
Reviews (5): Last reviewed commit: "chore: merge origin/main into fix/symbol..." | Re-trigger Greptile |
| paths: | ||
| - "src/extractors/**" | ||
| - "src/domain/graph/**" | ||
| - "crates/**" | ||
| - "scripts/benchmark.ts" | ||
| - "scripts/incremental-benchmark.ts" | ||
| - "scripts/lib/bench-config.ts" | ||
| - "scripts/lib/fork-engine.ts" |
There was a problem hiding this comment.
Path filter misses
src/domain/parser.ts
parseFilesWasmForBackfill and parseFilesWasmInline live in src/domain/parser.ts, but that path is not in the paths: filter. If a future PR touches only parser.ts (exactly as this one does), the canary will silently not run, leaving the very optimization this fix plumbs — skipping _tree assignment on the inline path — unguarded against performance regressions. The PR description explicitly calls out that 1-file incremental rebuilds are the target scenario, so measuring them without guarding parser.ts changes is an incomplete safety net.
| paths: | |
| - "src/extractors/**" | |
| - "src/domain/graph/**" | |
| - "crates/**" | |
| - "scripts/benchmark.ts" | |
| - "scripts/incremental-benchmark.ts" | |
| - "scripts/lib/bench-config.ts" | |
| - "scripts/lib/fork-engine.ts" | |
| paths: | |
| - "src/extractors/**" | |
| - "src/domain/graph/**" | |
| - "src/domain/parser.ts" | |
| - "crates/**" | |
| - "scripts/benchmark.ts" | |
| - "scripts/incremental-benchmark.ts" | |
| - "scripts/lib/bench-config.ts" | |
| - "scripts/lib/fork-engine.ts" |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Fixed — added src/domain/parser.ts to the paths: filter in .github/workflows/perf-canary.yml. The inline-path optimization introduced by this PR is now guarded against future regressions in parseFilesWasmInline/parseFilesWasmForBackfill.
Also took the opportunity to fix the minor WASM tree leak raised by the Claude review: parseFilesWasmInline now calls .delete() on the parsed tree when symbolsOnly=true, matching the disposal pattern already used by the extractor-error path.
Codegraph Impact Analysis5 functions changed → 29 callers affected across 8 files
|
…sOnly inline path Guard the inline-path optimization against regressions by adding src/domain/parser.ts to the perf-canary paths filter — without it the canary silently skips exactly the file this PR modifies. Also free the WASM-backed tree when symbolsOnly=true in parseFilesWasmInline. The tree was being parsed and then discarded without an explicit .delete() call, leaking WASM linear memory on every incremental rebuild that triggers the inline path. The deletion is guarded by a typeof check, matching the pattern used by the extractor-error path at line 1078.
|
Addressed both concerns from the review:
|
Resolves add/add conflicts in .claude/hooks/snapshot-pre-bash.sh and .claude/hooks/track-bash-writes.sh — taking the origin/main version which adds CMD_HASH to the snapshot filename to prevent parallel Bash calls from overwriting each other's baseline.
|
Resolved merge conflicts with origin/main — two add/add conflicts in |
parseFilesWasmForBackfill'ssymbolsOnlyflag was silently ignored for batches ≤16 files becauseparseFilesWasmInline(the inline path) didn't accept or propagate the option. The optimization from PR #1436 only applied to the worker-pool path (>16 files).Plumbs
symbolsOnlythroughparseFilesWasmInline→ extractor entry points, skipping the_treeassignment that triggers CFG/complexity/dataflow/AST visitor walks when only symbol+call extraction is needed. This makes the optimization effective for typical 1-file incremental rebuilds.Closes #1437