Implement global N-way collision resolution (bd-97)

- Add ResolveNWayCollisions function for deterministic global resolution
- Replace pairwise ScoreCollisions approach with content-hash-based sorting
- Implement helper functions: groupCollisionsByID, deduplicateVersionsByContentHash, extractNumber
- Update importer.go to use new resolution flow
- Add applyNWayResolution to create remapped issues
- Export UpdateReferences for use by importer
- Add comprehensive tests for N-way collision resolution
- All tests pass including TestTwoCloneCollision

This enables proper convergence for N-way (3+) collision scenarios where
multiple clones create issues with the same ID but different content.
The algorithm groups all versions, deduplicates by content, sorts by hash,
and assigns sequential IDs deterministically.

Amp-Thread-ID: https://ampcode.com/threads/T-3e649e13-792c-4fb5-a342-58fa805eb517
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Steve Yegge
2025-10-28 20:07:27 -07:00
parent b0d28bbdbd
commit 9b2d3554c3

File diff suppressed because one or more lines are too long