codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

fix: reduce generic context entry noise

Open bohe76 opened this issue 6 months ago • 0 comments

Summary

  • Suppress generic split-token entry points such as get, getDb, and testCases when a query already has a specific exact compound symbol match.
  • Keep generic results when they are in the exact-match files, so focused symbol queries still retain local helpers.
  • Reduce default context code blocks from 10 to 2, while keeping --max-code available for callers that need more code.
  • Avoid emitting full bodies for related classes that are not entry points; their locations remain in Related Symbols instead.
  • Skip tiny delegating wrappers when the same symbol has a more useful implementation block.
  • Add a compact focused snippet when non-root query terms co-locate with an entry symbol, so queries like getFileDependents affected tests include the CLI connection point without needing a separate query call.
  • Add regression coverage for getFileDependents affected tests and method-focused context that should not include related class bodies.

Validation

  • npm run build
  • npx vitest run __tests__/context.test.ts (20 passed)
  • node dist\\bin\\codegraph.js context "getFileDependents affected tests" --path .
  • Token measurement for repo_get_file_dependents_investigation: CodeGraph output 2,512 -> 639 approx tokens, changing from +120.0% vs manual to -51.6%.
  • Expanded combined local branch test with the related affected/class fixes: 14/14 smoke accuracy, 38,135 manual approx tokens vs 8,976 CodeGraph approx tokens, 76.5% total reduction.

Note: full npm test was also run locally before this update; it hit unrelated Windows temp-directory EBUSY cleanup failures in MCP process tests (mcp-initialize, mcp-roots).

bohe76 avatar May 23 '26 15:05 bohe76