Skip to content

SCA-4408: Purge finalization jobs during Python account erasure - #26310

Merged
Git-on-my-level merged 2 commits into
mainfrom
agent/multica-worker-2-codex-sol/501ce4af9f27
Nov 25, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
agent/multica-worker-2-codex-sol/501ce4af9f27

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

SCA-4408

Summary

Python account erasure now deletes all top-level conversation_finalization_jobs documents for the account before reporting success. It uses an owner-only projected query, batches of up to 450 deletes, and an empty-page check. Any query or commit failure makes the wipe retryable, including after the user root has been removed.

Ordinary intent admission, quiet-check creation, and meeting-receipt admission read the existing deletion marker inside the transaction. A commit before the marker is covered by the sweep. A transaction racing the marker retries against the current marker. Existing-job mutations cannot recreate a job removed by the purge. Go’s existing document-store fences and account erasure apply as before.

Firestore cost and rollout

A successful sweep with N matches uses N returned-document reads, one minimum billed read for the terminal empty query, and N deletes. The query uses the existing collection-scope single-field UID index and replaces the quiet-only scan. Admissions that gain the marker read add one Firestore read per attempt. The change introduces no persisted state or index changes.

Full independent R19 custody review is required. Release should verify that superseded writers have drained, then wipe a synthetic/test account on the serving Backend revision and record the revision and owner-filtered count of zero in Multica. Historical residue is outside this change. Roll back by reverting this PR.

Verification

  • Synthetic fixtures cover ordinary, quiet, merge, and other-account jobs, a missing user root, partial batch failure and retry, and admission after deletion.
  • Firestore emulator checks passed, including a late admission after a stale conversation write.
  • 636 query-shape tests, 648 targeted backend tests, and 19 emulator tests passed on the worker through bounded omi-heavy.

Failure-Class: none

Line-Count-Exception: backend/database/conversation_finalization_jobs.py | 3766 -> 3773 | Read the existing account-deletion marker in job-writing transactions so a late admission cannot recreate a purged job.

View guided diff Turn on auto-fix

Failure-Class: none
Co-authored-by: multica-agent <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T17:25:18.548815Z fcb633e PR opened
ℹ️ 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" or "@codex security review".

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
Git-on-my-level merged commit ee92c10 into main Nov 25, 2026
66 checks passed
@Git-on-my-level
Git-on-my-level deleted the agent/multica-worker-2-codex-sol/501ce4af9f27 branch November 25, 2026 22:40
Git-on-my-level added a commit that referenced this pull request Nov 26, 2026
…-commit meter (SCA-3551 lane 7) (#26322)

Follow-up to #26293 (SCA-3551 lane 7, the finalization replay oracle).
It's based on `main` at `e060f71e`, the #26293 merge. It touches only
replay tooling and no serving path.

**Current head: `73f41d0c`**, a merge of main `fd7f1519` into the
reviewed `9fa4bc15` (fast-forward of `bdad61e1`). The merge adds no
replay changes; it gives the PR a fresh check history on repaired main.
It includes the paired-erasure comparison and the two binding/evidence
commits below.
- `c6dd4765`, from bundle `8ca3e1ae`. The driver now gives both sides
the same lifecycle inputs:
- **Missing-row fence:** the Python row is deleted after claim, just
before the finalizer's first worker read.
  - **Erasure:** runs after a completed or discarded Python replay.

This clears both whole-`/conversation` differences. One conflict in
`driver.py` was resolved by hand: the speaker-trace hook from main runs
first, then the paired `run_python` wrapper.
- `96789fc5`, from bundle `006671ae`. Failed Firestore Commit RPCs are
reported per side and per case, outside the R7 total. Preserved Home
tokens with same-field pre-run evidence are compared literally.

- `2ad9855d` is the FIX-FIRST commit for the CI replay gate. On the
erasure fixture, the finalization witnesses (speaker resolver and batch
privacy) are read just before the wipe; the main comparison still uses
the documents and effects after erasure. CI's `invalid_binding`
assertion in `verify.py` is unchanged.
- `90d1799f` and `9dcf507b` are FIX-FIRST commits for the speaker
witness. The speaker checks read the pre-wipe view on both sides. A
departure receipt proves only the erasure. A Go row that existed before
the wipe but has no resolver result is reported as `missing_in_go` /
`speaker_resolver_unverified`.
- Regression tests cover an untraced Go resolver result, an invalid Go
speaker envelope, and a missing Go resolver result.
- `884221b1` compares the pre-wipe conversation and derived documents
across sides with the live rules, emitted under `/before_erasure`. The
resolver gap comes from that comparison, once. Regression tests change
speaker `assignments`, `structured.title` and the authenticated payload.
- The 109 pre-wipe rows from the `cmd/jobd` conformance flow are
diagnostic only, like jobd's other raw rows, and aren't counted. The
serving `workerd` erasure run is required before integrated zero
(SCA-3551).

- `2b90f180` keeps effects and erasure checks for proved-absent Go rows
and pairs post-wipe account operation receipts by operation type,
generation and owner digest. Duplicate and mismatched receipts remain
findings.
- The current head runs the same binding validator on both pre-wipe
views. Regressions cover missing jobs and mismatched fanout on Python
and Go, and missing or mismatched Go fence fields. Findings carry a
`/before_erasure` prefix.

**Scope:** `backend-go/tools/replay/` and
`backend/testing/finalization_replay/` only.

**Verification**
- At `9fa4bc15`, `go test ./tools/replay/...` and all 37 local preflight
checks passed. Each of the six pre-wipe binding mutations fails with the
previous comparator. The full local `./tools/replay/test.sh` passed on
Firestore and Postgres, with 10/10 admission cases, 41/41 active cases
completed, zero execution errors, zero `invalid_binding` rows, and the
verifier’s negative mutations passing.
- The paired serving runner in #26352 reran the pinned worker `0a0640ae`
in all 41 cases. R7 held with a minimum margin of +2, zero execution
errors, 163 diagnostic gap rows, zero unlabelled, and zero pre-wipe
`invalid_binding` rows.
- On Studio, at `96789fc5` (`go test ./tools/replay/...` passed again at
`2ad9855d`):
  - `go test ./tools/replay/...` passes.
  - `pytest testing/finalization_replay`: 40 passed, 1 skipped.
  - `scripts/backend-python-format --check` is clean.
  - The managed pre-push gate passed.
- Worker 1's emulator replays ran on the separate bundles, not on this
combined head:
- At `006671ae` with worker `aab6310d`: 41/41 cases, 0 execution errors,
R7 41/41 with a minimum margin of +2, 164 diagnostic go_gap rows, 0
unlabelled, 0 failed Commit RPCs.
  - At `8ca3e1ae`: both `/conversation` rows clear.
- At `2ad9855d`, from Worker 1: CI's `./tools/replay/test.sh` step,
building `jobd` from this tree, passes with 0 `invalid_binding` rows. On
the pinned `aab6310d` worker: R7 41/41 at +2, and 164 diagnostic gaps
with 0 unlabelled, the same as at `96789fc5`.
- At `9dcf507b`, from Worker 1: CI's `./tools/replay/test.sh` passes
with 0 `invalid_binding` rows. On the pinned `aab6310d` worker: R7 41/41
at +2, and 164 diagnostic rows with 0 unlabelled. GitHub CI: all 65
checks pass at `9dcf507b`.
- At `884221b1`, from Worker 1: `test.sh` passes with 0
`invalid_binding`. The pinned `aab6310d` run gives R7 41/41 at +2, with
164 rows and 0 unlabelled.
- `9dcf507b` passed all 65 checks but didn't compare the pre-wipe views
across sides. `2ad9855d` and `90d1799f` are earlier heads, kept for the
record.
- `96789fc5` is an earlier head, kept for the record: it failed the CI
replay gate with 9 `invalid_binding` rows on
`erase-removes-owner-and-jobs`.

**Open item, outside this PR:** Python leaves a Firestore finalization
job at `/effects/erasure/jobs_for_uid` after erasure. It's labelled
`python_bug?` and tracked on SCA-4408 (Python fix #26310).

Merge goes through Release intake. The Go lead signs off on parity on
SCA-3551.

🤖 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/26322?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/26322?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26322&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 Nov 26, 2026
## What changed and why

PL-786 carries the erasure boundary repaired in #26310 into the paired
Python and Go Firestore emulator suites. The Python executor removes
ordinary, quiet-check and merge jobs with the user root present or
missing and preserves the other account’s document exactly. Delayed
Python ordinary and quiet admissions and meeting receipts cannot
recreate work during and after erasure.

The Go adapters exercise ordinary, quiet and merge admission against the
shared Firestore deletion marker while erasure is running and after it
completes. The same synthetic inputs produce jobs under live authority.
The existing backend emulator proof runner requires loopback for the
Python test group. This change affects tests and their runner.

## Product invariants affected

none

## How it was verified

- Local loopback Firestore run through `omi-heavy` with the existing
backend-go emulator wrapper. All 19 Python pipeline-ledger tests and
both Go PL-786 cases passed. The Go run used the race detector.
- `omi-heavy run -- make -C backend-go check` passed vet, lint,
structural checks and the full race-enabled test suite using private
Firestore and PostgreSQL instances.

Failure-Class: none




<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26354?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/26354?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26354&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. -->

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant