Repository navigation
retention: add separate disposition authority and exact-scope preview - #244
Merged
Merged
Conversation
Implements separate explicit disposition execution authority (execute_disposition) and read-only exact-scope disposition preview per ADR 0030 and ADR 0020, with no destruction operation exposed. - Adds Capability::ExecuteDisposition (outside all role bundles), audit kinds disposition_authority_granted/revoked, and forward migration 0017_disposition_authority.sql adding capability discrimination to retention_authority_event. - Adds read-only disposition preview and confirmation digest verification (retention/disposition_preview.rs + queries.rs) evaluating policy versions, elapsed-day triggers, all six hold kinds across all three scopes, linked weekly-summary dependencies without silent broadening, controlled copy inventories, uncontrolled copy boundaries, recovery obligations, and high-watermark confirmation binding that detects intervening reverted changes. - Bumps installation-export format_version from 1 to 2 to carry retention_authority_event.capability while preserving version-1 verification and committed v1/v2 golden fixtures. Closes #211 Refs #64, #44
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: 6f999c4faf
ℹ️ 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".
Addresses review feedback on PR #244 by binding expires_at (as a decimal string so extreme i64 values fail closed as StaleConfirmation instead of hitting canonical JSON integer bounds) into ConfirmationBinding, and adds forged-expiry negative controls.
Member
Author
Local proof receipt — passed (
|
| # | Command | Status | Exit | Seconds | Log sha256 (prefix) |
|---|---|---|---|---|---|
| 1 | scripts/check-guidance-names.sh |
passed | 0 | 0.101 | 01.log 2b172a8e66c87574 |
| 2 | (cd web && npm ci && npm run check && npm run build) |
passed | 0 | 31.387 | 02.log 764cd574278b1be8 |
| 3 | cargo fmt --check |
passed | 0 | 1.367 | 03.log e3b0c44298fc1c14 |
| 4 | cargo clippy --workspace --all-targets -- -D warnings |
passed | 0 | 21.841 | 04.log e0122f1c1bee6628 |
| 5 | cargo test --workspace |
passed | 0 | 185.723 | 05.log c234e5a45c25eb75 |
| 6 | cargo build -p consolebook-server |
passed | 0 | 1.759 | 06.log 129e0c530cfde4e7 |
| 7 | (cd web && npx playwright install chromium && npm run e2e) |
passed | 0 | 441.28 | 07.log 362a6d3763a2a36c |
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Primary Issue
Closes #211
Refs #64, #44
Problem And Outcome
ADR 0030 and ADR 0020 require lawful disposition to be separated from retention policy/hold administration (
manage_retention) and from all role bundles, and to require a read-only exact-scope preview bound to a deterministic confirmation digest before any destruction path is introduced.This PR implements separate explicit destruction authority (
execute_disposition) with attributed grant/revocation history and read-only exact-scope disposition preview + confirmation verification, without exposing any destruction or deletion path.Changes
0017_disposition_authority.sql)Capability::ExecuteDisposition(execute_disposition) outside every role bundle (Administrator,Coordinator,Trainer,Trainee).EventKind::DispositionAuthorityGrantedandEventKind::DispositionAuthorityRevoked.crates/consolebook-server/migrations/0017_disposition_authority.sqladdscapability TEXT NOT NULL DEFAULT 'manage_retention' CHECK (capability IN ('manage_retention', 'execute_disposition'))toretention_authority_event(persisted constraint change: constrains the new column to the closed two-capability vocabulary while existing append-only triggers remain unchanged).crates/consolebook-server/src/retention/authority.rswithset_disposition_authorityanddisposition_authority_historyundermanage_users, keepingmanage_retentionandexecute_dispositioncompletely independent.retention/disposition_preview.rs+queries.rs)record_idsinside one read transaction after verifyingCapability::ExecuteDisposition.finalized_atresetting on amendment v2+,enrollment_closed_atrequiring closed non-reinstated status), all six hold kinds (litigation,anticipated_litigation,audit,investigation,public_records_request,otherwith configured operator authority) across all three scopes (installation,enrollment,record), and linkedweekly_summarydependencies (DependentSummaryRetained/DependentSummaryBlockedwithout silent broadening).data/backups/across all four prefixes +.partial,data/exports/, and off-servercopy_dirreachability), ADR 0030 §8 uncontrolled copy boundaries, and ADR 0030 §5–6 recovery obligations.confirmation_digest(15-minute validity) to actor, authority watermarks, policy watermarks, hold/release watermarks, scope/target watermarks, enrollment weekly-summary revisions/links, and controlled copy inventory — rejecting expiry, wrong actor, concurrent writes, forged digests, ineligible previews, and intervening reverted changes (revoke+regrant, policy revise+revert, hold place+release, enrollment reinstate+reclose, summary link add+remove).retention_http.rs:GET/POST /api/retention/disposition/authorityandPOST /api/retention/disposition/preview. No destruction route is exposed.execute_dispositiondisplay label inweb/src/lib/format.ts.format_version: 2(installation_export,installation_verify,docs/formats/installation-export.md)INSTALLATION_FORMAT_VERSIONfrom1to2to carryretention_authority_event.capability, appended v2's spec fingerprint and vocabulary floor beside untouched v1, committedtests/fixtures/installation-export-v2.zip, and preserved full verification of committedformat_version: 1archives (installation-export-v1.zip).Correction Ladder
Rung 1 & Rung 2: persisted schema CHECK + append-only triggers (
0017_disposition_authority.sql), domain-service capability enforcement and high-watermark confirmation digest binding (retention/disposition_preview.rs), and integration tests with negative controls (tests/disposition_preview/).Verification
cargo test -p consolebook-server --test disposition_preview: 7/7 passed (authority separation, policies/triggers/amendments/unfinalized, all 6 hold kinds × 3 scopes, linked summaries, expiry/wrong-actor/intervening-reverted changes, concurrent write + forged/ineligible digest negative controls, controlled copies & HTTP routes).cargo test -p consolebook-server --test installation_export: 28/28 passed (1 ignoredgolden::regenerate), including boththe_golden_version_1_archive_verifiesandthe_golden_version_2_archive_verifies.cargo test -p consolebook-server --test retention --test doctor_migrations --test upgrade_compat --test no_credential_literals: all passed.Local proof receipt — passed
6f999c4fafb8515f451f902fc2ed3c75e701c5betree826724d084e61b945c807a7c486a652f4311021f; unchanged during run: truecargo xtask proofin/data/dev/src/consolebook87f297e8dad4868f1364b29eb9a45b372ca3dc34e8e205c3505d15883036daa5/home/dev/.cache/ms-playwright/chromium-1254/chrome-linux64/chrome(Google Chrome for Testing 158.0.8127.18)target/debug/consolebook-serversha2560be193ceff37ec56ffe2bf9d41183320c6dc2409f42cdeef6870ac9044ae2baa6229ad2a596ad5607877f03602cf9f1ad218997f04019bbabc4ba2ab04cc68999fc5f33918383ecb3d71239332e8e6ee51b7d36b9caa61bbd54254adf1dea0ffscripts/check-guidance-names.sh2b172a8e66c87574(cd web && npm ci && npm run check && npm run build)361c6a05682bd1cfcargo fmt --checke3b0c44298fc1c14cargo clippy --workspace --all-targets -- -D warnings4d1b01c142939eeacargo test --workspace150ca34b142c34d8cargo build -p consolebook-server92bec25ad54c6504(cd web && npx playwright install chromium && npm run e2e)43829c2d29a63547