Skip to content

feat(prd-7): materialize AUDIT.log sheet — AuditRow, 9 columns, MetaFlag Display (#57)#92

Merged
elasticdotventures merged 2 commits into
mainfrom
feat/prd7-audit-sheet
May 12, 2026
Merged

feat(prd-7): materialize AUDIT.log sheet — AuditRow, 9 columns, MetaFlag Display (#57)#92
elasticdotventures merged 2 commits into
mainfrom
feat/prd7-audit-sheet

Conversation

@promptexecutionerr
Copy link
Copy Markdown
Collaborator

Summary

Makes the PRD-7 verification layer CPA-visible. Every committed transaction can now emit a row in AUDIT.log carrying the full verification provenance — constraint score, legal result, disposition, accumulated confidence, stage trace, flags, invoice arithmetic, and commit gate.

  • validation.rsDisplay for MetaFlag (all 5 variants: new_vendor:, anomaly:, repair:, low_conf:, constraint_weak:)
  • workbook.rsAuditRow struct with 9-column constructor: blake3 entry_id, worst-case disposition, legal_violation scan, serde_json stage trace, comma-joined flag display, CommitGate variant name
  • workbook.rssetup_audit_sheet(): 9 column headers + stage_trace_json column pinned to width 8 (CPA-friendly)
  • workbook.rssetup_audit_sheet wired into both initialize_workbook and copy_all_sheets for AUDIT.log
  • workbook.rsWorkbookWriter::append_audit_row(&self, row: &AuditRow)

Closes #57. Completes PRD-7 Phase 3; unblocks the full PDF → legal verification → audit trail path end-to-end.

Test plan

  • test_audit_row_legal_violation_resultZ3Result::Violated issue → legal_result = "legal_violation", commit_gate = "Blocked", disposition = "unrecoverable"
  • test_audit_row_approved_gateCommitGate::Approved { confidence: 0.95 }commit_gate = "Approved", legal_result = "ok"
  • test_audit_row_stage_trace_json_is_validstage_trace_json round-trips through serde_json::from_str as a 2-element array
  • All 157 ledger-core unit tests + 13 integration suites pass

@copilot please review

🤖 Generated with Claude Code

Claude Sonnet (coordinator) and others added 2 commits May 12, 2026 20:42
From<&TransactionInput> for DocumentFields conflicted with Rust's blanket
TryFrom via Into. Keep only TryFrom (the fallible parse-aware version).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lag Display

Closes #57. Makes the PRD-7 verification layer CPA-visible: every committed
transaction now emits a row in AUDIT.log with the full verification provenance.

- validation.rs: add Display for MetaFlag (all 5 variants)
- workbook.rs: AuditRow struct + constructor (blake3 entry_id, worst-case
  disposition, legal_violation scan, serde_json stage trace, comma-joined flags)
- workbook.rs: setup_audit_sheet() with 9 headers; stage_trace_json column
  pinned to width 8 to avoid overwhelming the CPA view
- workbook.rs: wire setup_audit_sheet into initialize_workbook + copy_all_sheets
- workbook.rs: WorkbookWriter::append_audit_row()
- 3 new tests: legal_violation result, Approved gate, stage_trace_json round-trip

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@elasticdotventures elasticdotventures merged commit 0539143 into main May 12, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

prd-7 phase 3: materialize _audit sheet — constraint_score, legal_result, stage_trace per transaction row

2 participants