Repository navigation
fix(enrichment): qualify Firestore outbox wake and coalescing conformance (#23559) - #23759
harmweber787-png wants to merge 2 commits into
Conversation
|
The fix is correct and well-scoped — it aligns the Firestore outbox with the shared contract that Postgres and the simulator already implement, while keeping every legacy path byte-compatible. One contract confirmation and one CI gap remain before merge. What I verified:
Material dimensions:
USER IMPACT: none — this brings the Firestore contract path in line with the other store backends; production behavior is unchanged. Still wanted:
Nice work on the diagnosis and the regression test — the root-cause analysis in the description matches the code exactly. Leaving for human maintainer review: the #23559 contract decision needs explicit sign-off. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…d wire conformance cases into test_outbox_firestore
|
Thanks for the detailed review, @Git-on-my-level! I have pushed commit 1. Green Run of the Three
|
|
Since my last review: addressed (verified on e01e2a3) — the three #23559 conformance cases now run on every head via test_emulator_conformance_cases_from_23559, which imports the exact test bodies from tests/integration/test_outbox_conformance.py and runs them against FirestoreOutbox with the injected seam; I reran backend/tests/unit/test_outbox_firestore.py on this head myself (25/25 pass, including the new max-coalesce re-arm and failed-wake -> sweep-retry coverage), and the legacy coalescing invariants in test_sync_reprocess_coalesce.py (95/95 pass) confirm wake_on_move=False is exactly the old condition. The contract decision is also now documented where it belongs (outbox_firestore.py module docstring, mark_update comment). still open — (1) no CI has run on this PR at all, and my local run skips the real [emulator]/[postgres] variants, so a green backend check on this head is still the mechanical merge blocker; (2) the #23559 decision itself (interface contract for the injected seam, retained trailing-edge early-wake for the production singleton) is documented but awaits maintainer ratification — that sign-off is David's call, not yours. newly introduced — nothing. Verdict: the fix is correct and verified on this head; both remaining items sit outside the contributor's control (CI trigger + contract sign-off). Material notes: performance/cost — wake_on_move=True mints one extra Cloud Task per moved row on the contract-(b) seam only; the production ENRICHMENT_OUTBOX singleton (create_wake=None) keeps 1-task-per-quiet-window semantics, so no per-append task growth in production. Blast radius — enrichment scheduling only; no schema, auth, secrets, workflow, or dependency changes. The _wake -> _rearmed swap on non-transactional enqueue mirrors Postgres's _try_wake and leaves failed task creates to sweep() (invariant 4) instead of raising after the row is committed; explicit wake(row_id, token) still raises to transactional callers. USER IMPACT: none — internal scheduling-contract fix; users should notice no behavioral difference. What's left: (1) let/trigger the backend CI on this head and link the green run (especially the real [emulator] conformance variants); (2) maintainer ratification of the documented #23559 contract split — thanks for writing it up so clearly in the docstring and comment. by AI on behalf of David — the remaining open item is the #23559 wake-contract ratification, which needs David's sign-off (already tagged). |
Closes #23559
Root Cause & Fix
Resolves the three Firestore emulator conformance failures identified in #23559 under
OMI_REQUIRE_STORE_BACKENDS=sim,emulator,postgres:test_enqueue_without_tx_commits_then_creates_its_own_wake[emulator]&test_max_coalescing_settles_later_and_min_coalescing_pulls_earlier[emulator]:utils.enrichment.outbox.mark_updatepreviously only rotatedtask_tokenand set_wake = Truewhen an existing open row moved earlier ((row.get('task_due_at') or 0) > row['due_at']), not whencoalesce='max'moveddue_atlater.wake_on_move: bool = Falsetomark_update, enabled whenFirestoreEnrichmentOutboxhas an injectedcreate_wakecontract (b) seam (wake_on_move=self._create_wake is not None), so movingdue_atin either direction mints a freshtask_tokenand wakes it, while legacyreprocess.mark()(wake_on_move=False) preserves its single-task trailing-edge coalescing behavior.test_a_failed_wake_leaves_the_row_pending_and_sweep_retries_it[emulator]&test_blocked_owner_is_discarded_on_delivery_and_by_sweep[emulator]:FirestoreEnrichmentOutbox.enqueuecalledself._wake(row)directly on non-transactional enqueues instead ofself._rearmed(row), propagatingRuntimeError('task create failed')out ofenqueue()after the row was already committed.self._rearmed(row)on the non-transactionalenqueue()path keeps the committed obligation durable forsweep()when task creation fails (Contract (b) Invariant 4), while explicitoutbox.wake(row_id, wake_token)continues to propagate errors to transactional callers.Verification
test_enqueue_without_tx_moves_wake_on_max_coalesce_and_tolerates_failed_wakeinbackend/tests/unit/test_outbox_firestore.py.reprocess.markcoalescing andFirestoreEnrichmentOutboxunit/conformance invariants.