codegraph
codegraph copied to clipboard
fix: improve affected, callers, and context precision
Summary
This PR combines three small CodeGraph precision improvements that were tested together:
- include semantic file dependents for
affectedby considering symbol-level edges and normalizing Windows-style paths - include
instantiatesedges in caller lookup so class construction is reported as usage - reduce noisy generic
contextentry points and keep output focused with fewer default code blocks plus compact same-file focus snippets
These changes are also available as split PRs for easier review:
- #351:
affectedsemantic dependents - #355: class instantiation callers
- #356: context noise/token reduction
Local evaluation
I ran the same 14-case local smoke suite against origin/main before these changes and against this combined branch.
| Source | Accuracy | CodeGraph approx tokens | Savings vs manual |
|---|---|---|---|
baseline f366222 |
6/14 (42.9%) | 17,661 | 51.8% |
| this branch | 14/14 (100.0%) | 8,976 | 76.5% |
Compared with baseline, the combined branch reduces CodeGraph output tokens by 8,685 tokens, or 49.2%, while passing 8 additional cases.
Token estimate method: ceil(character_count / 4) over prompt-visible command output. The smoke accuracy checks are string-presence checks for expected files/symbols, not a claim of semantic completeness.
Testing
npm run buildnpx vitest run __tests__/graph.test.ts __tests__/context.test.ts --minWorkers=1 --maxWorkers=1 --testTimeout=30000 --hookTimeout=30000 --no-file-parallelism- 2 test files passed
- 43 tests passed