fix(follows): clamp public follow-list pagination#288
Conversation
0e974b6 to
66dfb76
Compare
Greptile SummaryThis PR fixes a pagination bug in the public followers/following routes where negative
Confidence Score: 5/5Safe to merge — the change narrows the set of values that reach Supabase's .range() call and is backed by targeted tests. The helpers correctly handle every edge case: non-numeric strings (NaN → fallback), zero limit (0 ≤ 0 → fallback), negative limit, and negative offset. The Supabase range arguments are unchanged for well-formed inputs. Tests assert both the HTTP response shape and the exact .range() arguments, confirming the fix works end-to-end. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GET followers or following route] --> B[parsePositiveInt limit]
B --> C{finite AND greater than 0?}
C -- No --> D[fallback: 20]
C -- Yes --> E[Math.min parsed, 100]
D --> F[parseNonNegativeInt offset]
E --> F
F --> G{finite AND >= 0?}
G -- No --> H[fallback: 0]
G -- Yes --> I[use parsed offset]
H --> J[Supabase .range call]
I --> J
J --> K{error?}
K -- Yes --> L[400 Bad Request]
K -- No --> M[200 OK with data and pagination]
Reviews (2): Last reviewed commit: "fix(follows): clamp public follow-list p..." | Re-trigger Greptile |
66dfb76 to
402d148
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 #287
Summary
Validation