codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix: improve affected, callers, and context precision

Open bohe76 opened this issue 6 months ago • 0 comments

Summary

This PR combines three small CodeGraph precision improvements that were tested together:

  • include semantic file dependents for affected by considering symbol-level edges and normalizing Windows-style paths
  • include instantiates edges in caller lookup so class construction is reported as usage
  • reduce noisy generic context entry 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: affected semantic 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 build
  • npx 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

bohe76 avatar May 23 '26 16:05 bohe76