Audit refs: AUD-2026-06-28-V03 §1.3 Violation 3 / Mitigation 6
diagnostic_record builds a json! object then mutates it by string index (record["span"] = …, record["line"] = …, record["message"] = …). Replace the diagnostic, check-result, and event record construction with typed #[derive(Serialize)] structs using #[serde(skip_serializing_if = "Option::is_none")] for optional fields.
Scope
- Introduce typed record structs; keep emitted bytes identical (serde_json preserves BTreeMap key order).
- Verify against the
fixtures/cli/ golden corpus (byte-exact).
Acceptance criteria
Audit refs: AUD-2026-06-28-V03 §1.3 Violation 3 / Mitigation 6
diagnostic_recordbuilds ajson!object then mutates it by string index (record["span"] = …,record["line"] = …,record["message"] = …). Replace the diagnostic, check-result, and event record construction with typed#[derive(Serialize)]structs using#[serde(skip_serializing_if = "Option::is_none")]for optional fields.Scope
fixtures/cli/golden corpus (byte-exact).Acceptance criteria
cargo xtask verifygreen.docs/audit/2026-06-28_ship-readiness.md§1.3 Violation 3: add✅ Addressed (YYYY-MM-DD, #PR).