Skip to content

[Reliability] Pagination correctness issue — 2x over-fetch doesn't guarantee correct results #13

@daviddao

Description

@daviddao

Review Finding: 3b — MEDIUM

The cursor-based pagination re-sorts by createdAt after fetching by indexed_at:

// Fetch extra records to allow for re-sorting by createdAt
fetchLimit := first * 2

Over-fetching by 2x doesn't guarantee correctness — records could span page boundaries unpredictably. Requesting 20 records, fetching 50 and re-sorting can still miss records or produce duplicates.

Fix

Consider keyset pagination using (indexed_at, uri) composite cursor for deterministic, gap-free pagination.

From codebase review §3b

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions