Parent
#208 (Spec: deepened Store interface)
Blocked by
#213 (Add Store transaction combinators)
Deliverables
Add the audit-before-effect combinator so a wrong ordering stops compiling on the effect path (expand step).
AuditDescriptor value type carrying the audit-row inputs (kind, action, decision, reason, task_grant_id, refs) as data.
Store::with_audited_effect(&self, descriptor: AuditDescriptor, effect: impl FnOnce(&rusqlite::Transaction) -> Result<T, StoreError>) -> Result<T, StoreError>: runs effect and append_audit_conn inside one Immediate transaction, commits both atomically. It is the ONLY effect-path entry that can write an effect row; audit-only and non-effect internal-maintenance writes use separately named entries.
- Pilot the rollbackable shape by migrating
store/identity.rs::owner_assert_identity_binding (currently hand-pairs effect + append_audit_conn).
- Test: a forced
append_audit failure rolls back the effect row (no orphan effect — AD-105 ledger-before-consume).
Rationale in spec #208 (decision D-002). This encapsulates the 83 hand-paired append_audit_conn sites; the mass migration is T6.
Verification
./scripts/check.sh green. An effect-only write on the effect path must not compile (exercised by the migrated pilot).
🤖 Generated from spec #208 (wayfinder #189, map #182).
Parent
#208 (Spec: deepened Store interface)
Blocked by
#213 (Add Store transaction combinators)
Deliverables
Add the audit-before-effect combinator so a wrong ordering stops compiling on the effect path (expand step).
AuditDescriptorvalue type carrying the audit-row inputs (kind, action, decision, reason, task_grant_id, refs) as data.Store::with_audited_effect(&self, descriptor: AuditDescriptor, effect: impl FnOnce(&rusqlite::Transaction) -> Result<T, StoreError>) -> Result<T, StoreError>: runseffectandappend_audit_conninside oneImmediatetransaction, commits both atomically. It is the ONLY effect-path entry that can write an effect row; audit-only and non-effect internal-maintenance writes use separately named entries.store/identity.rs::owner_assert_identity_binding(currently hand-pairs effect +append_audit_conn).append_auditfailure rolls back the effect row (no orphan effect — AD-105 ledger-before-consume).Rationale in spec #208 (decision D-002). This encapsulates the 83 hand-paired
append_audit_connsites; the mass migration is T6.Verification
./scripts/check.shgreen. An effect-only write on the effect path must not compile (exercised by the migrated pilot).🤖 Generated from spec #208 (wayfinder #189, map #182).