Pinned Tweet
The whole file is too much context. The diff hunk is too little.
I built a third option: walk the AST from the changed bytes up to the smallest enclosing method/class. 100% resolution rate, 71.8% median size reduction on real PRs.
Thread 🧵
1
19
Important caveat, in the paper: 100% resolution ≠ "always tight." TS's definition set is broad, so almost everything resolves to something. The real signal is the reduction distribution — it's bimodal, not clustered near the mean. Full breakdown in the paper.
1
8
MIT-licensed, tests included, evaluation harness reproducible, DOI on Zenodo, paper (PDF/LaTeX/Markdown) in the repo.
Code: github.com/eherrador/ast-con…
DOI: doi.org/10.5281/zenodo.22905…
10
5) class/struct/interface should be the last resort, not a first-class target — a floating comment shouldn't pull in the whole class.
6. export class Foo {} is still a class. TS registers export_statement as a valid unit too, so this needs a special case.
1
13
3) A doc comment sits before the method it documents, not inside it. Edit both together and your range starts before the node even begins.
4. A pure insertion at a blank line collapses to nothing when you trim whitespace — unless you keep it as a zero-width point.
1
7
Sounds trivial. Wasn't. The naive version silently degrades back to whole-class context on real diffs unless you handle 6 specific edge cases. Each one cost me a real production failure before I found it.
1
4
The whole file is always "enough" — and usually way too much. A one-line fix in a 500-line file buries the signal in noise. Costly for a reviewer's attention, and literally costly for LLM fine-tuning: every irrelevant token dilutes the training signal.
1
12
The problem: a unified diff hunk pads the real change with ~3 arbitrary lines of context on each side. For a short method, that padding spills into the neighbor. For a big method, it doesn't even cover the signature. Structurally, it's noise.
1
10
Important caveat, in the paper: 100% resolution ≠ "always tight." TS's definition set is broad, so almost everything resolves to something. The real signal is the reduction distribution — it's bimodal, not clustered near the mean. Full breakdown in the paper.
1
5
MIT-licensed, tests included, evaluation harness reproducible, DOI on Zenodo, paper (PDF/LaTeX/Markdown) in the repo.
Code: github.com/eherrador/ast-con…
DOI: doi.org/10.5281/zenodo.22905…
12
