Fix/cursor pagination#742
Open
sakeena-7878 wants to merge 10 commits into
Open
Conversation
SdSarthak
requested changes
May 27, 2026
Owner
SdSarthak
left a comment
There was a problem hiding this comment.
Two regressions need to be fixed before this can merge:
- The empty-prompts validation was removed (
if not self.prompts: raise ValueError). Batch requests with zero prompts will now silently succeed with an empty response — please restore that guard. db: Sessionwas removed fromscan_promptalong with the webhook delivery block. That coupling was intentional — the webhook trigger relies on the db session. If the goal is to separate concerns, useBackgroundTasksto deliver the webhook asynchronously, but don't drop it entirely.
The CursorPagination helper itself and the CursorPaginatedResponse schema are the right direction — just fix the two regressions above.
Contributor
Author
|
Ok got it |
569b12a to
d0f1f32
Compare
Owner
|
The two regression fixes are in — the empty-prompts guard is restored and the |
e51033c to
a84d739
Compare
Contributor
Author
|
This PR resolves guard module merge conflicts and completes the cursor-based pagination refactor. Key updates:
Please let me know if any adjustments are needed. |
d958c87 to
0fc4778
Compare
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.
Summary
Closes #663
This PR replaces offset-based pagination in the LLM Guard /history endpoint with cursor-based pagination using a base64-encoded (scanned_at, id) cursor.
A dedicated CursorPaginatedResponse schema is introduced to avoid breaking the existing PaginatedResponse contract used elsewhere in the system.
SQLite compatibility handled (no tuple comparison operator used; logic uses explicit and_/or_ filtering)
Frontend has been updated to support cursor-based pagination instead of page/offset.
Type of Change
Checklist
pytest backend/tests/passes locally.envor any secretsScreenshots (if UI change)
Replaced page/limit pagination with cursor/next_cursor