fix: server-side pagination and error handling for /refractor status #123

Merged
cal merged 2 commits from fix/refractor-server-pagination into main 2026-03-25 21:44:54 +00:00
Owner

Summary

Fixes /refractor status failing silently when the API rejects limit=500 (max is 100).

  • Switch from client-side pagination to server-side (pass limit, offset, progress to API)
  • Use API's count field for total instead of len(items)
  • Detect API error responses (detail key) and log them + show user-facing error message
  • No longer silently returns "No refractor data" when the API returns a validation error

Test plan

  • /refractor status shows cards with correct values
  • /refractor status page:2 shows different cards than page 1
  • /refractor status card_type:batter filters correctly
  • /refractor status progress:close delegates to API
  • Footer shows correct total count across pages
## Summary Fixes /refractor status failing silently when the API rejects `limit=500` (max is 100). - Switch from client-side pagination to server-side (pass `limit`, `offset`, `progress` to API) - Use API's `count` field for total instead of `len(items)` - Detect API error responses (`detail` key) and log them + show user-facing error message - No longer silently returns "No refractor data" when the API returns a validation error ## Test plan - [ ] `/refractor status` shows cards with correct values - [ ] `/refractor status page:2` shows different cards than page 1 - [ ] `/refractor status card_type:batter` filters correctly - [ ] `/refractor status progress:close` delegates to API - [ ] Footer shows correct total count across pages
cal added 2 commits 2026-03-25 21:44:33 +00:00
- Switch from client-side pagination (fetch all, slice) to server-side
  (pass limit/offset/progress params to API)
- Fixes limit=500 rejection (API max is 100)
- Footer now shows total_count from API response
- progress=close filter delegated to API instead of client-side

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fix: add error logging and user-facing message for API failures
All checks were successful
Ruff Lint / lint (pull_request) Successful in 20s
1c21f674c2
- Log API error detail when refractor endpoint returns an error
- Show "Something went wrong" instead of misleading "No refractor data"
- Log empty response case for debugging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude approved these changes 2026-03-25 21:44:44 +00:00
Claude left a comment
Collaborator

Approved via pd-pr

Approved via pd-pr
cal merged commit 1c21f674c2 into main 2026-03-25 21:44:54 +00:00
cal deleted branch fix/refractor-server-pagination 2026-03-25 21:44:54 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-discord#123
No description provided.