Skip to content

feat(audit): stable, versioned JSON report contract (#385) - #386

Merged
lex00 merged 1 commit into
mainfrom
feat/audit-stable-json-contract
Jun 16, 2026
Merged

lex00 merged 1 commit into
mainfrom
feat/audit-stable-json-contract

Conversation

@lex00

@lex00 lex00 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Part of #350. Closes #385. Answers the "tools parsing this could break" concern, especially around the report metadata.

What

  • Versioned JSON envelope for --format json: { schemaVersion: "1.0", tool, snapshot, summary, findings[] } (was the unversioned { scanned, findings }).
  • The snapshot (host/repo/commit/files/timestamp/version) is now part of the machine-readable contract, not just rendered into HTML.
  • Each finding carries tier/fixKind/title/remediation/authority so consumers filter without re-deriving from the catalog.
  • The same JSON is embedded in the HTML report (<script type="application/json" id="chant-audit-report">, <-escaped) — expanded report is human- and machine-readable.

Stability policy (documented)

Additive fields keep the major; renames/removals bump schemaVersion; consumers check the major and ignore unknown fields. SARIF recommended for maximum stability. Shared report-model.ts builds both the JSON and the rendered reports, so they stay consistent.

Pre-release, so changing the json shape now to establish the contract is intentional.

77 audit tests (envelope shape, embedded-and-escaped HTML data, snapshot in JSON); tsc, eslint, astro build green.

--format json now emits a versioned envelope { schemaVersion, tool, snapshot,
summary, findings[] } instead of the unversioned { scanned, findings }. The
provenance snapshot is part of the contract, and each finding carries
tier/fixKind/title/remediation/authority so consumers can filter without
re-deriving. The same JSON is embedded in the HTML report
(<script type="application/json" id="chant-audit-report">, <-escaped) so the
expanded report is human- and machine-readable.

Stability: additive changes keep the major; rename/remove bumps schemaVersion;
consumers check the major and ignore unknown fields; SARIF recommended for max
stability. Documented in docs/cli/audit.

Closes #385
@lex00
lex00 merged commit 04ac626 into main Jun 16, 2026
6 checks passed
@lex00
lex00 deleted the feat/audit-stable-json-contract branch June 16, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(audit): stable, versioned JSON report contract for tool consumers

1 participant