Render generic finding confidence and resolution guidance

This commit is contained in:
Dandaedre 2026-09-16 18:05:30 +02:00
parent 1cb6cba4c0
commit da2882b4f8
Signed by: Dandaedre
GPG Key ID: 440C6592E8A26D99
4 changed files with 35 additions and 4 deletions

View File

@ -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

View File

@ -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": {

View File

@ -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: ()) {

View File

@ -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) <validated>