Repository navigation
test(backend): inventory lifecycle writers and latch invariants - #24591
Merged
Merged
Conversation
… task wake #15171 renamed the offloaded rate-limit call to redis_db.check_tts_rate_limit_for_user but left the desktop TTS unit stub and its identity assertion on the old function name, and #20665 retired routers.action_items._wake_task_changes while the shared-task 503 regression still patched it. Both files failed on origin/main and blocked every backend unit shard. Align the stub and assertion with the renamed call and drop the stale wake patch.
Prod listen pods showed no omi_listen_event_loop_lag_seconds series. The code path is correct: every listen deployment runs an image older than #22397 (backend:8d7778a is its parent), while Cloud Run backend runs 4f43b2d, which contains it. Pin the two links the D0b gate depends on: run_listen_session starts the probe before building the runtime, and the listen /metrics handler renders the histogram from import. Document the image-tag check for a missing series. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ogram doc Grok review on #22608: the exposition test did not use the listen route import, and the doc said every loop histogram renders from import, which is false for the codec-labelled frame histogram. Assert the route -> runtime -> probe module chain and the import-time registry collector, and document that the frame series appears only after the first timed frame. Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t first frame Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
…esh process Codex review: the exposition test imported routers.listen.runtime itself and called the metrics handler directly, so it kept passing if main.py stopped registering metrics.router, and its zero-count check only asserted the series name after earlier tests in the same file had already incremented the process-global histogram. Run the assertion path in a fresh interpreter instead: install the hermetic network blocker, import main (the deployed listen entrypoint per backend/Dockerfile CMD), make an unauthenticated request (401) and an authenticated one (200) through the real app routing, and assert the exact import-time 'omi_listen_event_loop_lag_seconds_count 0.0' with no probe started before or after serving. Subprocess CPU is not charged to the fast-unit duration guard, and the network blocker proves the path stays hermetic for the no-Redis CI lane. Failure-Class: none
Plan C (legacy sync consolidation) PR C1. Tests only; no runtime change. - tests/unit/test_sync_legacy_import_ratchet.py + fixtures/sync_legacy_import_baseline.json: freezes the 10 current importers (outside utils/sync and routers/sync.py) of the 19 legacy sync modules scheduled for retirement; new edges fail, stale edges must be removed, every edge carries a reviewed "why". - tests/integration/test_enrichment_outbox_contract_emulator.py: Firestore-emulator contracts for the sync enrichment outbox that the utils/enrichment move must keep: first-summary wake within 120s, coalescing, stale-token refusal, lease expiry repaired by the sweep, redirect custody transfer and the privacy fence. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ure teardown - Ratchet now runs for every in-scope importer on changed-file CI, not only the post-merge --all run: new shared scope predicate (tests/support/sync_legacy_ratchet_scope.py) wires the selector the same way the background-task ratchet is wired, so an importer under e.g. backend/utils/apps selects test_sync_legacy_import_ratchet.py. Contract tests pin the predicate against the ratchet's own scope. - import_module detection also accepts the keyword form (name='utils.sync.pipeline'); non-literal names still detect nothing. - Enrichment outbox emulator fixture deletes dormant receipts and synthetic conversation documents by key on teardown (uid is cleared on dormant rows, so the uid-query teardown misses them; parent deletes keep subcollections). - All function-local imports in the integration test hoisted to module scope (backend AGENTS.md import rules). - Baseline gains the reviewed upstream edge scripts/cap_hold_durability_emulator_test.py -> utils.sync.pipeline (rebased onto main that introduced cap-hold durability).
…elector tuple - import_module detection now resolves aliases bound by 'from importlib import import_module as load'; calls through the alias with a literal module name are dynamic-import edges. Non-importlib aliases with the same call shape still detect nothing (parametrized). - The ratchet no longer excludes the whole utils/sync/ package: only the retiring modules themselves and routers/sync.py are out of scope, so surviving in-tree callers (cap-hold core, recording_session_target) are scanned and their legacy edges are frozen in the baseline with reviewed whys. These are exactly the edges C11 (#22635, keep the cap-hold core) must cut; the shared selector predicate keeps its cheap superset and still defers narrow area selection to AREA_TESTS. - SYNC_LEGACY_RATCHET_TESTS now selects only the ratchet itself. test_workflow_contracts.py has no legacy-ratchet assertions; it keeps its own selection via workflow contract sources and backend/testing/ full-run prefixes, instead of riding every backend-Python selection.
… body Codex review: 'block_outbound_network().__enter__()' drops the only reference to the _GeneratorContextManager, so CPython finalizes it (and its finally block restores the socket functions) before 'import main' runs — the hermetic claim was inert, and an environment supplying Stripe credentials could turn the import into real network calls. Enter the guard through an ExitStack held for the entire child body. Failure-Class: none
…targets, fence/IO contracts
- Dynamic-import detection now requires proven importlib bindings: attribute
receivers bound by 'import importlib [as imp]' and bare names bound by
'from importlib import import_module [as load]'. An unrelated
obj.import_module(...) or a local function named import_module no longer
fabricates a legacy edge and fails changed-file CI (V8).
- Relative import_module targets ('.pipeline', package='utils.sync') resolve
against the literal package argument — positional or keyword — with each
leading dot beyond the first trimming the package, mirroring the
interpreter. A relative name without a literal package detects nothing (-s).
- Privacy-fence contract now exercises the race it names: phase 1 keeps the
pre-blocked discard (entry fence), phase 2 lands the block between the
entry fence and the claimed callback and proves the adapter's inner
discard_blocked discards without ever invoking work; blocks are cleared
between phases so each parametrized block path is really driven (-z).
- Malformed-binding rejection now proves 'before any IO': the Firestore
client accessor is replaced with a fail-fast mock for both the adapter and
the outbox, so any pre-validation read/write fails the test (WB).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: FC-empty-asr-without-context-recovery Co-Authored-By: Claude Opus 5.5 <[email protected]>
The unmodified main test fails five assertions before noon because its fixture and recap selection use different dates. Pass one explicit afternoon instant through the existing production input seam; keep every assertion and production behavior unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Carry PL-057, PL-072 and PL-086 through the shared Store matrix. Keep the new-store cancellation gap strict and linked to issue #23761. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nob; tag lag stalls with work in flight - --upload accept --upload-wals N appends wal_sync_upload_success: synthetic uploads and jobs drive real sync phases, persistence and reconcile. - cold_start, home_idle_sync_refresh and the upload window are sparse: cold readiness keeps the 15% spread gate and each run has a stall budget (<=2 stalls over 100 ms, <=500 ms). Dense windows keep 15% p90; no run dropped. - Semantics is off for heavy perf by default; --semantics on is a separate dataset and compare refuses mixed settings. - LagWorkRegistry: bounded, allocation-free begin/end; mobile_lag_stall records overlapping sync/upload/reconcile/WAL-load work. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without one, device_run.main() exits 2 on hosts with no scratch mount, so the manifest check failed on ordinary Linux checkouts. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port PL-194 into the shared scheduler/Store matrix and existing emulator proof lane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict resolution only: - backend/tests/unit/test_open_loops_recap_integration.py: take main's version. Main already pins the recap clock (_AT 18:00 UTC); this branch's RECAP_AT hunk duplicated that fix. - backend/docs/listen_pusher_pipeline.mdx: keep both additive sections (PL-049/050 qualification note, then main's manual-merge completion section). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…second chance Main a866d27 (10-30) gives Modulate-empty held units with positive speech one independent Soniox second chance. The PL-049 case written 10-26 asserted no second provider at all, so it failed on every store after the merge. It now pins the new contract: the second chance is spent at most once across repeated sweeps, and an uncertain call keeps audio, intent and custody held. Measured silence still settles without any paid call. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve PL-321/322/323 at frame boundaries, buffered query overlays and bounded walk stops. Register the shared matrix in the existing emulator-proof runner. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Include merge holds beside pull claims and prove cleanup preserves foreign namespaces and synthetic customer rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Qualify PL-061, PL-105 and PL-363 on old Firestore, new Postgres and the simulator through the existing Store harness. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…utcomes Use PL-396 for phone custody and leave PL-061 producer client_status as a separate missing invariant in the parity ledger. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Make the conformance fixture independent of CI stage defaults and reject paid-attempt metadata on a local no-spend refusal. Clarify minimum CI stores versus all-store cutover qualification. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # backend/scripts/run-emulator-proofs.sh
# Conflicts: # backend/scripts/select_backend_unit_tests.py
# Conflicts: # backend/scripts/run-emulator-proofs.sh
# Conflicts: # backend/scripts/enrichment_recovery_emulator_test.py # backend/scripts/run-emulator-proofs.sh # backend/testing/store_fixtures.py
…ed tree The ratchet fixture arrived from #22390 with a baseline ~4.5k commits stale: main gained nine importers of the retiring legacy sync modules (staging syncsplit proof, backfill worker control/job, empty-success guard, watch recovery e2e, capture coverage lanes) and lost two baseline edges (enrichment callback, cap_recovery_audio coverage replay). Regenerated with the ratchet's own --write pass, then reviewed each edge's why against the retire milestones (C10/C11).
This was referenced Nov 4, 2026
The PL-194 file predates two scheduler changes main landed since its base: - The pull transaction now returns (receipts-or-None, eligible, observations) where each receipt is (lease, enqueued_at, relet); Scheduler.pull is what unwraps receipts into LeasedWork. The conformance helper treated result[0][0] as a lease, so its committed list held receipt tuples against pull's LeasedWork list, and aborted['lease'].item raised AttributeError. Unwrap receipts to the lease on both sides so the whole test speaks the one shape main's lease API returns. - A multi-lease abort rolls back every receipt in its transaction, so the exact 'failing_lease - 1 committed' count only holds one lease per transaction; pin the documented BATCH_PULL_MULTI_LEASE_ENABLED kill switch (as the file already pins shard spread and cap dispatch). - Shard-spread selection reads control_candidates (plural fanout), not the singular control_candidate the overlap test paused; hook both, each wrapping its own original, since the singular delegates to the plural. All 24 partial-pull parametrizations plus both overlap cases pass on sim and Postgres locally; emulator legs stay with CI's proofs job.
Member
Author
Dimank92
pushed a commit
to Dimank92/omi
that referenced
this pull request
Nov 4, 2026
Preserve existing changed-file coverage and explicitly include scheduler regressions. Inventory lifecycle payload values, aliases, sibling keys and duplicates across database/utils. Probe deadline stamps independently for each persisted entry and reject late, conditional, null or cleared stamps. Correct stale plan gaps against main 1ee787b: proof repair exits, successful terminal alert semantics and finalization completed stock. Add the pure synthetic ordering contracts requested by ruling f1e35a. This is the local WP-B B1 fix delta. Publication is held by ruling c09a2a while the owner of the folded PR BasedHardware#24591 resolves the shared branch.
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.
What changed and why
Add the WP-B B1 lifecycle state table, an AST guard for undeclared field payload builders and literal job states, and a pure four-clause invariant matrix. Route relevant source changes to both tests without changing the selector's existing full-suite fallback.
The source audit corrects the plan at main a5ccd17: #24531 already fixed the fair-use downward ladder, and #24533 already supplied blocked-BYOK dwell and dead-letter stock/age alerts. Batch job state and result projection state are separate machines; projection pending/quarantine_held, job vendor_held/committed, and the fair-use base state are explicit.
The complete matrix has 54 rows and 79 individually enumerated strict xfails, including entry-deadline and terminal stock gaps absent from the original nine-state list. Each reason names the remaining fix or the tracked phase-contract follow-up. record_pending waits on #24587; producer tokens, sealed-without-job and upload-failure retry wait on freshtitles fixes with no PR yet.
These are source/table contracts. They validate declared mechanisms and committed alert definitions; bounded runtime liveness, simulator transitions and deployment are not claimed. Derived conversation phases are read-only compatibility vocabulary, with obligations checked on the underlying legacy machines. Field scanning intentionally includes payload builders and some response/query dictionaries; dynamic-key whole-program dataflow is outside its claim. Fixes must update the reviewed declarations, and an improved row retaining its strict xfail then blocks CI.
Product invariants affected
none
How it was verified
From the isolated lane/lcinv worktree, with the five cloud credential/project variables unset:
BACKEND_PYTEST_WORKERS=1 BACKEND_UNIT_TEST_FILE_LIST=/Volumes/Ephemeral/scratch/lcinv/tests.txt /Users/dazheng/workspace/omi/bin/omi-heavy run -- nice -n 19 bash backend/test.sh425 passed, 79 xfailed. Both new files use source parsing and pure phase enums, without serving-module imports, network or GCP.
With
PYTEST_ADDOPTS=--runxfailand the invariant-file list: 79 failed, 142 passed. All 79 are AssertionErrors, and the exact failing case set equals the independently enumeratedKNOWN_GAPS. The first audit attempt queued out before running; the retry used a longer wait with default slot counts unchanged.Tests
The writer guard checks the explicit inventory in both directions and detects nested transaction functions, literal field aliases, direct updates, dictionary payloads, new modules and new literal states inside an existing writer. Selector cases cover the requested source areas and a previously unrelated source. The invariant matrix has one strict xfail per broken clause, plus green controls for fixed plan gaps and deadline probes that reject reads without writes.
UI evidence
UI-Evidence: none -- test infrastructure only
Failure class (fixes)
Failure-Class: none
New guards
The 2026-11-03 title/custody incident and the fixes in #24494/#24500/#24531/#24533 show why lifecycle fields need a shared declared contract. This PR is that shared test primitive; simulator-backed WP-B B2 remains blocked on WP-A merging and uicleanup's go.
Tracking
Owner: lcinv. ANX: https://anx.scalingforever.com/o/david-zhang/w/omi/r/card:lcinv-lifecycle-invariants
No product code,
.github/, firmware, deployment or account-data changes. No deploy needed.