Repository navigation
Versioned JSON result contract (v1) - #95
Merged
Merged
Conversation
JsonViolationReporter now serialises an explicit ValidationReportV1 DTO built by ValidationReportMapper, instead of the internal ValidationResult. The output gains schemaVersion, toolVersion, durationMs and a metrics block. Status keeps its existing wire values. A JSON Schema (draft 2020-12) is embedded in CodeGuard.Reporting and reporter output is tested against it. This is a breaking change to --format json: the rule counts moved under metrics. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix
Adds docs/architecture/RESULT_CONTRACT.md, links it from the docs index and USAGE, records the design in IMPLEMENTATION_STATUS, and narrows the open result-contract item in the docs index to CI governance. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix
james-d12
force-pushed
the
feature/json-result-contract-66
branch
from
October 13, 2026 14:45
b9cc1dc to
323f5ee
Compare
james-d12
enabled auto-merge (squash)
October 13, 2026 19:27
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #66
Summary
validate --format jsonno longer serialises the internalValidationResult. It writes an explicit, versionedValidationReportV1DTO (CodeGuard.Reporting/Contracts/), built byValidationReportMapper.ToV1.schemaVersion("1.0"),toolVersion,durationMs, and ametricsblock.statuskeeps the existing values:passed,failed,partiallyEvaluated.CodeGuard.Reporting/Schemas/validation-report.v1.schema.json, embedded as a resource. Every object hasadditionalProperties: false.docs/architecture/RESULT_CONTRACT.md(shape, field meanings, versioning policy), linked fromdocs/USAGE.mdanddocs/README.md.This is a breaking change to
--format json. The rule counts (rulesEvaluated,rulesPassed,rulesFailed,rulesErrored) moved undermetrics. Violation and error field names are unchanged.Sample output
{ "schemaVersion": "1.0", "toolVersion": "0.1.4-alpha.0.27", "status": "failed", "evaluatedAtUtc": "2026-10-13T14:42:10.7202958+00:00", "durationMs": 6705, "metrics": { "rulesEvaluated": 11, "rulesPassed": 7, "rulesFailed": 4, "rulesErrored": 0, "violationCount": 4, "violationsBySeverity": { "info": 0, "warning": 0, "error": 3, "critical": 1 }, "evaluationErrorCount": 0, "analysisWarningCount": 0 }, "violations": [ { "ruleId": "DDD-ENTITY-001", "ruleVersion": 1, "severity": "error", "...": "..." } ], "evaluationErrors": [], "analysisWarnings": [] }Design decisions
--severity-thresholdresult, the same as before. It describes the report, not the exit code.--fail-oncan still give exit 0 withstatus: "failed".durationMsis an integer, measured from the start of thevalidateaction until just before the report is written. Library callers that do not measure get0.toolVersioncomes from the CLI assembly's informational version with the+commitsuffix stripped.Reportingcannot read it itself because MinVer is only on the CLI project.JsonViolationReporterconstructor, notIViolationReporter.WriteAsync, so the other reporters are untouched.switchexpressions, so renaming an internal enum member cannot change the wire format.file,line,symbol, ...) are omitted when unknown, as before.line/columnmay be0for unknown locations, so the schema allows0.Not in v1 (deferred)
From roadmap section 15:
rulesVersion,repository,commit,branch, and a separatetimestamp. Also not included: projects and types analysed. None of these is onValidationResult, so they need run context passed into the reporter.Test plan
dotnet build: 0 errors, 0 warningsdotnet test: 945 passed (1 + 220 + 49 + 460 + 7 + 117 + 67 + 24 across 8 projects)dotnet format --verify-no-changes: cleanvalidate --format jsonon the integration fixture: output shape confirmed by hand🤖 Generated with Claude Code
https://claude.ai/code/session_01Xouw37Lmze9pVQhpCJZKix