Repository navigation
backend-go: cover deferred transcript revision reads (SCA-3177) - #26031
Git-on-my-level wants to merge 61 commits into
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
Co-authored-by: multica-agent <[email protected]>
…-luna/lane7-next-outcome
…are#26190) ## Summary SCA-4083 fences Python post-effects episode writes inside their Firestore transactions. Transcript-tail commits, episode closes, episode updates including discarded-row reconciliation, recorded sync attachment after a memo miss, sync rejoin, and finalized attach memos recheck the account deletion marker and the source conversation tombstone before writing. The shared account policy permits `cancelled` and `billing_failed` markers. Any conversation tombstone still blocks the write, and retries recheck current authority. The [pipeline change note](backend/docs/listen_pusher_pipeline/changes/2026-11-24-episode-finalization-deletion-fence.md) records the behavior, verification and rollout. ## Verification - The scoped repair passed all 181 existing focused tests plus four new race cases, for 185 passes. The new cases insert each deletion marker before the recorded attach and reopen transactions and assert that stored state is unchanged. - On the prior revision, 1,357 episode unit tests and 61 Firestore emulator tests passed. The Home read fixture import error and discarded-anchor emulator mismatch were also present on the base. - The prior Hygiene failure is the overdue `OMI_INDEXED_LIST_READS_ENABLED` retirement, reproduced on `origin/main`. ## Release readback R19 full custody and deletion review is required before merge and rollout. On the serving revision, sum the increase in `omi_firestore_document_reads_by_site_total` across outcomes for `site=~"episode_finalization_(update|memo|moment|close)_fence"` during a controlled replay and divide by the number of finalizations in each case. Each guarded transaction attempt adds up to two reads. An update and memo that each run once add four reads, and a memo retry after transcript preload adds another pair. Tail, close, recorded attachment and reopen contribute their own reads when exercised. Recorded attachment and reopen use the episode update metric label. Record the serving revision and replay window in SCA-4083 before using the results as the Python R7 baseline. Rollback by reverting this PR. Line-Count-Exception: backend/utils/episodes/service.py | 2318 -> 2345 | Carry the finalizing conversation through existing episode writer calls and return the deletion outcome before subsequent finalization effects. (cherry picked from commit d5d0b95)
…6209) ## Summary SCA-4083 F1. Pass the finalizing conversation ID from the scheduled composer into the existing episode update transaction. The transaction reuses the shared account deletion policy and checks the conversation tombstone. A deletion refusal stops composition and leaves any already-claimed lease to expire. ## Verification and read delta The hermetic scheduled-compose tests use the episode writer and count the two authority document paths at the transaction boundary. | Case | Added authority reads | Result | | --- | ---: | --- | | Unfenced read-triggered control | 0 | Result committed | | Finalization, one lease claim and one result write | 4 | Result committed | | Account marker after lease claim | 3 | Result refused, stored state unchanged from immediately after the marker | | Conversation tombstone after lease claim | 4 | Result refused, stored state unchanged from immediately after the marker | Each additional guarded transaction attempt can add up to two reads. No extra writes or provider calls are introduced. ## Release R19 review is scoped to F1. Roll out with the Python backend and revert this PR to roll back. Release owns production Firestore readback through SCA-1819. Line-Count-Exception: backend/utils/episodes/composer.py | 2133 -> 2141 | Forward the existing finalization context at the common episode writer and stop on deletion refusal. <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/26209?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/26209?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26209&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. --> (cherry picked from commit 145f72b)
…-luna/lane7-next-outcome
…-luna/lane7-next-outcome
…put receipt (cherry picked from commit a26d0e83c8750aeeb89702a3af66d86abb5265ee)
9d8ea24 to
eb15e66
Compare
) Scoped replacement for #26031 (SCA-3551 lane 7: the finalization replay oracle). It's based on `main` at `f719b056` and contains only replay tooling. It touches no serving path. **Scope (45 + 1 files)** - `backend-go/tools/replay/`: comparator, labels and witness tests. - `backend/testing/finalization_replay/`: the Python replay harness and diagnostic tests. - `Makefile`: the `oracle-diag` target. #26031 had picked up out-of-lane drift: MCP serving Python, generated API clients and the OpenAPI spec. All of it has been dropped here. **What the oracle encodes** - Discarded attach memo: the episode owner, with `attach_revision`, `attach_completed` and `attach_finalized` present and null on both sides. A dead letter has all four fields absent. - `by_design:replay_clock` covers profile clocks, resolver elapsed time, memory expiry (`captured_at` + 172800 s) and the group 7 notes hash. - `by_design:generated_identity` covers group 12, and `by_design:encrypted_envelope` covers the encrypted envelopes. **Current reviewed head: `ec37b822b948a6e8f6c9b86bf11cbb1af7d2ad7b`** - Worker 2 (SHIP, 16:04Z) and Luna (SHIP, 16:07Z) reviewed this commit. All review threads are resolved, and all checks pass on it. - Verification at `ec37b822` with worker `aab6310d`: 164 diagnostic Go gaps, 0 unlabelled, 0 execution failures. R7 holds on all 41 cases (Go ≤ Python), with a minimum margin of +2. **Historical runs (earlier heads, kept for the record; they are not the current head)** - `672bfca3`: two consecutive fresh runs with worker `aab6310d`. Each passed 41/41 with zero execution errors and zero diagnostic R7 overages. Both produced the same 164 normalized Go gaps, zero unlabelled. Every case matched the baseline Firestore reads, writes and deletes. - `85ef2d21`: one smoke run gave the same 164 gaps and 0 unlabelled. The three terminal memo checks passed. `983c0b51` then added the pinned-formatter line in `ordinary_sync_retry.py`. The commits after that, up to `ec37b822`, address review findings. 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/26293?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/26293?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26293&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. -->
|
Hey @Git-on-my-level 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Failure-Class: none
Scope
Carries the lane 7 ordinary-sync replay oracle, including the witnessed notes output receipt, side-local clocks, approved Group 7 comparisons, and terminal episode attach-memo checks.
For discarded outcomes, both sides must store
attach_owner_idequal to the episode and storeattach_revision,attach_completed, andattach_finalizedas present nulls. For unreadable dead-letter outcomes, both sides must have all four attach-memo fields absent. Terminal memo fields are checked against these stored shapes; live-content memo proof does not apply to discarded or dead-letter outcomes.Latest verification — 2026-11-24
go test ./tools/replay -run 'TestTerminalEpisodeMemoShape|TestInvalidGoAttachMemo'passed../.venv/bin/python -m unittest testing.finalization_replay.test_ordinary_sync_diag— 9 passed.TestTerminalEpisodeMemoShapecovers 24 per-field negative cases across both sides and all three fixtures, including missing/wrong owner, non-null/missing discard stamps, and present (including null) dead-letter stamps.672bfca3), both saved 41-case captures report 164go_gap, zero unlabelled, zero execution errors, and R7 41/41. Worker 1's fresh two-run verification on the published head remains the final replay confirmation.The PR remains a draft while parity is open. Cohort admission remains closed.
UI-Evidence: none