Repository navigation
perf(sync): reuse snapshots within read-only operations - #23393
Conversation
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
left a comment
There was a problem hiding this comment.
SHIP — Sol / P88, round 1, exact head 79dcddfbbb759c57156ec38189ec1f13963596b2.
No P0/P1 findings in the bounded P5 snapshot slice. Redirect hydration preserves per-hop deletion markers and owner/path validation, the ordinary codecs/photo hydration, and detached stored data. Bridge reuse is confined to the no-effect path; attempted transfer, retraction, copy and receipt effects retain the final refresh. Mutation/transaction authority is not replaced by this snapshot.
Reviewed the counted 5→4 redirect / 2→1 bridge tests, enabled/disabled content and endpoint parity, fresh-operation deletion/redirect checks and post-effect race cases. This is source/test review; I did not rerun tests in the implementation checkout because it currently contains unpublished edits. The 22M/day number remains a planning ceiling, not measured savings. The outbox/index follow-on is a lead-owned scope decision, not implemented here.
This is a code-review verdict only; exact-head CI and lead-owned merge/deploy gates remain separate. No merge performed.
Git-on-my-level
left a comment
There was a problem hiding this comment.
SHIP — Sol / P88, round 2, DELTA ONLY: 79dcddfbbb759c57156ec38189ec1f13963596b2..f4e376f649fac50a232ea03a929b8b395f9d92a3.
No P0/P1 findings in the fix delta. Legacy survivors without a stored id now retain the resolved path identity after ordinary hydration, without mutating stored data. Bridge reuse is narrower: metadata-only path, no lineage and no effects. Donor traversal and hydrated-reader IO retain the final refresh, including concurrent redirect/deletion.
Reviewed the added legacy-id, metadata-off and donor-read redirect/deletion regressions plus updated scope/economics docs. Existing marker/owner/path checks, codec/photo hydration and mutation/transaction authority remain intact. No local test rerun; CI and lead-owned merge/deploy are separate gates. No merge performed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4e376f649
ℹ️ 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".
| def get_sync_redirected_conversation( | ||
| uid: str, conversation_id: str, *, read_site: FirestoreReadSite = FirestoreReadSite.UNATTRIBUTED | ||
| ) -> Optional[dict]: |
There was a problem hiding this comment.
Accept an injectable Firestore client
Add a keyword-only firestore_client parameter and thread that same client through redirect resolution and hydration. As written, callers exercising this new database helper against a fake or scoped client must patch module globals, and the disabled path can resolve through get_firestore_client() before hydrating through the separate legacy db proxy. This violates the backend database-helper contract requiring converted helpers to expose an injection seam.
AGENTS.md reference: backend/AGENTS.md:L173-L175
Useful? React with 👍 / 👎.
Expose a keyword-only Firestore client on the redirect helpers and carry the operation client through both hydration modes and photo reads. Preserve lazy initialization for invalid paths and the existing read reduction. Cover scoped and default clients with poisoned legacy globals, photo/content parity, exact read counts and fresh deletion-marker rejection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow the backend metric reload convention so archive contract imports reuse the registered avoided-read counter. Keep the archive test unchanged and prove fresh imports share the counter and preserve exported increments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61d363f23a
ℹ️ 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".
| include_transcript_decode_status: bool = False, | ||
| ): | ||
| user_ref = db.collection('users').document(uid) | ||
| client = firestore_client if firestore_client is not None else db |
There was a problem hiding this comment.
Use the client factory in the converted database readers
When no client is injected, this converted helper still selects the legacy db proxy; get_conversation_photos introduces the same fallback. The database contract in backend/AGENTS.md explicitly requires converted helpers to obtain their default client through get_firestore_client() at call time and prohibits new uses of db. Replace both default selections with the factory while preserving the explicit-client path.
AGENTS.md reference: backend/AGENTS.md:L175-L175
Useful? React with 👍 / 👎.
#23447) #23445 (37010d3, merged 20:04Z) passes `skip_existing=True` to `_copy_audio_chunks_for_merge` from `merge_conversations.py:293`. Four test stubs replace that function with fixed-arity lambdas, so these tests now fail on main with `TypeError: unexpected keyword argument 'skip_existing'`: - `test_merge_deleted_source_race.py` (2 stubs) - `test_speaker_match_scores.py` (1) - `test_merge_created_webhook.py` (1) #23445's own CI was green because selective test selection didn't run these files. Seen on #23393 (run 40016931073, shards 1 and 5). Fix: test-only. Each stub now accepts `**_kw`. No production change. Verification (m1, omi-heavy, nice 19): `pytest tests/unit/test_merge_deleted_source_race.py tests/unit/test_speaker_match_scores.py tests/unit/test_merge_created_webhook.py tests/unit/test_merge_audio_chunk_copy_failure.py` gives 129 passed. Failure-Class: none 🤖 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/23447?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/23447?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F23447&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. -->
Preserve P5 snapshot documentation and kill switch alongside fs-p1 list projection documentation and flags. No Python conflict resolution needed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Carry the firestore_read_origin.py repair unchanged from fs-p2 commit 77a033e so archive imports retain their process-wide collector. The shared test remains unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Include #23393 sync read-only snapshots and preserve both snapshot and monthly epoch declarations. Regenerate the feature registry at its existing date. The non-fatal usage publication safety delta is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…23402) ## Summary Repeated released-memory reads reload identical canonical, historical and metadata windows. This change atomically maintains a content-free owner change head with source commits, including deletes, and reuses exact raw-query projections at internal canonical, historical, list-window, status-pair and MCP-card callers. Existing authorization, policy, lineage, privacy, decryption and lever paths remain authoritative. Warm 100-document pages use two head reads instead of 100 source-document reads. Cold pages add head checks; queries smaller than three rows bypass reuse. The sprint's **50M/day target is conditional and unmeasured**. Grade avoided source reads minus marker reads and added writes before booking savings. This branch merges main through `251892e223fca3bf5c90f060d3b9673683e258fa`, including P1 list projections (#23394), fs-p5 operation snapshots (#23393), the typecheck repair (#23440), merge-copy fixture repairs (#23447), and apt CI repair (#23446). Conflict resolution retains BOTH writer installers, BOTH account-erasure cleanup families, and all flag contracts. New real-SDK sync/async mixed-batch checks verify one atomic commit, both projection families, and unchanged source result counts. Erasure checks cover late head recreation with both present and missing user roots. The final fs-p5 refresh resolved only an adjacent flag insertion; its origin-counter repair is byte-identical to P2's. The archive-filter CI regression is fixed in production registration: `firestore_read_origin` and `released_memory_projection` recover their existing process-wide Prometheus counters after import-isolation teardown evicts modules. Two re-import cycles prove collector identity and counts survive. No test catches the error or weakens archive behavior. The earlier shard-5 rerun passed all four archive cases in 514s against its unchanged 720s budget. ## Lane / contract fs-p2 owns `released_memory_changes_v1`, `MEMORY_RELEASED_PROJECTION`, `MEMORY_RELEASED_WRITERS_COVERED`, and `omi_memory_released_projection_total`; original design bus 9012d9. MCP consumes P1's `list_serving_versions/conversations.version`, writer kill switch and coverage epoch (original bus dd3ecb). Missing P1 metadata retains source reads. No additional conversation writer is introduced. ## Product invariants affected - INV-MEM-1: existing three-tier policy, pending/expiry and archive/device visibility checks rerun on raw candidates. No transcript, speaker or Free-plan changes. - INV-MEM-3: source errors and canonical/suppression/lineage checks still fail closed. Projection faults fall back to the same authoritative query. - INV-MEM-4: projections grant no promotion authority. Canonical receipts, graph transitions and lineage collapsing retain their existing owners; source/head writes remain atomic, including deletes. ## Verification Final focused conflict-resolution run on m1: **433 tests across 21 files passed** through `/Users/david/workspace/omi-workspace/bin/omi-heavy run -- nice -n 19 env BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-files.txt BACKEND_PYTEST_WORKERS=4 bash backend/test.sh`. Covers P1/P2 projections, mixed sync/async writes, erasure/privacy, archive filtering, origin attribution/wiring, MCP consumers, memory policy, all three shared-main merge-copy stub files, and fs-p5 snapshot/metric/tombstone/unlock contracts. Log: `/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-focused.log`. The prior P1/P2 refresh passed 353 tests across 17 files. Full backend typecheck passed with **zero errors** (existing warnings remain), via `omi-heavy run --cache-default backend-typecheck -- nice -n 19 bash backend/scripts/typecheck.sh`; log `/Volumes/scratch/m1-lanes/fs-p2/merge-typecheck.log`. One read-only Luna conflict delta review completed with **no P0/P1 findings**: `exec-curve-yellow-plunge-fancy-pill-obtain`, result `/Volumes/scratch/m1-lanes/fs-p2/luna-merge-result.txt`. Historical metric delta review: `exec-rhythm-sort-chapter-traffic-comic-vendor`; its P1 typing finding was corrected and verified. Published final merge head: `6ac131f9f566b0eb2d35447329c685d76c951ed1`. **Exact-head CI is green**: [Backend Unit Tests, attempt 2](https://github.com/BasedHardware/omi/actions/runs/40028276311), [Firestore emulator proofs](https://github.com/BasedHardware/omi/actions/runs/40028276314), and [hermetic backend gates](https://github.com/BasedHardware/omi/actions/runs/40028276356) pass. All visible checks are terminal: 37 successful, 30 intentionally skipped, no failures. Final-head shard 5 passes all four archive cases with wall **673s/720s**. The single permitted failed-job rerun passed shard 4 (all 66 runtime-contract assertions, GPU closure CPU **0.88s/1.00s**, shard wall **615s/720s**). No threshold, allowlist or source changes and no further reruns. Attempt 1's sole failure was the unchanged GPU closure CPU guard at 1.01s against 1.00s, with all 66 assertions passing. **Exact main also fails the same guard at 1.16s** in [run 40026957577](https://github.com/BasedHardware/omi/actions/runs/40026957577/job/120665436845); test and closure tool blobs match. ANX `card:fs-p2-runtime-duration` retains the shared-main timing follow-up for the lead. **Normal pre-push exited 0**: all 37 manifest checks, full backend typecheck with zero errors, runtime source closure and bounded selected unit checks passed; log `/Volumes/scratch/m1-lanes/fs-p2/fs5-merge-push.log`. The prior main refresh also passed all normal pre-push gates; log `/Volumes/scratch/m1-lanes/fs-p2/merge-push.log`. Prior-head CI passed five unit shards, guardrails, Firestore emulator proofs and hermetic gates. Shard 5 passed all four archive cases in **635s against its unchanged 720s wall budget**. Shard 4 passed all 66 assertions in unchanged `test_runtime_image_contracts.py` but failed its CPU guard on the GPU import-closure test at 1.05s versus 1.00s. A focused same-runner local reproduction passed all 66 tests, that case at 0.31s; log `/Volumes/scratch/m1-lanes/fs-p2/runtime-focused.log`. No threshold/allowlist changes and no CI rerun used. Tracking: ANX `card:fs-p2-runtime-duration`. Main advanced with fs-p5 during this CI run, so the final merge gets fresh CI rather than rerunning the superseded head. Earlier synthetic P2 Firestore emulator proof passed failed-batch atomicity, SDK transaction retry, result cardinality, sync/async deletes, bulk exclusion and raw-read parity at recovered head bf6f72c. Emulator project `demo-fs-p2`, local `127.0.0.1:18585`; log `/Volumes/scratch/m1-lanes/fs-p2/emulator.log`. This historical emulator run is not claimed as fresh conflict-resolution evidence. New-head registered CI emulator proofs must pass before merge. ## Rollout / rollback Writer maintenance is on. Reader preference defaults on with `MEMORY_RELEASED_PROJECTION=off` as kill switch. **Reuse requires `MEMORY_RELEASED_WRITERS_COVERED=v1:<unique-epoch>`**, initially absent until complete writer-fleet attestation. MCP additionally requires P1 writer coverage and its fresh epoch. Bulk-blocked or missing-head owners retain source reads; no user-data backfill. Owner: rollout lead. Target T2 **2026-10-24 08:00Z**, cutoff **07:30Z**, only after exact-head CI is green. By cutoff, verify every backend/sync/backfill/integration/listen/pusher/desktop/job writer release and synthetic create/update/delete parity, including standalone/non-Python/raw-RPC writers. If proof is missing, record the blocker and keep reuse disabled. Once proved, enable all eligible owners with a fresh epoch. Metrics: bounded `surface/outcome/origin` on `omi_memory_released_projection_total`; marker reads use `origin=job:released_memory_projection`, and source reads retain their existing caller/origin. Compare output/order/access parity and p95. Any mismatch or regression disables readers. Grade net reads in equal full-day windows and mature billing before recording savings. Clear coverage before ANY writer rollback or gap; rotate the epoch after restoration. Reader-only rollback keeps head writers installed. Details: `backend/docs/released-memory-change-projection.md`. Failure-Class: none Line-Count-Exception: backend/database/memories.py | 1968 -> 1971 | three raw query calls adopt the shared projection transport; query and policy ownership remain in place Tracking: ANX `card:fs-p2-released-memory-projection`, owner fs-p2; lead owns merge/deploy and full writer-fleet audit/activation by 2026-10-24 07:30Z. Handoff: `/Volumes/scratch/m1-lanes/fs-p2/HANDOFF.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
## What changed and why Monthly allowance refreshes repeatedly scan `hourly_usage` (caller #6, about 42M reads/day in the sprint's latest-hour snapshot). Maintain five monthly counters and daily subtotals in the same transaction as hourly usage and its existing once/partial receipt. Warm full-month and since-day lookups read one document. Absolute history overwrite, admin reset and historical deletion atomically invalidate the total; first use rebuilds from hourly source rows. Legacy anomalies retain the existing query. Every new aggregate creator binds erasure authority to publication: ordinary, once-key, absolute, admin and migration writers use the existing `external_write_fence` and require a user root inside their transaction. Authority reads precede all receipt/source/total writes. Rejected publication leaves receipts untouched. Existing batch projection completion/partial transactions reuse their deletion/root/privacy checks. Lead approved this strengthening in ANX `event:ev_5e7c48e900024551f307ab9c3e254fd7`. Usage publication refusals are non-fatal to user-facing pipelines. The shared `utils.analytics.record_usage` composition boundary catches the refusal outside the transaction: conversation/transcript/audio processing completes while hourly/monthly counters and the once receipt remain uncommitted. A typed missing-root refusal is distinct from a deletion/destructive-operation refusal in `omi_fallback_total` and matching fixed-field logs (`component=usage_publication`, `from_mode=publish`, `to_mode=skip`, `outcome=degraded`, reason `usage_root_missing` or `usage_fence_blocked`); no UID, content or exception text enters labels/logs. All user-facing source writes use this helper. Direct admin/migration operations keep their refusal semantics. Cold reader rebuild already returns to the hourly query on root absence; no other production user path gains a root dependency in this PR. Hermetic regressions cover a root absent before sync admission, root removal immediately before publication, pending/completed deletion and ordinary live-account once replay. They require completed sync, the persisted conversation/transcript, no aggregate/usage receipt on refusal and an incremented bounded counter. Deletion still returns 403 for HTTP polling. The Firestore fake now preserves subcollections during root deletion, matching Firestore; a harness self-test checks repeated deletion without recreating the root. ## Rollout and rollback Writer maintenance ships ON. Reader `usage_month_total` remains 0 because mixed-version writers can undercount paid/Free allowance. Lead owns merge, deploy and ramp. Target writer train: **2026-10-24 08:00Z**, cutoff **07:30Z**. Deploy every writer (listen → pusher → Cloud Run → desktop-backend, plus operator/migration tooling); verify actual serving identities/traffic and drain old jobs. Choose a common `FSR_USAGE_MONTH_TOTAL_EPOCH`, then 5% for two hours with zero synthetic parity mismatches, no p95/5xx regression and no contention errors. Lead/reads loop expands to 100%. The original 08:00Z full-ramp deadline conflicts with an 08:00Z writer train plus the required hold. **Proposed replacement: 2026-10-24 12:00Z, pending lead acceptance.** Report any writer/parity blocker. Details: `backend/docs/monthly-usage-totals.md`. Kill switch: `usage_month_total:0`, preserving other levers. Writers continue maintenance. After rollback to any old writer, change the epoch on all readers before re-enabling. Epoch wiring uses existing manifests/renderers; no new workflow. ## Attribution and net economics Origins: `job:usage_month_total_read`, `job:usage_month_total_rebuild`, `job:usage_month_total_fallback`. Grade all three alongside original monthly and writer caller origins. **Up to 40M/day gross reader reduction is modeled, not measured.** Previously unfenced writer/replay attempts now add **three point reads** (deletion marker, destructive gate, root) per commit attempt. If their daily count is W, subtract 3W plus cold-seed scans/point reads and fallbacks from gross reduction; account separately for one added total write per accounting commit. Retries and existing outer fences may add further reads. Example: W=1M/day implies at most 37M/day before those other costs. W and realized net saving remain unmeasured. Funded `read_month` and plan/shadow readers retain their existing paths. ## Product invariants affected INV-MEM-4: `backend/deploy/runtime_env.yaml` wires the epoch; canonical memory intake/promotion keeps its authority. Existing deletion fences are strengthened by transaction-bound reuse under the lead's explicit ruling. Free-plan allowance policy, authorization, transcripts and speaker labels retain their behavior. ## Validation - Latest integration head **`9efacbc5723b866a598c061986d8718d960071d6`** includes main **`0d302a99fe`** (#23402) and **`251892e223`** (#23393). Only adjacent feature declarations conflicted. All monthly/snapshot/released-memory declarations and query proof registry entries are preserved; the feature registry keeps its existing 2026-10-22 date. The reviewed safety code and regressions are unchanged from safety commit `162181c8d8`. - Normal integrated-head commit/push hooks passed; evidence `nonfatal-main2-push.log`. No workflow, timing budget, test selection, skip hatch or force-push change. [Live exact-head checks](https://github.com/BasedHardware/omi/pull/23397/checks) are authoritative: require every expected backend check, all six unit shards and aggregate gate, full Hermetic E2E and merge gate, emulator proofs, guardrails, source closure, static contracts, metadata, hygiene and formatting to be present and successful before merge. The final gate certificate belongs to the lane handoff; no stale-head or check-presence-only certification. - Safety delta local evidence: **165 focused unit passes** (47 sync-two-lane, 24 monthly total, 60 usage units, 34 user usage), **24 targeted hermetic passes**, and **56 loopback monthly Firestore emulator passes**. Eight ordinary/once refusal cases prove zero writes/committed usage receipt, exact bounded reason counter/log, and unrelated errors still propagate. Real finalize cases include a root absent before admission, root removed immediately before accounting, pending/completed deletion and live once replay; the job and persisted decoded conversation/transcript complete. Evidence: `nonfatal-unit2.log`, `nonfatal-unit3.log`, `nonfatal-hermetic2.log`, `nonfatal-emulator2.log`. - Full Hermetic E2E on predecessor `f05a38addd`: **135 passed, 3 skipped, 2 xfailed**, 110.56s ([job](https://github.com/BasedHardware/omi/actions/runs/40028805287/job/120671936148)); emulator, other five shards and stack checks also passed. That head was not green: its first shard-3 attempt passed all 66 runtime-image assertions but failed a **1.17s / 1.00s CPU guard**; one bounded same-head retry passed all test files and the CPU guard but failed the unchanged **723s / 720s wall gate**. Earlier safety head `162181c8d8` failed wall **733s / 720s**. No further identical reruns are queued. Main #23402 then advanced and caused a real merge conflict; the latest head integrates that changed source/test input. Timing evidence: `nonfatal-final-unit3-failure.log`, `nonfatal-final-unit3-retry-failure.log`, `card:fs-p3-ci-unit-wall-budget`. - One requested safety delta Luna review: **SHIP, no P0/P1**, execution `exec-express-mask-gap-tennis-atom-bundle`; static production/caller review, `nonfatal-luna-review.md`. Later changes only corrected test setup/fake deletion semantics and integrated already-reviewed main. No review loop. - Earlier writer proof remains: fake **744 source reads to 1 warm read**, identical five-field/day-cutoff results, three writer authority reads and one added total write. Monthly emulator proofs include all original creator erasure cases, receipt rollback/retry/replay and racing root/deletion inventories. Four historical broader projection failures also reproduced on then-main `4d236fd94e`, tracked on `card:fs-p3-projection-emulator-baseline`; the broader suite was not rerun after the latest upstream integration. All local checks use `omi-heavy` at nice 19 with targeted FILE_LIST or hermetic `-k`. No full local backend unit suite, production data, GCP or deploy action. Reader remains off until lead-owned writer/epoch gates; realized net savings are unmeasured. ## UI evidence UI-Evidence: none -- backend accounting/read-path change. ## Failure class (fixes) Failure-Class: none The erasure defect was found within this unmerged feature; no shipped incident is classified. ANX owner/evidence: `card:fs-p3`, `card:p88-monthly-usage-cold-seed-erasure`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
What changed and why
Redirected sync owner reads loaded the final survivor twice. Reuse the operation's detached raw snapshot and Firestore revision for ordinary photo/transcript hydration. A metadata-only bridge with no donor lineage or effect attempts reuses its initial metadata. Donor traversal and every attempted effect retain the final refresh. Transaction reads, CAS, deletion markers, owner/path checks and outbox custody remain authoritative.
Redirect helpers accept a keyword-only
firestore_client. One lazily selected client serves redirect resolution, either hydration mode and photo reads. This addresses the P1 injection finding at discussion_r4360643026; scoped-client tests reject fallback to legacy globals. Invalid paths reject before client initialization.Default ON. Kill switch:
SYNC_OPERATION_SNAPSHOT_ENABLED=false. Both modes useorigin=job:sync_operation_snapshot;omi_sync_operation_snapshot_reads_avoided_total{origin,operation}counts avoided redirect-hydration and no-effect bridge lookups. No reads-loop configuration changes. Keep renamed callersync_conversation_snapshot:resolve_snapshotin the measurement baseline; label movement is not savings.Both the snapshot counter and shared origin-overflow counter reuse existing Prometheus collectors across fresh imports. The origin helper is copied unchanged from fs-p2's reviewed commit
77a033e14a0a53d7eaffb04b7da3fbde2875019c; the archive contract test is unchanged.This is the bounded P5 snapshot slice.
backend/docs/sync-operation-snapshots.mdrecords the remaining index contract and P4 design only. The content-free <=4KiB enrichment outbox cannot carry structured user content. An id+writer-generation index obligation needs all-writer coverage, live eligibility, replay/CAS and migration proof; lead owns the scope ruling. P4 excludes every privacy caller and requires residual phase measurement after WQ12. The 22M/day and 25M/day figures are unverified planning ceilings; daily savings are unknown and none are booked.Product invariants affected
none
No transcript, speaker, Free-plan, entitlement, polling, hold, deletion or privacy authority changes.
How it was verified
532990aee3as merge commit252b517e11. Conflicts were additive documentation and flag entries only; preserved both fs-p1 feat(backend): add list metadata projections and conditional version checks #23394 entries and P5 entries. No Python conflict resolution. Head8de371d00851ed4b0e9bd1180633b65faa156944also carries the exact fs-p2 shared-origin helper (blobd3b25323f440457705bfd6eab3ce83a55217a176).backend/:/Users/david/workspace/omi-workspace/bin/omi-heavy run -- env BACKEND_PYTEST_WORKERS=4 BACKEND_UNIT_TEST_FILE_LIST=/Volumes/scratch/m1-lanes/fs-p5/merge-focused-files.txt nice -n 19 bash test.sh. Log:/Volumes/scratch/m1-lanes/fs-p5/merge-focused.log.make preflightPASS37/37 (169.88s) and full mandatory pre-push PASS, including full-backend typecheck (zero errors), runtime source closure, bounded selected tests, schema checks and formatting. Ran throughomi-heavy, nice19; log/Volumes/scratch/m1-lanes/fs-p5/merge-publish.log. Normal push succeeded after re-fetching main and the shared lane branch; no force-push. Exact-head CI40024971016 PASS: all six unit shards, guardrails and suite gate. All PR checks terminal at collection, 37SUCCESS and zero failures; GitHub merge state CLEAN. No rerun needed. Lead delta review remains required before merge.61d363f23a: eight focused files PASS (134 tests); published CI exposed the separate fs-p2 origin-counter dependency and main fix(storage): coalesce pusher boundary tails and skip identical merge copies #23445 fixture mismatches. This integration contains the origin repair and main fix(tests): let merge-copy stubs accept #23445's skip_existing keyword #23447 fixture repair. Earlier full mandatory pre-push and full-backend typecheck passed. No checks bypassed.f4e376f649fac50a232ea03a929b8b395f9d92a3. Lead must inspect the seven-line fixture delta at7186a6bf67d, client-injection delta7186..526eand metric delta06d8..61d3. No third round: two-round cap exhausted, and current conflict resolution changes no runtime behavior. The shared origin fix was reviewed by fs-p2's read-only Luna delta review.Line-Count-Exception: backend/database/conversations.py | 4431 -> 4449 | Add scoped-client parameters and forwarding at existing redirect/hydration boundaries for P1 correctness; operation orchestration remains extracted in sync_conversation_snapshot.py.
UI evidence
UI-Evidence: none -- backend read optimization with unchanged response contract.
Failure class (fixes)
Failure-Class: none
🤖 Generated with Claude Code