0009 - Output Schema Rules With Findings
Context¶
The renderer in internal/report/report.go emits summary.rules_with_findings
in JSON output. However, schemas/output.schema.json declares
additionalProperties: false on the summary object and does not list the
field. Any strict JSON Schema validation of archfit output therefore fails.
This was tracked as CLAUDE.md §7.2 and PROJECT.md §3.2.
Decision¶
- Add
rules_with_findings(integer, minimum 0) tosummary.propertiesinschemas/output.schema.jsonand mark it as required. - Add
llm_suggestion(optional object) tofindings.items.propertiesto cover the--with-llmenrichment that was also undeclared. - Bump
OutputSchemaVersionfrom0.1.0to0.2.0. Per the pre-1.0 stability rules (CLAUDE.md §12), additive field changes are a minor bump. - Add a CI-runnable schema conformance test (
internal/report/schema_test.go) that validates every goldenexpected.jsonagainst the schema. This prevents future drift. - Use
github.com/santhosh-tekuri/jsonschema/v6as the validator — a pure-Go, zero-dependency JSON Schema implementation supporting draft 2020-12. This was already listed indocs/dependencies.mdas planned.
Consequences¶
- Every current and future
expected.jsongolden file must validate against the schema. Adding a field to the renderer without updating the schema will break the build. - Consumers of
--jsonoutput that parseschema_versionshould accept0.2.0. The only change is the newrules_with_findingsfield insummary— no fields were renamed, removed, or retyped. - One new test-time dependency:
github.com/santhosh-tekuri/jsonschema/v6. It has zero transitive dependencies of its own.