Sub-issue of #335 (item 2). Current state (verified on main @f8bcee3):
Ward::apply emits in-memory AuditRecords (target, resolved, tier, prev/next SHA-256, bytes) for every Tier-2 write; POST /familiars/{id}/edits returns them in the response (ward_change_json) but never persists them.
- The designated single audit store exists:
ward_audit (append-only, UPDATE/DELETE-abort triggers), created from coven_threads_core::WARD_AUDIT_SCHEMA_SQL and already used for gate verdicts (validation_verdict) and WARD-C6 compaction_ledger events.
Blocker / design dependency: ward_audit.event_type carries a schema CHECK (event_type IN (...)) enumerating exactly the coven_threads_core::AuditEventType tags (proposal_submitted/approved/rejected/vetoed, ward_updated, validation_verdict, compaction_ledger). Persisting apply records needs:
- Upstream (OpenCoven/coven-threads): add an
AuditEventType::ApplyAudit (or similar) variant + tag to the schema CHECK, plus a documented migration story — SQLite cannot ALTER a CHECK, so existing stores need a guarded table rebuild or a versioned ensure_* migration mirroring the exhaustiveness test at audit.rs:269.
- Here: after the applied disposition in
familiar_edits (api.rs, after advance_applied_protected_baselines), append one row per `report.audit_records()": event_type=apply tag, familiar_id, tier, decision="applied", diff_hash←next_sha256 (prev_sha256 in a JSON detail or dedicated column per upstream design), files_touched=[resolved], channel, submitted_at/decided_at=now. Reuse the insert shape from threads_gate.rs:537.
- Surface the ledger: read endpoint (e.g.
GET /familiars/{id}/audit) + coven read verb via the observe.rs pattern + reference doc.
Acceptance: applied Tier-2 writes appear in ward_audit across daemon restarts; append-only triggers still hold; workspace tests green.
Sub-issue of #335 (item 2). Current state (verified on main @f8bcee3):
Ward::applyemits in-memoryAuditRecords (target, resolved, tier, prev/next SHA-256, bytes) for every Tier-2 write;POST /familiars/{id}/editsreturns them in the response (ward_change_json) but never persists them.ward_audit(append-only, UPDATE/DELETE-abort triggers), created fromcoven_threads_core::WARD_AUDIT_SCHEMA_SQLand already used for gate verdicts (validation_verdict) and WARD-C6compaction_ledgerevents.Blocker / design dependency:
ward_audit.event_typecarries a schemaCHECK (event_type IN (...))enumerating exactly thecoven_threads_core::AuditEventTypetags (proposal_submitted/approved/rejected/vetoed, ward_updated, validation_verdict, compaction_ledger). Persisting apply records needs:AuditEventType::ApplyAudit(or similar) variant + tag to the schema CHECK, plus a documented migration story — SQLite cannot ALTER a CHECK, so existing stores need a guarded table rebuild or a versionedensure_*migration mirroring the exhaustiveness test at audit.rs:269.familiar_edits(api.rs, afteradvance_applied_protected_baselines), append one row per `report.audit_records()": event_type=apply tag, familiar_id, tier, decision="applied", diff_hash←next_sha256 (prev_sha256 in a JSON detail or dedicated column per upstream design), files_touched=[resolved], channel, submitted_at/decided_at=now. Reuse the insert shape from threads_gate.rs:537.GET /familiars/{id}/audit) +covenread verb via the observe.rs pattern + reference doc.Acceptance: applied Tier-2 writes appear in
ward_auditacross daemon restarts; append-only triggers still hold; workspace tests green.