Repository navigation
retention: execute confirmed disposition with recoverable copy cleanup - #247
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2249539321
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 909dbb2691
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Closes #214
Refs #64, #44
Implements confirmed lawful disposition execution, residual-byte reclamation, durable recovery ledger updates, safe clean-snapshot replacement, and idempotent post-commit retry under ADR 0030 §§3–5.
Summary of changes
0020_disposition_execution.sql(persisted constraint changes):record_holdand childhold_releaseatomically underPRAGMA foreign_keys = ONto decouplerecord_hold.evaluation_record_id's foreign key so historical released holds survive record destruction, while addingrecord_hold_record_exists(insert-time trigger) and preserving all0015_retention_administration.sqltriggers and indexes.notice.evaluation_record_id INTEGERwith indexnotice_evaluation_recordand insert-time triggernotice_record_existsso record-linked workflow notices are purged during disposition without touching unrelated notices.*_no_delete/*_frozen_deletetriggers (evaluation_version,acknowledgment,amendment,draft_snapshot,review_decision,contributor_event,draft_rating,draft_rating_modifier,draft_narrative,evaluation_session,summary_daily_link) preserving their original error messages, and addsevaluation_record_no_delete, permitting deletes only when a committed/in-transactiondisposition_eventbelongs to adisposition_runin statedb_committed_vacuum_pending.crates/consolebook-server/src/retention/disposition_execute.rs+cleanup.rs):execute_disposition,execute_disposition_at,execute_disposition_with_fault, andretry_disposition_run(_at/_with_fault). Deliberately NOT wired into HTTP or UI in#214(deferred to#219).Capability::ExecuteDisposition, input validity, expiry, policies, holds, dependency closure, and the exact confirmation digest insidestorage::write_tx(BEGIN IMMEDIATE) viabuild_preview.disposition_run, minimaldisposition_eventtombstones (which atomically advanceevaluation_record_id_floorvia0019), optionaldisposition_version_hash, FK-safe batch-wide deletions across all in-scope tables, and a content-freeEventKind::DispositionExecutedaudit event (Subject::DispositionRun(run_id)).PRAGMA wal_checkpoint(TRUNCATE)(verifying(busy=0, log=0, checkpointed=0)) →VACUUM→PRAGMA wal_checkpoint(TRUNCATE),advance_to_copy_cleanup_pending, durable local recovery ledger sync, fresh clean local snapshot (backup::run_after_restore) before deleting pre-disposition local artifacts (backups/, pre-migration, pre-restore.db/.damaged,.partial/.tmp,exports/), off-server clean copy verification/replacement + ledger mirror + pre-disposition copy removal, final pre-disposition verification,mark_run_completed, andEventKind::DispositionCompleted.notices.rs,evaluation_drafts.rs,draft_review.rs,finalization.rs,amendments.rs,acknowledgments.rs):notice.evaluation_record_idat every evaluation-record notice site so workflow notices referencing disposed records are deleted cleanly.installation_exportformat version 5 (docs/formats/installation-export.md,installation_export/spec*,export_verify.rs,tests/fixtures/installation-export-v5.zip):INSTALLATION_FORMAT_VERSIONto5fornotice.evaluation_record_idandrecord_hold.evaluation_record_idFK decoupling, keeping v1–v4 golden archives verifying via versioned shims and pinning v5's spec fingerprint (91b76345199ea0bd944cfada675543b8f49228fd6340875b8b74fbb2789df301) and golden archive.tests/disposition_execution/):consolebook.db,-wal,-shm, localbackups/,exports/, off-servercopy_dir, recovery ledgers, audit events, and notices proving every disposed content sentinel is purged while unrelated records, enrollments, task signoffs, and released hold history survive intact.BeforeDbCommit,AfterDbCommitBeforeVacuum,DuringVacuum,DuringLedgerWrite,DuringCleanSnapshot,DuringLocalCleanup, andDuringCopyCleanupwith idempotentretry_disposition_runrecovery.Correction ladder rung
0020_disposition_execution.sqltriggers enforce disposition-gated deletion at the SQLite layer;disposition_executeenforces atomic re-verification and idempotent state-machine recovery;tests/disposition_execution/proves raw-byte purge, fault recovery, and fail-closed races).Local proof (
cargo xtask proof)22495393217de92165c2621d9e6d24b855a5aee2(clean tree01d0478e3f9bff6b004905645559f267e207960a)webcheck + build,cargo fmt --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace,cargo build -p consolebook-server, Playwright e2e 74/74 expected, 0 unexpected, 0 flaky, 0 skipped)3c54f729f0f3e44ab6edfc4e45128374e03edaca853f0ddbb3a48f737373391b