Skip to content

Require strictly increasing patch indices - #11181

Merged
mhk197 merged 2 commits into
developfrom
mk/strict-patch-indices
Nov 3, 2026
Merged

mhk197 merged 2 commits into
developfrom
mk/strict-patch-indices

Conversation

@mhk197

@mhk197 mhk197 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Patches::new now checks, in debug builds, that patch indices are strictly increasing instead of only sorted. Nothing in the workspace produces repeated indices; only hand-built tests did. The paths that handle them also disagree: search_index returns the first patch at a repeated index, while decoding keeps the last.

Changes

  • Patches::new asserts is_strict_sorted; the new_unchecked safety contract says "strictly increasing".
  • Remove the repeated-index handling: the last-wins skip in append_patch_walk_to_varbin, and the repeated-position checks in execute_sparse_lists and lists::can_use_native_list.
  • Remove test_append_utf8_with_duplicate_patch_indices and the repeated_position cases from the sparse list tests added in Reuse compact elements when canonicalizing sparse lists #11173; add test_new_rejects_repeated_indices.

Testing

  • test_new_rejects_repeated_indices (debug builds only).

Signed-off-by: Matt Katz <mhkatz97@gmail.com>
Signed-off-by: Matt Katz <mhkatz97@gmail.com>
@mhk197
mhk197 marked this pull request as ready for review November 3, 2026 21:17
@mhk197
mhk197 requested a review from robert3005 November 3, 2026 21:17
@mhk197 mhk197 added the changelog/fix A bug fix label Nov 3, 2026
@mhk197
mhk197 requested a review from joseph-isaacs November 3, 2026 21:22
@mhk197
mhk197 merged commit bc58587 into develop Nov 3, 2026
152 of 153 checks passed
@mhk197
mhk197 deleted the mk/strict-patch-indices branch November 3, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants