Repository navigation
feat(storage-lifecycle): one retention contract for audio buckets; lifecycle gate reads it - #24349
Conversation
…fecycle gate reads it The workspace drift/retention checks and the monorepo release prerequisite (check_sync_staging_lifecycle.py) judged bucket lifecycles from different rules: the gate failed any Delete, the workspace contract allowed a Delete at least as old as the longest hold. Neither covered the derived, syncing-local, canonical-audio or speech-profile buckets, and neither had a ceiling side (workspace daily review SP-1102-01; lead ruling 19540a). - backend/deploy/storage-lifecycle/retention_contract.json is the single threshold source: per bucket, protected prefixes and holds (code windows cited by file and regex; custody/source/profile holds unbounded; the failed_held redrive SLA proposed and unbounded until ruled) and a ceiling (soft delete, versioning, noncurrent cleanup, cache max ages) with sources. - scripts/retention_contract.py: floor_violations and ceiling_findings. - The gate judges contract buckets by their floor (noncurrent-only deletes allowed), keeps the strict any-Delete rule for others, reads softDeletePolicy and versioning, and reports ceiling codes without changing PASS/FAIL. Live read-only check (ro-prod, 11-02): syncing-local and omi-private-cloud-sync PASS the floor; ceilings report soft delete 7 d and unbounded noncurrent on syncing-local, and unbounded noncurrent plus missing merged/ max age on omi-private-cloud-sync (14.75 TB noncurrent, frozen lifecycle). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…checker No behaviour change: _governed() returns (contract, bucket) or None so pyright sees non-optional arguments to floor_violations and ceiling_findings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…jects as noncurrent (Luna r1) - numNewerVersions counts as noncurrent-only when >= 1 (a live object has zero newer versions, so numNewerVersions: 0 can delete live audio). - noncurrentTimeBefore is noncurrent-only, like daysSinceNoncurrentTime. - A cache max-age rule covers its prefix only with no narrowing condition (createdBefore, matchesSuffix, ...): GCS requires every condition to match. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
8 issues found across 6 files
Confidence score: 2/5
retention_contract.pycan treat a live generation as noncurrent, letting a protected-prefix Delete bypass the retention floor. Make the predicate require that the object is demonstrably noncurrent.retention_contract.jsonleavesraw-live/outside the source-audio floor, so lifecycle cleanup could delete the only retained capture while the gate passes. Addraw-live/to the contract.- The shared contract omits the active development audio buckets, so those buckets miss the source/profile floors and ceiling reporting. Add entries for the dev buckets.
test_sync_staging_lifecycle_guard.pydoes not verify thatsoftDeletePolicyandversioningare parsed from the response. Add representative values to the mock and assert both parsed results.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/unit/test_sync_staging_lifecycle_guard.py">
<violation number="1" location="backend/tests/unit/test_sync_staging_lifecycle_guard.py:31">
P2: This updated transport test does not verify the two newly requested fields are parsed correctly. Add representative `softDeletePolicy` and `versioning` values to the mocked response and assert the returned `soft_delete_seconds` and `versioning` values, otherwise a response-mapping regression can pass all tests.</violation>
</file>
<file name="backend/scripts/retention_contract.py">
<violation number="1" location="backend/scripts/retention_contract.py:41">
P1: This predicate is not a safe test for live-object reach: `numNewerVersions: 0` can match the live generation, allowing a protected-prefix Delete to bypass the floor, while `noncurrentTimeBefore` is incorrectly treated as live. Classify only positive newer-version counts as noncurrent and include the repository-supported noncurrent-time condition.</violation>
</file>
<file name="backend/tests/unit/test_retention_contract.py">
<violation number="1" location="backend/tests/unit/test_retention_contract.py:36">
P2: This repository-wide source scan runs in the fast unit lane because the module is neither slow-marked nor listed in the slow-guardrail manifest. Mark the guardrail slow and add the test file to `tests/slow_guardrail_manifest.txt` so the fast lane remains bounded and the check still runs in CI.</violation>
<violation number="2" location="backend/tests/unit/test_retention_contract.py:38">
P3: This environment check is coupled to one source spelling and can reject valid implementations or pass an unrelated use. Replace the substring search with an AST/semantic check of the bucket-binding code.</violation>
</file>
<file name="backend/docs/runbooks/audio-cleanup-custody.md">
<violation number="1" location="backend/docs/runbooks/audio-cleanup-custody.md:115">
P3: This contract reference omits the `backend/` prefix used by the repository-root runbook commands, so an operator following the runbook cannot locate the file at the cited path. Use the repository-relative `backend/deploy/storage-lifecycle/retention_contract.json` path.</violation>
<violation number="2" location="backend/docs/runbooks/audio-cleanup-custody.md:118">
P3: The receipt can report noncurrent-cleanup and unknown/missing-policy findings, not only soft-delete, versioning, and cache-age violations. Describe the list as ceiling findings, including noncurrent-cleanup and unknown/unbounded state, so operators do not misinterpret valid receipt entries.</violation>
</file>
<file name="backend/deploy/storage-lifecycle/retention_contract.json">
<violation number="1" location="backend/deploy/storage-lifecycle/retention_contract.json:83">
P2: The shared contract omits active development audio buckets, so the dev private-sync and speech-profile buckets do not receive the same source/profile retention floors or ceiling reporting. Add contract entries for `omi-dev-private-cloud-sync` and `speech-profiles-dev`, or explicitly document and enforce why those deployed buckets are out of scope.</violation>
<violation number="2" location="backend/deploy/storage-lifecycle/retention_contract.json:86">
P1: This source-audio floor does not cover the `raw-live/` objects that batch processing treats as retained input, so a prefix-scoped age Delete could remove the only retained capture while the gate passes. Include `raw-live/` in the protected prefixes (and any other source prefix covered by this hold).</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| "omi-private-cloud-sync": { | ||
| "env": "BUCKET_PRIVATE_CLOUD_SYNC", | ||
| "project": "based-hardware", | ||
| "protected_prefixes": ["chunks/"], |
There was a problem hiding this comment.
P1: This source-audio floor does not cover the raw-live/ objects that batch processing treats as retained input, so a prefix-scoped age Delete could remove the only retained capture while the gate passes. Include raw-live/ in the protected prefixes (and any other source prefix covered by this hold).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/deploy/storage-lifecycle/retention_contract.json, line 86:
<comment>This source-audio floor does not cover the `raw-live/` objects that batch processing treats as retained input, so a prefix-scoped age Delete could remove the only retained capture while the gate passes. Include `raw-live/` in the protected prefixes (and any other source prefix covered by this hold).</comment>
<file context>
@@ -0,0 +1,106 @@
+ "omi-private-cloud-sync": {
+ "env": "BUCKET_PRIVATE_CLOUD_SYNC",
+ "project": "based-hardware",
+ "protected_prefixes": ["chunks/"],
+ "holds": ["source_audio"],
+ "ceiling": {"soft_delete_seconds_max": 0, "max_age_days": {"merged/": 3, "playback/": 30}, "noncurrent_cleanup": true,
</file context>
| "protected_prefixes": ["chunks/"], | |
| "protected_prefixes": ["chunks/", "raw-live/"], |
|
|
||
|
|
||
| def test_bucket_env_names_are_the_ones_the_backend_reads(): | ||
| source = '\n'.join(p.read_text() for d in ('utils', 'scripts') for p in (BACKEND / d).rglob('*.py')) |
There was a problem hiding this comment.
P2: This repository-wide source scan runs in the fast unit lane because the module is neither slow-marked nor listed in the slow-guardrail manifest. Mark the guardrail slow and add the test file to tests/slow_guardrail_manifest.txt so the fast lane remains bounded and the check still runs in CI.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_retention_contract.py, line 36:
<comment>This repository-wide source scan runs in the fast unit lane because the module is neither slow-marked nor listed in the slow-guardrail manifest. Mark the guardrail slow and add the test file to `tests/slow_guardrail_manifest.txt` so the fast lane remains bounded and the check still runs in CI.</comment>
<file context>
@@ -0,0 +1,112 @@
+
+
+def test_bucket_env_names_are_the_ones_the_backend_reads():
+ source = '\n'.join(p.read_text() for d in ('utils', 'scripts') for p in (BACKEND / d).rglob('*.py'))
+ for bucket, spec in CONTRACT['buckets'].items():
+ assert f"getenv('{spec['env']}'" in source, (bucket, spec['env'])
</file context>
| session.get.assert_called_once_with( | ||
| 'https://storage.googleapis.com/storage/v1/b/synthetic-bucket', | ||
| params={'fields': 'metageneration,lifecycle,defaultEventBasedHold,retentionPolicy'}, | ||
| params={'fields': 'metageneration,lifecycle,defaultEventBasedHold,retentionPolicy,softDeletePolicy,versioning'}, |
There was a problem hiding this comment.
P2: This updated transport test does not verify the two newly requested fields are parsed correctly. Add representative softDeletePolicy and versioning values to the mocked response and assert the returned soft_delete_seconds and versioning values, otherwise a response-mapping regression can pass all tests.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_sync_staging_lifecycle_guard.py, line 31:
<comment>This updated transport test does not verify the two newly requested fields are parsed correctly. Add representative `softDeletePolicy` and `versioning` values to the mocked response and assert the returned `soft_delete_seconds` and `versioning` values, otherwise a response-mapping regression can pass all tests.</comment>
<file context>
@@ -28,7 +28,7 @@ def test_metadata_transport_only_gets_whitelisted_bucket_fields_and_preserves_un
session.get.assert_called_once_with(
'https://storage.googleapis.com/storage/v1/b/synthetic-bucket',
- params={'fields': 'metageneration,lifecycle,defaultEventBasedHold,retentionPolicy'},
+ params={'fields': 'metageneration,lifecycle,defaultEventBasedHold,retentionPolicy,softDeletePolicy,versioning'},
timeout=20,
)
</file context>
| "artifact_cleanup_after_projection", "upload_pending", "failed_held_quarantine_redrive_sla"], | ||
| "ceiling": {"soft_delete_seconds_max": 0, "max_age_days": {"": 30}, "source": ["voice_evidence"]} | ||
| }, | ||
| "omi-private-cloud-sync": { |
There was a problem hiding this comment.
P2: The shared contract omits active development audio buckets, so the dev private-sync and speech-profile buckets do not receive the same source/profile retention floors or ceiling reporting. Add contract entries for omi-dev-private-cloud-sync and speech-profiles-dev, or explicitly document and enforce why those deployed buckets are out of scope.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/deploy/storage-lifecycle/retention_contract.json, line 83:
<comment>The shared contract omits active development audio buckets, so the dev private-sync and speech-profile buckets do not receive the same source/profile retention floors or ceiling reporting. Add contract entries for `omi-dev-private-cloud-sync` and `speech-profiles-dev`, or explicitly document and enforce why those deployed buckets are out of scope.</comment>
<file context>
@@ -0,0 +1,106 @@
+ "artifact_cleanup_after_projection", "upload_pending", "failed_held_quarantine_redrive_sla"],
+ "ceiling": {"soft_delete_seconds_max": 0, "max_age_days": {"": 30}, "source": ["voice_evidence"]}
+ },
+ "omi-private-cloud-sync": {
+ "env": "BUCKET_PRIVATE_CLOUD_SYNC",
+ "project": "based-hardware",
</file context>
| def test_bucket_env_names_are_the_ones_the_backend_reads(): | ||
| source = '\n'.join(p.read_text() for d in ('utils', 'scripts') for p in (BACKEND / d).rglob('*.py')) | ||
| for bucket, spec in CONTRACT['buckets'].items(): | ||
| assert f"getenv('{spec['env']}'" in source, (bucket, spec['env']) |
There was a problem hiding this comment.
P3: This environment check is coupled to one source spelling and can reject valid implementations or pass an unrelated use. Replace the substring search with an AST/semantic check of the bucket-binding code.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_retention_contract.py, line 38:
<comment>This environment check is coupled to one source spelling and can reject valid implementations or pass an unrelated use. Replace the substring search with an AST/semantic check of the bucket-binding code.</comment>
<file context>
@@ -0,0 +1,112 @@
+def test_bucket_env_names_are_the_ones_the_backend_reads():
+ source = '\n'.join(p.read_text() for d in ('utils', 'scripts') for p in (BACKEND / d).rglob('*.py'))
+ for bucket, spec in CONTRACT['buckets'].items():
+ assert f"getenv('{spec['env']}'" in source, (bucket, spec['env'])
+
+
</file context>
| `deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not | ||
| reach a protected prefix sooner than the longest hold plus margin (an | ||
| unbounded or pending-ruling hold forbids any), and noncurrent-only deletes are | ||
| allowed. The receipt's `ceilings` list reports soft delete, versioning and cache |
There was a problem hiding this comment.
P3: The receipt can report noncurrent-cleanup and unknown/missing-policy findings, not only soft-delete, versioning, and cache-age violations. Describe the list as ceiling findings, including noncurrent-cleanup and unknown/unbounded state, so operators do not misinterpret valid receipt entries.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/runbooks/audio-cleanup-custody.md, line 118:
<comment>The receipt can report noncurrent-cleanup and unknown/missing-policy findings, not only soft-delete, versioning, and cache-age violations. Describe the list as ceiling findings, including noncurrent-cleanup and unknown/unbounded state, so operators do not misinterpret valid receipt entries.</comment>
<file context>
@@ -109,10 +109,17 @@ backend/.venv/bin/python backend/scripts/check_sync_staging_lifecycle.py --bucke
+`deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not
+reach a protected prefix sooner than the longest hold plus margin (an
+unbounded or pending-ruling hold forbids any), and noncurrent-only deletes are
+allowed. The receipt's `ceilings` list reports soft delete, versioning and cache
+ages beyond the contract's ceiling without changing PASS/FAIL. The same JSON is
+the threshold source for the workspace drift and retention checks. It never
</file context>
| bucket/env values, prefixes or provider diagnostics. Missing metadata and | ||
| bucket retention/default holds that could block privacy erasure fail the guard. | ||
| Lifecycle `Delete` actions fail it too, except on a bucket named in | ||
| `deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not |
There was a problem hiding this comment.
P3: This contract reference omits the backend/ prefix used by the repository-root runbook commands, so an operator following the runbook cannot locate the file at the cited path. Use the repository-relative backend/deploy/storage-lifecycle/retention_contract.json path.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/docs/runbooks/audio-cleanup-custody.md, line 115:
<comment>This contract reference omits the `backend/` prefix used by the repository-root runbook commands, so an operator following the runbook cannot locate the file at the cited path. Use the repository-relative `backend/deploy/storage-lifecycle/retention_contract.json` path.</comment>
<file context>
@@ -109,10 +109,17 @@ backend/.venv/bin/python backend/scripts/check_sync_staging_lifecycle.py --bucke
+bucket/env values, prefixes or provider diagnostics. Missing metadata and
+bucket retention/default holds that could block privacy erasure fail the guard.
+Lifecycle `Delete` actions fail it too, except on a bucket named in
+`deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not
+reach a protected prefix sooner than the longest hold plus margin (an
+unbounded or pending-ruling hold forbids any), and noncurrent-only deletes are
</file context>
| `deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not | |
| `backend/deploy/storage-lifecycle/retention_contract.json`: there a `Delete` may not |
…tention contract David 2026-11-02 06:09Z (bus 6be2e1): no 21-day deadline; most audio within 30 min of finalization, alarm at 2 h. The proposed 21-day redrive SLA becomes batch_finalization_alarm (finalization_target_seconds 1800, finalization_alarm_seconds 7200, deadline null, decided_by David). The floor counts the hold until a human is alarmed plus margin_days, so the batch floor is 8 d and the 30-day staging rule passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…once it is verified (Luna r3) failed_held units never finalize, so a finalization alarm never fires for them. batch_finalization_alarm carries control_verified: false; while false the hold is unbounded and batch staging's 30-day Delete still fails the floor, as it does today. Flip it when an age-since-enqueue alarm covering stuck units is installed and verified (lane alarm2h). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ntrol (Luna r4) accept_pending only answers "would a pending ruling fit?"; a hold whose control is unverified stays unbounded either way. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…xplicitly verified (#24357) ## Summary Follow-up to #24349. A retention hold that names a control (for example `batch_finalization_alarm`'s stuck-unit alarm) now counts as bounded only when `control_verified` is explicitly `true`. If the field is missing, `null` or any other value, the check fails closed. Luna found this fail-open on the workspace copy of the same logic. There is no live impact today: the checked-in contract sets `control_verified: false` explicitly. This change stops a future edit from silently dropping the field and turning batch staging's 30-day Delete into a pass. ## Changes - `backend/scripts/retention_contract.py`: `_pending()` treats a hold with `control` or `control_verified` as unverified unless `control_verified is True`. - `backend/tests/unit/test_retention_contract.py`: covers a missing field, `null`, `"yes"` and `1` (all unbounded), and `true` (8 d floor). ## Verification `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST` = `test_retention_contract.py` and `test_sync_staging_lifecycle_guard.py`: 26 + 27 passed, run through `bin/omi-heavy` with no ambient credentials. ## Product invariants affected none ## Risk / rollout No deploy, flag, IAM or data change. Operator-run gate only. Rollback: revert. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/24357?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="View guided diff" src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a> <a href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/24357?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F24357&source=description" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img alt="Turn on auto-fix" src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
David dropped the existing-stock Coldline-to-Archive proposal on 2026-11-02 because of its large one-time operation cost (about $38k for the 381.6M-object stock in the rollout carry report). Remove that rule from `prod.json` and the Archive acceptance added by #24280. Update the lifecycle docs and #24349's retention contract bookkeeping, and make the forward source gate also validate the existing prod contract. The separate release-scoped forward Archive proposal still requires a new empty regional bucket. The 3-day `merged/` Delete and noncurrent `.opus.enc` Delete remain unchanged. The rollout handoff reports only the playback 30-day Delete and batch Coldline rule live, so **any prod lifecycle apply would still install both additional delete rules**. David has not ruled on `merged/`; prod apply remains blocked pending explicit clearance. This PR does not apply lifecycle policy, dispatch workflows, or deploy anything. Validation: **425 passed** across the targeted lifecycle, forward, retention-contract, staging-guard and storefront files through `backend/test.sh` (`BACKEND_UNIT_TEST_FILE_LIST`, one worker), under `omi-heavy run -- nice -n 19`. All four private-cloud source variants and the forward/prod source validator passed. Restoring the old Archive rule in a temporary mutation made `test_prod_has_no_archive_rule` fail as intended; the original config was restored byte-for-byte. Injected Archive rules are rejected in every private-cloud variant. `make preflight` passed under the same heavy-slot/nice wrapper with this PR body. Failure-Class: none UI-Evidence: none -- config, offline validators, docs and tests only
Summary
This PR adds one retention contract for the audio buckets, and the lifecycle release prerequisite now reads it.
Before this PR, two checks judged bucket lifecycles by different rules:
backend/scripts/check_sync_staging_lifecycle.pyfailed on any lifecycle Delete.Neither covered the derived, syncing-local, canonical-audio or speech-profile buckets, and neither checked a ceiling. This follows the workspace daily review SP-1102-01 and lead ruling 19540a.
Why it matters: on 11-01, a whole-bucket 7-day Delete on the batch staging bucket removed 161
failed_heldsync uploads that had been held 8+ days. They were the only server copy.Changes
backend/deploy/storage-lifecycle/retention_contract.json: the single threshold sourceEach bucket lists its protected prefixes, its holds and a ceiling. The workspace tools read this file through
git show origin/main:.Floor:
staging_custody);source_audio; David 10-15, FORWARD.md);batch_finalization_alarmencodes David's 06:09Z ruling (bus 6be2e1), withdecided_by: David: no 21-day deadline; most audio within 30 min of finalization (finalization_target_seconds: 1800); alarm at 2 h (finalization_alarm_seconds: 7200, owned by lane alarm2h);deadline: null.control_verified: false:failed_heldunits never finalize and have no TTL in code, so the hold stays unbounded until an alarm by age since enqueue that covers them is installed and verified (asked alarm2h). Once it is, the floor is 2 h +margin_days(7), i.e. 8 d with the 1-day code windows, and the 30-day staging Delete passes. Raisingmargin_daysis the knob if more response time is wanted.Ceiling: soft delete, versioning, noncurrent cleanup, and cache max ages (
merged/3 d,playback/30 d, batch staging 30 d). Each ceiling is cited to the runbook,artifacts.py verify_voice_retention, FORWARD.md or prod.json. Ceilings that differ from live today carryruling: pending.Buckets covered:
BUCKET_CANONICAL_AUDIO(not provisioned)backend/scripts/retention_contract.pyPure
floor_violationsandceiling_findings.check_sync_staging_lifecycle.pysoftDeletePolicyandversioning.contractandceilings(reason codes only, never names or prefixes). Ceilings never change PASS/FAIL. Promoting a ceiling to enforcing is a separate decision.Runbook
The
audio-cleanup-custody.mdparagraph is updated to match.Verification
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_retention_contract.pyandtests/unit/test_sync_staging_lifecycle_guard.py: 13 + 27 passed, run throughbin/omi-heavywith no ambient GCP credentials.--bucket syncing-local --bucket omi-private-cloud-sync: PASS.ceiling_soft_delete:pending(7-day soft delete) andceiling_noncurrent_unbounded:pending.ceiling_noncurrent_unbounded:pending(14.75 TB of noncurrent generations; the lifecycle is frozen) andceiling_max_age:pending(nomerged/rule live).storage.buckets.get). The read-only grant is an access change for David.Product invariants affected
none
Risk / rollout
No deploy, flag, IAM or data change. The gate is run by an operator before promotion.
The only behaviour change: a contract bucket with a Delete beyond its floor now passes. Today that is
omi-private-cloud-syncwithplayback/30 d, which used to fail aslifecycle_delete. The batch staging 30-day rule still fails until the stuck-unit alarm is verified (control_verified), as it does today. Unlisted buckets are unchanged.Rollback: revert the PR.
🤖 Generated with Claude Code