Skip to content

fix: page through posts by date and id so backdated posts are not skipped - #251

Draft
TwoDCube wants to merge 1 commit into
test/integrationfrom
fix/posts-cursor-backdated
Draft

TwoDCube wants to merge 1 commit into
test/integrationfrom
fix/posts-cursor-backdated

Conversation

@TwoDCube

Copy link
Copy Markdown
Member

Fixes a bug recorded by the tests in #247. Stacked on #247 (base test/integration), so this is a draft until #246 and #247 merge.

Bug

Post lists (posts, search, author.posts, label.posts) are ordered by date, then id, both descending. The cursor filter was date <= d AND id < i, so a post with a higher id than the cursor's post but an older date never appeared on a later page. That happens to posts entered later and backdated. With the seed data, paging two at a time stopped after posts [1, 2], skipping 3, 6 and 5.

Fix

The rows after a cursor are now date < d OR (date = d AND id < i), which matches the ordering. before still selects the same rows as after.

Tests

  • paging_through_posts_visits_every_published_post_once is no longer ignored.
  • New: paging_orders_posts_with_the_same_date_by_descending_id inserts two posts on the same date as post 2 and checks paging returns [1, 8, 7, 2, 3, 6, 5]. This covers the date = d branch.
  • No snapshots change.
  • cargo clippy --workspace --all-targets -D warnings is clean. CI=true cargo test --workspace passes against MySQL 8.4 and Redis 6.2.

🤖 Generated with Claude Code

…pped

Post lists are ordered by date, then id, both descending, but the cursor
filter was `date <= d AND id < i`. A post with a higher id than the cursor's
post but an older date, such as one entered later and backdated, failed
`id < i` and never appeared on a later page. Filter on
`date < d OR (date = d AND id < i)` instead, which matches the ordering.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@verseghy-prow

verseghy-prow Bot commented Sep 14, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: TwoDCube

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@verseghy-prow verseghy-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant