Prepare occurrence chronology keys before sorting

This commit is contained in:
2026-11-26 02:56:43 +00:00
parent 26da344f27
commit 7077cee35e
9 changed files with 109 additions and 14 deletions

View File

@@ -35,6 +35,12 @@ func Less(order shared.SourceRefOrder, left, right dnd.NPCOccurrence) bool {
if leftHasEvidence && leftPosition != rightPosition {
return leftPosition < rightPosition
}
return LessAfterEvidence(order, left, right)
}
// LessAfterEvidence compares tie breakers after equal earliest-evidence keys.
// Callers must establish that premise; Less remains suitable for arbitrary input.
func LessAfterEvidence(order shared.SourceRefOrder, left, right dnd.NPCOccurrence) bool {
leftKey := left.NPCID
rightKey := right.NPCID
if leftKey != rightKey {