diff --git a/__tests__/lib/idea-schemas.test.ts b/__tests__/lib/idea-schemas.test.ts index 1514f5d..637ce1c 100644 --- a/__tests__/lib/idea-schemas.test.ts +++ b/__tests__/lib/idea-schemas.test.ts @@ -128,4 +128,21 @@ describe('ideaPlanMdFrontmatterSchema', () => { }) expect(r.success).toBe(false) }) + + it('accepts plan with task.priority omitted (inherits story-priority via materialize)', () => { + const r = ideaPlanMdFrontmatterSchema.safeParse({ + ...validPlan, + stories: [ + { + title: 'Story zonder task-priorities', + priority: 2, + tasks: [ + { title: 'Taak 1' }, // geen priority — moet geaccepteerd + { title: 'Taak 2', verify_required: 'ALIGNED' }, + ], + }, + ], + }) + expect(r.success).toBe(true) + }) }) diff --git a/actions/ideas.ts b/actions/ideas.ts index 94dfc4d..0a2ad09 100644 --- a/actions/ideas.ts +++ b/actions/ideas.ts @@ -738,7 +738,11 @@ export async function materializeIdeaPlanAction( title: t.title, description: t.description ?? null, implementation_plan: t.implementation_plan ?? null, - priority: t.priority, + // Erf priority van de story zodat YAML-volgorde gerespecteerd + // blijft. Worker sorteert op `priority ASC, sort_order ASC`; + // gemixte task-priorities binnen één story zouden anders de + // YAML-volgorde verstoren (zie plan-fix task-volgorde-na-upload). + priority: s.priority, sort_order: ti + 1, status: 'TO_DO', verify_required: t.verify_required ?? 'ALIGNED_OR_PARTIAL', diff --git a/lib/idea-prompts/make-plan.md b/lib/idea-prompts/make-plan.md index 86891a0..a45500b 100644 --- a/lib/idea-prompts/make-plan.md +++ b/lib/idea-prompts/make-plan.md @@ -101,7 +101,8 @@ stories: 1. Bestand X aanpassen — concrete steps 2. Test toevoegen Y 3. Verifieer Z - priority: 2 + # task.priority is optioneel en wordt door materialize GENEGEERD. + # Tasks erven story.priority; sort_order = positie in deze tasks-array. verify_required: ALIGNED_OR_PARTIAL # ALIGNED | ALIGNED_OR_PARTIAL | ANY verify_only: false # true voor pure verify-passes - title: "Taak B" @@ -142,7 +143,12 @@ Beschrijf: ## Validatie-regels die de parser afdwingt - `pbi.title`: 1–200 chars, **verplicht**. -- `pbi.priority`, `story.priority`, `task.priority`: integer 1–4. +- `pbi.priority`, `story.priority`: integer 1–4, **verplicht**. +- `task.priority`: integer 1–4, **optioneel**. **Wordt door materialize genegeerd** + ten faveure van story-priority — alle tasks binnen een story erven dezelfde + priority. Reden: worker sorteert op `priority ASC, sort_order ASC`; gemixte + task-priorities zouden de YAML-volgorde verstoren. De YAML-volgorde *is* de + execution-volgorde — daar is `sort_order` (positie in de array) voor. - Minimaal 1 story; per story minimaal 1 taak. - `implementation_plan`: max 8000 chars. - `verify_required`: enum exact `ALIGNED` | `ALIGNED_OR_PARTIAL` | `ANY`. diff --git a/lib/schemas/idea.ts b/lib/schemas/idea.ts index 4be1553..a8a32f2 100644 --- a/lib/schemas/idea.ts +++ b/lib/schemas/idea.ts @@ -20,11 +20,16 @@ export type IdeaUpdateInput = z.infer const verifyRequiredEnum = z.enum(['ALIGNED', 'ALIGNED_OR_PARTIAL', 'ANY']) +// Task-level priority is geaccepteerd in het schema voor backward-compat, +// maar wordt door `materializeIdeaPlanAction` genegeerd ten faveure van +// story-priority. Reden: worker sorteert op `priority ASC, sort_order ASC` +// — gemixte task-priorities binnen één story zouden de YAML-volgorde +// verstoren. Auteurs hoeven het veld dus niet meer in te vullen. const planTaskSchema = z.object({ title: z.string().min(1).max(200), description: z.string().max(4000).optional(), implementation_plan: z.string().max(8000).optional(), - priority: z.number().int().min(1).max(4), + priority: z.number().int().min(1).max(4).optional(), verify_required: verifyRequiredEnum.optional(), verify_only: z.boolean().optional(), })