Skip to content

fix: return an empty post list when no post is published - #252

Draft
TwoDCube wants to merge 1 commit into
test/integrationfrom
fix/posts-empty-list
Draft

TwoDCube wants to merge 1 commit into
test/integrationfrom
fix/posts-empty-list

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

To compute page info, post lists look up the oldest and newest published post. With no published post that lookup found nothing and returned Could not get min value, so posts, search, author.posts and label.posts all failed instead of returning an empty list.

Fix

get_published_posts_min_max_id now returns None when no post is published, and the connection then has neither a previous nor a next page. The list itself is necessarily empty in that case.

The fix for filtered page info (the next PR) stacks on this one. Applying a filter to the lookup without this change would make every empty filtered list fail the same way, for example a label with no posts.

Tests

  • listing_posts_without_published_posts_returns_an_empty_list is no longer ignored.
  • 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

Page info looks up the oldest and newest published post and returned
"Could not get min value" when there was none, so every post list failed
instead of returning no posts. Treat the absence of published posts as a
list without neighbouring pages.

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