Review: /play guest checkout route + landing updates

review-812-2026-04-03 Doc

review needs-refinement

Verdict: NEEDS_REFINEMENT

Template Completeness

  • [x] Type — Feature
  • [x] Lineage — "New primary flow — direct challenge link. Standalone."
  • [x] Repo — forgejo_admin/twitch-2k-wager
  • [x] User Story — clear challenger wants frictionless guest checkout
  • [x] Context — explains /play route purpose, landing page CTA change, code exists locally
  • [x] File Targets — 6 files, all specific with change descriptions
  • [x] Acceptance Criteria — 6 testable conditions
  • [x] Test Expectations — 3 items including CI pipeline
  • [x] Constraints — code exists locally, no new dependencies
  • [x] Checklist — standard PR/tests/no-unrelated
  • [x] Related — project page, story note, arch note referenced

Traceability

  • [x] story:challenger-pay label — Secure Buy-In Payment
  • [x] story note verified — challenger-pay listed in project-twitch-2k-wager user-stories table (key: challenger-pay, note: story-twitch-2k-wager-challenger-pay)
  • [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#38, open

File Targets

  • [x] src/routes/play/+page.svelte — verified: NEW file exists with tier pills, gamertag + email form, handleCheckout calling /api/checkout
  • [x] src/routes/+page.svelte — verified: MODIFIED with clickable tier cards, $1 test tier (dashed red border), gamertag input, checkout form replacing Twitch-login-first CTA
  • [x] src/app.css — verified: MODIFIED with .tier-card, .tier-card.selected, .checkout-form styles, tier color vars
  • [x] src/lib/stripe.ts — verified: MODIFIED with $1 test tier (amount: 100, label: "Test Challenge") in TIERS map, VALID_TIERS = [1, 15, 30, 45]
  • [x] src/lib/types.ts — verified: MODIFIED with 100 added to BuyInAmount union (100 | 1500 | 3000 | 4500)
  • [x] src/lib/schema.sql — verified: MODIFIED with 100 added to buy_in_amount CHECK constraint

Repo Placement

Correct. Issue filed on forgejo_admin/twitch-2k-wager, all 6 file targets in the same repo. No cross-repo scope.

Dependencies

  • [ ] Board item #813 / Forgejo issue #39 ("Checkout API: guest flow — gamertag + email") — HARD DEPENDENCY, UNDOCUMENTED. The current /api/checkout/+server.ts (line 30-38) destructures { tier, twitch_id, twitch_username, email } and returns 400 if twitch_id or twitch_username is missing. The /play guest page sends { tier, gamertag, email } with no twitch_id. Without #39 merged first, every guest checkout returns 400. Both items currently in backlog.

Acceptance Criteria

6 AC, all individually testable. AC #1-2 and #4-6 are purely frontend and verifiable by rendering. AC #3 ("Pay $X & Play button calls /api/checkout") will fail with a 400 until the backend dependency (#39) is resolved. An implementing agent cannot fully validate AC #3 without either mocking the endpoint or having #39 merged first.

Blast Radius

  • The $1 test tier addition is consistent across all three type-system files (stripe.ts: TIERS + VALID_TIERS, types.ts: BuyInAmount union, schema.sql: CHECK constraint). No mismatch detected.
  • The schema.sql CHECK constraint change (adding 100) requires a migration or ALTER TABLE on the live database. The issue does not mention a migration strategy. This is a deployment concern, not a code concern.
  • Landing page (/) CTA changes from Twitch login to gamertag entry. Twitch login preserved as optional path. The existing authenticated checkout flow (Keycloak OIDC) is unaffected — the same /api/checkout endpoint is called with the same payload shape from the auth path.
  • Rollback is straightforward — revert the branch. No database schema applied yet.

Decomposition Assessment

6 file targets in 1 repo, 6 AC. Borderline on the three-thing limit. However, the issue explicitly states code is already written locally on archbox — agent work is commit, push, and CI verification, not implementation. Estimated agent time well under 5 minutes. No independent subtasks to parallelize. No decomposition needed.

Recommendation

  • [BODY] Add a Dependencies section to the issue body documenting the hard dependency on #39 (Checkout API guest flow). The /play frontend sends { tier, gamertag, email } but the current backend requires { tier, twitch_id, twitch_username, email }. Execution order: #39 before #812, or merge both in a single branch.
  • [BODY] Add a note under Constraints about schema migration strategy for the $1 test tier — the CHECK constraint change (adding 100 to buy_in_amount) needs an ALTER TABLE or migration on the live database.