You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: make compare_lines a valid total order (#105) (#106)
* fix: make compare_lines a valid total order (#105)
The previous comparator could return Ordering::Less for both
compare_lines(a, b) and compare_lines(b, a) when two lines shared a
prefix ending just before "**". That violated antisymmetry, so
Vec::sort_by produced different orderings on different platforms,
breaking "CODEOWNERS out of date" validation.
Compare path components left-to-right with "**" treated as a sentinel
that sorts before any non-"**" component, falling back to full-line
lexical compare as a deterministic tiebreaker. The shared comparator
is reused by codeowners_file_parser, so both generation and parse
agree.
* test: prove transitivity and cover edge branches in compare_lines
- Rename the antisymmetry sweep so the name matches what it asserts.
- Add a transitivity sweep over the same special-character set; this is
the property that was actually missing from coverage of the Ord
contract.
- Add a length-asymmetry case (shorter path vs longer extension) and
an equal-path tiebreaker case, exercising the (None, Some) /
(Some, None) and full-line fallback arms.
0 commit comments