Repository navigation
feat(backend): add account deletion grace period - #23897
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Gate per-user background, public-share, Stripe, and capture paths on deletion state; make wipe completion verify billing, app, and search-index cleanup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve legacy output while the shared media policy records shadow admissions, then verify serving mode filters the matching rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep the shared user id guard aligned with its string contract and remove an unused local from the fenced day-3 worker. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
Git-on-my-level
added a commit
that referenced
this pull request
Oct 29, 2026
#23873) ## What changed and why Builds the approved delete-account safety screens. Server-held processing audio is kept during a server-reported grace window; only phone-only uploads warn of immediate loss. Without an authoritative window the app uses immediate-deletion copy. Taking a break or technical issues offers Pause Omi through the existing capture toggle, retaining sign-in and billing. Pending-deletion sign-in shows Restore my account and Finish deleting. Product initialization and deep links wait for status. Restore needs a successful server response. Tapping Erase my account now opens the final warning confirmation before the app sends `erase_now: true`. Depends on backend PR #23897 for the grace policy and recovery endpoints. The backend now reports `grace_period_days` before deletion and accepts `?grace=true` as an explicit opt-in; this new client adds that query to the initial DELETE. Released clients that omit it keep immediate erasure. Finish deleting continues to send `erase_now: true` through the authenticated deletion-only owner route. Older 404/405 status endpoints retain normal sign-in and immediate-delete behavior; fresh sign-ins and server failures offer Retry. A transport outage preserves an existing onboarded startup UID only; previously confirmed pending-deletion owners remain blocked, and this fallback never grants grace copy. Restore/erase errors retain the decision screen. No production access. ## Product invariants affected INV-UI-1, INV-UI-3, INV-PERF-1. Uses OmiType, OmiColors, OmiButton and existing icons. ## How it was verified - Focused `deletion_safety_test.dart`: all 11 widget tests passed, including 9-day, 1-day, under-one-day, unknown and expired `wipe_at` cases, and the modal-only erase warning. - Render harness: all 17 tests passed; the 20 light/dark PNGs at 1179×2796 were generated and visually inspected. Window/count fixtures are synthetic; no real deletion is invoked. - Focused Dart analysis found no issues. `python3 scripts/l10n.py check` passed for 49 locales and 4,325 keys. - `omi-l10n-fill stub` then `fill` translated the three changed/new countdown and confirmation strings across 48 target locales; ICU validation passed (5 batches, 6 calls, no retries, review approved three fixes). - `make preflight` passed all 45 checks; `actionlint` passed. The workflow budget guard records the 35-minute Dart job ceiling after two runs completed all 7,920 tests but hit the former 30-minute limit during cleanup; p50 remains 17 minutes. - Follow-up head `cc42da5eddb6d79ae0198fa0bec0986270fc643a` is green: `ci-wait` completed with 45 checks, 0 pending, and 0 failures, including Mobile Release Eligibility and all 7,920 Dart tests. The initial deletion request sends `?grace=true`; older released clients omit it and keep immediate erasure. Current origin/main is `b8ed4da0d44f6ac7a17fb9fe4c91afc2d6532c82`; a read-only merge-tree check confirms conflicts in generated localization files, after the green run on this exact head. No production account, device, API, or GCP tier was accessed. These are hermetic widget/API tests and rasters; device acceptance remains separate. ## Tests `app/test/widgets/deletion_safety_test.dart`: deletion policy and pause cases, plus remaining-day copy for 9 days, 1 day, under one day, unknown and expired deadlines, and the final erase confirmation. `app/test/unit/backend/http/deletion_contract_test.dart`: optional/expired policy, UID-filtered WAL counts, status counts and restore/erase payload, rejection of erase acknowledgements that remain pending, and UID-bound offline fallback. ## UI evidence       20 tracked iOS widget rasters cover reason, feedback, pause, grace with mixed/server-only/phone-only/empty counts, immediate deletion, restore, and finish confirmation, each in light and dark. See the sibling evidence manifest and harness. ## Failure class Failure-Class: none 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This was referenced Oct 29, 2026
Git-on-my-level
added a commit
that referenced
this pull request
Oct 29, 2026
…23936) ## Summary - Generate Dart wire models for the account deletion status, action, and restore responses already defined in OpenAPI. - Decode account deletion API responses through those generated types while preserving legacy aliases and conservative normalization. - Add coverage for generated-backed responses and preserve the existing deletion behavior. This is separate from #23935: it fixes an existing main-branch backend unit failure after the account deletion API changes in #23873 and #23897. `test_app_client_schema_inventory.py::test_inventory_separates_generated_backed_adapters_from_raw_manual_dtos` reported one remaining manual Dart response adapter, `account_deletion.dart`. ## Verification - `backend/test.sh` with `BACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_app_client_schema_inventory.py` under `nice`: 14 passed. - `cd app && flutter test test/unit/backend/http/deletion_contract_test.dart`: 6 passed. - `cd backend && .venv/bin/python scripts/generate_dart_models.py --group users --check`: passed. - `cd app && dart run build_runner build --delete-conflicting-outputs`: completed; no tracked generated-file changes. ## Metadata Product invariants affected: none Failure-Class: none UI-Evidence: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/23936?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/23936?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23936&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. -->
Git-on-my-level
added a commit
that referenced
this pull request
Oct 29, 2026
The Sync Cloud Tasks concurrency gauntlet must hold paid STT inside the upload worker lease. PR #23919 (merge `0dee519a`) deferred full note processing until merge settlement, so waiting for that processor could never enter the gate. Current main already moved the call to STT; this finishes that fixture contract and makes the hold behavior executable. - Rename the gate, evidence and diagnostics to STT throughout the fixture and its callers. - Pin `SYNC_PROCESSING_HOLD_ENABLED=true` for normal scenarios. The held concurrency scenario verifies one STT call, Redis fencing before pipeline work and during STT, completed upload/ledger readback, pending conversation hold, and a durable deferred enrichment obligation with zero full-processor calls. - Run the same concurrency scenario with the hold disabled and require exactly one eagerly persisted full-processing result. Terminal duplicate delivery must repeat neither STT nor full processing in either mode. Product behavior, worker budgets and CI timeouts are unchanged. Failure-Class: none This is test-fixture phase drift after a deliberate product scheduling change; no existing semantic failure class describes it. Why isn't this a shared primitive instead? Both hold modes use the same STT gate and `_assert_full_processing_policy` verifier in the existing blocking emulator gauntlet, rather than adding a separate guard. The regression instance is merged PR #23919, with the supplied bisect showing its parent passes and merge fails waiting for the processor gate. ## Product invariants affected none (test harness and fixture only) ## Validation - Related units: 154 passed across `test_sync_cloud_tasks_stack_ci_wiring.py`, `test_sync_stack_postgres_hook.py`, `test_sync_processing_hold.py` and `test_sync_reprocess_coalesce.py` (separate pytest processes). - Full gauntlet: passed via `nice -n 10 backend/testing/sync_cloud_tasks_stack/run.sh --state-dir /Volumes/Ephemeral/scratch/gauntlet-holdfix-20261029/full`, under `omi-heavy` (both hold modes, all legacy Sync and batch scenarios, plus 5 passing Firestore shard-spread integration tests). - Preflight: `make preflight` passed all 33 selected checks; `scripts/pr-preflight --pr-body-file` also passed all 33 checks on commit `d3981e1de54`. - GCP tier: none; all services are local emulators/fakes. 🤖 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/23935?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/23935?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23935&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. --> ## Main CI follow-up The backend unit failure is independent of the Sync gauntlet: main currently fails `tests/unit/test_app_client_schema_inventory.py::test_inventory_separates_generated_backed_adapters_from_raw_manual_dtos` because account deletion is the remaining manual Dart response adapter after #23873/#23897. The fix is split into [PR #23936](#23936). This PR excludes the app change; its unit checks need a rerun after the main-branch fix lands.
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.
What changed and why
Account deletion starts a restorable window only when a client explicitly opts in with
?grace=trueandACCOUNT_DELETION_GRACE_ENABLEDis on with a positive window. Requests without the marker—including released apps that do not have restore UI—keep today’s immediate erasure.erase_now=true, a zero-day window, or the kill switch also selects immediate erasure. Opted-in grace cancels billing and revokes refresh tokens at admission, retains the existing Firebase UID, and fences ordinary account access; the durable reconciler dispatches the legal-hold-gated wipe after the deadline and immediate-action receipt.The owner status API reports
pending_deletion,wipe_at, the pre-deletegrace_period_dayspolicy, and metadata-only held-recording and processing-backlog counts. Restore preserves the existing UID and leaves billing cancelled.Luna FIX-FIRST review resolutions
erase_now; the route allowlist matches status and restore access.Product invariants affected
Line-count exceptions
Line-Count-Exception: backend/database/conversation_finalization_jobs.py | 3040 -> 3049 | Add restored-status checks to finalization worker admission and result publication.
Line-Count-Exception: backend/database/conversations.py | 4589 -> 4592 | Apply the shared deletion status decision at the final-pass promotion transaction.
Line-Count-Exception: backend/routers/chat.py | 1803 -> 1812 | Return 404 for public chat shares owned by a pending-deletion account.
Line-Count-Exception: backend/routers/conversations.py | 2492 -> 2501 | Return 404 for public conversation shares owned by a pending-deletion account.
Line-Count-Exception: backend/routers/payment.py | 1934 -> 1967 | Fence late entitlement webhooks and cancel subscriptions created during deletion.
Line-Count-Exception: backend/routers/sync.py | 4124 -> 4134 | Fence sync finalization and processing entrypoints during deletion.
Line-Count-Exception: backend/utils/apps.py | 1731 -> 1765 | Suppress public catalog results for apps whose creator is pending deletion.
How it was verified
backend/test.shundernice(1,014 passed; 1 deselected), covering account deletion, public shares, worker fences, Typesense/app erasure, and recap rollback.nice -n 10 env BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-account-deletion-tests.txt bash test.shselection passed 461 tests across four files, covering missing opt-in immediate erasure, opted-in grace, the global kill switch, restore gating, and status policy.9c5bc288f307f69b9f2f4abf4bcc2beedc8b05a8is green: all 67 checks completed with zero pending or failures. The branch currently conflicts withorigin/main(b8ed4da0) inbackend/testing/sync_cloud_tasks_stack/app.pyandbackend/testing/sync_cloud_tasks_stack/run.py; these base-branch changes are not included in this PR head.make preflightpassed all 62 selected checks, including Firestore guards, backend typecheck, web tests, generated Swift DTO validation, Swift formatting, and SwiftLint.origin/main.git diff --checkpassed.Tests
Regression tests cover worker admission and notifications, public share-link access, late Stripe events and cancellation verification, creator-app erasure, Typesense retry behavior, restore on capture and processing paths, and
erase_nowauthorization for pending owners.UI evidence
UI-Evidence: none -- this PR has no app UI changes.
Failure class (fixes)
Failure-Class: new
Failure-class transition narrative
Violated contract: a user who requests deletion to take a break must be able to restore the same account and retain held or unprocessed recordings until the grace deadline, while pending deletion must stop further per-user work and public access. The admission marker, status-aware access policy, worker fences, provider cancellation checks, and retryable wipe now enforce that contract across request, background, public-share, and restore paths.
Canonical guard:
account_deletion_blocks_user_workis shared by per-user workers; capture and processing paths treat pending markers as fences while allowing a restored status; public share routes check the owner; Stripe cancellation and Typesense purge must be verified before wipe completion. Regression coverage lives in the account-deletion, worker, public-share, billing, and restore test selections above.Rollout and owner sign-off
Keep
ACCOUNT_DELETION_GRACE_ENABLED=true; only clients that send?grace=truereceive the configured 14-day restorable window. Requests without opt-in remain immediate. Monitor deletion reconciliation and wipe completion/failure events; setting the kill switch tofalserestores immediate erasure for opted-in requests too. The new mobile client opt-in is in PR #23873. Product and privacy owners must sign off on the privacy-policy timing and account-deletion confirmation copy before the user-facing copy rollout.🤖 Generated with Claude Code