Review: Challenge Links — Shareable Proposal URLs

review-852-2026-04-05 Doc

review needs-refinement

Verdict: NEEDS_REFINEMENT

Template Completeness

  • [x] Type — Feature
  • [x] Lineage — V2 ticket, depends on #67 and #69, part of #66
  • [x] Repo — forgejo_admin/twitch-2k-wager
  • [x] User Story — clear "As Marcus (or any player), I want to share a challenge link in Twitch chat"
  • [x] Context — thorough two-scenario explanation (viewer initiates vs Marcus initiates)
  • [x] File Targets — 4 files listed with annotations (UPDATE/NEW)
  • [x] Acceptance Criteria — 6 testable conditions
  • [x] Test Expectations — 5 test scenarios
  • [x] Constraints — dependencies, nanoid length, open challenge optionality noted
  • [x] Checklist — standard 3-item PR checklist
  • [x] Related — links to #66, #67, #69, #70
All required sections present. Template is complete.

Traceability

  • [x] story:player-propose label — "My $X to your $Y sent in under 5 seconds. Proposal visible to both sides immediately."
  • [x] story note verified — found in project-twitch-2k-wager user-stories section
  • [x] arch:twitch-2k-wager-app label — SvelteKit app component
  • [ ] arch note MISSING — [SCOPE] Create architecture note arch-twitch-2k-wager-app for the SvelteKit frontend component
  • [x] Forgejo issue — forgejo_admin/twitch-2k-wager#74, open

File Targets

  • [ ] src/routes/api/propose/+server.ts — ISSUE: marked UPDATE but file does NOT exist on main. This route is created by dependency #69 (proposal API). Ticket should clarify this is UPDATE after #69 lands, or change to NEW if #74 creates the initial route.
  • [x] src/routes/challenge/[code]/+page.server.ts — NEW file, parent directory does not exist yet. Correct for new route.
  • [x] src/routes/challenge/[code]/+page.svelte — NEW file. Correct for new route.
  • [ ] src/lib/schema.sql — ISSUE: File exists but contains V1 schema (challenger/game model with fixed tiers). No proposals table exists. Adding challenge_code TEXT UNIQUE to proposals table requires #67 (v2 schema) to land first. Ticket should note: "after #67 lands, proposals table will exist."

Repo Placement

OK. Issue filed on forgejo_admin/twitch-2k-wager, all file targets are in the same repo. Single-repo change. No multi-repo concerns.

Dependencies

  • #67 (v2 schema — player pools, proposals) — board item 845, backlog, open. HARD DEPENDENCY: proposals table must exist before challenge_code column can be added.
  • #69 (proposal API — propose, accept, counter, decline) — board item 847, backlog, open. HARD DEPENDENCY: /api/propose route must exist before this ticket can UPDATE it. /api/accept must exist for challenge page accept flow.
  • #70 (dashboard shows challenge links) — board item 848, backlog. DOWNSTREAM: consumes challenge URLs generated by this ticket.
Dependencies are documented in the issue (Lineage + Constraints sections). Both hard dependencies are in backlog and must be completed first. Execution order: #67 then #69 then #74 then #70.

Acceptance Criteria

6 criteria, all testable by an agent:
  • [x] "Every proposal generates a unique challenge_code and URL" — verifiable via API call + response check
  • [x] "/challenge/[code] shows proposal terms to the right player" — verifiable via page load with auth
  • [x] "Unauthenticated visitors redirected to login" — verifiable via unauthenticated request + redirect check
  • [x] "Accept on challenge page calls /api/accept" — verifiable, but depends on #69 accept endpoint existing
  • [x] "Invalid/expired challenge codes show friendly error" — verifiable via bad code request
  • [x] "Open challenges (no to_player) can be claimed by first clicker" — verifiable, noted as optional in constraints
All criteria are specific and testable. No ambiguous language. Test expectations align with AC.

Blast Radius

Low. No existing challenge/invite/shareable-URL patterns in the codebase. This is a clean new feature addition. No sibling services affected. The /challenge route is a new namespace with no collision risk. Rollback is straightforward — remove the new route and revert the schema column addition.

Decomposition Assessment

4 file targets in 1 repo. 6 AC. 5 test expectations. All within one SvelteKit app. The work is: add a column to schema, modify one API route, create two new route files (server + page). Estimated agent time approximately 5 minutes. Borderline but acceptable as a single agent pass since all changes are tightly coupled and in one repo. No decomposition needed.

Recommendation

  • [BODY] Fix file target annotation: src/routes/api/propose/+server.ts is marked UPDATE but does not exist yet. Clarify: "UPDATE (after #69 lands creates this file)" so the executing agent understands the dependency.
  • [BODY] Add note to schema file target: "After #67 lands, proposals table will exist — this ticket adds challenge_code column to that table."
  • [SCOPE] Create architecture note arch-twitch-2k-wager-app for the SvelteKit frontend component in pal-e-docs.