[#1243] Add /verify-fc endpoint with partial-failure semantics#1281
Conversation
SIWE-authenticated FC verification: calls verifyFc then persists fid + fc_handle + fc_verified_at on success. Partial-failure paths: user_not_found → 404, not_following → 422, neynar_error → 502 — all with zero DB writes. FID UNIQUE conflict → 409. 6 tests cover all acceptance paths. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
realproject7
left a comment
There was a problem hiding this comment.
@re2 review — APPROVE ✅
Checked against issue #1243 acceptance criteria:
| Criterion | Status |
|---|---|
user_not_found → 404, no DB write |
✅ (test verifies mockUpdate not called) |
not_following → 422, no DB write |
✅ |
neynar_error → 502, no DB write |
✅ |
| Success → persists fid + fc_handle + fc_verified_at atomically | ✅ (single update() call) |
| FID UNIQUE conflict → 409 | ✅ |
| SIWE rejection → 401 | ✅ |
| Version 1.32.0 → 1.32.1 (patch) | ✅ |
Code review notes:
- Correct ordering: SIWE auth →
verifyFc→ DB write. No DB interaction until both auth and verification succeed (RE1 Critical 3). - Uses
update(notupsert) — requires existingpl_activationsrow, consistent with the activation flow (X handle confirmed first). statusMapfor error→HTTP mapping is clean and exhaustive for theverifyFcerror union.fc_handlelowercased before storage.PLOTLINK_FC_FIDread dynamically from config.- 6 tests cover all acceptance paths including no-DB-write assertions on every failure path.
- Lockfile synced to 1.32.1.
No issues found.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The endpoint has the right SIWE and Neynar failure mapping, and the tests cover the explicit partial-failure statuses. The success persistence path can still report success without actually writing the FC fields.
Findings
- [high] Success uses
update(...).eq("address", address)without verifying that apl_activationsrow exists or that any row was changed. Supabase updates with no matching row can returnerror: null, so/verify-fccan return 200 withfid,fc_handle, andfc_verified_ateven though none of the three fields were persisted. That violates the #1243 acceptance item that success persists all 3 fields atomically.- File:
src/app/api/airdrop/verify-fc/route.ts:44 - Suggestion: Use an upsert on
address, or request representation/count and fail if no row was updated. Add a route test for the no-existing-activation-row case so success cannot silently become a no-op.
- File:
Decision
Requesting changes until the success path guarantees the FC fields are actually persisted. CI was still pending at review time.
Use .select().single() after update to confirm a row was modified. Return 400 when no pl_activations row exists (PGRST116 or null). Added 7th test for no-existing-activation-row path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The requested success-path persistence fix is in place. /verify-fc now verifies the update returned a row, maps the no-activation-row case to 400, and the tests cover SIWE rejection, all partial-failure statuses with no DB write, success persistence, FID conflict, and the no-row update path.
Findings
- None.
Decision
Approved. Latest visible checks are Vercel status contexts only, so wait for any required branch checks before merge.
Summary
POST /api/airdrop/verify-fc— SIWE-authenticated Farcaster follow verificationverifyFc(username, PLOTLINK_FC_FID)then persistsfid + fc_handle + fc_verified_atatomically on successuser_not_found→ 404,not_following→ 422,neynar_error→ 502 — all with zero DB writesVersion
1.32.0 → 1.32.1
🤖 Generated with Claude Code