Review: Stripe Connect payout + admin result
Verdict: NEEDS_REFINEMENT
Template Completeness
- [x] Type -- Feature
- [x] Lineage -- Sub-ticket of #7, depends on #11. Sequential.
- [x] Repo -- forgejo_admin/twitch-2k-wager
- [x] User Story -- winning challenger receives payout via Stripe after one-time setup
- [x] Context -- Connect Express deferred onboarding, account.updated webhook, revenue split
- [x] File Targets -- 3 files listed (all new)
- [x] Acceptance Criteria -- 6 items
- [x] Test Expectations -- 2 items
- [x] Constraints -- 3 items (Connect enabled, test keys, auth required)
- [x] Checklist -- standard PR/tests/no-unrelated
- [x] Related -- parent #7, dependency #11, story note, arch note
Traceability
- [x] story:winner-payout label -- Winner Payout and Receipt
- [x] story note verified -- story-twitch-2k-wager-winner-payout (id 1160) exists in pal-e-docs; winner-payout row present in project-twitch-2k-wager user-stories table
- [x] arch:dataflow-twitch-2k-wager label -- Data Flow: Twitch 2K Wager
- [x] arch note verified -- arch-dataflow-twitch-2k-wager (id 1155) exists in pal-e-docs
- [x] Forgejo issue -- forgejo_admin/twitch-2k-wager#12, open
File Targets
- [x]
src/routes/api/admin/result/+server.ts-- new file. Parent dirsrc/routes/exists in scaffold. Correct SvelteKit API route placement. - [x]
src/routes/payout/+page.svelte-- new file. Parent dirsrc/routes/exists. Connect onboarding redirect/status page. - [x]
src/lib/stripe.ts-- new file. Parent dirsrc/lib/exists. Stripe helper module for Connect account creation + transfer. - [ ] MISSING: webhook route for
account.updated-- AC #3 requires handlingaccount.updatedwebhook events to detect onboarding completion and trigger transfer. No webhook file is listed in File Targets. If #11 creates a webhook endpoint (e.g.src/routes/api/webhook/+server.ts), this ticket must list it as a file to modify.
Repo Placement
OK. Issue filed on forgejo_admin/twitch-2k-wager, all file targets are in that repo. Single-repo change. No cross-repo concerns.
Dependencies
- [x] #11 (Stripe Checkout + webhook) -- PENDING. Currently in
next_upon the board (item #797). Sequential dependency documented in Lineage. This ticket cannot start until #11 merges because it needs Stripe client initialization and webhook infrastructure. - [x] #7 (parent) -- open. Decomposed parent ticket in
backlog(item #793). Informational, not blocking. - [ ] #9 (Postgres schema + db.ts) -- UNDOCUMENTED dependency. Currently in
needs_approval(item #795). The Payout and RevenueSplit records from AC #5-6 require DB tables and types. Not listed in Lineage. - [x] #13 (Game status UI + email receipts) -- downstream consumer, not blocking. Shares story:winner-payout label.
Acceptance Criteria
6 criteria, all verifiable via Stripe test mode. Maps cleanly to the arch-dataflow-twitch-2k-wager sequence diagram (operator declares winner, Connect account created, transfer initiated). AC is a focused subset of the user story's 8 criteria -- email receipts and payout status UI are correctly deferred to #13.
Testability assessment:
- AC 1 (admin endpoint) -- testable with HTTP request + DB assertion
- AC 2 (Connect account creation) -- testable with Stripe test mode API
- AC 3 (account.updated webhook) -- testable with Stripe CLI webhook forwarding or test event simulation
- AC 4 (repeat winner transfer) -- testable with pre-onboarded test account
- AC 5 (RevenueSplit) -- testable with DB assertion
- AC 6 (payout status tracking) -- testable with DB query
All criteria are specific and agent-verifiable. No ambiguous language.
Blast Radius
Greenfield SvelteKit app with no downstream consumers yet. No shared libraries. No sibling services affected. The Stripe Connect integration is self-contained. Rollback is straightforward (revert the PR). The only cross-cutting concern is that the webhook endpoint created by #11 may need to handle both
checkout.session.completed and account.updated events -- this is an integration point between #11 and #12.Decomposition Assessment
3 file targets (+1 missing webhook file = 4 total), 1 repo, 6 AC. Within the three-thing limit (all changes are tightly coupled: admin endpoint calls stripe helpers, payout page shows Connect status). Estimated agent time: 3-4 minutes. No independent subtasks that could be parallelized -- the admin endpoint, stripe helpers, and payout page are interdependent. No decomposition needed.
Recommendation
[BODY]Add webhook route to File Targets: theaccount.updatedwebhook handler file (path TBD after #11 merges, likelysrc/routes/api/webhook/+server.ts) must be listed since AC #3 depends on extending it.[BODY]Add #9 (Postgres schema + db.ts) as a dependency in the Lineage section. Payout and RevenueSplit DB records require the schema and types from #9.