Check if content matches represent a true reorder (relative order changed). If all matches preserve relative order (sorted by old_idx gives same ordering as sorted by new_idx), it's just a positional shift from insertions/removals.
(matches: list[tuple[int, int]])
| 171 | |
| 172 | |
| 173 | def _has_relative_order_change(matches: list[tuple[int, int]]) -> bool: |
| 174 | """Check if content matches represent a true reorder (relative order changed). |
| 175 | |
| 176 | If all matches preserve relative order (sorted by old_idx gives same ordering |
| 177 | as sorted by new_idx), it's just a positional shift from insertions/removals. |
| 178 | """ |
| 179 | if len(matches) <= 1: |
| 180 | return False |
| 181 | sorted_by_old = sorted(matches, key=lambda m: m[0]) |
| 182 | new_indices = [m[1] for m in sorted_by_old] |
| 183 | for i in range(len(new_indices) - 1): |
| 184 | if new_indices[i] > new_indices[i + 1]: |
| 185 | return True |
| 186 | return False |
| 187 | |
| 188 | |
| 189 | def _frid_from_index(index: int) -> str: |