Fix pagination gap-skipping bug in list_tasks - #63
Open
zinodict121 wants to merge 1 commit into
Open
Conversation
cybermax4200
requested changes
Aug 18, 2026
cybermax4200
left a comment
Contributor
There was a problem hiding this comment.
The CI checks are failing please kindly fix them
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix pagination gap-skipping bug in
list_tasks.Previously, a gap in the ID space (from any missing records) would silently consume a tick of the
limitcounter. This bug returned artificially shortened pages, causing front-end or indexer paginators that usepage.len() < limitas a stop signal to drop indexing operations and miss remaining items.This PR fixes this issue by moving
remaining -= 1;inside theif let Some(task) = storage::read_task(...)condition inlist_tasks. This ensures the requested page limit is fulfilled by actual returned tasks rather than consuming the page allocation on missing or deleted IDs (gaps).Fixes #40
Type of change
How Has This Been Tested?
Added
test_list_tasks_with_gapsto simulate scenarios where gaps exist in the index. The test strictly validates that the function correctly fetches the requested quota of tasks despite gaps, safely stopping only at the end-of-registry. Existingpaginationandfull_scantests remain unbroken.cargo test- Verifiedcargo test -p task-registryhandles base index scans, pagination constraints, and accurately fetches tasks dynamically when spanning deleted/missing item chunks.tests/Checklist: