You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cache): delta-based incremental SQLite analysis cache for Go (shivasurya#649)
## Summary
Adds `AnalysisCache` backed by SQLite to speed up repeated Go call graph builds.
**Cold → warm speedup**: ~2m 39s → ~24s (**6.6×**) on 392 Go files / 39,743 call sites.
Enable with `--enable-db-cache` on `resolution-report` (scan/ci in PR-10).
## Design
**Which passes are cached:**
- Passes 2a/2b/3 (file-local): cached by content hash — always safe
- Pass 4 (cross-file): delta-based — files are replayed from cache unless dirty
- Pass 1: never cached — must run to detect what changed
**Pass 4 delta invalidation** (`NeedsPass4Rerun`): a file is dirty if:
1. No cache entry exists
2. Content hash changed
3. A resolved callee FQN was removed from the index
4. An unresolved call name matches a newly-added FQN
Warm files skip resolution entirely; cached edges replay directly into the call graph.
**Per-table schema versioning** — three constants (`fileCacheVersion`, `functionIndexVersion`, `pass4Version`) stored in the `meta` table. On version mismatch only the affected table is wiped; other tables stay warm. Project-root change wipes all.
## Test coverage
- `analysis_cache_test.go`: per-table version wipe, file-cache wipe, project-root change
- `go_builder_test.go`: cold→warm round-trip, nil cache regression, dirty-file re-resolution
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
resolutionReportCmd.Flags().String("dump-callsites-json", "", "Export all Go call sites as JSONL for accuracy validation (e.g., --dump-callsites-json callsites.jsonl)")
934
+
resolutionReportCmd.Flags().Bool("enable-db-cache", false, "Enable SQLite-backed incremental analysis cache (experimental). Caches Pass 2b scopes and Pass 3 call sites per file keyed by content hash; only changed files are re-analysed on subsequent runs.")
0 commit comments