Skip to content

Conversation

@apexskier
Copy link

@apexskier apexskier commented Nov 7, 2025

New unit tests demonstrate the bugs - returned position is wrong without an offset, and offsets cause the wrong items to be returned.

This is relevant to section 5.5 of the JMAP spec

Unit test output (before the fix, just fa1b1f6)
running 6 tests

thread 'query::sort::tests::test_pagination_position_with_1_anchor_offset' panicked at crates/store/src/query/sort.rs:436:9:
assertion `left == right` failed: First item should be 5
  left: 4
 right: 5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test query::sort::tests::test_pagination_without_anchor_from_start ... ok

thread 'query::sort::tests::test_pagination_position_with_positive_anchor_offset' panicked at crates/store/src/query/sort.rs:460:9:
assertion `left == right` failed: First item should be 6
  left: 5
 right: 6

thread 'query::sort::tests::test_pagination_position_with_zero_anchor_offset' panicked at crates/store/src/query/sort.rs:488:9:
assertion `left == right` failed: Position should be 5 (anchor position)
  left: 0
 right: 5
test query::sort::tests::test_pagination_without_anchor_with_offset ... ok
test query::sort::tests::test_pagination_without_anchor_partial_results ... ok
test query::sort::tests::test_pagination_position_with_zero_anchor_offset ... FAILED
test query::sort::tests::test_pagination_position_with_1_anchor_offset ... FAILED
test query::sort::tests::test_pagination_position_with_positive_anchor_offset ... FAILED

failures:

failures:
    query::sort::tests::test_pagination_position_with_1_anchor_offset
    query::sort::tests::test_pagination_position_with_positive_anchor_offset
    query::sort::tests::test_pagination_position_with_zero_anchor_offset

test result: FAILED. 3 passed; 3 failed; 0 ignored; 0 measured; 2 filtered out; finished in 0.00s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant