Repository navigation
Measure batch packing and enforce Firestore cost controls - #25716
Conversation
Keep the upload allowance probe and packing observation in the same admission flow.
|
Exact-head closure b15cfb5 GitHub reports this head mergeable with 45 successful checks, 26 skips, zero failures, and zero pending. The Round 3 backend unit and emulator runs now both pass. Backend unit run · Emulator proofs Panel findings and exact-head verification
|
|
Exact-head closure 2c82eef Supersedes the Round 4 closure at GitHub reports this head mergeable with 45 successful checks, 25 skips, zero failures, and zero pending. The coordinator's HPA shard rerun and its backend unit suite passed. HPA shard rerun · Backend unit suite · Emulator proofs Panel findings and exact-head verification
|
Preserve worker read counters and the simulator packing and projection outbox imports.
Covered results wait for the outbox after Firestore exhausts its commit retries. Use the short retry cadence for contention so a fresh claim can advance projection without waiting for the generic follow-up backoff. Failure-Class: FC-sync-assignment-read-abort-escapes-retry
|
Exact-head closure 23d7a90 Delta
The legacy reader still covers unstamped results from GPU image DELTA SHIP 23d7a90 |
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_RATEdefaults to0.001and caps at0.01. Set0across the intake and lease roles, includingworker.packingSampleRate: '0'for Helm, to stop observation reads, intake stamps and cohort completion counters. Restore0.001to resume. The metrics scope recordsjob:batch_packing_counterfactualseparately. Release can withdraw the independent GMPGlobalRulesresource. Reverting the cost commit withdraws the CI guard without requiring any persistent data migration.Old images such as
ef42ee8ignore 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
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.BACKEND_UNIT_TEST_FILE_LIST=<focused list> bash backend/test.shrun 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.9c88e7f888b0.backend/.venv/bin/python backend/scripts/cross_service_contract.pyreported zero new and zero stale violations. The background-task ratchet passed all six tests.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
Scope panel
scope-20261118t145605-e19dreturned Luna and GLM Flash. DeepSeek ended without a terminal answer on that run. The retryscope-20261118t150457-45c4returned DeepSeek and GLM Flash. The panel's scoping dossier returns prose without F identifiers, soomi-panel triagedid not accept a numbered entry.WorkItem, guessing paid or trial on ambiguous legacy rows, and projecting full job documents throughpending_page.GlobalRulesrecording 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.Round 2 review panel
review-20261119t041052-488dreturned FIX-FIRST on6c06588ec5. RecordedF1=accept F2=accept F3=acceptwithomi-panel triage.unknown_duration. An invalid anchor contributes zero, and an invalid following row preserves the eligible prefix.Round 2 verification
backend/,.venv/bin/python -m pytest -q tests/unit/test_batch_packing_counterfactual.py tests/unit/test_monitoring_cloud_monitoring_promql_shape.pypassed 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.pypassed 66 simulator and Firestore-emulator cases. A local PostgreSQL 16.2 rerun with-k postgrespassed the remaining 33 cases.Round 3 merge verification
Merge
b15cfb58a3bincorporatesmainate3cfebcfb32. 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.shpassed 342 tests across intake, admission, allowance holds, staging, packing and future-capture parity.test_accepted_upload_drains_after_rollback_with_encrypted_context_and_accountingreturnedNoneat the admission assertion on both the merge and its exact main parent.GitHub CI on the Round 2 head
GitHub tested merge
3577371251for the earlier head1a2711956c5. The backend unit suite is red from two failures also observed onmainbefore this follow-up.test_listen_v3_rotation_custody.py::test_frames_during_a_failed_create_never_bind_to_its_successorbecause the producer missed the transientsession-2label before the test reached its custody assertions. The test and relevant listen code match the CI merge's main parent7437adc424b9. The same assertion failed on earlier main2a8b05cd3e0dand passed on7437adc424b9. PR failure · Earlier main failure · Exact main parent passtest_monitoring_adapter_hpa_contract.py::test_hpa_and_adapter_changes_select_this_contractat 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 mainae68d3176d80. The selector additions in this PR match census and Firestore guard paths outside this test's HPA and adapter inputs. PR failure · Earlier main failureFailure-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.