Repository navigation
Schedule batch projection from committed result obligations - #25724
Conversation
Failure-Class: FC-unresolved-head-blocks-projection
Failure-Class: FC-unresolved-head-blocks-projection
…utbox # Conflicts: # backend/tests/unit/test_batch_pipeline_serving.py
Failure-Class: FC-unresolved-head-blocks-projection
Failure-Class: FC-unresolved-head-blocks-projection
…ting test The [all] case reparsed the full runtime manifest on every validator call and drifted past the 1.00 s CPU guard (0.92 -> 1.04 -> 1.10 s on hosted runners). Same test-only change as #25722. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Exact-head closure 3b258f3This is the source closure for the batch-custody owner on #25724. The exact head is clean and mergeable. Hosted Backend Unit Tests passed all eight shards and guardrails. Emulator proofs, both Hermetic E2E gauntlets, runtime image contracts and Firestore index reconciliation passed. Unit tests, emulator proofs, Hermetic E2E, index reconciliation. Panel findings and exact-head confirmation
I verified the fixing commits are ancestors and reread the implementation and named tests from the final tree. Raw triage command and stdout from the implementation session The panel and raw triage rows are in Delta reviewI reread
All 115 commits brought in by the main mergeThese commits were already on the base branch. Their subjects identify the individual changes. The grouped risk notes describe their interactions with the outbox delta. Merge commits Their integration risk is reconciling overlapping edits from main. The retained tree and relevant custody boundaries were checked at the downstream lane merge.
Job-store retirement and copy serving The material risks are copy scope, schema ordering, byte-order cursor progress, and resource contention with critical maintenance. Retirement uses supervised leases, bounded pages and target-bound cursors, and the production integration overlay stages it off.
Conversation deletion and purge audit The material risks are premature erasure acknowledgment, unscoped artifact deletion and audit visibility. The inherited active purge retains pending receipts and the audit is read-only with scoped evidence.
Capture rotation and continuation The material risks are losing audio or resuming the wrong recording across a boundary. The inherited path uses a successor-first handoff, ownership checks, a close barrier and bounded retries. Its rollout gate defaults off.
Cap-hold accounting The material risks are premature capacity release and removal of the held audio. The inherited handoff checks durable content completion before release and erase.
Home review and repair The material risks are overbroad reads, small-cohort disclosure and writes against stale eligibility or privacy state. The inherited review constrains inputs and receipts and the repair rereads policy and authority in its write transaction.
Home and live reads The material risks are visibility drift, empty cursor loops and live-row misclassification. These inherited reader changes preserve owner scoping and add paging, visibility and open-window coverage.
Conversations v3 projection and reconciliation The material risks are projection/wake lag, oversized writes, colliding window identities and readback false conflicts. The inherited changes preserve transaction and owner fences, bound retry behavior and skip note draining for account deletion.
Mobile Finish and frame-queue behavior The direct risks concern user-visible Finish reentry and bounded frame-queue progress. Those paths arrived from main and the outbox delta leaves their writes and policy placement unchanged.
Tests, formatting and workflow selectors These entries affect test or validation coverage. No further batch-custody runtime change is introduced by the test wiring.
Scope-only baseline to the reviewed SHAThe scope baseline predates the PR. The main changes covered lookback documentation, stale canary configuration, per-owner v3 backfill and the sync upload allowance. The latter policy is enforced at upload. Custody of already-committed results remains with the existing result and receipt fences. The feature commit introduced the reviewed scheduling and lease path. F1–F3 and the replay fences above address its new scanner, witness and retry risks.
DELTA SHIP 3b258f3 |
…utbox # Conflicts: # backend/tests/unit/test_batch_pipeline_serving.py
Exact-head closure a80b924Supersedes the closure on Delta since the prior closure
Verification
All 80 commits inherited from main
DELTA SHIP a80b924 |
## What changes The batch owner-state lane gets one PR with separate implementation commits. The first adds a post-lease packing counterfactual for all nine G/S pairs, a validated capture-gap histogram, observed due depth and intake cohort labels through fenced completion. It supplies measurement for the packing decision in place of estimates based only on upload spacing. The second adds the GMP batch read-cost recording group and CI coverage for recurring Firestore and PostgreSQL selectors. The existing Firestore alerts keep their current definitions and thresholds. The probe reads one metadata-only owner prefix with at most 17 rows, one outstanding read per process, no RPC retries, and a one-second deadline. No authority, scheduling or sweep decisions consume its results. The background-task ratchet records why process loss can drop only an optional sample. The shared identity helper has no runtime configuration imports, so the GPU worker does not become a reader of the upload-coalescing feature flag. The recorded cost ratio uses the existing fenced completion seconds across metric labels and marks low volume and missing telemetry explicitly. The selector guard runs the existing builders in the query inventory and requires actionable deadlines or owner-reviewed, bounded, expiring exceptions. A shared selector primitive would change the compatibility queries it is meant to audit. The check catches the state-only legacy projection discovery and provider sweep documented by the owner-state R1/R5 inventory. This follows the same replicated-read failure class as the coalescing scan containment in #25330. ## Kill switches and mixed versions `BATCH_PIPELINE_PACKING_SAMPLE_RATE` defaults to `0.001` and caps at `0.01`. Set `0` across the intake and lease roles, including `worker.packingSampleRate: '0'` for Helm, to stop observation reads, intake stamps and cohort completion counters. Restore `0.001` to resume. The metrics scope records `job:batch_packing_counterfactual` separately. Release can withdraw the independent GMP `GlobalRules` resource. Reverting the cost commit withdraws the CI guard without requiring any persistent data migration. Old images such as `ef42ee8` ignore the optional job metadata and keep the existing worker payload and completion counter. New readers treat missing clocks and ambiguous Stripe paid-versus-trial evidence as unknown. Completion disposes of the stamp on its existing fenced write. Old workers may retain it until the ordinary job retention or erasure path. Samples describe the visible queue shortly after commit, with explicit capped and unavailable coverage. ## Verification and expected cost - On the original head `6c06588ec5`, the normal pre-push hook passed 54 repository preflight checks, full backend Pyright with zero errors, and all 40 selected backend unit test files. - The initial `BACKEND_UNIT_TEST_FILE_LIST=<focused list> bash backend/test.sh` run passed 715 checks across packing, scheduler, capture decode, intake, coalescing, chart, runtime env, flag budget, census, simulator and cost alerts. Final focused reruns passed 20 packing tests, six background-task checks and two lifecycle guard cases for the observation module. Later simulator reruns hit the local 300-second file wall. An earlier rerun printed all 12 simulator assertions as passing before that wall ended the process. - `pytest -q backend/tests/unit/test_batch_census_registry.py backend/tests/unit/test_firestore_query_shapes.py -k 'selector or no_errors or zero_serving_debt'` passed 571 focused checks. - `backend/.venv/bin/python backend/tests/promql/firestore_cost_budget.py --promtool <pinned promtool 2.55.1>` passed the existing thresholds and the new missing, low-volume, true-zero, raw counter reset and caller-group fixtures. - The loopback Firestore, PostgreSQL and simulator pull conformance plus upload coalescing emulator suites passed 109 tests. The separate legacy intake rollback fixture returns a fallback before admission on this head and on base `9c88e7f888b0`. - `backend/.venv/bin/python backend/scripts/cross_service_contract.py` reported zero new and zero stale violations. The background-task ratchet passed all six tests. - Direct savings inferred from this PR are zero. The probe adds one bounded read per accepted sample. A PostgreSQL probe statement timeout closes its warm pooled connection. A later store call can incur the cost of opening and configuring a replacement. That cost is unmeasured. A serving readout must measure its actual billed overhead and whether compatible jobs can be combined. The recording group is a source artifact awaiting Release-owned install and GMP comparison. Line-Count-Exception: backend/database/firestore_index_registry.py | 2399 -> 2402 | Keep the two metadata-only field exemptions in the existing index authority so high-volume telemetry adds no single-field indexes. ## Product invariants affected - INV-MEM-4. Probe metadata and metrics add no path for user content disclosure or custody settlement. ## Scope panel `scope-20261118t145605-e19d` returned Luna and GLM Flash. DeepSeek ended without a terminal answer on that run. The retry `scope-20261118t150457-45c4` returned DeepSeek and GLM Flash. The panel's scoping dossier returns prose without F identifiers, so `omi-panel triage` did not accept a numbered entry. - Accepted both reviewers' bounded, post-commit, fail-open read, source-only metrics, fixed labels, explicit missing or low telemetry, settled metric window, per-process coverage limits and expiring reviewed exceptions. - Accepted separate probe attribution and cost breakout. The probe is outside the cost total. The old alert query retains its exact caller regex. - Used the original coalescing compatibility key and intake clock evidence. Rejected inferring missing session or funding proof from `WorkItem`, guessing paid or trial on ambiguous legacy rows, and projecting full job documents through `pending_page`. - Used the existing intake and completion writes for the telemetry stamp and no worker wire changes. An in-transaction query would add contention. An in-memory handoff would lose attribution across service boundaries. - Used a GMP `GlobalRules` recording resource for the fleet-wide window. The in-cluster PrometheusRule would see only its local series. This source is outside the Grafana JSON consumer inventory and the alert provisioning path. Release qualification remains separate from local PromQL tests. - Exercised executable query builders and their existing registry. A cursor on one page cannot establish non-wrapping progress. The default-on guard uses reviewed exception metadata and exact builder digests. - Kept one PR per the lane assignment. Deferred the packing algorithm and all live, fleet-size and savings validation to the program owner. ## Round 2 review panel `review-20261119t041052-488d` returned FIX-FIRST on `6c06588ec5`. Recorded `F1=accept F2=accept F3=accept` with `omi-panel triage`. - **F1 accepted.** Native read coverage now takes the fewest samples across every observed series of each type, then applies the 58-sample floor. A second QUERY series at 58 preserves coverage, and a second QUERY series at 57 suppresses the ratio. - **F2 accepted.** The cost section accounts for the warm connection lost on a PostgreSQL statement timeout. - **F3 accepted.** A missing or non-finite decoded duration yields `unknown_duration`. An invalid anchor contributes zero, and an invalid following row preserves the eligible prefix. ### Round 2 verification - From `backend/`, `.venv/bin/python -m pytest -q tests/unit/test_batch_packing_counterfactual.py tests/unit/test_monitoring_cloud_monitoring_promql_shape.py` passed 29 tests. - `backend/.venv/bin/python backend/tests/promql/firestore_cost_budget.py --promtool <pinned promtool 2.55.1>` passed both new multi-series fixtures and the existing cost fixtures. - `pytest -q tests/integration/test_partial_pull_conformance.py tests/integration/test_pull_batch_parity.py` passed 66 simulator and Firestore-emulator cases. A local PostgreSQL 16.2 rerun with `-k postgres` passed the remaining 33 cases. ## Round 3 merge verification Merge `b15cfb58a3b` incorporates `main` at `e3cfebcfb32`. Upload intake now forwards main's allowance refusal and this PR's packing observations to the same admission transaction. Both the observation and admission use the timestamp taken after the allowance probe. - `backend/test.sh` passed 342 tests across intake, admission, allowance holds, staging, packing and future-capture parity. - The allowance-hold integration matrix passed 75 cases across the simulator, loopback Firestore and local PostgreSQL. Its 18 skips are fixture-specific. - The separate legacy Firestore rollback fixture `test_accepted_upload_drains_after_rollback_with_encrypted_context_and_accounting` returned `None` at the admission assertion on both the merge and its exact main parent. ### GitHub CI on the Round 2 head GitHub tested merge `3577371251` for the earlier head `1a2711956c5`. The backend unit suite is red from two failures also observed on `main` before this follow-up. - Shard 7 failed `test_listen_v3_rotation_custody.py::test_frames_during_a_failed_create_never_bind_to_its_successor` because the producer missed the transient `session-2` label before the test reached its custody assertions. The test and relevant listen code match the CI merge's main parent `7437adc424b9`. The same assertion failed on earlier main `2a8b05cd3e0d` and passed on `7437adc424b9`. [PR failure](https://github.com/BasedHardware/omi/actions/runs/44465204778/job/135361476491) · [Earlier main failure](https://github.com/BasedHardware/omi/actions/runs/44445981915/job/135298343674) · [Exact main parent pass](https://github.com/BasedHardware/omi/actions/runs/44458558798/job/135339706957) - Shard 2 failed the CPU duration guard for `test_monitoring_adapter_hpa_contract.py::test_hpa_and_adapter_changes_select_this_contract` at 1.03 seconds against the 1.00-second limit. All 39 assertions in the file passed. The same test exceeded the guard at 1.06 seconds on earlier main `ae68d3176d80`. The selector additions in this PR match census and Firestore guard paths outside this test's HPA and adapter inputs. [PR failure](https://github.com/BasedHardware/omi/actions/runs/44465204778/job/135361476516) · [Earlier main failure](https://github.com/BasedHardware/omi/actions/runs/44416485689/job/135198319558) <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25716?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/25716?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25716&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. --> Failure-Class: FC-sync-assignment-read-abort-escapes-retry Implemented by a delegated agent for the batch owner-state program. ### Current head The final head is `23d7a907b5f936b59db4f9674b4ca0bedee85d36`. Its exact-head closure is comment 7016584048, which records the merge with main after #25724 and the outbox commit-contention fix. lead2 gave the batch-custody delta source ACK at this head (bus 0bd65c). CI is green.
## Design
DESIGN: Defer speculative native-record audio materialization until
projection assignment needs the authenticated intake context.
Owner-chain read-ahead continues to fetch immutable job bindings and
result artifacts. The existing assignment path requests the staging
artifact and source verification on the storage executor. The owner walk
waits only for its remaining step budget and can resume a pending read
on the next step without another fetch. One unconsumed prefetch avoids
one staging audio-artifact read and the corresponding source metadata
and payload GETs. An assigned unit still performs the required
verification. No storage or database writes are added.
`BATCH_PIPELINE_DEFER_NATIVE_PROJECTION_AUDIO_PREFETCH_ENABLED` is on by
default. Set it to `false` to restore read-ahead.
DESIGN: OK from David on Nov 19, with the fixed-outcome counter, custody
and rollback tests, and exact-head CI and full review gates.
## Batch custody
The native-record branch only defers work. It keeps authenticated
staging, source generation and digest checks, frame and range
validation, owner and conversation binding, authorization, and the live
privacy and deletion transaction checks for every assignment. It makes
no receipt, retention, or deletion decisions from the prefetched result.
Native and non-native legacy inputs continue through the same on-demand
loaders whenever assignment needs audio. The design adds no shared audio
cache and changes no mixed-version data contracts.
## Production readback
Compare complete UTC hours before and after serving. Match projection
completions and check owner-chain advancement and backlog age. In
`backend-integration`, compare
`increase(omi_private_sync_object_get_total{reader="batch_source",kind="payload"}[1h])`
against `storage_googleapis_com:api_request_count` and
`storage_googleapis_com:network_sent_bytes_count` on private-sync
`ReadObject`. Adjust for overlapping rollout changes. Track `sum by
(outcome)(increase(omi_batch_projection_native_audio_prefetch_total{service_name="backend-integration"}[1h]))`
in both modes. Its only label is `outcome`, with `started`, `consumed`,
and `abandoned`. Use abandoned candidates alongside the direct GET and
byte counters to size savings. A candidate may settle in a later scrape
window. Historical abandoned candidates and source reads per candidate
are unmeasured. The before/after test is fewer payload GETs and bytes
per comparable completed audio-hour with stable owner-chain progress.
Nov 2 to Nov 16, bucket-wide bytes per completed audio-hour rose from
1.016 to 2.338 GB, while completed hours rose 7.20×. Cloud Run
integration Google-network receive traffic per completed hour rose from
2.058 to 2.128 GB across the same days. Those numerators include other
activity. They cannot measure waste from a single path. Aggregate
production reads were through `ro-prod`.
INV-MEM-4. Authorization and actual source verification still run before
any assignment that consumes the recording. The focused tests exercise
real assignment through the encrypted staging and generation-pinned
source reader with fake object storage. They cover successful
assignment, staging tamper, source digest mismatch, privacy revocation
during source IO, eager rollback, and accounting for blocked and closed
work. 210 focused tests passed through `omi-heavy` on the updated
implementation, including a delayed read that yields at the step
boundary and resumes the same task. Five loopback Firestore emulator
tests passed against replay, privacy holds and deletion during multipart
projection. The branch also includes current main’s projection
obligation changes in #25724.
Panel `review-20261119t144713-f96b` found that an inline deferred read
could exceed the owner-drain budget. The storage-executor future now
follows the same turn across bounded step waits. The background-task
inventory records why interrupting that read-only work is safe. 6
inventory tests and the 8 focused native prefetch cases passed.
Panel `review-20261119t151207-4579` identified a missing exact metric in
the shared Cloud Run collector keep rule. The collector now retains that
name. A matched served collector revision is required for readback on
backend-integration. The scraper rule and eager-failure fallback tests
passed in the 126-test targeted run.
Final panel `review-20261119t154350-2f61` returned SHIP on head
`5856f1ad769d6b71cccb4d15cc39b8a3ca1cc558` with both reviewers.
Transient failures of the assignment-owned deferred read retain the
durable obligation for a later bounded retry. Eager rollback keeps its
original same-step fallback after a failed speculative load.
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1914
-> 1933 | Bound deferred read waits and account for the lifecycle at the
assignment and owner-walk decision boundaries.
Failure-Class: FC-metric-dropped-by-scrape-allowlist
## Gauntlet contention follow-up
On `760390a1`, the local two-worker scenario timed out with the native
prefetch switch on and completed in 26.5 seconds with it off. Both arms
verified non-native bindings and recorded zero native prefetches. The
failing transaction was `mark_enrichment` on a non-native unit.
Firestore aborted its commit and the SDK exhausted five attempts. The
assignment context read is already outside that transaction.
The test-only change sets
`SYNC_ASSIGNMENT_CONTENTION_RETRY_ENABLED=true` in the gauntlet's
serving fixture, matching the serving backend-integration configuration
verified through `ro-prod`. The existing bounded wrapper retries
explicit contention with fresh transactions and jitter. With this
setting and native deferral on, the local batch gauntlet passed all ten
scenarios, including the two-worker case in 36.8 seconds. The fixture
keeps its original timeout, custody assertions, and worker concurrency.
) ## What changed Add the PL-668 Store conformance guard for mixed-writer projection discovery from #25724. A healthy elected scan can suppress a stamped row from legacy discovery while unstamped and explicitly legacy rows stay visible. A fully filtered page still advances the raw keyset cursor. Overdue debt withdraws coverage, and a failed query cannot extend it. Legacy discovery finds the stamped row again when coverage ends. The test uses the production coordinator and discovery over the simulator, Firestore emulator and replacement Postgres Store. Go batch B21 needs equivalent behavior when its projector takes over discovery. ## Verification - With `OMI_REQUIRE_STORE_BACKENDS=all`, the Store and recovery-custody suites passed 293 cases with seven existing backend-specific skips. PL-668 passed all six cases across three stores. - The existing Emulator Proofs runner includes the same Store suite. - `git diff --check` passed. ## Product invariants affected none ## Failure class 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/26073?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/26073?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26073&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. -->
…ormance (#25832) ## What changed and why Extend the existing Store conformance suite with parity cases PL-665–667 for committed projection obligations from #25724. A lost wake must leave durable work for discovery, due pages must stay bounded and stable, and a stale delivery must be unable to settle a current claim. The same cases exercise the Python Firestore Store, replacement Postgres Store and in-memory simulator. The Go rewrite can use them as acceptance cases under [batch contract B21](https://github.com/BasedHardware/omi/blob/b301dc3d1f183770aeb041bc22d1a75cb6bedf35/backend-go/docs/contracts/batch.md). Its batch projector remains a separate implementation and verification step. ## Product invariants affected none ## How it was verified - Ran the Store and recovery-custody suites with `OMI_REQUIRE_STORE_BACKENDS=all` under a private loopback Firestore emulator and local Postgres. They passed with 326 passes and seven existing backend-specific skips. - Reran the final focused selectors across all three required stores. All 18 cases passed, including 15 new cases, with zero skips or xfails. All 11 existing projection-outbox unit cases passed. - The existing Emulator Proofs runner requires the simulator and Firestore legs in CI. Its Store proof heading now identifies the committed projection debt sub-suite. ## Tests - `test_pl665_projection_debt_commits_with_result` aborts after the real merge has scheduled its writes, then verifies complete rollback and wake-free discovery after restart. - `test_pl666_projection_due_page_filters_before_limiting` checks kind and time exclusion, the inclusive cutoff, ID ties and visibility of the next key after a claim. - `test_pl667_projection_settlement_checks_lease_and_canonical_state` checks exact lease expiry, stale token and revision refusal, bounded retry and canonical completed, erased and held dispositions. Suite path is `backend/tests/integration/test_store_conformance.py`. ## UI evidence UI-Evidence: none -- shared backend tests only ## Failure class Failure-Class: FC-unresolved-head-blocks-projection <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/25832?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/25832?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F25832&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)
Change
Ordered merge and source-alias fallback now stamp an idempotent projection obligation on the committed result in the same transaction. The segment key and owner log sequence identify the revision. Serving offers an immediate, bounded post-commit hint, and one strict lease holder per namespace scans lost wakes in kind, due time, and document ID order. A delivery claims the revision, runs the existing fenced projector, then settles from the canonical result state. Predecessor, sibling, timeout and error deferrals retain the obligation with a bounded clock and a disposition. Multipart receipts, content ledger completion, hourly usage, retained audio and privacy checks use the existing authority.
This removes downstream job/policy probes and projection attempts for covered rows from legacy assignment, finish and follow-up sweeps while the backstop has recently succeeded and is keeping up. Legacy pages retain their raw Firestore reads, cursor and overlap measurements. The existing finish classifier (#25314), follow-up due-clock marker, overlap measurement (#25596), refused-head recovery (#25623), and raw keyset conformance (#25555) retain their separate responsibilities.
Mixed versions and rollback
Older writers, including GPU image
ef42ee8, leave unstamped rows eligible for every legacy path. Older readers may consume a stamped result through the existing receipt and accounting fences. Current GPU-side commits rely on the elected due scan because the GPU process has no projector. No cross-process wake transport or historical backfill is needed for coverage. Fenced held release and privacy resume rearm a result and invalidate its prior token. New writers with the switch off mark a reactivated row for legacy discovery while keeping its previous scheduling metadata. An expired or stalled backstop restores compatibility attempts, even for stamped rows.Set
BATCH_PROJECTION_OUTBOX=falseon the participating readers and writers to restore the full legacy discovery paths and stop new obligations and claims. Existing result and receipt data stay available. Set it to true to resume after both stage-specific indexes are READY and the due query is confirmed. Release qualification compares matched completion, partial latency, oldest obligation, failures and read/write telemetry across the actual serving roster.The outbox supervisor starts on projection-serving roles when its switch is on. A batch-serving process continues outbox discovery when the dedicated pump and legacy projection sweep are both off. The due-page loop has a 5-second interval, a MAX_PENDING initial 200-key bound, and a MAX_SCAN_LAG initial 60-second coverage limit. Both follow-up queues share the existing per-process slot budget. Its claim expires after 180 seconds. Existing serving and projection-pump cadence and page configuration are preserved. A missed wake, process loss or leader change returns unclaimed debt to discovery. A canonical hold parks it until an existing release or privacy resume. Persisted and ready receipts honor a future
projection_followup_due_at. Unsuccessful finish then uses the configured follow-up backoff on the outbox clock, with a 60-second fallback if the setting is zero. Outbox delivery skips the legacy durable deferral write.Expected saving
Inferred, unmeasured in serving. The design baseline measured overlapping 339.56M follow-up-origin and 222.08M serving-origin reads in the 24 hours ending 2026-11-18 13:16Z. Those totals include useful work. The avoided share is the expensive downstream attempts of covered rows, and the two baselines cannot be added. Embedding the metadata adds zero document writes at merge. One claim plus one settlement at the recorded 1.516M daily commits implies about 3.03M scheduling writes/day if every commit follows that path, before retries and lease writes. Index cost and net read savings need a matched serving measurement.
Panel and verification
Scope panel
scope-20261118t145338-00dereturned three answers. Accepted its writer audit, per-row revision witness, strict lease and post-page token check, due deferral, existing receipt/privacy fences, three-store parity, existing age gauge, rollback and cost measurement. Chose embedded result fields because they avoid a new merge write and preserve the existing purge and retention lifecycle. Deferred a physical Firestore legacy page cut, fleet backfill, additional election switch, and cross-process wake transport. A successful per-row witness keeps old and mixed-mode writers eligible without a fleet cutover. The scope command emitted a dossier without F-numbered findings, so its review-only triage CLI had no calls to record.cd backend && .venv/bin/python -m pytest -q tests/unit/test_firestore_query_shapes.py --tb=short— 611 passed.bash backend/scripts/check_runtime_env_compose.sh,python3 scripts/check_feature_flag_registry.py, andcd backend && .venv/bin/python scripts/generate_firestore_indexes.py— passed.Focused backend pytest files for the outbox, serving, leader, discovery and follow-up desync — 201 passed.
OMI_REQUIRE_STORE_BACKENDS=all .venv/bin/python -m pytest -q tests/integration/test_store_conformance.py -k projection_outbox(loopback Firestore and an owned PostgreSQL 16 container) — 3 passed, one per store.The fixture pins scheduler elapsed time alongside its synthetic timestamps so local load cannot expire the setup claim.
.venv/bin/python -m pytest -q tests/integration/test_batch_pipeline_projection_followup_firestore.py(loopback Firestore) — 13 passed, including lost wake/ack, duplicate delivery, privacy, predecessor, and multipart restart..venv/bin/python -m pytest -q tests/unit/test_flag_budget.py— 26 passed..venv/bin/python -m testing.pipeline_sim projection-drain --rows 300 --owners 12— all three projection modes preserved ordering and completed assignment.Dev and prod
backend/scripts/validate-backend-runtime-env.pyand deployment-setting classification — passed.The normal pre-push PR preflight passed all 52 selected static, metadata and Firestore guard checks. The local hook used the approved 900-second per-file wall budget after a host-load timeout.
Whole-backend Pyright passed with zero errors in the normal push hook. The loopback Store conformance and 13 Firestore tests were repeated after the typed Store interface correction.
The outbox unit and background-task ratchet rerun passed 12 tests, including graceful worker shutdown. The runtime manifest validator passed 295 tests, and the async blocker gate reported zero selected findings.
cd backend && .venv/bin/python -m pytest -q tests/unit/test_batch_pipeline_projection_outbox.py— 6 passed after adding the mixed-switch reactivation assertion. The three-store conformance and 13-test Firestore replay rerun also passed with the fixed scheduler test clock.Round 2 review and CI repairs
Review panel
review-20261118t202810-030a(FIX-FIRST), CLI triageF1=accept F2=accept F3=accept.F1 starts elected outbox discovery independently of the dedicated pump and legacy sweep on a batch-serving process. Projection and first-summary policy stamping stay on owning roles. The outbox hands off predecessor work and index flushes after the delivery claim scope.
F2 proves a stale oldest due row clears the coverage witness, successful scans renew it near expiry, and scans leave a fresh witness alone.
F3 enforces the follow-up due time and configured backoff on outbox delivery. The outbox is the sole durable retry-clock writer for those deliveries.
CI on
d1195ac4cc7found a stale ghost-hold assertion, a stale pump fixture and Store protocol expectations, and scheduler-only fields leaking into the characterization and provider-STT behavior goldens. The integration assertion now pins the ghost-hold outbox clock. The simulator trace excludes the internal kind and retry reason, with the outbox details checked directly by replay and conformance tests.Hosted unit shard 7 on
0be3b03fd7ecaught the shadow-store guard pointing at the public wrapper. It now asserts that the cached constructor wraps the only Firestore store. All 23 cases intest_jobstore_shadow_seams.pypassed locally.Hosted Sync Cloud Tasks
batch-happyon0be3b03fd7eexposed an admission process stamping projection policy when neither serving role was enabled. The startup gate now preserves projection-serving role ownership even while the outbox remains independent of legacy sweeps.Round 5 incorporates #25778, which removed the paused jobstore retirement carrier. The migration runner requires contiguous numbers, so the unchanged outbox index SQL occupies
0010_projection_outbox_due.sql. Production Postgres target bindings remain absent and outbox projection stays on Firestore during the pause. The main branch’s staging isolation fence stays in place.08352903c14also fences the delivery claim at canonical transaction read and before fair-use dispatch, preserves mixed-store discovery parity, and reserves queue space for lost wakes.Ran each of nine focused unit files in its own pytest process from
backendusing.venv/bin/python -m pytest -q tests/unit/<file>.py --tb=short. All 559 cases passed across outbox, serving, pump, follow-up clock, job-store parity and migrations, provider STT, characterization, and the background-task ratchet.The role-bound startup change passed the 178 focused serving, pump, and outbox cases. The local
batch-happygauntlet passed against Firestore and Redis with its original owning-role and effect assertions. The first local full-batch attempt stopped before scenarios at the serving startup deadline under host load. The focused rerun increased only the local startup wait.Discovery, overlap, and dual-store focused unit files added 150 passes. The final typed parity adapter was exercised again with 156 protocol-parity and 78 dual-store passes.
make preflightpassed all 52 selected manifest checks, including the index and collection guards, feature flags, and runtime composition. The normal push hook also passed whole-backend Pyright with zero errors and all 40 selected unit files.Loopback Firestore pytest proofs passed 16 in
test_batch_pipeline_projection_followup_firestore.pyand 37 intest_batch_projection_ghost_holds_firestore.py. One ghost-hold throughput assertion was intentionally skipped because emulator speed depends on host load.OMI_REQUIRE_STORE_BACKENDS=all .venv/bin/python -m pytest -q tests/integration/test_store_conformance.py -k projection_outboxpassed all three backends.test_jobstore_migrations_postgres.pyadded three native PostgreSQL 16 passes. A supplemental full run was interrupted at 193 passes and two skips after a Docker connection stall reproduced by a standalone PostgreSQL connection. The targeted rerun used the native test fixture..venv/bin/python -m testing.pipeline_sim projection-drain --rows 300 --owners 12preserved projection and chain ordering in all three modes.Hosted verification at
6d2551733d9The full Sync Cloud Tasks and Listen Pusher gauntlets, Backend Emulator Proofs, and unit shard 7 all passed. The backend unit suite remains red solely on two CPU-duration guard violations. Pytest reported 39 and 297 passing tests in the two files, respectively. Hermetic E2E, emulator proofs, backend unit suite.
test_monitoring_adapter_hpa_contract.py::test_hpa_and_adapter_changes_select_this_contractused 1.02 s of CPU against the 1.00 s limit. It used 0.65 s in the preceding hosted run and 0.59 s in the local rerun with the same guard. Hosted shard 2.test_backend_runtime_env_validator.py::test_control_sync_routing_validates_deployed_values_without_changing_manifest[all]used 1.04 s against the same limit. It used 0.92 s in the preceding hosted run and 0.62 s in the local rerun. Hosted shard 5.Product invariants affected
Failure-Class: FC-unresolved-head-blocks-projection
Line-Count-Exception: backend/utils/batch_pipeline/projection.py | 1871 -> 1914 | Projection owns coverage-aware discovery and dispatches outbox snapshots through its existing fenced receipt methods.
Implemented by a delegated agent for the batch owner-state program.