New diagnostics & analysis

This commit is contained in:
Dandaedre 2026-09-15 12:20:13 +02:00
parent 2c2dc39d7a
commit e4aa5d55ac
12 changed files with 19505 additions and 50 deletions

3
Jenkinsfile vendored
View File

@ -84,6 +84,9 @@ pipeline {
.ci-venv/bin/python -c "import pyzipper"
command -v python3
typst compile --root . tools/check-diagnostics.typ /tmp/check-diagnostics.pdf
for fixture in tools/fixtures/*.json; do
typst compile --root . --input diagnostics="$fixture" --input author="CI validation" diagnostics.typ /tmp/check-diagnostics-render.pdf
done
'''
}
}

View File

@ -54,7 +54,7 @@ Compilation stops with an actionable error if `metadata.Date` or
### Generate a Windows diagnostics assessment
Convert a Full WinDiagnostics text dump into a concise, exception-focused PDF:
Convert a WinDiagnostics schema 1 or 2 JSON capture into a concise, exception-focused PDF:
```bash
./render-diagnostics.sh diagnostics/windows_system_report_PC.json "Your Name" cic

View File

@ -77,7 +77,7 @@
#let finding-card(theme, finding, show-remediation: true, target-index: none, link-index: none) = {
let tone = severity-color(theme, get(finding, "severity", "info"))
if target-index != none { [#metadata("finding") #finding-target(target-index)] }
block(width: 100%, breakable: false, inset: 7pt, radius: 3pt,
block(width: 100%, breakable: true, inset: 7pt, radius: 3pt,
stroke: (left: 2.5pt + tone, top: .5pt + line-color(theme), right: .5pt + line-color(theme), bottom: .5pt + line-color(theme)),
)[
#grid(columns: (1fr, auto), gutter: 6pt,
@ -121,7 +121,7 @@
v(5pt)
}
#let evidence(theme, item) = block(width: 100%, breakable: false, below: 6pt)[
#let evidence(theme, item) = block(width: 100%, breakable: true, below: 6pt)[
#let tone = severity-color(theme, get(item, "severity", "info"))
#text(size: 9pt, weight: "bold", fill: tone)[#get(item, "title", "Evidence")]
#v(3pt)
@ -159,7 +159,7 @@
let health-score = get(data, "health_score", 0)
let analysis-confidence = get(data, "analysis_confidence", 50)
let assessment-tone = if critical > 0 { color(theme, "critical") } else if warnings > 0 { color(theme, "warning") } else { color(theme, "success") }
let health-tone = if health-score < 50 { color(theme, "critical") } else if health-score < 75 { color(theme, "warning") } else { color(theme, "success") }
let health-tone = if get(data, "collection_incomplete", false) { color(theme, "warning") } else if health-score < 50 { color(theme, "critical") } else if health-score < 75 { color(theme, "warning") } else { color(theme, "success") }
// Page 1: deliberately short and decision-oriented.
text(size: 7.5pt, weight: "bold", fill: muted(theme))[SECTION 01 · EXECUTIVE OVERVIEW]
@ -168,7 +168,7 @@
#text(size: 22pt, weight: "bold", fill: accent(theme))[Windows diagnostic assessment]
#v(3pt)
#text(size: 10.5pt, fill: muted(theme))[
#get(data, "computer", "Unknown computer") · #get(data, "mode", "Unknown") collection
#get(data, "computer", "Unknown computer") · #get(data, "mode", "Unknown") collection · Administrator: #get(data, "administrator", "Unknown")
]
]
@ -188,10 +188,14 @@
metric(theme, "Analysis confidence", str(analysis-confidence) + "%"),
)
v(5pt)
if get(data, "collection_incomplete", false) {
text(size: 8pt, weight: "bold", fill: color(theme, "warning"))[Collection is partial. The score covers observed signals only; unavailable checks cannot establish health. Confidence is capped at 50%.]
}
v(7pt)
panel(theme, stroke: health-tone)[
#grid(columns: (1fr, auto),
[#text(size: 8pt, weight: "bold", fill: ink(theme))[HEALTH ANALYSIS]],
[#text(size: 8pt, weight: "bold", fill: ink(theme))[#if get(data, "collection_incomplete", false) { [OBSERVED SIGNAL SCORE · PARTIAL COLLECTION] } else { [HEALTH ANALYSIS] }]],
[#text(size: 15pt, weight: "bold", fill: health-tone)[#health-score / 100]],
)
#v(4pt)
@ -237,9 +241,11 @@
pagebreak()
heading(theme, "Correlated event evidence")
for event in get(data, "event_groups", ()).filter(item => get(item, "severity", "info") != "info") {
[Requested history: #get(get(data, "parameters", (:)), "event_log_days", 7) days; configured maximum: #get(get(data, "parameters", (:)), "max_event_errors", 100) per log. Returned Windows levels: #get(data, "event_counts", (:)).pairs().map(pair => pair.at(0) + ": " + str(pair.at(1))).join(", "). Counts describe captured records; see coverage for truncation and unavailable logs.]
v(5pt)
for event in get(data, "event_groups", ()) {
let tone = severity-color(theme, get(event, "severity", "info"))
block(width: 100%, breakable: false, below: 5pt, inset: 6pt, fill: tone.lighten(95%), stroke: (left: 2.5pt + tone, top: .4pt + line-color(theme), right: .4pt + line-color(theme), bottom: .4pt + line-color(theme)), radius: 2pt)[
block(width: 100%, breakable: true, below: 5pt, inset: 6pt, fill: tone.lighten(95%), stroke: (left: 2.5pt + tone, top: .4pt + line-color(theme), right: .4pt + line-color(theme), bottom: .4pt + line-color(theme)), radius: 2pt)[
#grid(columns: (1fr, auto), gutter: 5pt,
[*#get(event, "provider", "Unknown")* · Event #get(event, "id", "?")],
[#badge(get(event, "severity", "info"), tone) #h(3pt) #badge(str(get(event, "count", 1)) + "×", tone)],
@ -248,7 +254,7 @@
#text(size: 8pt)[#get(event, "message", "")]
#if get(event, "rationale", "") != "" { v(2pt); text(size: 7.5pt, style: "italic", fill: tone)[#get(event, "rationale", "")] }
#v(1pt)
#text(size: 7pt, fill: muted(theme))[Latest captured: #get(event, "display_time", get(event, "time", "Unknown"))]
#text(size: 7pt, fill: muted(theme))[Log: #get(event, "log", "Unknown") · Windows level: #str(get(event, "level", "Unknown")) (#get(event, "level_display", "Unknown")) · Latest captured: #get(event, "display_time", get(event, "time", "Unknown"))]
]
}
@ -306,10 +312,13 @@
},
table.header([Collector section], [Treatment], [Records]),
..get(data, "coverage", ()).map(item => (
[#get(item, "section", "")], [#get(item, "use", "")], [#get(item, "records", 0)],
[#get(item, "section", "")], [#get(item, "use", "")], [#if get(item, "records", 0) == "Unavailable" { [—] } else { get(item, "records", 0) }],
)).flatten(),
)
v(3pt)
text(size: 7pt, fill: muted(theme))[— = unavailable record count.]
v(8pt)
text(size: 7pt, fill: muted(theme))[
Source: #get(data, "source", "Unknown"). This synthesis is heuristic: it prioritizes exceptions and suppresses routine inventory, but does not replace targeted diagnosis.

View File

@ -1,4 +1,4 @@
// Pure-Typst normalizer for WinDiagnostics schema_version 1 JSON reports.
// Pure-Typst normalizer for WinDiagnostics schema_version 1 and 2 JSON reports.
//
// The collector now emits structured JSON. This file intentionally does not
// reconstruct tables or parse presentation text. It only performs reporting
@ -14,6 +14,16 @@
if matched == none or dict.at(matched) == none { default } else { dict.at(matched) }
}
}
#let value-text(value) = {
if type(value) == dictionary {
value.pairs().map(pair => pair.at(0) + ": " + value-text(pair.at(1))).join("; ")
} else if type(value) == array {
value.map(value-text).join("\n")
} else if value == none { "Unknown" }
else if value == true { "Yes" }
else if value == false { "No" }
else { str(value) }
}
#let enabled(value) = value == true or value == 1
#let legacy-incomplete(report, name) = {
let value = get(get(report, "sections", (:)), name, (:))
@ -34,7 +44,7 @@
#let section-data(report, name) = get(section(report, name), "data", ()).filter(item => get(item, "text", none) == none)
#let section-first(report, name) = first(section-data(report, name))
#let section-count(report, name) = if legacy-incomplete(report, name) { "Unavailable" } else { get(section(report, name), "count", 0) }
#let section-count(report, name) = if legacy-incomplete(report, name) or get(section(report, name), "status", "missing") != "ok" { "Unavailable" } else { get(section(report, name), "count", "Unknown") }
#let section-status(report, name) = get(section(report, name), "status", "missing")
#let number(value, default: 0.0) = {
@ -146,12 +156,19 @@
}
}
#let event-sections(report) = {
let names = get(report, "sections", (:)).keys()
(
(if "recent_system_events" in names { "recent_system_events" } else { "recent_system_errors" }, "System"),
(if "recent_application_events" in names { "recent_application_events" } else { "recent_application_errors" }, "Application"),
("code_integrity", "Code Integrity"),
)
}
#let windows-level(level) = if level == 1 { "Critical" } else if level == 2 { "Error" } else if level == 3 { "Warning" } else if level == 4 { "Information" } else if level == 5 { "Verbose" } else { "Unknown" }
#let raw-events(report) = {
let events = ()
for (section-name, log-name) in (
("recent_system_errors", "System"),
("recent_application_errors", "Application"),
) {
for (section-name, log-name) in event-sections(report) {
for item in section-data(report, section-name) {
events.push((
time: str(get(item, "TimeCreated", "Unknown")),
@ -161,6 +178,9 @@
item.pairs().filter(pair => not (pair.at(0) in ("time_created", "id", "provider_name", "message"))).map(pair => " " + pair.at(0).replace("_", " ") + ": " + str(if pair.at(1) == none { "" } else { pair.at(1) })).join("")
} else { "" },
log: log-name,
source_section: section-name,
level: get(item, "Level", if section-name.ends-with("_errors") { 2 } else { none }),
level_display: get(item, "LevelDisplayName", "Unknown"),
))
}
}
@ -170,15 +190,16 @@
#let group-events(events, rules, reference-day: none) = {
let groups = ()
for event in events {
let index = groups.position(group => group.provider == event.provider and group.id == event.id)
let index = groups.position(group => group.provider == event.provider and group.id == event.id and get(group, "log", "") == get(event, "log", "") and get(group, "level", none) == get(event, "level", none))
if index == none {
let item = event
item.message = event-summary(event)
item.insert("count", 1)
item.insert("messages", (item.message,))
item.insert("occurrences", (event,))
let rule = event-rule(rules, event)
let fading = fade-weight(rule, event.time, reference-day)
item.insert("severity", if rule == none { get(rules, "unknown_event_severity", "unanalysed") } else { get(rule, "severity", "unanalysed") })
item.insert("severity", if rule == none and get(event, "level", none) in (4, 5) { "info" } else if rule == none { get(rules, "unknown_event_severity", "unanalysed") } else { get(rule, "severity", "unanalysed") })
item.insert("rationale", if rule == none { "FAIL TO ANALYSE — no matching rule in diagnostics-rules.yaml." } else { get(rule, "rationale", "") })
item.insert("remediation", if rule == none { "Add a reviewed provider/ID rule before attempting cleanup." } else { get(rule, "remediation", "") })
item.insert("resolution_steps", if rule == none { ("Review the raw event and add a rule to diagnostics-rules.yaml.", "Re-run the report after the rule has been reviewed.") } else { get(rule, "resolution_steps", ()) })
@ -192,6 +213,7 @@
} else {
let item = groups.at(index)
item.count += 1
item.occurrences.push(event)
let summary = event-summary(event)
if not (summary in item.messages) {
item.messages.push(summary)
@ -233,13 +255,20 @@
}
#let object-lines(item, fields) = {
fields.map(pair => pair.at(0) + ": " + str(get(item, pair.at(1), "Unknown"))).join("\n", default: "")
fields.map(pair => pair.at(0) + ": " + value-text(get(item, pair.at(1), "Unknown"))).join("\n", default: "")
}
#let normalize(report, rules: (:), source-name: "WinDiagnostics JSON") = {
let schema = get(report, "schema_version", 0)
if schema != 1 { panic("Unsupported WinDiagnostics schema_version: " + str(schema)) }
if schema not in (1, 2) { panic("Unsupported WinDiagnostics schema_version: " + str(schema) + "; supported versions: 1 and 2") }
if type(report) != dictionary { panic("Malformed WinDiagnostics report: expected a JSON object") }
if type(get(report, "sections", (:))) != dictionary { panic("Malformed WinDiagnostics sections: expected an object") }
for (name, value) in get(report, "sections", (:)).pairs() {
if type(value) != dictionary or type(get(value, "data", ())) != array {
panic("Malformed WinDiagnostics section " + name + ": expected an envelope with optional data array")
}
}
let generated-raw = get(report, "generated_at", "Unknown")
let generated = if generated-raw == "Unknown" { "Unknown" } else { display-date(generated-raw) }
let reference-day = datetime-day(generated-raw)
@ -250,6 +279,9 @@
// Full/Mid reports use sections. Compact reports use summary.
let compact = lower(mode) == "compact"
let summary = get(report, "summary", (:))
// Use available check metadata regardless of the producer's version label.
// Older Compact captures contain summary values without check envelopes.
let compact-checks = compact and get(report, "sections", (:)).len() > 0
let os = if compact { get(summary, "operating_system", (:)) } else { section-first(report, "operating_system") }
let system = if compact { get(summary, "system", (:)) } else { section-first(report, "computer_system") }
@ -272,7 +304,7 @@
findings.push((severity: "warning", title: "Collector warning", detail: str(warning), confidence: 100, weight_factor: 0))
}
for (name, value) in get(report, "sections", (:)).pairs() {
if get(value, "status", "") in ("error", "skipped") {
if get(value, "status", "missing") not in ("ok", "missing") {
findings.push((severity: "warning", title: "Collector coverage: " + name, detail: get(value, "status", "") + ": " + str(get(value, "error", "No result collected")), confidence: 100, weight_factor: 0))
}
}
@ -361,13 +393,18 @@
}
}
let problem-devices = if compact { () } else { section-data(report, "problem_devices") }
let problem-devices = if compact { () } else { section-data(report, "problem_devices").map(device => {
for (key, alias) in (("FriendlyName", "Name"), ("Class", "PNPClass"), ("InstanceId", "DeviceID")) {
if get(device, key, none) == none { device.insert(key, get(device, alias, "Unknown")) }
}
device
}) }
for device in problem-devices {
if get(device, "Class", "") == "Display" and (get(device, "ConfigManagerErrorCode", 0) == 22 or str(get(device, "Problem", "")).contains("CM_PROB_DISABLED")) {
findings.push((severity: "warning", title: str(get(device, "FriendlyName", get(device, "Name", "Display adapter"))) + " is disabled (Code 22)", detail: "The device is disabled. This does not establish GPU hardware failure or who disabled it.", confidence: 99, resolution_steps: ("Inspect the adapter status and Events tab in Device Manager.", "If it should be active, enable it, restart, and verify acceleration and workload stability.")))
}
}
if problem-devices.len() > 0 or (compact and get(get(summary, "devices", (:)), "problem_count", 0) > 0) {
if problem-devices.len() > 0 or (compact and (not compact-checks or section-status(report, "problem_devices") == "ok") and get(get(summary, "devices", (:)), "problem_count", 0) > 0) {
findings.push((
severity: "warning",
title: "Devices report problems",
@ -457,6 +494,16 @@
)
}
if compact-checks {
for (index, name) in ("installed_programs", "appx_packages", "startup_programs", "automatic_services").enumerate() {
if section-status(report, name) != "ok" { inventory.at(index).count = "Unavailable" }
}
}
// Absent sections belong only in the final coverage recap.
let inventory-names = if compact { ("installed_programs", "appx_packages", "startup_programs", "automatic_services") } else { ("installed_programs", "appx_packages", "automatic_services", "signed_drivers", "hotfixes", "non_microsoft_scheduled_tasks", "startup_programs", "active_tcp_listeners") }
if not compact or compact-checks {
inventory = inventory.enumerate().filter(pair => section-status(report, inventory-names.at(pair.at(0))) != "missing").map(pair => pair.at(1))
}
let excerpts = ()
for (name, title, fields) in (
("bios", "BIOS", (("Manufacturer", "Manufacturer"), ("Version", "Name"))),
@ -470,8 +517,32 @@
}
}
let evidence-sections = (
"signed_drivers", "system_drivers", "services", "storage_disks", "storage_pnp_devices",
"driver_store", "filter_drivers", "filter_instances", "upper_filters", "lower_filters",
"boot_configuration", "enabled_windows_features", "reliability_records", "minidumps",
)
for name in evidence-sections {
let records = section-data(report, name)
if name != "signed_drivers" and section-status(report, name) != "missing" { inventory.push((label: name.replace("_", " "), count: section-count(report, name))) }
if records.len() > 0 {
let selected = records.slice(0, calc.min(8, records.len()))
let text = selected.map(item => item.pairs().map(pair => pair.at(0) + ": " + value-text(pair.at(1))).join("\n")).join("\n\n")
let shortened = text.len() > 6000
excerpts.push((title: upper(name.replace("_", " ")), severity: "info", text: "Source: sections." + name + "; showing " + str(selected.len()) + " of " + str(records.len()) + " returned records. Presence alone does not establish fault. Full records remain in source JSON.\n" + text.slice(0, calc.min(6000, text.len())) + if shortened { "\n[Display shortened at 6000 characters; see source JSON.]" } else { "" }))
}
}
for name in ("component_store", "system_file_check") {
if section-status(report, name) != "ok" and section-data(report, name).len() > 0 {
excerpts.push((title: upper(name), severity: "warning", text: repr(section-data(report, name))))
}
}
if not compact and storage-root != (:) {
excerpts.push((title: "STORAGE SOURCES", severity: "info", text: repr(storage-root)))
}
let storage-health = get(storage-root, "storage_health", ())
let unhealthy-storage = storage-health.filter(item => lower(str(get(item, "HealthStatus", "Healthy"))) != "healthy")
let unhealthy-storage = storage-health.filter(item => lower(str(get(item, "HealthStatus", "Unknown"))) != "healthy")
if unhealthy-storage.len() > 0 {
excerpts.push((
title: "STORAGE HEALTH",
@ -539,29 +610,39 @@
)
let coverage = ()
if compact {
coverage.push((section: "summary", use: "Compact structured summary", records: 1, severity: "info"))
} else {
for (name, value) in get(report, "sections", (:)).pairs() {
let status = get(value, "status", "missing")
let count = section-count(report, name)
let use = if legacy-incomplete(report, name) { "Legacy conversion incomplete; recollect JSON" } else if status == "skipped" { "Skipped by collector" }
else if status == "error" { "Collector error retained" }
else if name in ("recent_system_errors", "recent_application_errors") { "Deduplicated findings" }
if compact { coverage.push((section: "summary", use: "Compact summary; check individual collection states", records: 1, severity: "info")) }
for (name, value) in get(report, "sections", (:)).pairs() {
let status = get(value, "status", "missing")
let event-source = event-sections(report).any(pair => pair.at(0) == name)
let use = if status != "ok" { status + ": " + str(get(value, "error", "No verified result")) }
else if legacy-incomplete(report, name) { "Legacy conversion incomplete; recollect JSON" }
else if event-source { "Grouped by log, provider, ID and Windows level" }
else if name in evidence-sections { "Inventory summary and selected evidence" }
else if compact { "Compact summary check completed" }
else if name in inventory-sections { "Inventory count" }
else if name in sensitive-sections { "Reviewed; sensitive/noise-heavy values omitted" }
else if name in routine-sections { "Reviewed; routine snapshot omitted" }
else if name in detailed-sections { "Structured health evidence" }
else { "Retained in source; no specific analysis" }
let severity = if legacy-incomplete(report, name) { "warning" } else if status == "error" { "warning" }
else if status == "skipped" { "warning" }
else if name in ("recent_system_errors", "recent_application_errors") and events.any(event => event.severity == "critical") { "critical" }
else { "success" }
coverage.push((section: name, use: use, records: count, severity: severity))
if event-source {
use += "; truncation: " + if get(value, "truncated", none) == true { "yes; records omitted" } else if get(value, "truncated", none) == false { "no" } else { "unknown" }
use += "; limit: " + str(get(value, "limit", "unknown"))
}
coverage.push((section: name, use: use, records: section-count(report, name), severity: if status not in ("ok", "missing") or legacy-incomplete(report, name) { "warning" } else { "info" }))
}
// Outer success does not imply that nested APIs were available.
for (name, records) in (("storage.storage_health", get(storage-root, "storage_health", ())), ("storage.reliability_counters", get(storage-root, "reliability_counters", ())), ("defender", (defender,))) {
for item in records {
if get(item, "status", "ok") != "ok" or get(item, "available", true) == false {
coverage.push((section: name, use: str(get(item, "status", "unavailable")) + ": " + str(get(item, "error", "Nested check unavailable")), records: "Unavailable", severity: "warning"))
}
}
}
let recap-sections = if compact { ("operating_system", "computer_system", "problem_devices") } else { ("operating_system", "computer_system", "storage", "problem_devices", "defender", "component_store", "system_file_check") + inventory-sections + evidence-sections + ("bios", "cpu", "memory_modules", "motherboard", "gpus", "code_integrity") + event-sections(report).slice(0, 2).map(pair => pair.at(0)) }
for name in recap-sections.dedup() {
if section-status(report, name) == "missing" and not coverage.any(item => item.section == name) and not (compact and not compact-checks) {
coverage.push((section: name, use: "Not supplied in this capture", records: "Unavailable", severity: "info"))
}
}
let incomplete = compact or get(report, "legacy", none) != none or coverage.any(item => item.severity == "warning") or event-sections(report).any(pair => get(section(report, pair.at(0)), "truncated", false) == true)
findings = findings.filter(item => item.severity == "critical") + findings.filter(item => item.severity == "warning") + findings.filter(item => item.severity == "unanalysed")
@ -613,9 +694,15 @@
generated: generated,
computer: str(get(host, "computer_name", "Unknown")),
administrator: bool-text(administrator),
health: if critical > 0 { "Attention required" } else if warnings > 0 or unanalysed > 0 { "Review recommended" } else { "No actionable issue detected" },
health: if critical > 0 { "Attention required" } else if warnings > 0 or unanalysed > 0 { "Review recommended" } else if incomplete { "Insufficient evidence for a complete assessment" } else { "No actionable issue detected in collected evidence" },
health_score: health-score,
analysis_confidence: analysis-confidence,
collection_incomplete: incomplete,
parameters: get(report, "parameters", (:)),
diagnostic_collection: get(report, "diagnostic_collection", (:)),
source_report: report,
raw_events: raw,
event_counts: (critical: raw.filter(e => e.level == 1).len(), error: raw.filter(e => e.level == 2).len(), warning: raw.filter(e => e.level == 3).len(), information: raw.filter(e => e.level in (4, 5)).len(), unknown: raw.filter(e => e.level == none).len()),
analysis_confidence: if incomplete { calc.min(50, analysis-confidence) } else { analysis-confidence },
system: (
os: os-name,
version: os-version,

View File

@ -28,11 +28,11 @@
)
}
#if source.at("schema_version", default: 0) != 1 {
#if source.at("schema_version", default: 0) not in (1, 2) {
panic(
"Unsupported WinDiagnostics schema version: " +
str(source.at("schema_version", default: "missing")) +
". This renderer currently supports schema_version 1."
". This renderer currently supports schema_version 1 and 2."
)
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ message.
## Pipeline
1. `diagnostics-normalize.typ` reads WinDiagnostics schema version 1 JSON,
1. `diagnostics-normalize.typ` reads WinDiagnostics schema versions 1 and 2 JSON,
deduplicates event records, classifies signals, and builds normalized data
entirely inside Typst.
2. `diagnostics.typ` validates the inputs and selected YAML theme.
@ -284,7 +284,7 @@ but Full provides the evidence needed for meaningful fault synthesis. Unknown fu
The schema follows [WindowsMaintenanceReport.ps1](https://proxy.dandaedre.com/gitea/Beffroi/WinDiagnostics/raw/branch/main/WindowsMaintenanceReport.ps1).
The renderer validates `report_type`, `schema_version`, and `generated_at`.
Full/Mid captures use section envelopes (`status`, `count`, `data`, `error`);
Compact captures use `summary`. Collector warnings and skipped/error sections
Compact captures use `summary` and may include metadata-only check sections. Collector warnings and skipped/error/unavailable sections
remain visible. Coverage counts are records, not transcript lines.
Native PowerShell dates may use `/Date(milliseconds)/`; ISO timestamps and their
@ -312,4 +312,37 @@ is a critical kernel-crash finding; code 0x133 is identified as
[DPC_WATCHDOG_VIOLATION](https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-0x133-dpc-watchdog-violation).
The saved dump must be analyzed to identify the responsible component.
`volmgr` 162 records successful dump generation and is informational, so it
adds no health-score penalty and is omitted from actionable event evidence.
adds no health-score penalty and remains visible in the event evidence without becoming an actionable finding.
## Schema 2 and partial collection
Both schema versions support Compact, Mid and Full. Unversioned and unsupported
versions are rejected. The September 15 12:10:57 native capture uses schema 2 and is covered by regression checks alongside the earlier schema 1 captures. The fixtures in `tools/fixtures` additionally cover synthetic edge cases.
New event keys take precedence over legacy aliases, including when unavailable.
Groups retain log, provider, ID, Windows numeric level, occurrence counts and raw
records. Windows level totals are separate from curated diagnostic severity.
Code Integrity information/verbose records are retained without automatically
becoming faults. Coverage reports explicit truncation metadata; a count at the
limit alone does not establish truncation. The requested history comes from the
capture parameters.
Failed, skipped, missing and unknown collection states are not successful checks.
Nested storage and Defender failures remain visible even when the parent succeeded.
Compact and incomplete captures cap analysis confidence at 50%; the heuristic
score describes observed signals only and cannot certify uncollected checks.
Top-level `diagnostic_collection` booleans are retained as collection metadata,
not health conclusions.
Driver, service, storage, filter, boot, feature, reliability and dump inventories
have source-attributed evidence summaries. Each shows at most eight records and
6,000 characters, with explicit display limits and full evidence in the source
JSON (also retained in the normalized model). Native exit metadata and localized
output are kept as data. Inventory presence, stopped services and dump metadata
do not establish a cause or constitute dump analysis. Storage sources are kept
separate rather than joined by array position.
Absent sections are omitted from inventory and evidence displays and listed only
in the final coverage recap as “Not supplied in this capture / Unavailable”.
Their absence alone does not add a finding or trigger the partial-collection banner.
Explicit failed/skipped checks and legacy-conversion limitations remain distinct.

View File

@ -1,4 +1,4 @@
#import "../diagnostics-normalize.typ": normalize, datetime-day, date-index, datetime-second, catalog-correlation, group-events, display-time
#import "../diagnostics-normalize.typ": normalize, value-text, datetime-day, date-index, datetime-second, catalog-correlation, group-events, display-time
#let rules = yaml("../diagnostics-rules.yaml")
#let fixture = json("fixtures/windiagnostics-v1.json")
@ -100,3 +100,57 @@ Diagnostics JSON regression checks passed.
#assert.eq(display-time("/Date(-1000)/"), "1969-12-31 23:59:59 UTC")
#assert.eq(display-time("2026-09-14T15:29:36+02:00"), "2026-09-14 13:29:36 UTC")
#assert.eq(display-time("Unknown"), "Unknown")
// Synthetic schema 2 contracts, not Windows collector execution evidence.
#let v2 = normalize(json("fixtures/windiagnostics-v2-full.json"), rules: rules)
#assert.eq(v2.schema_version, 2)
#assert.eq(v2.event_counts, (critical: 0, error: 1, warning: 2, information: 1, unknown: 0))
#assert.eq(v2.raw_events.len(), 4)
#assert.eq(v2.event_groups.find(e => e.level == 3).count, 2)
#assert.eq(v2.event_groups.find(e => e.level == 4).severity, "info")
#assert(v2.coverage.any(c => c.section == "recent_system_events" and c.use.contains("truncation: no")))
#assert(v2.coverage.any(c => c.section == "storage.storage_health" and c.severity == "warning"))
#assert(v2.excerpts.any(e => e.title == "DRIVER STORE" and e.text.contains("Échec")))
#assert(v2.excerpts.any(e => e.title == "MINIDUMPS"))
#assert(v2.collection_incomplete)
#assert(v2.analysis_confidence <= 50)
#assert.eq(v2.parameters.event_log_days, 30)
#let v2compact = normalize(json("fixtures/windiagnostics-v2-compact.json"), rules: rules)
#assert.eq(v2compact.inventory.at(0).count, "Unavailable")
#assert(not v2compact.findings.any(f => f.title == "Devices report problems"))
#assert(v2compact.coverage.any(c => c.section == "problem_devices" and c.severity == "warning"))
#let v2partial = normalize(json("fixtures/windiagnostics-v2-partial.json"), rules: rules)
#assert(v2partial.coverage.any(c => c.section == "services" and c.severity == "warning"))
#assert(v2partial.excerpts.any(e => e.title == "DRIVER STORE" and e.text.contains("exit_code")))
#for mode in ("Compact", "Mid", "Full") {
let old = fixture
old.mode = mode
assert.eq(normalize(old, rules: rules).schema_version, 1)
}
// Older native captures do not acquire placeholder inventories for newer fields.
#assert(not native.inventory.any(item => item.label == "filter drivers"))
#assert(native.coverage.any(item => item.section == "filter_drivers" and item.records == "Unavailable"))
#assert(not native.findings.any(item => item.title.contains("filter_drivers")))
#assert(not native.collection_incomplete)
#let second-native = normalize(json("../diagnostics/windows_system_report_DESKTOP-SAU019H_20260915_113124.json"), rules: rules)
#assert.eq(second-native.schema_version, 1)
#assert.eq(second-native.raw_events.len(), 102)
#assert(not second-native.inventory.any(item => item.label == "filter drivers"))
// One normalization path: collection shape, not schema label, controls Compact.
#let compact-with-old-label = json("fixtures/windiagnostics-v2-compact.json")
#{ compact-with-old-label.schema_version = 1 }
#assert.eq(normalize(compact-with-old-label, rules: rules).inventory, v2compact.inventory)
#let summary-only-new-label = (schema_version: 2, mode: "Compact", summary: (devices: (problem_count: 1)))
#assert(normalize(summary-only-new-label).findings.any(item => item.title == "Devices report problems"))
// Real schema 2 inventories contain booleans, including inside nested values.
#assert.eq(value-text(true), "Yes")
#assert.eq(value-text(false), "No")
#assert.eq(value-text((IsSigned: true, flags: (false, none))), "IsSigned: Yes; flags: No\nUnknown")
#let captured-v2 = normalize(json("../diagnostics/windows_system_report_DESKTOP-SAU019H_20260915_121057.json"), rules: rules)
#assert.eq(captured-v2.schema_version, 2)
#assert.eq(captured-v2.raw_events.len(), 249)
#assert(captured-v2.excerpts.any(item => item.title == "SIGNED DRIVERS" and item.text.contains("IsSigned: Yes")))
#assert(captured-v2.excerpts.any(item => item.title == "STORAGE DISKS" and item.text.contains("IsBoot:")))

View File

@ -0,0 +1,49 @@
{
"schema_version": 2,
"report_type": "windows_system_maintenance",
"mode": "Compact",
"generated_at": "2026-09-15T12:00:00Z",
"host": {
"computer_name": "SYNTHETIC-V2",
"administrator": false
},
"parameters": {
"event_log_days": 30,
"max_event_errors": 3
},
"warnings": [],
"summary": {
"memory": {
"total_gb": 16,
"free_gb": null
},
"devices": {
"problem_count": 0
},
"software": {
"desktop_program_count": 0
}
},
"sections": {
"operating_system": {
"status": "unavailable",
"count": 0,
"error": "Synthetic unavailable check"
},
"computer_system": {
"status": "unavailable",
"count": 0,
"error": "Synthetic unavailable check"
},
"problem_devices": {
"status": "unavailable",
"count": 0,
"error": "Synthetic unavailable check"
},
"installed_programs": {
"status": "unavailable",
"count": 0,
"error": "Synthetic unavailable check"
}
}
}

View File

@ -0,0 +1,384 @@
{
"schema_version": 2,
"report_type": "windows_system_maintenance",
"mode": "Full",
"generated_at": "2026-09-15T12:00:00Z",
"host": {
"computer_name": "SYNTHETIC-V2",
"administrator": true
},
"parameters": {
"event_log_days": 30,
"max_event_errors": 3
},
"warnings": [],
"summary": null,
"sections": {
"operating_system": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"computer_system": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"problem_devices": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"component_store": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"system_file_check": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"recent_system_events": {
"status": "ok",
"count": 3,
"data": [
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 2,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
},
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 3,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
},
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 3,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
}
],
"error": null,
"limit": 3,
"truncated": false
},
"recent_system_errors": {
"status": "ok",
"count": 1,
"data": [
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 1,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
}
],
"error": null
},
"recent_application_events": {
"status": "ok",
"count": 0,
"data": [],
"error": null,
"limit": 3,
"truncated": true
},
"code_integrity": {
"status": "ok",
"count": 1,
"data": [
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 4,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
}
],
"error": null
},
"storage": {
"status": "ok",
"count": 1,
"data": [
{
"storage_health": [
{
"status": "unavailable",
"error": "Synthetic API failure"
}
],
"reliability_counters": [
{
"status": "skipped",
"error": "Synthetic elevation gap"
}
]
}
],
"error": null
},
"defender": {
"status": "ok",
"count": 1,
"data": [
{
"available": false,
"error": "Synthetic unavailable Defender"
}
],
"error": null
},
"signed_drivers": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"system_drivers": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"services": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"storage_disks": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"storage_pnp_devices": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"enabled_windows_features": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"reliability_records": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"minidumps": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"driver_store": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"filter_drivers": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"filter_instances": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"upper_filters": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"lower_filters": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"boot_configuration": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
}
},
"diagnostic_collection": {
"operating_system": true,
"computer_system": true,
"problem_devices": true,
"component_store": true,
"system_file_check": true,
"recent_system_events": true,
"recent_system_errors": true,
"recent_application_events": true,
"code_integrity": true,
"storage": true,
"defender": true,
"signed_drivers": true,
"system_drivers": true,
"services": true,
"storage_disks": true,
"storage_pnp_devices": true,
"enabled_windows_features": true,
"reliability_records": true,
"minidumps": true,
"driver_store": false,
"filter_drivers": false,
"filter_instances": false,
"upper_filters": false,
"lower_filters": false,
"boot_configuration": false
}
}

View File

@ -0,0 +1,348 @@
{
"schema_version": 2,
"report_type": "windows_system_maintenance",
"mode": "Mid",
"generated_at": "2026-09-15T12:00:00Z",
"host": {
"computer_name": "SYNTHETIC-V2",
"administrator": false
},
"parameters": {
"event_log_days": 30,
"max_event_errors": 3
},
"warnings": [],
"summary": null,
"sections": {
"operating_system": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"computer_system": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"problem_devices": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"component_store": {
"status": "ok",
"count": 0,
"data": [],
"error": null
},
"system_file_check": {
"status": "skipped",
"count": 0,
"data": [],
"error": null
},
"recent_system_events": {
"status": "ok",
"count": 3,
"data": [
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 2,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
},
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 3,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
},
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 3,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
}
],
"error": null,
"limit": 3,
"truncated": false
},
"recent_system_errors": {
"status": "ok",
"count": 1,
"data": [
{
"TimeCreated": "2026-09-14T12:00:00Z",
"ProviderName": "Synthetic provider",
"Id": 123,
"Level": 1,
"LevelDisplayName": "Localized level",
"Message": "Synthetic Unicode \u00e9 # [test] C:\\Windows"
}
],
"error": null
},
"recent_application_events": {
"status": "ok",
"count": 0,
"data": [],
"error": null,
"limit": 3,
"truncated": true
},
"code_integrity": {
"status": "unavailable",
"count": 0,
"data": [],
"error": null
},
"storage": {
"status": "ok",
"count": 1,
"data": [
{
"storage_health": [
{
"status": "unavailable",
"error": "Synthetic API failure"
}
],
"reliability_counters": [
{
"status": "skipped",
"error": "Synthetic elevation gap"
}
]
}
],
"error": null
},
"defender": {
"status": "ok",
"count": 1,
"data": [
{
"available": false,
"error": "Synthetic unavailable Defender"
}
],
"error": null
},
"signed_drivers": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"system_drivers": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"services": {
"status": "unexpected",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"storage_disks": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"storage_pnp_devices": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"enabled_windows_features": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"reliability_records": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"minidumps": {
"status": "ok",
"count": 1,
"data": [
{
"Name": null,
"DeviceID": "synthetic",
"State": "Stopped",
"Message": "Synthetic evidence"
}
],
"error": null
},
"driver_store": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": null,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"filter_drivers": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"filter_instances": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"upper_filters": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"lower_filters": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
},
"boot_configuration": {
"status": "unavailable",
"count": 1,
"data": [
{
"executable": "synthetic.exe",
"arguments": [
"/test"
],
"exit_code": 5,
"output": [
"\u00c9chec # [test] C:\\Windows"
]
}
],
"error": null
}
}
}