[#94] Add comment length validation and GET pagination#98
Conversation
- Server-side 500-char comment limit with client-side maxLength - GET endpoint now supports ?limit=N&offset=N pagination (default 20, max 100) with total count in response - Results ordered by updated_at descending Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
T2b Review — APPROVE
Comment length validation (API + UI) and GET pagination both implemented correctly.
- Server-side 500-char limit checked before signature verification ✓
maxLength={500}on textarea ✓- Pagination with limit (capped at 100), offset, total count, and
updated_at descordering ✓
Note (non-blocking): average is now page-scoped, not global. The inline comment acknowledges this, but consumers relying on the average will get incorrect values once ratings exceed one page. Consider a separate aggregate query in a follow-up.
LGTM ✓
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The comment-length validation is fine, but the pagination change introduces a correctness regression in the ratings API contract and the existing UI consumers.
Findings
- [high]
GET /api/ratingsnow computesaverageandcountfrom only the current page, while existing consumers still use those fields as all-ratings metadata. Once a storyline has more than one page of ratings, both the summary and widget will display incorrect totals/averages.- File:
src/app/api/ratings/route.ts:47 - Suggestion: Keep
averageand the displayed total based on the full storyline dataset, not the paginated slice. If pagination needs extra metadata, add new fields likepageCount/totalwithout changing the meaning of existing fields.
- File:
- [medium] The widget prefill logic now only searches the first page of recent ratings, so a connected user with an older rating will appear unrated and can accidentally overwrite without seeing their current value.
- File:
src/components/RatingWidget.tsx:88 - Suggestion: Preserve a way to fetch the current user's own rating independently of page slicing, or ensure the API response for the widget still includes that record regardless of pagination.
- File:
Decision
Requesting changes because the current pagination implementation breaks existing ratings displays and user prefill behavior for storylines with more than one page of ratings.
Average and count now computed from all ratings (not just the current page). Added optional raterAddress param to GET for dedicated lookup of the caller's own rating, used by RatingWidget for prefill. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The PR now adds the requested 500-character comment validation and GET pagination while preserving correct global rating metrics and widget prefill behavior.
Findings
- No blocking findings.
Decision
Approving because the updated implementation matches issue #94, resolves the pagination regressions from the prior revision, and the refreshed lint/typecheck run passed.
project7-interns
left a comment
There was a problem hiding this comment.
T2b Re-Review — APPROVE
Both issues resolved:
- Average/count now computed from full dataset, not page-scoped ✓
- Dedicated
?raterAddress=param for myRating lookup — widget prefill works regardless of pagination ✓ - Query key includes
addressfor proper refetch on wallet change ✓
LGTM ✓
Summary
Fixes #94
maxLengthon textarea?limit=N&offset=Nparams (default limit=20, max 100), returnstotalcount alongside paginated results, ordered byupdated_atdescendingTest plan
GET /api/ratings?storylineId=1returns max 20 ratings withtotalfieldGET /api/ratings?storylineId=1&limit=5&offset=0returns 5 ratings🤖 Generated with Claude Code