From e683c41df1355c992df549c1105b28fc9ca5d485 Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Thu, 7 May 2026 16:59:01 +0200 Subject: [PATCH] =?UTF-8?q?fix(ST-1272):=20allow=20PLAN=5FREADY=20?= =?UTF-8?q?=E2=86=92=20GRILLING=20re-grill=20transition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit actions/ideas.ts already lists PLAN_READY in GRILL_TRIGGERABLE_FROM, but lib/idea-status.ts ALLOWED_TRANSITIONS was missing the PLAN_READY → GRILLING edge. As a result, clicking Grill on a PLAN_READY idea returned 422 "Status-transitie ongeldig" while the UI button was enabled. Mirrors the existing PLANNED → GRILLING re-grill behaviour. - lib/idea-status.ts: PLAN_READY allows GRILLING in addition to PLANNING/PLANNED - __tests__/lib/idea-status.test.ts: explicit assert for PLAN_READY → GRILLING and PLAN_READY added to the regrill loop covering every GRILL_TRIGGERABLE_FROM status Co-Authored-By: Claude Opus 4.7 (1M context) --- __tests__/lib/idea-status.test.ts | 5 +++-- lib/idea-status.ts | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__tests__/lib/idea-status.test.ts b/__tests__/lib/idea-status.test.ts index 9bedd32..b72692c 100644 --- a/__tests__/lib/idea-status.test.ts +++ b/__tests__/lib/idea-status.test.ts @@ -41,6 +41,7 @@ describe('canTransition', () => { it('allows re-grill from GRILLED and PLAN_READY-ish states', () => { expect(canTransition('GRILLED', 'GRILLING')).toBe(true) expect(canTransition('PLAN_FAILED', 'PLANNING')).toBe(true) + expect(canTransition('PLAN_READY', 'GRILLING')).toBe(true) }) it('allows fail-side transitions', () => { @@ -60,8 +61,8 @@ describe('canTransition', () => { }) it('canTransition to GRILLING from all statuses that allow re-grill', () => { - // DRAFT, GRILLED, GRILL_FAILED, PLANNED are in GRILL_TRIGGERABLE_FROM and support the transition. - const regrill = ['DRAFT', 'GRILLED', 'GRILL_FAILED', 'PLANNED'] as const + // GRILL_TRIGGERABLE_FROM in actions/ideas.ts — alle statussen die re-grill ondersteunen. + const regrill = ['DRAFT', 'GRILLED', 'GRILL_FAILED', 'PLAN_READY', 'PLANNED'] as const for (const status of regrill) { expect(canTransition(status, 'GRILLING')).toBe(true) } diff --git a/lib/idea-status.ts b/lib/idea-status.ts index 1cc94b2..e513245 100644 --- a/lib/idea-status.ts +++ b/lib/idea-status.ts @@ -53,7 +53,7 @@ const ALLOWED_TRANSITIONS: Record> = { GRILLED: ['GRILLING', 'PLANNING'], PLANNING: ['PLAN_READY', 'PLAN_FAILED'], PLAN_FAILED: ['PLANNING', 'GRILLED'], - PLAN_READY: ['PLANNING', 'PLANNED'], + PLAN_READY: ['PLANNING', 'PLANNED', 'GRILLING'], // GRILLING via startGrillJobAction (re-grill) PLANNED: ['PLAN_READY', 'GRILLING'], // PLAN_READY via relinkIdeaPlanAction; GRILLING via startGrillJobAction }