Skip to content

test(backend): preserve retained recording settlement across stores (PL-487/482) - #24963

Merged
Git-on-my-level merged 3 commits into
mainfrom
lane/parity-pl487
Nov 24, 2026
Merged

Git-on-my-level merged 3 commits into
mainfrom
lane/parity-pl487

Conversation

@Git-on-my-level

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

Copy link
Copy Markdown
Member

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.py path matches the existing workflow trigger, so future test-only changes still select the proof. CI requires simulator and emulator; full local qualification requires OMI_REQUIRE_STORE_BACKENDS=all. No serving implementation, configuration, workflow, language gate or firmware changes.

Product invariants affected

none

How it was verified

  • Simulator: 27 passed / zero skips or expected failures.
  • All-required simulator/Firestore/Postgres matrix: 80 passed, one strict expected failure, zero skips. The unannotated run first reproduced 80 passes / one failure. #24960 tracks Postgres rejecting a legacy boolean enqueue age in its generated-column cast. The strict annotation accepts only that exact SQL error; PL-482 remains incomplete. Every PL-487 case passes on all stores.
  • The existing full emulator runner passed every pre-existing group; its sole initial failing group was the new boolean-age case. The corrected new suite passes as qualified above.
  • make preflight passed all 34 selected checks. The ordinary final-commit push gates pass, including full backend typecheck (zero errors).
  • Three in-memory mutations fail at their intended assertions (renewed expiry, stale expiry, flattened retry); a simulated repaired boolean backend produces strict XPASS. Production files stay unchanged.

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.sh runs 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.

View guided diff Turn on auto-fix

🤖 Generated with Claude Code

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]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T04:54:46.426359Z da7c91b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

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 Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 literal ValueError(BARRIER_NOT_CLOSED), only while latest.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), max 3600 is exactly the 599 / 600 / 86399 / 86400 / None / True table, and enqueued_at is 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_preserved compares every non-exempt field, including unknown ones, so "never releases audio custody" is a whole-row invariant rather than a spot check on audio_uri.
  • #24960 strict expected failure: enqueued_at=true hits jobs.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 is strict=True, raises=BooleanEnqueueClockUnsupported, gated to h.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

  1. The PR is CONFLICTING with main: backend/scripts/run-emulator-proofs.sh conflicts 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.
  2. 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 #24960 reference next to the assertion when the gap closes.
  3. The drain's defer_privacy_blocked path (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.
  4. The record_dead_letter metric is asserted only on the single expiry path; per-store unit counts are not compared. Fine for a conformance suite.
  5. A green CI run qualifies simulator and emulator only (testing/store_fixtures.py skips Postgres in CI by design), so PL-482's Postgres leg rests on the reported local OMI_REQUIRE_STORE_BACKENDS=all run.

SECOND-LOOK: Kimi

@mintlify

mintlify Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 24, 2026, 4:51 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Git-on-my-level left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Git-on-my-level
Git-on-my-level merged commit 01043de into main Nov 24, 2026
76 of 78 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/parity-pl487 branch November 24, 2026 06:10

This branch was successfully deployed

1 active deployment
staging - docs — da7c91b4 Deployed Nov 24, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant