[#884] Add write + rate point hooks#903
Conversation
- New lib/airdrop/award.ts with awardWritePoints (50 PL) and awardRatePoints (5 PL, daily cap of 10) - Hook awardWritePoints into storyline indexer and backfill cron (non-blocking, with campaign window + dedup checks) - Hook awardRatePoints into ratings POST endpoint (non-blocking, with daily cap + dedup) - Both respect campaign window and apply streak boost Fixes #884 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The general award-hook shape is reasonable, but the write-points path in the live storyline indexer does not currently enforce the campaign window using the storyline's publish timestamp as the ticket requires.
Findings
- [high]
src/app/api/index/storyline/route.tscallsawardWritePoints()without the storyline's on-chainblock_timestamp, soawardWritePoints()falls back tonew Date()and awards based on indexing time rather than publication time. That means an old storyline indexed during the campaign can incorrectly receive points, and a storyline published during the campaign but indexed later can incorrectly miss them.- File:
src/app/api/index/storyline/route.ts:188 - Suggestion: pass the storyline's actual block timestamp into
awardWritePoints()in this path as well, matching the backfill implementation and the issue requirement to gate onblock_timestamp.
- File:
Decision
Requesting changes because the live storyline-index path does not currently satisfy the campaign-window acceptance criteria for write points.
Use on-chain blockTimestamp instead of Date.now() so campaign window check is based on publication time, not indexing time. 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 live storyline-index path now passes the on-chain blockTimestamp into awardWritePoints(), so the campaign-window check is based on publication time as required. The write/rate award hooks otherwise remain aligned with the ticket scope.
Findings
- No blocking findings in the updated patch.
Decision
Approving from a code-review standpoint. The blocker from my previous review is resolved, and I do not see a remaining PR-specific code issue.
Summary
lib/airdrop/award.tswithawardWritePoints()(50 PL per storyline) andawardRatePoints()(5 PL per rating, max 10/day)src/app/api/index/storyline/route.ts)src/app/api/cron/backfill/route.ts) for StorylineCreated eventssrc/app/api/ratings/route.ts) after successful upsert.catch(() => {}))Files Changed
lib/airdrop/award.ts— new award helperssrc/app/api/index/storyline/route.ts— write point hooksrc/app/api/cron/backfill/route.ts— write point hook (backfill path)src/app/api/ratings/route.ts— rate point hookTest plan
Fixes #884
🤖 Generated with Claude Code