Skip to content

feat(jobstore): sampled production copies and bounded discovery index - #25360

Merged
Git-on-my-level merged 21 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/jobstore-index-mode
Nov 15, 2026
Merged

Git-on-my-level merged 21 commits into
BasedHardware:mainfrom
Git-on-my-level:lane/jobstore-index-mode

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Complete the Firestore-authoritative discovery index and its production copy lifecycle. In explicit index mode, only due leased/retry/result_ready reads use Postgres hints; Firestore retains every transaction, claim and privacy decision. Warm SQL/socket deadlines, first/periodic primary scans and live read/write kills preserve fallback.

Production copying now resolves a canonical owner at every current-document reread, applies a deterministic owner cohort and omits shared control/GPU/pull-claim documents. Excluded, malformed, absent or newly removed owners retire their copy. Captured reads and convergence use the same policy. State-specific sampled due parity checks selected primary-prefix coverage and validates every returned hint against the current primary; it does not claim complete backlog coverage.

A bounded operator page fills historical copies or rotates through retained copies after primary TTL deletion, including a dropped expiry refresh. It never invents a TTL or deletes Firestore state. Explicit read/statement/row/deadline budgets, warm transport deadlines, atomic private target-bound checkpoints and a nonblocking single-writer lock keep retries resumable. Copy retirement and synchronous privacy erasure remain reachable with mirror mode/admission/write kills off.

Product invariants affected

none

Validation

  • New cohort/admission unit suite: 256 passed.
  • New bounded reconciliation suite: 26 passed; operator/checkpoint suite: 55 passed.
  • Production copy, existing mirror, index selection and seam unit suites: 148 passed.
  • Combined real loopback Firestore and Postgres run: 48 passed, none skipped, covering production copy/cohort/retirement and sampled parity, existing index deadlines/stale hints, and account/conversation copy erasure.
  • An initial integration run reproduced a tuple-key encoding defect in sampled parity; converting the bounded observation to ordered key/document pairs fixes it. The same real backend cases pass afterward.
  • Independent source review found and reproduced mode-off queued upserts and absent-row parity pollution. Both are fixed with regressions; 210 focused cohort/copy tests and the 48 real backend cases pass afterward.
  • Full GitHub CI completed green on 6b1e2bd, including eight unit shards, guardrails, emulator proofs and hermetic/stack suites. Current main 5b21b67 is integrated at 06b4621; all 43 local manifest checks and 496 focused isolated tests pass, with one existing deselection, and independent exact-head review is SHIP. Full substantive GitHub CI completed green on this exact combined head, including all eight unit shards, guardrails, emulator proofs and hermetic/stack suites; no failed/cancelled/pending checks in the readiness snapshot. All 43 prior local manifest checks and normal push gates passed at 6b1e2bd. Independent exact-head integration verdict on d433ea5: SHIP; jobstore code, hooks, tests and fences remain unchanged afterward. The only subsequent delta is the locally reviewed retention-test import relocation below. Four affected isolated files pass 185 tests with the timing guard active; the complete clock ratchet passes 11 tests (overlapping prior sets).
  • Repeated CI shard 4 CPU overruns were traced to the retention test importing shared provider/model helpers inside its measured call. Move that existing import to collection, preserving every assertion and the unchanged 1-second guard. The two affected files pass 345 tests through the CI-style isolated runner; the diagnostic profiled call drops from 1.405s to 0.0021s locally.
  • The CI-style isolated 14-file unit runner passed 1205 tests; latest interface, reconciliation, index and cohort checks passed 324 tests. These overlap the other sets and are not additive.
  • The new operator-only document-id page sites are registered with reviewed body digests, and their read envelope is declared at the exact collection site. All prior collection budget values are unchanged; the 1M/day envelope is planning-bound and requires supervisor accounting before activation.
  • Strict changed-file pyright reports zero errors; public bounded helper contracts replace private cross-module access without suppressions. The normal full pre-push checks passed on the activation source and are repeated on the final integration head.
  • Third-party image closure passes with the module-specific codec import, avoiding an unintended package-barrel edge into unrelated outbox/enrichment dependencies. Worker dependency locks and gate allowances are unchanged.

Rollout and rollback

The mirror foundation #25323 is merged. The source does not activate production. A separately reviewed stdlib operator supervisor enforces a canonical single-carrier installation, shared target daily reservations and bounded child-process cleanup; all 45 local packet tests pass. It is delivered on SCA-2288, with installation and production execution still pending. The release executor must pin actual writer/deletion revisions and targets, supervise a bounded rotation outside sweepable worktrees, set and measure its accepted retirement lag/read/write/connection budgets, verify backup retention and mode-off erasure, then admit an initial deterministic cohort in shadow mode. Index ramp is leased, retry, then result_ready, expanded only with state-specific traffic/parity, action correctness, sweep freshness, rollback and net-read evidence. Expansion belongs to the SCA-2288 integration owner with the existing release executor; the next evidence review and absolute budgets must be recorded before each activation. No arbitrary soak interval is required.

Rollback discovery with JOBSTORE_INDEX_READS=off or shadow/firestore mode; JOBSTORE_SHADOW_WRITES=off also disables index reads. Disable new production copies with JOBSTORE_PRODUCTION_MIRROR=off. Keep the retained target and deletion executor access, and continue copy retirement, until all retained obligations retire. Source merge, runtime acceptance and settled billing savings remain separate. #25215 stays frozen.

Runbooks: backend/docs/jobstore-discovery-index.md and backend/docs/jobstore-production-mirror.md. Existing SCA-2288/SCA-2222 retain coordination; no second rollout owner or production authority is introduced.

Failure class

Failure-Class: none

This is a new explicitly selected discovery/copy lifecycle on the merged mirror foundation. Unreviewed discovery methods, including ready_pending and hold/completion/capacity queries, retain primary semantics. No workflow, flag-budget policy or baseline allowances change.

The existing inventory contains 291 entries, while its declared count remained 289 after main integration. Correct the derived count; retain the seeded budget, entries and exception policy. The existing test_flag_budget.py assertion reproduces before this change and all 24 tests pass after it.

Failure-Class: none
Resolve the derived flag count against all 295 merged entries. Retain the new upstream ready_pending discovery method on the primary-store delegation path and extend its regression coverage without expanding the index query allowlist.
Keep collector mode selection inside the existing infrastructure configuration helper. Preserve index and primary-baseline metric registration when either kill switch is off. The existing environment-read ratchet reproduces before this correction; the ratchet, selection, seam, index and flag-budget suites pass after it without changing its baseline.

Failure-Class: none
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 15, 2026 06:34
@Git-on-my-level
Git-on-my-level marked this pull request as draft November 15, 2026 07:15
@Git-on-my-level Git-on-my-level added the ci:full Maintainer-granted: run full CI on this fork PR label Nov 15, 2026
@Git-on-my-level Git-on-my-level changed the title feat(jobstore): prepare bounded discovery index reads (SCA-2288) feat(jobstore): sampled production copies and bounded discovery index Nov 15, 2026
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 15, 2026 10:57
@Git-on-my-level
Git-on-my-level merged commit 1ba2470 into BasedHardware:main Nov 15, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Maintainer-granted: run full CI on this fork PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant