Repository navigation
legacy-retire C11 (draft, deletion + WORKFLOW EDIT needing David): delete legacy sync transcription, keep the cap-hold core - #22635
Git-on-my-level wants to merge 170 commits into
Conversation
…-local-files 410 (lane 10 slice 2b) routers/sync.py: no legacy job outside on (fence for legacy-owned content, 409 retry-later otherwise), legacy-fresh skipped, sequencer registration and pre-sequencer migration only at on, dark sweep stops claims but keeps enrichment and summary-debt repair, dark wake 200. uid_sequencer: kick/sweep inert in dark. /v1/sync-local-files returns 410 (7-day census: zero calls); its v1-only tests are removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…acy-fresh deleted Co-Authored-By: Claude Opus 5.5 <[email protected]>
… admission tests and legacy-fresh env removed Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ipt (pipeline.py deletion follows) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lr/10-delete-c11 # Conflicts: # backend/utils/batch_pipeline/enrichment.py
…o enrichment root); parity test pins the core's copy Co-Authored-By: Claude Opus 5.5 <[email protected]>
…; ladder-denied v2 guard kept via the fence Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d_audio) and no enforce_budget Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # backend/utils/sync/uid_sequencer.py
# Conflicts: # backend/tests/unit/test_sync_cloud_tasks.py
Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # config/feature-flags.yaml
… 410 in slice 2b Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te is 410) Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # backend/tests/unit/test_sync_cloud_tasks.py
…lr/10-slice2b # Conflicts: # config/feature-flags.yaml
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n def Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…quencer Deletes uid_sequencer, sync_backfill_sequencer, owner/staged prefetch, backfill_cutover/order, sync_owner_concurrency and their operator scripts; the sweep/wake routes and the sequenced half of /v2/sync-jobs/run (a stale sequenced task acks 200 sequencer_retired); the budget-deferral owner count; the sequencer scheduler job; 9 SYNC_BACKFILL_* keys and registry rows; and (named by David 10-19) the lifecycle action's backfill-queue and sequencer-sweep recreation steps. Requires C4 (enrichment-maintenance) first: the deleted sweep route still ran reprocess and summary-debt repair. Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # .github/actions/sync-backfill-lifecycle/action.yml # backend/tests/unit/test_legacy_dark.py
Resolve two test conflicts by keeping the C6 deletion of v1-only cases that main had added or edited after the last restack. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… retirement Luna round 1 on #22501 (P2): C6 deleted the shared header assertion along with v1. Restore it scoped to the v2 handler; the v1 route is a 410 stub. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflicts resolved by keeping C9 (legacy admission removed): main had extended the legacy admission/staging block, its tests and the legacy gauntlet family that C9 replaces. Main-only additions dropped with that block: the staging dispatch-hold recheck helper and its imports, two dispatch-hold unit tests, and the legacy-pipeline usage-finalization e2e case in the deleted test_sync_lifecycle.py. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep C10 deletions (sequencer modules, tests, scheduler job, lifecycle backfill queue step named by David 10-19). Main additions kept: AUDIO_ARCHIVE_REGIONAL_CACHE_PERCENT in both overlays; the dev scheduler set follows the merged manifest (memory-maintenance-hourly is gone on main). runtime_env.yaml recomposed from the overlays. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Luna r1 on #22592 (P1): the refresh kept the C9 signature while the merged body read main's archive flag, so the retirement scenario raised NameError before the batch scenarios ran. Local gauntlet --only all now passes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
legacy_segment_core.py is re-extracted from the current main pipeline (planc/c10 utils/sync/pipeline.py), not carried from the 10-23 copy: 37 definitions take main's text verbatim; process_segment is a 3-way merge that re-applies only C11's minimal-redrive removal on top of main (the resulting diff against main is exactly that removal); main's new helper _record_capture_time_admission joins via closure; three names main moved to utils.enrichment.admission become imports. Other conflicts keep C11's legacy deletions and main's unrelated additions (episode composer, open-loop models, conversation-size docs, merge_dedupe tests, flag rows). Tests main added for deleted coordinator paths are dropped; tests of retained code are repointed to legacy_segment_core. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Luna r2 on #22592 (P1): main's scenario passed archive into a helper that does not take it. C9 replaces the legacy scenario registry with the retirement contract, so the scenario was never registered; remove it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…extracted core Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent contract The route tests assumed legacy admission (202 completed via the legacy claim, create_sync_job). After C9 batch is the only admission: the client fixture stubs the record-route and batch-accept seams and the tests assert batch admission instead. Same coverage of skew admission and empty/invalid clip handling. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main's router test expected legacy admission at on. After C9 every mode answers the retirement 409 and creates no legacy job. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…admission use Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
main's versions patched pipeline-only names; drop patches of names the retained core never calls (run_blocking, delete_syncing_temporal_file), load the core module path, repoint cap-hold empty-recovery patching, take main's audio payload for the oversized backfill test and drop the CI wiring check of the deleted legacy gauntlet worker. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lag budget Main's flag-budget ratchet (ADR 0006, seeded 10-25) requires names C9 stops reading to move to "retired" with the budget lowered in the same change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Stale sequenced tasks are acknowledged (200 dropped/sequencer_retired) ahead of the minimal-redrive kill switch; they can never run again. - Stop provisioning the retired sequencer Scheduler failure/heartbeat alerts (the heartbeat would page once sweep logs stop); the live policies are disabled at the C10 deploy. - test_fsr_wq17 no longer patches the deleted uid_sequencer. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… budget Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keep C11's enrichment-only sync-jobs handler over C10's legacy handler edits; retire the minimal-redrive, durable-redrive, completion-convergence and inline-backfill flags in the pipeline flag budget. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… deleted coordinator main added it 10-25 for the legacy pipeline's staged-audio cleanup; after C11 nothing imports it (dead-code ratchet). Its module test and the legacy cleanup case in test_audio_durable_outbox go with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d pipeline Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he re-extracted core Co-Authored-By: Claude Opus 5.5 <[email protected]>
… after C11 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
26 issues found across 200 files
Confidence score: 3/5
- The failure-class edits combine
open→dormanttransitions with prevention metadata changes, contrary to the registry policy. Separate the lifecycle transitions from the prevention rewrites. - Removing
backend/config/rollout_cohorts.pyleaves the documented legacy-fresh admission and rollback procedure ineffective. Update or archive the runbook references in the same change. backend/tests/unit/test_sync_two_lane.pyhardcodessync-jobseven though production routes through the configuredsync-jobs-freshqueue. ResolveSYNC_TASKS_QUEUEin the test and assert against that queue.- Deleting
backend/testing/e2e/test_core_flow_expansion.pyremoves the only hermetic success-path coverage for the retained v2 batch upload and polling contract. Replace it with a batch-aware completion test.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/failure-classes/FC-queued-delivery-invalidated-by-redrive.json">
<violation number="1" location=".github/failure-classes/FC-queued-delivery-invalidated-by-redrive.json:14">
P2: Separate the dormant transition from the prevention metadata rewrite. This PR changes `canonical_prevention` and its artifact while also setting `status` to `dormant`, but lifecycle transitions and existing-class prevention edits must land in separate registry-only changes.</violation>
</file>
<file name="backend/tests/unit/test_stt_cap_dispatch_http.py">
<violation number="1" location="backend/tests/unit/test_stt_cap_dispatch_http.py:65">
P3: This test no longer exercises the ladder-denial behavior its name describes: both ladder mocks are unreachable from the v2 route, so the `unavailable` cases are equivalent and a regression in allowance handling can pass. Rename it to describe the legacy-dark fence and remove the dead ladder setup, or add a separate test at the actual allowance/admission boundary.</violation>
</file>
<file name="backend/tests/unit/test_fsr_wq17_resolve_snapshot.py">
<violation number="1" location="backend/tests/unit/test_fsr_wq17_resolve_snapshot.py:246">
P3: These patches do not affect the code exercised by this test and can give a false impression that production-stage and ledger-fence behavior is covered. Remove them, or invoke/assert the actual gate they are intended to test.</violation>
</file>
<file name="backend/tests/fast_unit_duration_allowlist.txt">
<violation number="1" location="backend/tests/fast_unit_duration_allowlist.txt:456">
P3: This duration note names a module that the selected test no longer imports, so it will mislead future allowlist maintenance about the source of the import cost. Remove `utils.sync.legacy_segment_core` from the comment.</violation>
</file>
<file name=".github/failure-classes/FC-sync-fresh-proof-demotion.json">
<violation number="1" location=".github/failure-classes/FC-sync-fresh-proof-demotion.json:11">
P2: Separate this `open`→`dormant` lifecycle transition from the `canonical_prevention` and `canonical_prevention_artifact` edits. Combining them violates the failure-class registry policy and prevents the lifecycle transition from being reviewed and audited independently.</violation>
</file>
<file name="backend/tests/unit/_sync_pipeline_fakes.py">
<violation number="1" location="backend/tests/unit/_sync_pipeline_fakes.py:37">
P2: This is not a dead path under the test runner: `database` and `models` resolve their real source trees, so any unlisted submodule bypasses the fake set and imports production dependencies. Use an absolute nonexistent path (or an empty `__path__`) and explicitly fake every submodule the isolated core needs.</violation>
</file>
<file name=".github/failure-classes/FC-pending-queue-without-dispatch-owner.json">
<violation number="1" location=".github/failure-classes/FC-pending-queue-without-dispatch-owner.json:13">
P2: Keep this dormant lifecycle transition separate from the canonical-prevention and artifact rewrite. The repository rule requires both existing-class prevention changes and `open`→`dormant` transitions to land in a separate registry-only PR, so this file should not make these registry changes in the implementation-deletion PR.
(Based on your team's feedback about separate dormant lifecycle transitions.)</violation>
</file>
<file name=".github/failure-classes/FC-sync-backfill-cross-environment-state.json">
<violation number="1" location=".github/failure-classes/FC-sync-backfill-cross-environment-state.json:14">
P2: Keep the open-to-dormant transition in its own registry-only change; move the `canonical_prevention` and `canonical_prevention_artifact` rewrites to a separate change so lifecycle history remains independently reviewable.</violation>
</file>
<file name="backend/tests/unit/test_config_train.py">
<violation number="1" location="backend/tests/unit/test_config_train.py:611">
P2: This assertion does not verify the new `sync-jobs` contract. Assert the captured commands explicitly, so the test fails if the lifecycle stops describing or updating `sync-jobs` with `--max-attempts=5`.</violation>
</file>
<file name="backend/tests/unit/test_sync_two_lane.py">
<violation number="1" location="backend/tests/unit/test_sync_two_lane.py:435">
P2: This assertion hardcodes `sync-jobs`, but production routes through the ops-selected `sync-jobs-fresh` queue. Make the lifecycle resolve and reconcile the configured `SYNC_TASKS_QUEUE`, then assert that resolved contract instead of enshrining the stale literal.</violation>
</file>
<file name="backend/tests/unit/test_config_refactor_w6.py">
<violation number="1" location="backend/tests/unit/test_config_refactor_w6.py:193">
P2: This retirement check covers only the feature-flag registry, while deployment classification still advertises the deleted owner-concurrency settings. Remove those retired entries from classification too, or extend this guardrail to cover that source.</violation>
</file>
<file name="backend/testing/e2e/test_mobile_batch_archive.py">
<violation number="1" location="backend/testing/e2e/test_mobile_batch_archive.py:69">
P2: The revised success branch no longer verifies that the raw archive preserved the uploaded bytes. The route archives before returning C9’s 409, so retain the archive-count and byte-equality assertions to keep this archive regression test meaningful.</violation>
</file>
<file name="backend/config/rollout_cohorts.py">
<violation number="1" location="backend/config/rollout_cohorts.py:26">
P2: Removing this cohort makes the documented legacy-fresh admission and rollback procedure ineffective, while the runbook still directs operators to use it. Delete or explicitly archive/update these references in the same retirement change so operators do not attempt to control a cohort that `COHORT_ENVS` and the rollout tooling no longer recognize.</violation>
</file>
<file name="backend/tests/unit/test_sync_cloud_tasks_stack_ci_wiring.py">
<violation number="1" location="backend/tests/unit/test_sync_cloud_tasks_stack_ci_wiring.py:28">
P3: Deleting the AST-based test leaves `ast` unused, so Ruff now fails this file's lint hook. Remove the stale `import ast`.</violation>
</file>
<file name="backend/testing/e2e/test_watch_recovery_process_now.py">
<violation number="1" location="backend/testing/e2e/test_watch_recovery_process_now.py:18">
P2: This policy disables the batch branch, making `decline_batch` unreachable; the test therefore does not verify the behavior described by its name and module docstring. Enable batch admission so the mocked `accept_batch_upload` path executes before asserting the legacy-retirement 409.</violation>
</file>
<file name="backend/tests/unit/test_sync_recording_session_target.py">
<violation number="1" location="backend/tests/unit/test_sync_recording_session_target.py:26">
P3: This autouse fixture now imports the entire retained sync core even though no remaining test uses its return value. Remove the obsolete fixture so these tests do not pay the import cost or fail setup due to unrelated core dependencies.</violation>
</file>
<file name="backend/tests/unit/test_mobile_standard_batch.py">
<violation number="1" location="backend/tests/unit/test_mobile_standard_batch.py:194">
P3: This fixture still uses hand-rolled `sys.modules` cleanup for the router reload. Refactor the fixture/harness to use `testing.import_isolation.stub_modules` with `load_module_fresh`; otherwise a pre-existing `legacy_segment_core` import can be discarded and later tests can observe polluted import state.
(Based on your team's feedback about sanctioned router import isolation.)</violation>
</file>
<file name="backend/tests/unit/test_legacy_dark_router.py">
<violation number="1" location="backend/tests/unit/test_legacy_dark_router.py:28">
P2: Keep this router fixture on the sanctioned import-isolation path instead of extending the hand-rolled `sys.modules` teardown. The current replacement only changes which core is popped and still cannot restore all modules and parent attributes created by the fresh router import, allowing order-dependent test pollution.</violation>
</file>
<file name="backend/tests/unit/test_sync_lineage_diagnostics.py">
<violation number="1" location="backend/tests/unit/test_sync_lineage_diagnostics.py:665">
P3: This added import duplicates the module-level import at line 11 and appears after test definitions, triggering Ruff’s `E402` late-import check. Remove the duplicate and keep the existing top-level import.</violation>
</file>
<file name="backend/testing/e2e/test_core_flow_expansion.py">
<violation number="1" location="backend/testing/e2e/test_core_flow_expansion.py:167">
P2: This deletion removes the only hermetic success-path regression test for the retained v2 batch upload and polling contract. Replace it with a batch-aware completion test rather than dropping coverage for POST → completion → GET polling and persistence.</violation>
</file>
<file name="backend/docs/listen_pusher_pipeline.mdx">
<violation number="1" location="backend/docs/listen_pusher_pipeline.mdx:7614">
P2: This says the batch pipeline uses `legacy_segment_core.py`, but the batch pipeline has no dependency on that module and maintains its segment-processing implementation under `utils/batch_pipeline`. Correct the ownership description so operators do not audit or modify the wrong recovery path.</violation>
</file>
<file name=".github/actions/sync-backfill-lifecycle/action.yml">
<violation number="1" location=".github/actions/sync-backfill-lifecycle/action.yml:275">
P3: This replacement leaves `max_concurrent_dispatches` dead: the action only produces it and no longer consumes it. Remove that calculation or run the max-scale step only for workers to avoid an unnecessary Cloud Run API failure point on platform and dispatch runs.</violation>
<violation number="2" location=".github/actions/sync-backfill-lifecycle/action.yml:281">
P2: The sequencer is being retired, but this action still provisions `Sync backfill UID sequencer stalled` from `sync_uid_sequencer` log events. Remove this remaining alert path and retire its existing metric/policy, or every platform/dispatch run will recreate an alert that no code can emit.</violation>
</file>
<file name="backend/docs/runbooks/legacy-dark.md">
<violation number="1" location="backend/docs/runbooks/legacy-dark.md:73">
P2: The post-C10 behavior is documented incorrectly: `/v2/sync-jobs/run` dispatches only `sync_reprocess` tasks and drops other deliveries as `legacy_retired`, rather than running epoch-less backfill tasks directly with `sequencer_retired`. Document the actual retirement response.</violation>
</file>
<file name=".github/failure-classes/FC-durable-queue-outlives-executable-work.json">
<violation number="1" location=".github/failure-classes/FC-durable-queue-outlives-executable-work.json:11">
P2: These five entries combine `open`→`dormant` lifecycle transitions with canonical-prevention and artifact rewrites. Move the lifecycle transitions to a separate registry-only change, leaving this PR only the deletion-related artifact updates.
(Based on your team's feedback about separating dormant lifecycle transitions from prevention-artifact rewrites.) [ec507008-ef9e-469f-ac56-31148bab2c37]</violation>
</file>
<file name="backend/config/flag_budget.json">
<violation number="1" location="backend/config/flag_budget.json:219">
P2: The retired flags remain in `config/deployment-setting-classification.json`, so deployment tooling still advertises deleted settings after this ledger marks them retired. Remove the retired sync names from that classification and related deployment allowlists.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
| "backend/utils/cloud_tasks.py" | ||
| ], | ||
| "status": "open" | ||
| "status": "dormant", |
There was a problem hiding this comment.
P2: Separate the dormant transition from the prevention metadata rewrite. This PR changes canonical_prevention and its artifact while also setting status to dormant, but lifecycle transitions and existing-class prevention edits must land in separate registry-only changes.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/failure-classes/FC-queued-delivery-invalidated-by-redrive.json, line 14:
<comment>Separate the dormant transition from the prevention metadata rewrite. This PR changes `canonical_prevention` and its artifact while also setting `status` to `dormant`, but lifecycle transitions and existing-class prevention edits must land in separate registry-only changes.</comment>
<file context>
@@ -2,15 +2,15 @@
"backend/utils/cloud_tasks.py"
],
- "status": "open"
+ "status": "dormant",
+ "dormant_since": "2026-10-19T17:37:30Z"
}
</file context>
| "evidence_prs": [], | ||
| "scope_hints": ["backend/utils/sync/", "backend/routers/sync.py"], | ||
| "status": "open" | ||
| "status": "dormant", |
There was a problem hiding this comment.
P2: Separate this open→dormant lifecycle transition from the canonical_prevention and canonical_prevention_artifact edits. Combining them violates the failure-class registry policy and prevents the lifecycle transition from being reviewed and audited independently.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/failure-classes/FC-sync-fresh-proof-demotion.json, line 11:
<comment>Separate this `open`→`dormant` lifecycle transition from the `canonical_prevention` and `canonical_prevention_artifact` edits. Combining them violates the failure-class registry policy and prevents the lifecycle transition from being reviewed and audited independently.</comment>
<file context>
@@ -2,12 +2,12 @@
"evidence_prs": [],
"scope_hints": ["backend/utils/sync/", "backend/routers/sync.py"],
- "status": "open"
+ "status": "dormant",
+ "dormant_since": "2026-10-19T16:58:49Z"
}
</file context>
|
|
||
| for parent in ('database', 'models'): | ||
| pkg = ModuleType(parent) | ||
| pkg.__path__ = [parent] # dead path: submodule resolution only via fakes |
There was a problem hiding this comment.
P2: This is not a dead path under the test runner: database and models resolve their real source trees, so any unlisted submodule bypasses the fake set and imports production dependencies. Use an absolute nonexistent path (or an empty __path__) and explicitly fake every submodule the isolated core needs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/_sync_pipeline_fakes.py, line 37:
<comment>This is not a dead path under the test runner: `database` and `models` resolve their real source trees, so any unlisted submodule bypasses the fake set and imports production dependencies. Use an absolute nonexistent path (or an empty `__path__`) and explicitly fake every submodule the isolated core needs.</comment>
<file context>
@@ -0,0 +1,92 @@
+
+ for parent in ('database', 'models'):
+ pkg = ModuleType(parent)
+ pkg.__path__ = [parent] # dead path: submodule resolution only via fakes
+ fakes[parent] = pkg
+
</file context>
| "backend/utils/sync/legacy_dark.py" | ||
| ], | ||
| "status": "open" | ||
| "status": "dormant", |
There was a problem hiding this comment.
P2: Keep this dormant lifecycle transition separate from the canonical-prevention and artifact rewrite. The repository rule requires both existing-class prevention changes and open→dormant transitions to land in a separate registry-only PR, so this file should not make these registry changes in the implementation-deletion PR.
(Based on your team's feedback about separate dormant lifecycle transitions.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/failure-classes/FC-pending-queue-without-dispatch-owner.json, line 13:
<comment>Keep this dormant lifecycle transition separate from the canonical-prevention and artifact rewrite. The repository rule requires both existing-class prevention changes and `open`→`dormant` transitions to land in a separate registry-only PR, so this file should not make these registry changes in the implementation-deletion PR.
(Based on your team's feedback about separate dormant lifecycle transitions.) </comment>
<file context>
@@ -2,16 +2,14 @@
+ "backend/utils/sync/legacy_dark.py"
],
- "status": "open"
+ "status": "dormant",
+ "dormant_since": "2026-10-19T17:37:30Z"
}
</file context>
| "backend/database/sync_jobs.py" | ||
| ], | ||
| "status": "open" | ||
| "status": "dormant", |
There was a problem hiding this comment.
P2: Keep the open-to-dormant transition in its own registry-only change; move the canonical_prevention and canonical_prevention_artifact rewrites to a separate change so lifecycle history remains independently reviewable.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/failure-classes/FC-sync-backfill-cross-environment-state.json, line 14:
<comment>Keep the open-to-dormant transition in its own registry-only change; move the `canonical_prevention` and `canonical_prevention_artifact` rewrites to a separate change so lifecycle history remains independently reviewable.</comment>
<file context>
@@ -2,16 +2,15 @@
+ "backend/database/sync_jobs.py"
],
- "status": "open"
+ "status": "dormant",
+ "dormant_since": "2026-10-19T17:37:30Z"
}
</file context>
| _BOUNDED_APT_GET = 'sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=10 -o Acquire::https::Timeout=10' | ||
|
|
||
|
|
||
| def test_concurrent_lease_probe_holds_stt_instead_of_deferred_full_processing(): |
There was a problem hiding this comment.
P3: Deleting the AST-based test leaves ast unused, so Ruff now fails this file's lint hook. Remove the stale import ast.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_sync_cloud_tasks_stack_ci_wiring.py, line 28:
<comment>Deleting the AST-based test leaves `ast` unused, so Ruff now fails this file's lint hook. Remove the stale `import ast`.</comment>
<file context>
@@ -25,39 +24,13 @@
-
-
def test_sync_cloud_tasks_stack_gauntlet_has_a_deterministic_hermetic_ci_job() -> None:
workflow = (_REPO_ROOT / '.github' / 'workflows' / 'backend-hermetic-e2e.yml').read_text(encoding='utf-8')
package = json.loads((_REPO_ROOT / 'package.json').read_text(encoding='utf-8'))
contracts = json.loads((_REPO_ROOT / 'backend' / 'testing' / 'workflow_contracts.json').read_text(encoding='utf-8'))
</file context>
| def dependencies(): | ||
| from database import conversations # noqa: F401 | ||
| from utils.sync import pipeline | ||
| from utils.sync import legacy_segment_core as pipeline |
There was a problem hiding this comment.
P3: This autouse fixture now imports the entire retained sync core even though no remaining test uses its return value. Remove the obsolete fixture so these tests do not pay the import cost or fail setup due to unrelated core dependencies.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_sync_recording_session_target.py, line 26:
<comment>This autouse fixture now imports the entire retained sync core even though no remaining test uses its return value. Remove the obsolete fixture so these tests do not pay the import cost or fail setup due to unrelated core dependencies.</comment>
<file context>
@@ -23,7 +23,7 @@
def dependencies():
from database import conversations # noqa: F401
- from utils.sync import pipeline
+ from utils.sync import legacy_segment_core as pipeline
return pipeline
</file context>
| finally: | ||
| sys.modules.pop('routers.sync', None) | ||
| sys.modules.pop('utils.sync.pipeline', None) | ||
| sys.modules.pop('utils.sync.legacy_segment_core', None) |
There was a problem hiding this comment.
P3: This fixture still uses hand-rolled sys.modules cleanup for the router reload. Refactor the fixture/harness to use testing.import_isolation.stub_modules with load_module_fresh; otherwise a pre-existing legacy_segment_core import can be discarded and later tests can observe polluted import state.
(Based on your team's feedback about sanctioned router import isolation.)
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_mobile_standard_batch.py, line 194:
<comment>This fixture still uses hand-rolled `sys.modules` cleanup for the router reload. Refactor the fixture/harness to use `testing.import_isolation.stub_modules` with `load_module_fresh`; otherwise a pre-existing `legacy_segment_core` import can be discarded and later tests can observe polluted import state.
(Based on your team's feedback about sanctioned router import isolation.) </comment>
<file context>
@@ -191,7 +191,7 @@ def mobile_sync_router():
finally:
sys.modules.pop('routers.sync', None)
- sys.modules.pop('utils.sync.pipeline', None)
+ sys.modules.pop('utils.sync.legacy_segment_core', None)
sys.modules.pop('utils.sync.ledger_completion', None)
for name, original in saved.items():
</file context>
| assert assigned['_sync_lineage_stamp_gap_refused'] is True | ||
|
|
||
|
|
||
| from config.sync_live_dedupe import SYNC_LINEAGE_LIVE_DEDUPE_ENV |
There was a problem hiding this comment.
P3: This added import duplicates the module-level import at line 11 and appears after test definitions, triggering Ruff’s E402 late-import check. Remove the duplicate and keep the existing top-level import.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At backend/tests/unit/test_sync_lineage_diagnostics.py, line 665:
<comment>This added import duplicates the module-level import at line 11 and appears after test definitions, triggering Ruff’s `E402` late-import check. Remove the duplicate and keep the existing top-level import.</comment>
<file context>
@@ -805,6 +662,16 @@ def test_fully_deduped_stamp_gap_keeps_live_and_landed_sync_row_unchanged(monkey
assert assigned['_sync_lineage_stamp_gap_refused'] is True
+from config.sync_live_dedupe import SYNC_LINEAGE_LIVE_DEDUPE_ENV
+
+
</file context>
| --quiet | ||
|
|
||
| - name: Reconcile bounded sync backfill queue | ||
| - name: Reconcile sync-jobs attempt contract |
There was a problem hiding this comment.
P3: This replacement leaves max_concurrent_dispatches dead: the action only produces it and no longer consumes it. Remove that calculation or run the max-scale step only for workers to avoid an unnecessary Cloud Run API failure point on platform and dispatch runs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At .github/actions/sync-backfill-lifecycle/action.yml, line 275:
<comment>This replacement leaves `max_concurrent_dispatches` dead: the action only produces it and no longer consumes it. Remove that calculation or run the max-scale step only for workers to avoid an unnecessary Cloud Run API failure point on platform and dispatch runs.</comment>
<file context>
@@ -272,64 +272,15 @@ runs:
--quiet
- - name: Reconcile bounded sync backfill queue
+ - name: Reconcile sync-jobs attempt contract
if: ${{ inputs.mode == 'platform' || inputs.mode == 'dispatch' }}
shell: bash
</file context>
* test(backend): catch main up to the TTS rate-limit rename and retired 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. * test(listen): guard lag-probe wiring and /metrics exposition 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]> * test(listen): tie exposition test to the route wiring; fix frame-histogram 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]> * docs(listen): frame histogram child appears at receive-loop entry, not first frame Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(listen): exercise the deployed app's /metrics exposition in a fresh 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 * test(sync): legacy import ratchet and enrichment outbox contracts 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]> * test(sync): address review — selector coverage, keyword imports, fixture 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). * test(sync): address review — aliased import_module, survivor scope, selector 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. * test(listen): keep the child's network guard referenced for its whole 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 * test(sync): address review — proven import_module bindings, relative 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). * test(jobstore): port recovery discovery and progress parity invariants Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): carry recovery custody invariants across job stores Failure-Class: FC-empty-asr-without-context-recovery Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): pin recap fixture to a reproducible admission time 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]> * test(backend): port recovery and admission parity invariants 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]> * test(mobile-perf): upload-success window, sparse scoring, semantics knob; 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]> * test(mobile-perf): dry-run tests pass an explicit artifact root 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]> * test(jobstore): qualify fenced shard pulls across stores Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(jobstore): require available backends in the selected proof lane Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(outbox): preserve durable enqueue across wake failures (PL-042) Failure-Class: none Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(outbox): verify committed enqueue result identity Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): qualify partial-pull leases across store backends Port PL-194 into the shared scheduler/Store matrix and existing emulator proof lane. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): qualify pending deletion across old and new stores Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(backend): PL-049 positive-speech custody follows the one Soniox 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]> * test: qualify pull-batch parity across Firestore and Postgres 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]> * test: clean coordination fixtures within their owned namespace 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]> * test(backend): enforce held-custody and no-spend recovery parity 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]> * test(backend): keep partial-custody identity distinct from producer outcomes 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]> * test(backend): declare isolated stage and fence paid refusal markers 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]> * style(firmware): match CI clang-format on the safe-mode snapshot initializer CI's clang-format 18 attaches the compound-literal brace and drops the space before it; break nothing else and keep the initializer alignment one column left. * test(backend): keep the enrichment proof clock a real clock The consumer's heartbeat hold cap reads time.monotonic, so the injected consumer clock must carry the full time module with only the wall-clock pinned, or every PL-397 delivery dies on AttributeError before the callback runs. * style(firmware): drop the compound-literal brace space CI's clang-format rejects CI formats firmware with clang-format 18, which attaches the brace after the compound-literal cast; the local 23 kept a space and realigned one column right, so the Formatting job failed on the merge preview. Commit with clang-format 18 first on PATH so the pre-commit hook agrees. * test(backend): inventory lifecycle writers and latch invariant gaps * test(backend): re-baseline the legacy-sync import ratchet to the folded 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). * test(backend): align partial-pull conformance with the current lease API 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. --------- Co-authored-by: David Zhang <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
|
When this PR returns to the merge queue, please update its branch against current |
Delete the legacy job coordinator, minimal-redrive runner/database helper, retired endpoints/flags and Phase0A replay harness/job. Stale deliveries ACK HTTP200 with
dropped/legacy_retired. Polling and held-capture recovery remain on the shared segment core used by batch.Refreshed 2026-11-01 (planc, Plan C owner). The refreshed C10 head (C6 + C9 + current
origin/main) is merged into the original C11 ancestry with merge commits; no rebase or force-push.The retained core is re-extracted from the current main pipeline, not carried from the 10-23 copy.
utils/sync/legacy_segment_core.pynow holds 38 definitions taken fromplanc/c10:backend/utils/sync/pipeline.py(main814dd415f60lineage):process_segmentis a 3-way merge (base251892e, C11's 10-23 core, main) that re-applies only C11's minimal-redrive removal; its diff against main is exactly that removal (theselect_servicewrapper becomes the directresolve_filecall,paid_recovery_enabledbecomesempty_recovery.enabled(), thesegment_targetattach and theProviderUnavailableexcept are gone);_record_capture_time_admissionjoins through the reference closure;SyncConversationPersistenceFencedand two helpers that main moved toutils.enrichment.admissionbecome imports;Conflict policy: C11's legacy deletions win (coordinator, minimal redrive, Phase0A harness,
sync_redrive, legacy worker role in the gauntlet); main's unrelated additions are kept (episode composer and open-loop model entries, conversation-size docs,merge_dedupeandintake_completiontests, flag rows). Tests main added for deleted coordinator paths are dropped; tests of retained code are repointed tolegacy_segment_core(test_sync_capture_time_skew.py,test_sync_transcription_prefs.pyfrom main's current version,test_sync_lineage_allowlist.pyrebuilt from main minus coordinator cases). The router importsget_timestamp_from_pathfor main's new v2 admission use.utils/sync/staging_custody.py(main 10-25, the legacy pipeline's staged-audio cleanup) is deleted with its tests: nothing else imports it. Main's flag-budget ratchet: the minimal-redrive, durable-redrive, completion-convergence and inline-backfill flags move toretired.Published m1 head:
64303bd8d7e7b7d68b44f09628a268bcac162dcd. Original PR ancestry is preserved and main #23440 is included. All normal push hooks passed; no force-push or bypass. Current-head CI is shown in the checks below.DRAFT / RELEASE HOLD: p90 must qualify batch100% across every serving revision with route, quality, parity, custody, recovery and S1 overlap receipts. Legacy owners must drain/rehome; two zero censuses and a continuous 12h dark soak must pass. Production remains batch0% / legacyON and the dark clock has not started. C10 must be serving before this step. Minimal-redrive disposition, held-capture recovery closure and phone/Watch S1 overlap must be proved. David's2026-10-23 go covers C6→C9→C10→C11, including minimal redrive and the named lifecycle/Phase0A CI retirements. Lead alone merges and deploys; each preceding deployment requires a fresh clean step soak.
Validation and scope
251892e223fca3bf5c90f060d3b9673683e258fa, SHA2562eb68490d1004e57005cabfdcedc294e26ea5f0ac1e1f53183830355dc8e16c5). 34 definitions / 1,714 lines remain AST-equal after formatting, except minimal-only behavior is removed fromprocess_segment. Current assignment/owner fencing, clock-run/recording-session provenance, transcript admission, language routing, empty-success, paid recovery and deferred cleanup survive.exec-budget-sleep-item-face-frost-inform: no P0/P1, at8c4bfc5d. Later changes carry reviewed upstream main fixes, remove unused sequencer/test glue and adapt the Watch retry contract. Main#23393's redirect snapshot change is ported exactly into the retained core and current-source AST parity is revalidated. No second review, per instruction.episode_incrementalremains in the model inventory. Duration allowlist removes only thirteen actually retired targets. Runtime env and feature registry are regenerated.c11-push-final.log.Line-Count-Exception: backend/utils/sync/legacy_segment_core.py | 0 -> 1907 | Current-main closure of the deleted coordinator's shared batch/held-capture recovery code (re-extracted 2026-11-01); temporary until the cap-hold rehome into batch admission.
Complete gate/query sequence and evidence:
/Volumes/scratch/m1-lanes/l10/SEQUENCE.md,HANDOFF.md, source-scope receipts and focused logs. Source inclusion alone is not maintenance/recovery serving proof.Product invariants affected
Failure-Class: none
Rollback requires the coordinated predecessor image and captured queue/scheduler specs; flags cannot restore deleted code.
🤖 Generated with Claude Code