Repository navigation
test(backend): preserve retained recording settlement across stores (PL-487/482) - #24963
Conversation
Cover PL-487 and PL-482 with the production drainer, real Store transactions and privacy fences. Preserve the strict Postgres boolean enqueue-clock gap in #24960. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review Summary: ✅ CompletedThis 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
left a comment
There was a problem hiding this comment.
VERDICT: SHIP.
Reviewed against the issue Goal and Scope (test-only parity suite in backend/scripts/record_dead_letter_emulator_test.py, registered by run-emulator-proofs.sh; PL-487/PL-482).
Checked against the production code the suite exercises, not just the diff:
utils/batch_pipeline/live.py:580-627(defer CAS): the deadline is stamped only on the literalValueError(BARRIER_NOT_CLOSED), only whilelatest.available_at == lease. So the "full window, restarts do not renew it" and "a stale refusal cannot expire a newer owner/lease" assertions match real behavior rather than assuming it.config/record_drain.py:41-56:(600, 60),(86400, 900), max3600is exactly the 599 / 600 / 86399 / 86400 / None / True table, andenqueued_atis read back from the store, so "durable age" is the persisted value and not fixture memory.database/batch_pipeline_record_dead_letter.py:11-28: the requeue CAS (state + reason, idempotent, clears only the three expiry fields) matches the deadline-boundary and replay assertions. Privacy fences are re-checked at the real commit (database/jobstore/postgres_store.py:184-204), which is why the account/conversation/generation cases genuinely fail closed and leave the row untouched.assert_preservedcompares every non-exempt field, including unknown ones, so "never releases audio custody" is a whole-row invariant rather than a spot check onaudio_uri.#24960strict expected failure:enqueued_at=truehitsjobs.enqueued_at float8 GENERATED ... (doc->>'enqueued_at')::float8(database/jobstore/migrations/0001_doc_mode_store.sql:19) and the accepted message is that cast's own text. The annotation isstrict=True, raises=BooleanEnqueueClockUnsupported, gated toh.name == 'postgres' and age is True, so it cannot mask a different case. Accepted, and PL-482 is explicitly recorded as incomplete in the change doc while no PL-487 case is an expected failure — that satisfies the Done check.
Non-blocking notes
- The PR is CONFLICTING with
main:backend/scripts/run-emulator-proofs.shconflicts because both sides append a proof block at the same anchor. Mechanical, but the merge needs a base refresh and one more backend-emulator-proof run on the refreshed head. - The accepted xfail matches a literal driver message string; a psycopg/Postgres wording change turns it into a hard failure. That is the safe direction, but keep the
#24960reference next to the assertion when the gap closes. - The drain's
defer_privacy_blockedpath (utils/batch_pipeline/live.py:522-533) is not exercised — only the claim/admit/defer fence is. Out of this Goal's scope; worth a follow-up if that defer stays load-bearing. - The
record_dead_lettermetric is asserted only on the single expiry path; per-store unit counts are not compared. Fine for a conformance suite. - A green CI run qualifies simulator and emulator only (
testing/store_fixtures.pyskips Postgres in CI by design), so PL-482's Postgres leg rests on the reported localOMI_REQUIRE_STORE_BACKENDS=allrun.
SECOND-LOOK: Kimi
…tions Co-authored-by: multica-agent <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Git-on-my-level
left a comment
There was a problem hiding this comment.
REVIEW: SHIP
Reviewed #24963 at exact head feb1f80c28cde2896484d9ec754d46607b96cea8.
The panel failed: omi-panel review --issue SCA-1989 exited 1 with cannot read the PR for SCA-1989 from ''; its issue lookup did not resolve the manually linked PR. I completed the full review directly.
Against current main, the intended delta is three files (+335): the 303-line regression suite, its change note, and the five-line runner registration. The suite uses synthetic simulator/emulator/Postgres stores, injecting only audio admission and the drainer clock while exercising real discovery, transactions, and privacy checks. The assertions cover bounded retry and expiry, malformed deadlines, stale leases, account/conversation/generation fences, idempotent requeue, whole-row custody and policy preservation, and both kill switches. These assertions match the current drainer, retry policy, requeue CAS, and Postgres commit privacy fence. I found no serving/config change or undeclared production read/write path.
The #24960 exception is strict and limited to Postgres with age is True and the exact generated-column cast error. PL-482 is explicitly marked incomplete; no PL-487 case is xfailed. The Done check is satisfied.
Non-blocking merge gates remain: this head is 3,328 commits behind current main; current checks show Backend emulator proofs, UI author approval, and guard failing. The ship-stage report attributes the backend proof failures to provider_merge_emulator_test.py, outside this suite. This review does not clear those gates.
Git-on-my-level
left a comment
There was a problem hiding this comment.
REVIEW: SHIP
Reviewed #24963 at exact head da7c91b41920198b7870c45ebee43ae21ea9f9c1.
Findings: none.
The change is limited to the synthetic-store test, its change note, and registration in the existing emulator-proof runner. The suite exercises the production drainer and requeue with deterministic barrier refusal and clock control, and asserts whole-row preservation across deadline expiry, retry boundaries, stale-worker races, kill-switch behavior, and account/conversation/generation privacy fences. The Postgres expected failure is strict, limited to the legacy boolean enqueue-age case, and accepts only the exact generated-column cast error; PL-482 remains explicitly incomplete.
The panel fallback was required because omi-panel review --issue SCA-1989 --brief ./panel-brief.md --format multica failed with cannot read the PR for SCA-1989 from ''. I completed this manual review against the exact head. No production implementation, configuration, or production read/write path is added by the diff.
CI note: Backend emulator proofs passed on this head. The Backend unit suite is red in tests/unit/test_historical_graph_enrichment.py, a file not changed by this PR; keep the merge gate until that check is resolved.
Git-on-my-level
left a comment
There was a problem hiding this comment.
VERDICT: SHIP da7c91b
R1 of at most two. Findings: none.
The exact-head diff adds the synthetic-store conformance suite, its change note, and runner registration. The harness uses unique test namespaces; the Firestore path requires a loopback emulator with anonymous credentials and has no cloud fallback. The tests inject only admission and the drain clock, use synthetic audio references, and add no serving, configuration, vendor, storage, or production-data path.
The assertions match the current drainer and requeue behavior: first barrier refusal establishes the durable deadline; only the exact barrier refusal under the current lease can expire it; malformed deadlines do not authorize expiry; requeue is a state-and-reason CAS and preserves the rest of the row. The age retry boundaries match the production constants. The Postgres boolean-age xfail is strict and accepts only the specific generated-column cast error; PL-482 is explicitly incomplete and no PL-487 case is xfailed.
I read the existing PR material before this verdict. The review-comments API has no inline threads. The Codex summary for this head reports no findings. I also saw the PR author's own REVIEW: SHIP on this same head; I did not count that as an independent review. Earlier review notes are addressed as follows: the runner conflict and stale-base concern are resolved by the merge of current main; the strict Postgres exception remains deliberately narrow; missing defer_privacy_blocked coverage is outside this goal; the metric assertion remains a single-path check; and Postgres is still not qualified by CI, as the change note states.
The PR's Backend emulator proofs check passes. Backend unit suite and shard 7/8 currently fail at unchanged tests/unit/test_historical_graph_enrichment.py; this diff does not touch that file, so keep the repository merge gate until it is resolved. I could not run the suite locally: this checkout has no backend virtualenv, installed pytest, or configured Firestore emulator. I therefore make no local all-store pass claim.
What changed and why
A record whose capture barrier stays open needs bounded retries and a recoverable terminal state without releasing audio custody. Follow-up to #24884 and #24863: add the same production-drainer and reason-bound requeue contract on legacy Firestore, replacement Postgres and the simulator, covering parity rows PL-487/PL-482.
The suite pins a full nonrenewing expiry window, exact deadline settlement, malformed deadline refusal, stale selection leases, current account/conversation/generation privacy fences, idempotent requeue and complete custody/policy preservation. It also proves age-based barrier delays, discovery at the retry deadline and both kill switches. Only audio admission and the drainer clock are injected; Store discovery, transactions and privacy checks remain real.
The existing emulator runner executes the suite. Its
*_emulator_test.pypath matches the existing workflow trigger, so future test-only changes still select the proof. CI requires simulator and emulator; full local qualification requiresOMI_REQUIRE_STORE_BACKENDS=all. No serving implementation, configuration, workflow, language gate or firmware changes.Product invariants affected
none
How it was verified
make preflightpassed all 34 selected checks. The ordinary final-commit push gates pass, including full backend typecheck (zero errors).Measured layer: local synthetic store conformance, not a deployed migration or physical audio erasure.
Tests
backend/scripts/record_dead_letter_emulator_test.py;backend/scripts/run-emulator-proofs.shruns it with the mandatory backend matrix. Missing required infrastructure fails.UI evidence
UI-Evidence: none -- test-only backend conformance.
Failure class (fixes)
Failure-Class: none
New guards
The merged #24884 recording-settlement change and #24863 barrier-retry incident motivate this regression contract. It extends the existing shared Store harness around the production drainer and requeue instead of adding another state authority or standalone gate.
🤖 Generated with Claude Code