Repository navigation
test(sync): check phone custody over every batch unit state - #24340
Merged
Merged
Conversation
#24335 found three durable_status branches that answered `completed` while units were still held, each caught by reading code, about 12 days after it shipped. One golden per branch would not catch the fourth. The new backend property test enumerates every per-unit job state (in flight, committed, committed-but-held, each quarantine recovery state, open operator intents) for one- and two-unit uploads, beside every ledger shape and both held-terminal kill-switch settings, and asserts `completed` only when every unit is terminal. Against the pre-#24335 intake.py it fails with 282 (switch on) and 266 (switch off) unresolved uploads answering `completed`. Every answer it can produce is pinned in a shared fixture. The phone test replays each unresolved answer through syncJobTerminalPolicy and real WAL reconciliation, and checks that 14-day-old bytes survive. A new backend answer therefore cannot reach phones without that check; adding the old `completed/batch_unit_held` answer makes the phone test fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
Luna r1 (P2): the reachable silence_disposition operator intent was not enumerated. Add it, and sweep unordered two-unit pairs, since durable_status has no order dependence; CPU stays about 0.4 s per sweep. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Why
#24335 found three
durable_statusbranches that told phonescompletedwhile batch units were still held. Released phones readcompletedas permission to mark the WAL synced and later age-delete their only independent copy. Each branch was found by reading code, about 12 days after it shipped (laneartifactmissing; risk review E4). A golden per branch would not catch a fourth.What
Tests only. No runtime change.
Backend property test (
backend/tests/unit/test_batch_pipeline_custody_property.py). It enumerates every per-unit job state:ready/leased/retry/result_ready);speech_redrive,terminal_disposition,silence_disposition).It covers one-unit uploads and unordered two-unit pairs (
durable_statushas no order dependence), beside every ledger shape (as admitted, partial,completedwithheld_audio, validcompleted) and both settings ofBATCH_PIPELINE_HELD_TERMINAL_STATUS_ENABLED. It asserts the answer iscompletedonly when every unit is committed with no recovery or operator work owed.Shared fixture (
backend/tests/fixtures/custody_status_shapes.json). It pins every(status, reason_code, poll_after_ms)the sweep produces, split into resolved and unresolved. A new backend answer fails the backend test until it is added there.Phone test (
app/test/unit/custody_status_shapes_test.dart). It replays each unresolved answer throughsyncJobTerminalPolicyand realLocalWalSyncImplreconciliation, and checks that a 14-day-old WAL is never acknowledged, never marked synced and never age-evicted. Only the resolvedcompletedanswer may acknowledge.A one-paragraph pointer in
CONTRACT.mdand akind:nonemobile changelog fragment.Assumption, stated in the test: a valid
completedledger is the projection's own all-units receipt, and is authoritative over job rows (test_status_is_durable_and_completed_result_is_authoritative). It is paired only with all-terminal units. If projection ever wrotecompletedearly, this test would not see it; that needs its own projection-side property.Fail-first evidence
backend/utils/batch_pipeline/intake.py(f520a2c92e687, swapped in locally, then restored). It fails: 175 unresolved uploads answeredcompletedwith the switch on, and 165 with it off. That covers the partial-ledger branch and_held_status.completed/batch_unit_held/0) added to the unresolved fixture fails on both the policy check and real reconciliation (1 acknowledgement where 0 is expected).Verification (layer: local unit tests, this head)
backend/test.shwithBACKEND_UNIT_TEST_FILE_LIST=tests/unit/test_batch_pipeline_custody_property.py, viabin/omi-heavy, nice 19: 3 passed. CPU time is about 0.4 s per sweep, under the 1.0 s guard; the sweep is cached between tests.flutter test test/unit/custody_status_shapes_test.dart test/unit/held_partial_custody_test.dart test/unit/sync_job_terminal_policy_test.dart: 18 passed.Deploy: none (tests only).
Product invariants: INV-DATA-1.
🤖 Generated with Claude Code