fix(onset): merges never declare one thing twice, and match git wherever git is clean
Radin committed
- Author
- Radin · radin@coline.appOct 31, 2026 at 21:10
- Committer
- Radin · radin@coline.appOct 31, 2026 at 21:27
- Parents
- b2c8186aaa9d
fix(onset): merges never declare one thing twice, and match git wherever git is clean The smart merge kept both sides wherever both added at one spot, so two different `def helper` landed as two definitions and `timeout:` landed twice in one YAML map, both silently. It also missed its own headline case: two new JS functions still conflicted on their shared closing braces. - core/decls.rs reads what a file declares (functions, classes, members by scope; YAML, JSON, TOML, .env and INI keys). A merge that declares something more times than either side did is a conflict, even where the lines didn't touch and git calls it clean; sync marks the change's spot. - Both-added blocks merge only when each is whole declarations or test cases with nothing in common; statements keep git's conflict. Imports binding one name twice conflict. Entries added to a sorted list go in sorted. - A property test checks 4,000 random merges per file type: where git's line merge is clean, Onset's is byte-identical. A fuzz test checks the scanner and merges never panic (it found a slice past a short line). - examples/merge_corpus replays a repository's merges: on 4,000 of git's own, 6,416/6,416 clean files identical; of 576 conflicts its maintainer resolved, 37 settled as he did, 530 left, 9 differing only in order or blank lines. On this repository it catches a duplicated pnpm-lock entry git merged silently and a person fixed by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed+1,424−25