From da2882b4f8e08ef5f964377bf53bab0d25197866 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 16 Sep 2026 18:05:30 +0200 Subject: [PATCH] Render generic finding confidence and resolution guidance --- docs/report-contract.md | 4 +++- schema/report.schema.json | 17 +++++++++++++++++ templates/report.typ | 12 ++++++++++-- tools/validate.typ | 6 +++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/report-contract.md b/docs/report-contract.md index dafd0d4..8dbcb3f 100644 --- a/docs/report-contract.md +++ b/docs/report-contract.md @@ -56,7 +56,9 @@ Optional fields retain useful legacy structure: - `metrics`: up to four supplied label/value cards with an optional severity tone. - `timeline`: rows with `time`, `event`, optional `notes`. - `findings`: title, optional ID/severity/status, separate `evidence` and `assessment`, - and optional `evidence_refs` containing artifact, JSON pointer, and optional label. + optional numeric `confidence` (0–100), `resolution_steps`, HTTPS `reference_url` + and `reference_label`, and optional `evidence_refs` containing artifact, JSON + pointer, and optional label. - `sections`, `appendices`: titled sections containing generic content blocks. - `actions_title`, `actions`: action titles, optional status/text/command strings. - `provenance`: generic source records with artifact and optional SHA-256/schema diff --git a/schema/report.schema.json b/schema/report.schema.json index 5e6d56c..e9fa5d5 100644 --- a/schema/report.schema.json +++ b/schema/report.schema.json @@ -226,6 +226,23 @@ "type": "string", "pattern": "\\S" }, + "confidence": { + "type": "number", + "minimum": 0, + "maximum": 100 + }, + "resolution_steps": { + "type": "array", + "items": {"type": "string", "pattern": "\\S"} + }, + "reference_url": { + "type": "string", + "pattern": "^https://" + }, + "reference_label": { + "type": "string", + "pattern": "\\S" + }, "evidence_refs": { "type": "array", "items": { diff --git a/templates/report.typ b/templates/report.typ index bfe4400..377ed2f 100644 --- a/templates/report.typ +++ b/templates/report.typ @@ -140,12 +140,20 @@ heading("Findings") for finding in report.findings { block(width: 100%, inset: 8pt, below: 6pt, breakable: false, stroke: 0.5pt + line-color, radius: 2pt)[ - #grid(columns: (1fr, auto, auto), gutter: 5pt, align: (left, center, center), + #grid(columns: (1fr, auto, auto, auto), gutter: 5pt, align: (left, center, center, center), text(weight: "bold")[#as-text(finding.title)], if "severity" in finding { badge(finding.severity) } else { [] }, - if "status" in finding { badge(finding.status) } else { [] }) + if "status" in finding { badge(finding.status) } else { [] }, + if "confidence" in finding { badge(str(finding.confidence) + "% confidence") } else { [] }) #if "evidence" in finding { parbreak(); text(size: 8pt, weight: "bold", fill: muted)[EVIDENCE]; parbreak(); as-text(finding.evidence) } #if "assessment" in finding { parbreak(); text(size: 8pt, weight: "bold", fill: muted)[ASSESSMENT]; parbreak(); as-text(finding.assessment) } + #if "resolution_steps" in finding and finding.resolution_steps.len() > 0 { + parbreak(); text(size: 8pt, weight: "bold", fill: muted)[RESOLUTION PATH] + parbreak(); enum(..finding.resolution_steps.map(step => [#as-text(step)])) + } + #if "reference_url" in finding { + parbreak(); link(finding.reference_url)[#as-text(get(finding, "reference_label", default: "Reference guidance")) ↗] + } ] } } #for section in get(report, "sections", default: ()) { diff --git a/tools/validate.typ b/tools/validate.typ index a636e7f..1125c1d 100644 --- a/tools/validate.typ +++ b/tools/validate.typ @@ -77,7 +77,11 @@ #let finding-ids = findings.filter(item => "id" in item).map(item => item.id) #assert(finding-ids.dedup().len() == finding-ids.len(), message: "duplicate finding ID") #for finding in findings { - assert(keys-allowed(finding, ("id", "title", "severity", "status", "evidence", "assessment", "evidence_refs")) and nonempty(finding.at("title", default: none)), message: "invalid finding") + assert(keys-allowed(finding, ("id", "title", "severity", "status", "evidence", "assessment", "evidence_refs", "confidence", "resolution_steps", "reference_url", "reference_label")) and nonempty(finding.at("title", default: none)), message: "invalid finding") + if "confidence" in finding { assert(type(finding.confidence) in (int, float) and finding.confidence >= 0 and finding.confidence <= 100, message: "invalid finding confidence") } + if "resolution_steps" in finding { assert(type(finding.resolution_steps) == array and finding.resolution_steps.all(nonempty), message: "invalid resolution steps") } + if "reference_url" in finding { assert(type(finding.reference_url) == str and finding.reference_url.starts-with("https://"), message: "invalid reference URL") } + if "reference_label" in finding { assert(nonempty(finding.reference_label), message: "invalid reference label") } } #metadata(true)