ADR-0011: Code context is added by measurement ​
Status: accepted (2026-10-12), partly superseded by ADR-0017
Decision ​
- A context source is added only when the missing-context report of the review eval shows that its absence costs findings, and it ships only when the eval shows it improves review metrics. The report after context v0 named two categories:
callersanddefinitions. The next context work builds exactly these. - Symbols are extracted per review from the checked-out tree with tree-sitter (
web-tree-sitter, MIT, WASM grammars for TypeScript, TSX, JavaScript and Python, MIT). No native addon is built; grammar install scripts are disabled. - Two new context sources:
definition(the enclosing declaration of a symbol referenced in changed lines but defined in another file) andcaller(the enclosing function of a call site of a symbol whose definition changed). Both are bounded snippets with line ranges, not whole files. - There is no persistent index. Candidate files are found with
git grepin the per-review checkout and confirmed by parsing, so results always match the reviewed SHA and nothing is stored per tenant.
Deferred until measured ​
- Persistent
code_chunks/symbols/symbol_edges/index_snapshotstables and incremental indexing on push. - Embeddings, pgvector HNSW and hybrid BM25 + vector search with RRF.
- BM25 (pg_textsearch) history search over issues, PRs, review comments and docs. The report shows no
historyordocsmisses for review; it is measured separately for triage. - Languages beyond TypeScript/JavaScript and Python, chosen by pilot repositories.
- Monorepo workspace detection and a shared clone cache.
Consequences ​
- Review latency grows by parsing a bounded number of files per review; budgets cap symbols and snippet lines.
- Results from the synthetic smoke set prove the pipeline, not the quality gain. Real datasets at the end of the build re-run the missing-context report and may reorder or remove sources.