feat(validation): enforce array minItems/items in artifact schemas (role-reliability §3)
The JSON-schema artifact validator enforced `required` keys but not array
contents, so a model could emit `"requirements": []` (or `"steps": []`,
`"components": []`) and pass — a misread brief sailing through as a valid
artifact. That empty-list gap is the hole under role-reliability §3's
keystone ("force the analyst to define done; verifiability propagates
downstream").
- JsonSchemaProperty gains `minItems` and `items` (recursive), letting a
schema declare a required-non-empty / element-typed array.
- JsonSchemaValidator checks array length >= minItems and each element's
declared item type (with index in the message). Pure + deterministic;
single-return to stay within the detekt ReturnCount budget.
- Role-pipeline schemas tightened: analysis.requirements, design.components,
impl_plan.steps → minItems 1 + items string. Prompt-free — these arrays
were already `required`; this only forbids them being empty.
§4 (force a non-empty `alternativesConsidered` on the architect) is
deliberately NOT taken: it contradicts the standing "don't raise
alternatives unnecessarily" preference the architect prompt already encodes.
This commit is contained in:
@@ -7,7 +7,9 @@
|
||||
},
|
||||
"requirements": {
|
||||
"type": "array",
|
||||
"description": "concrete requirements / acceptance criteria, one per item"
|
||||
"description": "concrete requirements / acceptance criteria, one per item",
|
||||
"minItems": 1,
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"affected_areas": {
|
||||
"type": "array",
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
},
|
||||
"components": {
|
||||
"type": "array",
|
||||
"description": "components/files to add or change, one per item"
|
||||
"description": "components/files to add or change, one per item",
|
||||
"minItems": 1,
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"risks": {
|
||||
"type": "array",
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
"properties": {
|
||||
"steps": {
|
||||
"type": "array",
|
||||
"description": "ordered, individually verifiable implementation steps, one per item"
|
||||
"description": "ordered, individually verifiable implementation steps, one per item",
|
||||
"minItems": 1,
|
||||
"items": { "type": "string" }
|
||||
},
|
||||
"verification": {
|
||||
"type": "array",
|
||||
|
||||
Reference in New Issue
Block a user