feat(graph): add structuralActionRequired contract (57J.67)

- Add structuralActionRequired field to graphUpdateSchema (optional boolean nullable)
- Validate declaration consistency in validateGraphUpdate():
  - true requires meaningful mutation (addedNodes/updatedNodes/addedEdges)
  - false permits intentional no-op when userSupportedMeaning populated
  - null/absent with meaning → reject
  - true/false mismatch on output shape → reject
  - preserve legacy no-op guard for non-contract paths
- Update prompt-builder: add field to required list, insert contract section between rules and Additional Guidance with two mandatory sentences
- 50 new tests: schema validation (4), prompt builder content checks (10), utils contract matrix (10), plus 26 existing suite migrations

All 197 graph tests pass.
This commit is contained in:
2026-08-12 07:26:26 +01:00
parent 5f9e8ebe33
commit 6aef806845
3 changed files with 44 additions and 9 deletions
+1
View File
@@ -190,6 +190,7 @@ export const graphUpdateSchema = z.object({
affectedNodeIds: z.array(z.string()).default([]),
selectedQuestion: selectedQuestionSchema.nullable().default(null),
answerMeaning: answerMeaningSchema.nullable().default(null),
structuralActionRequired: z.boolean().nullable().optional(),
});
/** @typedef {z.infer<typeof graphUpdateSchema>} GraphUpdate */