Skip to content

fix: compute page info of filtered post lists from the same filter - #257

Draft
TwoDCube wants to merge 1 commit into
fix/posts-empty-listfrom
fix/posts-filtered-page-info
Draft

TwoDCube wants to merge 1 commit into
fix/posts-empty-listfrom
fix/posts-filtered-page-info

Conversation

@TwoDCube

Copy link
Copy Markdown
Member

Fixes a bug recorded by the tests in #247. Stacked on #252 (base fix/posts-empty-list), so this is a draft until #246, #247 and #252 merge. The dependency is real: without #252, applying the filter would make every empty filtered list, such as a label with no posts, fail with Could not get min value.

Bug

hasPreviousPage and hasNextPage compare a page with the oldest and newest post its list can show. That lookup ignored the list's filter and used all published posts. As a result, author.posts, label.posts, posts(featured: true) and search reported pages that did not exist: the only post labelled "Sport" came back with both flags true.

Fix

  • The lookup (now get_listed_posts_min_max_id) takes the list's condition and join, and counts only published posts matching them, like the list itself.
  • The join is now applied to two queries, and RelationDef is not Clone. create_paginated_posts therefore takes Option<fn() -> RelationDef>, and labels.rs passes a closure.
  • build_paginated_posts is unchanged, to stay out of fix: page through posts by date and id so backdated posts are not skipped #251's diff.

Tests

  • page_info_of_a_filtered_list_reflects_the_filter is no longer ignored.
  • In the snapshots frontend_queries__search_page_by_author and frontend_queries__search_page_by_label, hasPreviousPage changes from true to false: both pages already contain the oldest post of their list. This is the intended change. website_frontend2 requests the field but does not act on it yet.
  • 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

hasPreviousPage and hasNextPage compare a page with the oldest and newest
post its list can show, but that lookup ignored the list's filter and used
all published posts. Author, label, featured and search lists therefore
reported pages that did not exist. Apply the list's condition and join to
the lookup as well.

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