I built a merge-conflict predictor that ignores lines and reads the AST instead
Описание и применение
Прогнозатор конфликтов PRISM использует AST‑парсинг с tree‑sitter для выявления конфликтов по символам, которые Git пропускает, снижая количество ошибок после «чистых» слияний.
Задача
Git’s line‑based conflict detection misses semantic conflicts that break production after a clean merge.
Результат
The predictor identifies semantic merge conflicts that Git’s line‑based system misses, reducing production bugs caused by silent merges.
Рабочий процесс
- Parse merge‑base and branch heads into ASTs using tree‑sitter
- Extract symbols (functions, classes, methods) from each AST
- Detect overlap between symbols on both sides
- If overlap exists, compute a risk score and list of symbols
- Expose result via POST /repos/{id}/predict-conflict and a UI with risk bar and symbol list
Доказательства
Git's idea of a merge conflict is narrower than it should be. Two branches change the same lines, you get a conflict. Two branches touch the same function from different files and never collide, git merges cleanly and congratulates you.
Parse the merge-base and both branch heads into ASTs with tree-sitter, extract the symbols (functions, classes, methods), and flag overlap between the two sides.
Tree-sitter grammar packages aren't always installed on the machine. The first version crashed when one was missing, which made it a demo, not a tool.
The predictor doesn't replace tests or review. It answers one narrow question: did these two branches step on the same symbols?
- Дата записи: 2026-10-04T08:40:46.613Z