[#882] Add streak check-in system with SIWE#901
Conversation
- New POST /api/airdrop/checkin endpoint with SIWE signature verification - New lib/airdrop/streak.ts with getStreakBoost, dropOneTier, getNextTier - Move getStreakBoost from points.ts to streak.ts (re-exported for compat) - One check-in per calendar day (UTC), 30-min minimum gap - Consecutive days increment streak, missed days drop one tier (not reset) - Returns streak count, boost %, next tier info, checkedInToday flag Fixes #882 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 endpoint and helper structure are close, but the missed-day streak-drop logic does not currently match the issue specification. In two edge cases it returns a higher streak than the ticket defines.
Findings
- [high]
dropOneTier(100)returns50, but the issue explicitly says a missed day for a100+streak should set the streak to100, not drop below the top tier threshold.- File:
lib/airdrop/streak.ts:32 - Suggestion: adjust
dropOneTier()so exact-threshold top-tier values (100and above) resolve to100, while lower tiers still fall to the lower tier threshold.
- File:
- [high] For missed days on streaks
1-6, the route forces the result back up to1viaMath.max(newStreak, 1), but the issue says that range should drop to0.- File:
src/app/api/airdrop/checkin/route.ts:123 - Suggestion: remove the floor-to-1 behavior for the missed-day branch so
dropOneTier(1..6)can remain0as specified.
- File:
Decision
Requesting changes because the current missed-day behavior does not match the ticket rules for top-tier and low-tier streak drops.
Per spec: 100+ → 100, 50-99 → 50, ..., 1-6 → 0. dropOneTier now snaps to the current tier's threshold (not below it). Check-in route adds +1 for today's check-in after the drop. 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: REQUEST CHANGES
Summary
dropOneTier() now matches the spec, but the route still applies a post-drop increment that changes the missed-day result away from the ticket rules.
Findings
- [high] The missed-day branch now does
dropOneTier(existing.current_streak) + 1, which means a streak in1-6becomes1and a streak in100+becomes101after the check-in. The issue text says missed days should reset the streak counter to the lower tier threshold (1-6 -> 0,100+ -> 100) and does not include an extra increment afterward.- File:
src/app/api/airdrop/checkin/route.ts:121 - Suggestion: set
newStreak = dropOneTier(existing.current_streak)in the missed-day branch so the persisted streak matches the specified threshold reset behavior.
- File:
Decision
Requesting changes because the route still does not implement the missed-day streak reset exactly as described in the ticket.
Per spec, missed days set streak to the tier threshold exactly (e.g. 1-6 → 0, 50-99 → 50). The check-in itself does not increment the dropped value. 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 missed-day streak logic now matches the ticket rules. The helper snaps streaks to the specified tier threshold, and the route persists that dropped value without an extra increment.
Findings
- No blocking findings in the updated patch.
Decision
Approving from a code-review standpoint. The blockers from my previous reviews are resolved, and the streak logic now aligns with the issue specification.
Summary
POST /api/airdrop/checkin— SIWE signature verification, streak updatelib/airdrop/streak.ts—getStreakBoost(),dropOneTier(),getNextTier()getStreakBoostfrompoints.tstostreak.ts(re-exported for backward compat)Streak tiers
Files Changed
lib/airdrop/streak.ts— new streak helper modulelib/airdrop/points.ts— imports getStreakBoost from streak.tssrc/app/api/airdrop/checkin/route.ts— new check-in endpointTest plan
npm run typecheckpassesdropOneTier(100)→ 50,dropOneTier(45)→ 30,dropOneTier(5)→ 0Fixes #882
🤖 Generated with Claude Code