Skip to content

feat(guard): upgrade /guard/history pagination to cursor-based system#893

Open
Pcmhacker-piro wants to merge 1 commit into
SdSarthak:mainfrom
Pcmhacker-piro:fix/cursor-based-pagination
Open

feat(guard): upgrade /guard/history pagination to cursor-based system#893
Pcmhacker-piro wants to merge 1 commit into
SdSarthak:mainfrom
Pcmhacker-piro:fix/cursor-based-pagination

Conversation

@Pcmhacker-piro
Copy link
Copy Markdown

Summary

Closes #663

This PR replaces the offset-based pagination in the `/guard/history` endpoint with a scalable, cursor-based pagination system using a base64-encoded `(scanned_at, id)` cursor. It

enforces stable sorting (scanned_at DESC, id DESC), returns a next_cursor, and preserves/restores optional advanced filtering by decision, intent, and date ranges
(start_date, end_date). Additionally, it cleans up duplicated merge-residue code in the guard.py API module.

## Type of Change

- [x] Bug fix
- [x] New feature
- [ ] Documentation update
- [x] Refactor
- [x] Tests
- [ ] Infra / CI

## Checklist

- [x] I have read [CONTRIBUTING.md](../CONTRIBUTING.md)
- [x] My code follows the project style (PEP 8 for Python, ESLint for TS)
- [x] I have added/updated tests where relevant
- [x] `pytest backend/tests/` passes locally
- [x] I have not committed `.env` or any secrets
- [x] I have updated documentation if needed

## Screenshots (if UI change)

<!-- Add before/after screenshots here -->

@Pcmhacker-piro
Copy link
Copy Markdown
Author

hii @SdSarthak

the checks have passed. Could you please review and approve the pending workflows when you have a chance? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant