I built a merge-conflict predictor that ignores lines and reads the AST instead
说明与用途
PRISM 的冲突预测器使用 tree‑sitter 进行 AST 解析,检测 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