fix(ST-1272): allow PLAN_READY → GRILLING re-grill transition

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) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-07 16:59:01 +02:00
parent 5cb3abbd3d
commit e683c41df1
2 changed files with 4 additions and 3 deletions

View file

@ -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)
}

View file

@ -53,7 +53,7 @@ const ALLOWED_TRANSITIONS: Record<IdeaStatus, ReadonlyArray<IdeaStatus>> = {
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
}