fix(bounties): clamp list pagination params#290
Conversation
Greptile SummaryThis PR replaces the previous
Confidence Score: 5/5Safe to merge — the pagination clamping logic is correct, all edge cases (zero, negative, floats, overflow-to-Infinity) are handled, and the tests verify the full boundary matrix. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GET /api/bounties] --> B[Read searchParams]
B --> C{parsePositiveInt limit}
C --> D{"value null or not /^\\d+$/"}
D -- yes --> E[fallback = 50]
D -- no --> F[parseInt value]
F --> G{"<= 0 or not finite"}
G -- yes --> E
G -- no --> H["min(parsed, 100)"]
E --> I[limit = 50]
H --> I
B --> J{parsePositiveInt page}
J --> K{"value null or not /^\\d+$/"}
K -- yes --> L[fallback = 1]
K -- no --> M[parseInt value]
M --> N{"<= 0 or not finite"}
N -- yes --> L
N -- no --> O[parsed as-is]
L --> P[page = 1]
O --> P
I & P --> Q["offset = (page-1) * limit"]
Q --> R[".range(offset, offset+limit-1)"]
R --> S[Return JSON response]
Reviews (2): Last reviewed commit: "fix(bounties): clamp list pagination par..." | Re-trigger Greptile |
898b7c6 to
5aad35f
Compare
|
Submitted this PR for the ugig bounty: "I will pay for every bug fix found and PR submitted that fixes it". The PR is ready for review:
Solana wallet for bounty payout: |
Fixes #289
Summary
Validation