Repository navigation
firestore-reads: enable batch_privacy_memoize 0->5 (WQ16, config-only) - #23554
Merged
Merged
Conversation
…>17 keys) Top measured origin database.batch_pipeline_privacy:read ~3.36M reads/h (~81M/day 1hx24, loop baseline-2026-10-24T09-45Z-pre-bpm.json, window_end 2026-10-24T08Z) storms per-write privacy reads on backend-sync/backfill. Memoize code served since d90643d (#23072); key already in KNOWN_LEVERS. All other 16 keys byte-identical to the served literal. Contract tests 121 pass; literal consistency checked at all 54 backend sites.
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
added a commit
that referenced
this pull request
Oct 25, 2026
…0.0068 vs ref 0.0010) (#23575) ## Summary Firestore reads loop URGENT flag-off: `singleton_loops`, `usage_month_cache`, `backfill_task_reads`, `historical_scan_memo`, `ledger_purge_coalesce` **100 → 0**; the other 12 keys byte-identical to the deployed literal (17 keys, incl. `batch_privacy_memoize:5` from #23554). Generated with `avo/firestore-reads/set_levers.py`. - Why now: loop verify UNSAFE at 08Z and 09Z on 2026-10-25 — backend-sync 5xx rate **0.0034 (640 errs) at 08Z → 0.0068 (1239 errs) at 09Z** vs lever-free reference 0.0010 (roughly doubling hourly). All five flagged levers are the 100%-pct levers verify grades against the backend-sync guard. Evidence is ambiguous (the lead's op1custody train served new backend-sync code ~05:37–06Z, same service), so per runbook we flag off on breach anyway: if the 5xx rate persists at lever 0, the levers are exonerated and re-enable at 5%. - Off-path restores pre-lever behavior for all five levers (per-process loops, uncached reads, per-task scans — worst case equals lever-off). Reads cost of this flag-off is bounded and known: these callers regain reads only until root cause lands. - Rendered literal identical across `_base.yaml`, regenerated `runtime_env.yaml`, listen/pusher dev+prod values, the flag registry doc, and the two pinned contract tests. The literal keeps all 17 keys — missing keys default OFF (`backend/config/firestore_read_levers.py`). ## Product invariants affected - INV-MEM-4 — config-only lever rollout; no data-path, promotion or authority change; each lever reverts to its pre-lever per-process behavior at 0. - INV-DATA-1 — no routing or ownership change; value-only edit of the existing `FIRESTORE_READ_LEVERS` key. ## Test plan - `backend/tests/unit/test_verify_pusher_config_references.py` + `backend/tests/unit/test_render_backend_runtime_env.py` + `backend/tests/unit/test_backend_runtime_env_validator.py`: **267 passed** locally (lane venv, this commit). - Diff checked: exactly the 5 flagged keys 100→0 in every literal site; all other 12 keys unchanged; 17 keys in both old and new literals. ## Rollout 1. Train order **listen → pusher → Cloud Run** (URGENT flag-off; backend-sync 5xx doubling hourly at time of writing). 2. Lead handoff posted on merge; ramp clocks for untouched levers unaffected (`batch_privacy_memoize` stays 5).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Config-only: enable
batch_privacy_memoizeat 5% in the prodFIRESTORE_READ_LEVERSliteral. All 16 existing keys are byte-identical to the served literal on backend-02109-qzv; the only delta is the added"batch_privacy_memoize":5.Behavior code already merged and served via #23072 (merge d90643d, ancestor of the serving release; memoized per-job privacy assertion). The lever key is in main
KNOWN_LEVERS(firestore_read_levers.py:46). The lever has been dark at 0 since then; this PR makes it addressable at the cautious first ramp step.Caller pool being addressed (loop snapshot baseline-2026-10-24T09-45Z-pre-bpm.json, 1h caller window, window_end 2026-10-24T08Z):
database.batch_pipeline_privacy:read~3.36M reads/h across backend-sync + backend-sync-backfill (not_found storms onother+ lookups on users/conversations) ≈ 81M/day at 1hx24 — the top measured origin. Expected saving is unknown until the ramp readout; predicted 50M/day is the caller-pool hypothesis registered in the loop ledger, not a measurement.Product invariants affected
Verification
backend/.venv/bin/python -m pytest backend/tests/unit/test_render_backend_runtime_env.py backend/tests/unit/test_verify_pusher_config_references.py -q→ 121 passed.UI-Evidence: none — backend config only, no UI change.
Failure-Class: none
Rollout and rollback
Rollout: loop-owned lever config at 5%, then per the loop runbook ramp rule (verify PASS x2 ticks after 3h → 100% candidate; grades on absolute caller reads vs the pinned baseline). Deploy train order remains listen → pusher → Cloud Run (rollout lead owns the train). Rollback: revert this commit (or a follow-up config PR setting the key to 0), then the same train.