Scrum4Me/actions
Madhura68 6fee0394c5 actions: materializeIdeaPlanAction + relinkIdeaPlanAction (M12 T-498)
actions/ideas.ts:
- materializeIdeaPlanAction(id):
  - guard: status===PLAN_READY, plan_md present, product linked, demo-403
  - parsePlanMd → 422 with line-info on fail
  - Prisma.\$transaction:
    - SELECT max(code) for PBI/Story/Task within product
    - INSERT PBI with sort_order = lastPbi+1 within priority
    - per story: INSERT (sequential ST-NNN), per task: INSERT (T-N)
    - UPDATE idea SET pbi_id, status=PLANNED
    - INSERT IdeaLog{PLAN_RESULT, metadata}
  - returns 409 on P2002 (concurrent-materialize race)
- relinkIdeaPlanAction(id):
  - guard: status===PLANNED && pbi_id===null (PBI manually deleted via SetNull FK)
  - reverts to PLAN_READY + IdeaLog{NOTE}

Tests: 39 cases total (8 new for materialize + relink): happy creates entities,
status-mismatch-422, parse-fail-422 with details, demo-403, P2002→409,
relink happy + invalid-precondition guards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 19:51:18 +02:00
..
active-product.ts feat(M9): active product backlog — persistent active PB, NavBar splits, sprint card styling (#10) 2026-04-27 20:25:13 +02:00
api-tokens.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
auth.ts feat(ST-1135): UA-redirect bij login — phone naar /m/* (T-322/T-323/T-324) 2026-05-04 10:09:09 +02:00
claude-jobs.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
ideas.ts actions: materializeIdeaPlanAction + relinkIdeaPlanAction (M12 T-498) 2026-05-04 19:51:18 +02:00
pairing.ts M10: Password-loze inlog via QR-pairing (ST-1001..ST-1008) (#12) 2026-04-28 00:01:04 +02:00
pbis.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
products.ts fix(demo): close 3 demo-policy gaps in mutation actions (before-launch) 2026-05-04 14:14:01 +02:00
profile.ts feat(ST-507): persist email in updateProfileAction with Zod validation 2026-04-26 19:37:49 +02:00
questions.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
sprints.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
stories.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
tasks.ts feat(rate-limit): per-user mutation-rate-limiting (v1-readiness #3) 2026-05-04 13:48:59 +02:00
todos.ts fix(demo): close 3 demo-policy gaps in mutation actions (before-launch) 2026-05-04 14:14:01 +02:00