Skip to content

Build CLI records from typed Serialize structs (no post-construction Value mutation) #92

Description

@flyingrobots

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

  • Records built from typed structs; golden corpus byte-identical; cargo xtask verify green.
  • Update docs/audit/2026-06-28_ship-readiness.md §1.3 Violation 3: add ✅ Addressed (YYYY-MM-DD, #PR).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestrelease:cliPublic edict CLI boundary and structured diagnostics release work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions