Skip to content

legacy-retire C9 (draft, deletion): remove legacy admission from v2 sync, delete legacy_fresh - #22592

Open
Git-on-my-level wants to merge 66 commits into
mainfrom
lr/10-delete-c9
Open

Git-on-my-level wants to merge 66 commits into
mainfrom
lr/10-delete-c9

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Remove legacy admission from POST /v2/sync-local-files and delete legacy_fresh with its dedicated config and tests. Batch admission stays first. Completed, held and active ownership is answered through the durable fence; declined uploads use the shipped client cooldown response without creating a legacy job or consuming local audio.

Refreshed 2026-11-01 (planc, Plan C owner). The refreshed C6 head (which merges current origin/main) is merged into the original C9 ancestry with a merge commit; no rebase or force-push. Conflicts were resolved by keeping C9's removal of legacy admission. Main had kept extending code C9 deletes, so these main-only additions go with it:

  • the legacy staging dispatch-hold recheck (_stage_files_to_gcs_with_hold_recheck, its constants and four now-unused imports);

  • two unit tests for that hold (test_sync_dispatch_hold_*);

  • the legacy-pipeline usage-finalization e2e case in the deleted testing/e2e/test_sync_lifecycle.py;

  • main's edits to the legacy gauntlet scenarios C9 replaces with the retirement contract.

  • Main tests written against legacy admission were adapted to the retirement contract: test_sync_capture_time_skew.py route tests now assert batch admission through stubbed record/batch seams; test_batch_admission_language_router.py expects the retirement 409 in every mode (an on read still records the route owner, re-homed to batch on the next draining/dark upload). The unreachable archived-success legacy gauntlet scenario is removed (Luna r2 P1). Main's flag-budget ratchet (ADR 0006, seeded 10-25): the four SYNC_LEGACY_FRESH_* flags move to retired; budget lowered. feat: scope legacy sync retirement to the batch cohort #24219 rewrites the language-router test again; it is reconciled when C9 re-merges main.

Targeted tests on the refreshed head: 15 files through backend/test.sh with BACKEND_UNIT_TEST_FILE_LIST, omi-heavy, nice -n 19: 862 passed, 0 failed; every router-referencing unit file (34): 1,341 passed before the two adaptations above, which then pass (35 + 27); local Sync Cloud Tasks gauntlet --only all: passed. CI on the refreshed head is authoritative. Ordering: #24219 (per-cohort legacy switch) and #24222 (prod C3/C8 transport, cap-hold census) land first; C9 is re-merged with main after them.

Published m1 head: 46eb96bb3a07750a2c257b3b9ae543e9ad63f168. 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. C6 must be serving before this step. C3 queue routing, C8 provider-STT/recovery and ladder debit must be proved, including manual phone/Watch Process Now visibility through processing/reassessment. 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

  • Twelve focused FILE_LIST suites: 797 passed. Router AST differs from C6 only in v2 admission and the legacy_fresh import. Runtime config and feature registry regenerated from current sources.
  • Single Luna review exec-steak-galaxy-silent-journey-suffer-viable found one P1: the new retry code was not recognized by the shipped Flutter parser. Both retry arms now use sync_content_in_progress, null job ID and existing cooldown hints; 104 delta tests passed. Held/stranded jobs cannot leak into client polling.
  • The Watch legacy E2E now tests the retirement retry protocol. Its hermetic HTTP check passes on final C11. Batch recovery visibility and phone/Watch S1 overlap serving evidence remain separate mandatory gates.
  • The obsolete gauntlet family expected new legacy202 admission. It is replaced by a real signed-upload retirement contract (409/null-job/cooldown, zero legacy work and speech debit), with positive sanitized admission evidence. Targeted C9 and C11 emulator replays pass. Every batch scenario and its default work-stream/sentinel checks remain unchanged. No unchanged-job flake retry was used.
  • Final normal push: 42 preflight checks passed in198.87s, full backend typecheck, bounded selected units, runtime-image closure and all other required hooks passed. Log: c9-push-final.log.

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

  • INV-DATA-1: preserve audio custody, durable ownership and held-capture recovery; no data deletion.
  • INV-MEM-4: retain current transcript admission, assignment and projection behavior while retiring legacy scheduling/routing.

Failure-Class: none

Rollback requires the coordinated predecessor image and captured queue/scheduler specs; flags cannot restore deleted code.

🤖 Generated with Claude Code

Git-on-my-level and others added 28 commits October 19, 2026 16:41
…-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]>
… admission tests and legacy-fresh env removed

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
# Conflicts:
#	config/feature-flags.yaml
# Conflicts:
#	backend/tests/unit/test_sync_cloud_tasks.py
…lr/10-slice2b

# Conflicts:
#	config/feature-flags.yaml
…listed like test_sync_cloud_tasks

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	backend/tests/unit/test_legacy_dark.py
…oves to the C6 deletion PR (lead ruling (a))

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…v1 census by app_build, 12h soak and David's go

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lr/10-delete-c9

# Conflicts:
#	backend/routers/sync.py
#	backend/tests/unit/test_legacy_dark_router.py
#	backend/tests/unit/test_stt_cap_dispatch_http.py
# Conflicts:
#	backend/docs/feature-flag-registry.md
#	config/feature-flags.yaml
Base automatically changed from integration/legacy-retire to main October 21, 2026 23:50
Git-on-my-level and others added 10 commits October 23, 2026 13:56
Merge the original C6 draft with current main, retaining only the authenticated
410 retirement stub and removing v1-only tests. Preserve newer router changes.
Production release remains gated on p90 and the 12h legacy-dark evidence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve final-pass owner acknowledgement and the newer ramp/custody cases
while removing legacy admission and legacy_fresh configuration. Batch and
held-content paths retain ownership; declined uploads keep client audio.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Use the shipped sync_content_in_progress 409 code without an owner handle
for unaccepted and stranded/capped uploads. Keep Retry-After and polling hints
so released mobile clients enter their deferred retry path and retain audio.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the current CI download fix and inherited retirement review fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the legacy coordinator E2E dependency and check the existing client
cooldown response for a declined Watch upload. Batch recovery visibility and
phone/Watch overlap serving evidence remain explicit release gates.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the current CI download fix and inherited retirement review fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Remove the legacy coordinator E2E dependency and check the existing client
cooldown response for a declined Watch upload. Batch recovery visibility and
phone/Watch overlap serving evidence remain explicit release gates.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the current CI download fix and inherited retirement review fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the current CI download fix and inherited retirement review fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Generate the app-client contract from the real hermetic route exporter so its
description reflects batch admission and the durable legacy fence.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Project Status Preview Updated
omi 🟢 Ready View Preview Nov 1, 2026, 7:12 AM

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

Git-on-my-level and others added 6 commits October 23, 2026 15:58
Replace scenarios that begin with the deleted legacy admission behavior with
a real signed-upload retirement contract: retryable409, no job/task/provider
work and no speech debit. Require positive sanitized admission evidence while
keeping every batch scenario and its existing work-stream checks unchanged.

Legacy worker ownership and recovery unit contracts remain through retirement.

Failure-Class: none

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve the current CI download fix and inherited retirement review fixes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nt stack

Include reviewed main #23447 without rewriting the published draft history.
Preserve the deletion order and all production retirement gates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
Git-on-my-level and others added 5 commits November 1, 2026 14:26
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]>
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]>
…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]>
…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]>
@Git-on-my-level
Git-on-my-level marked this pull request as ready for review November 4, 2026 07:28

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

11 issues found across 42 files

Confidence score: 3/5

  • sync.py still exposes cooldown hints on declined uploads through Retry-After and poll_after_ms. Omit those fields while returning the compatibility code and job_id: null.
  • The retry-path tests don’t reliably enforce the C9 contract: test_batch_admission_language_router.py could pass with a legacy job_id, and test_stt_cap_dispatch_http.py bypasses admission with a pre-seeded ledger row. Assert the decoded response and exercise the actual upload path.
  • test_mobile_batch_archive.py no longer verifies that a successful upload preserves the archive. Keep the archive assertions so missing or corrupted raw bytes are still caught.
  • The dormant transition in FC-sync-fresh-proof-demotion.json is bundled with other artifact changes, contrary to the repository’s registry-only lifecycle rule. Move that transition to a separate registry-only change.
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="backend/tests/unit/test_batch_admission_language_router.py">

<violation number="1" location="backend/tests/unit/test_batch_admission_language_router.py:115">
P2: This assertion would pass even if the retired path returned a legacy owner `job_id`, so it does not enforce the C9 retry contract. Decode the JSON and assert `body.get('job_id') is None`.</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:106">
P2: This rewrite makes the HTTP test validate only `legacy_dark.fence_response`, not the C9 upload path: the pre-seeded ledger row bypasses admission and all relevant side effects. Keep a separate fence unit test if needed, but drive the real custody boundary here and assert no legacy work or speech debit plus the complete client response contract.</violation>
</file>

<file name="backend/testing/e2e/test_mobile_batch_archive.py">

<violation number="1" location="backend/testing/e2e/test_mobile_batch_archive.py:78">
P2: The successful branch no longer verifies the archive that this test is named for. Keep the archive assertions so the test still catches missing or corrupted raw bytes while validating the new 409/no-job behavior.</violation>
</file>

<file name="backend/routers/sync.py">

<violation number="1" location="backend/routers/sync.py:928">
P2: This declined-upload fallback still exposes cooldown hints through `Retry-After` and `poll_after_ms`. Return the compatibility code with `job_id: null` but omit those cooldown fields and headers.</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:5">
P3: `canonical_prevention` now names `test_legacy_dark.py` as the remaining fence, but `canonical_prevention_artifact` does not record that guard. Add `backend/tests/unit/test_legacy_dark.py` to the artifact list so the registry points to the contract test it claims answers this class.</violation>

<violation number="2" location=".github/failure-classes/FC-sync-fresh-proof-demotion.json:11">
P2: This `status: dormant` transition is bundled with the canonical-prevention and artifact rewrite, but the repository requires lifecycle transitions to be separate registry-only changes. Keep the artifact update with C9, then apply only `status`/`dormant_since` in a follow-up registry-only PR.

(Based on your team's feedback about separating dormant lifecycle transitions from prevention-artifact rewrites.)</violation>
</file>

<file name="backend/testing/sync_cloud_tasks_stack/run.py">

<violation number="1" location="backend/testing/sync_cloud_tasks_stack/run.py:624">
P2: The retirement scenario does not verify durable legacy-job state; it only verifies that instrumentation streams are empty. Also query the isolated job/ledger stores (and assert no created job or ownership row) so a legacy job created without an evidence event cannot make this gauntlet pass.</violation>
</file>

<file name="backend/config/flag_budget.json">

<violation number="1" location="backend/config/flag_budget.json:223">
P3: These flags are retired in the pipeline budget but not in the canonical feature-flag registry. Add matching `kind: env`, retirement date, and reason rows under `config/feature-flags.yaml`’s `retired:` section so the rendered registry preserves the retirement record and guardrails.</violation>
</file>

<file name="backend/tests/unit/test_sync_cloud_tasks.py">

<violation number="1" location="backend/tests/unit/test_sync_cloud_tasks.py:2968">
P2: This assertion cannot distinguish route-entry anchoring from granting a fresh budget inside `_run_sync_job_body`. Inject a delay in the preamble or control `monotonic()` and assert that the body receives the original deadline.</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 test never exercises the batch-decline path: `batch_enabled=False` prevents `accept_batch_upload` from running, leaving `decline_batch` dead and allowing regressions in declined batch handling to pass. Enable batch admission and assert the mocked batch handler was awaited before asserting the legacy-retirement response.</violation>
</file>

<file name="backend/tests/unit/test_sync_record_usage.py">

<violation number="1" location="backend/tests/unit/test_sync_record_usage.py:183">
P3: This deletion removes the only test for the v1 response’s `successor-version` link. Keep or adapt a 410 contract test that asserts both deprecation headers so clients retain migration discoverability.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

# C9 retired legacy admission: no mode creates a legacy job, and the client keeps its audio and retries.
# An `on` read still records the route owner (draining/dark re-homes it to batch on the next upload);
# the cohort-scoped exclusion bypass in draining/dark lands with #24219.
assert response.status_code == 409 and b'sync_content_in_progress' in response.body

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This assertion would pass even if the retired path returned a legacy owner job_id, so it does not enforce the C9 retry contract. Decode the JSON and assert body.get('job_id') is None.

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_batch_admission_language_router.py, line 115:

<comment>This assertion would pass even if the retired path returned a legacy owner `job_id`, so it does not enforce the C9 retry contract. Decode the JSON and assert `body.get('job_id') is None`.</comment>

<file context>
@@ -109,14 +109,15 @@ def authorize(store, work, snapshots):
+        # C9 retired legacy admission: no mode creates a legacy job, and the client keeps its audio and retries.
+        # An `on` read still records the route owner (draining/dark re-homes it to batch on the next upload);
+        # the cohort-scoped exclusion bypass in draining/dark lands with #24219.
+        assert response.status_code == 409 and b'sync_content_in_progress' in response.body
+        module.create_sync_job.assert_not_called()
         if mode is LegacySyncMode.ON:
</file context>
Suggested change
assert response.status_code == 409 and b'sync_content_in_progress' in response.body
assert response.status_code == 409 and b'sync_content_in_progress' in response.body and b'"job_id":' not in response.body

monkeypatch.setattr(
legacy_dark,
'read_ledger_row',
lambda uid, content_id: {'dispatch_protocol': 'stt_cap_hold_v1', 'status': 'held', 'result': held},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This rewrite makes the HTTP test validate only legacy_dark.fence_response, not the C9 upload path: the pre-seeded ledger row bypasses admission and all relevant side effects. Keep a separate fence unit test if needed, but drive the real custody boundary here and assert no legacy work or speech debit plus the complete client response contract.

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_stt_cap_dispatch_http.py, line 106:

<comment>This rewrite makes the HTTP test validate only `legacy_dark.fence_response`, not the C9 upload path: the pre-seeded ledger row bypasses admission and all relevant side effects. Keep a separate fence unit test if needed, but drive the real custody boundary here and assert no legacy work or speech debit plus the complete client response contract.</comment>

<file context>
@@ -176,57 +89,36 @@ def snapshot(*args, **kwargs):
+    monkeypatch.setattr(
+        legacy_dark,
+        'read_ledger_row',
+        lambda uid, content_id: {'dispatch_protocol': 'stt_cap_hold_v1', 'status': 'held', 'result': held},
+    )
+    decisions = []
</file context>

# the legacy-dark fence (409, audio kept on the client); no legacy job runs.
assert response.status_code == 409, response.text
assert response.json()['code'] == 'sync_content_in_progress'
assert not scheduled

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: The successful branch no longer verifies the archive that this test is named for. Keep the archive assertions so the test still catches missing or corrupted raw bytes while validating the new 409/no-job behavior.

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/testing/e2e/test_mobile_batch_archive.py, line 78:

<comment>The successful branch no longer verifies the archive that this test is named for. Keep the archive assertions so the test still catches missing or corrupted raw bytes while validating the new 409/no-job behavior.</comment>

<file context>
@@ -71,10 +71,11 @@ def unavailable(uid, paths):
+            # the legacy-dark fence (409, audio kept on the client); no legacy job runs.
+            assert response.status_code == 409, response.text
+            assert response.json()['code'] == 'sync_content_in_progress'
+            assert not scheduled
     finally:
         server.should_exit = True
</file context>

Comment thread backend/routers/sync.py
await run_blocking(sync_executor, shutil.rmtree, job_dir, True)
return (
legacy_dark.fence_response(decision, total_files=len(files), lane=lane_decision.lane.value)
or legacy_dark.admission_refused_response()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This declined-upload fallback still exposes cooldown hints through Retry-After and poll_after_ms. Return the compatibility code with job_id: null but omit those cooldown fields and headers.

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/routers/sync.py, line 928:

<comment>This declined-upload fallback still exposes cooldown hints through `Retry-After` and `poll_after_ms`. Return the compatibility code with `job_id: null` but omit those cooldown fields and headers.</comment>

<file context>
@@ -1388,534 +907,25 @@ async def sync_local_files_v2(
+        await run_blocking(sync_executor, shutil.rmtree, job_dir, True)
+        return (
+            legacy_dark.fence_response(decision, total_files=len(files), lane=lane_decision.lane.value)
+            or legacy_dark.admission_refused_response()
         )
     except HTTPException as error:
</file context>

"evidence_prs": [],
"scope_hints": ["backend/utils/sync/", "backend/routers/sync.py"],
"status": "open"
"status": "dormant",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This status: dormant transition is bundled with the canonical-prevention and artifact rewrite, but the repository requires lifecycle transitions to be separate registry-only changes. Keep the artifact update with C9, then apply only status/dormant_since in a follow-up registry-only PR.

(Based on your team's feedback about separating dormant lifecycle transitions from prevention-artifact rewrites.)

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>This `status: dormant` transition is bundled with the canonical-prevention and artifact rewrite, but the repository requires lifecycle transitions to be separate registry-only changes. Keep the artifact update with C9, then apply only `status`/`dormant_since` in a follow-up registry-only PR.

(Based on your team's feedback about separating dormant lifecycle transitions from prevention-artifact rewrites.) </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>

assert isinstance(anchor, float)
now = module.time.monotonic()
assert now < anchor
assert anchor <= now + module.SYNC_JOB_HANDLER_BUDGET_SECONDS + 5

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This assertion cannot distinguish route-entry anchoring from granting a fresh budget inside _run_sync_job_body. Inject a delay in the preamble or control monotonic() and assert that the body receives the original deadline.

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.py, line 2968:

<comment>This assertion cannot distinguish route-entry anchoring from granting a fresh budget inside `_run_sync_job_body`. Inject a delay in the preamble or control `monotonic()` and assert that the body receives the original deadline.</comment>

<file context>
@@ -2963,756 +2925,47 @@ async def test_sync_dispatch_carries_private_recording_location_into_cloud_task(
+        assert isinstance(anchor, float)
+        now = module.time.monotonic()
+        assert now < anchor
+        assert anchor <= now + module.SYNC_JOB_HANDLER_BUDGET_SECONDS + 5
     finally:
         sys.modules.pop('routers.sync', None)
</file context>

return row, created, segments

monkeypatch.setattr(lifecycle, 'ingest_sync_conversation', retain_discarded_speech)
monkeypatch.setattr(sync_router, 'resolve_batch_policy', lambda uid: BatchUnitPolicy(batch_enabled=False))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: This test never exercises the batch-decline path: batch_enabled=False prevents accept_batch_upload from running, leaving decline_batch dead and allowing regressions in declined batch handling to pass. Enable batch admission and assert the mocked batch handler was awaited before asserting the legacy-retirement response.

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/testing/e2e/test_watch_recovery_process_now.py, line 18:

<comment>This test never exercises the batch-decline path: `batch_enabled=False` prevents `accept_batch_upload` from running, leaving `decline_batch` dead and allowing regressions in declined batch handling to pass. Enable batch admission and assert the mocked batch handler was awaited before asserting the legacy-retirement response.</comment>

<file context>
@@ -1,48 +1,38 @@
-        return row, created, segments
-
-    monkeypatch.setattr(lifecycle, 'ingest_sync_conversation', retain_discarded_speech)
+    monkeypatch.setattr(sync_router, 'resolve_batch_policy', lambda uid: BatchUnitPolicy(batch_enabled=False))
+    monkeypatch.setattr(sync_router.legacy_dark, 'read_ledger_row', lambda uid, content_id: None)
+    monkeypatch.setattr(sync_router, 'get_hard_restriction_status', lambda uid: (False, None))
</file context>
Suggested change
monkeypatch.setattr(sync_router, 'resolve_batch_policy', lambda uid: BatchUnitPolicy(batch_enabled=False))
monkeypatch.setattr(sync_router, 'resolve_batch_policy', lambda uid: BatchUnitPolicy(batch_enabled=True))

Comment on lines +5 to 8
"canonical_prevention": "Keep provenance classification distinct from recency. Promote recent LEGACY uploads only behind an explicit flag and an atomic per-user upload-count and byte budget. Demote budget exhaustion and store failure to isolated backfill, preserving invalid, future and lookback handling and persisted worker lane. Dormant since legacy-retire C9 (lr/10-delete-c9) deleted the legacy path this class guarded; the legacy-dark fence (test_legacy_dark.py) answers its remaining traffic.",
"canonical_prevention_artifact": [
"backend/tests/unit/test_sync_legacy_fresh.py",
"backend/tests/unit/test_sync_cloud_tasks.py"
],

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: canonical_prevention now names test_legacy_dark.py as the remaining fence, but canonical_prevention_artifact does not record that guard. Add backend/tests/unit/test_legacy_dark.py to the artifact list so the registry points to the contract test it claims answers this class.

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 5:

<comment>`canonical_prevention` now names `test_legacy_dark.py` as the remaining fence, but `canonical_prevention_artifact` does not record that guard. Add `backend/tests/unit/test_legacy_dark.py` to the artifact list so the registry points to the contract test it claims answers this class.</comment>

<file context>
@@ -2,12 +2,12 @@
   "id": "FC-sync-fresh-proof-demotion",
   "violated_contract": "Recent offline recordings from released clients without server capture proof must have a bounded path to fresh processing rather than joining the entire historical recovery backlog. Client timestamps must never authorize unbounded fresh capacity.",
-  "canonical_prevention": "Keep provenance classification distinct from recency. Promote recent LEGACY uploads only behind an explicit flag and an atomic per-user upload-count and byte budget. Demote budget exhaustion and store failure to isolated backfill, preserving invalid, future and lookback handling and persisted worker lane.",
+  "canonical_prevention": "Keep provenance classification distinct from recency. Promote recent LEGACY uploads only behind an explicit flag and an atomic per-user upload-count and byte budget. Demote budget exhaustion and store failure to isolated backfill, preserving invalid, future and lookback handling and persisted worker lane. Dormant since legacy-retire C9 (lr/10-delete-c9) deleted the legacy path this class guarded; the legacy-dark fence (test_legacy_dark.py) answers its remaining traffic.",
   "canonical_prevention_artifact": [
-    "backend/tests/unit/test_sync_legacy_fresh.py",
</file context>
Suggested change
"canonical_prevention": "Keep provenance classification distinct from recency. Promote recent LEGACY uploads only behind an explicit flag and an atomic per-user upload-count and byte budget. Demote budget exhaustion and store failure to isolated backfill, preserving invalid, future and lookback handling and persisted worker lane. Dormant since legacy-retire C9 (lr/10-delete-c9) deleted the legacy path this class guarded; the legacy-dark fence (test_legacy_dark.py) answers its remaining traffic.",
"canonical_prevention_artifact": [
"backend/tests/unit/test_sync_legacy_fresh.py",
"backend/tests/unit/test_sync_cloud_tasks.py"
],
"canonical_prevention": "Keep provenance classification distinct from recency. Promote recent LEGACY uploads only behind an explicit flag and an atomic per-user upload-count and byte budget. Demote budget exhaustion and store failure to isolated backfill, preserving invalid, future and lookback handling and persisted worker lane. Dormant since legacy-retire C9 (lr/10-delete-c9) deleted the legacy path this class guarded; the legacy-dark fence (test_legacy_dark.py) answers its remaining traffic.",
"canonical_prevention_artifact": [
"backend/tests/unit/test_legacy_dark.py",
"backend/tests/unit/test_sync_cloud_tasks.py"
],

"on": "2026-10-26",
"replaced_by": null
},
"SYNC_LEGACY_FRESH_BURST_TOKENS": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: These flags are retired in the pipeline budget but not in the canonical feature-flag registry. Add matching kind: env, retirement date, and reason rows under config/feature-flags.yaml’s retired: section so the rendered registry preserves the retirement record and guardrails.

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/config/flag_budget.json, line 223:

<comment>These flags are retired in the pipeline budget but not in the canonical feature-flag registry. Add matching `kind: env`, retirement date, and reason rows under `config/feature-flags.yaml`’s `retired:` section so the rendered registry preserves the retirement record and guardrails.</comment>

<file context>
@@ -223,6 +219,22 @@
       "on": "2026-10-26",
       "replaced_by": null
+    },
+    "SYNC_LEGACY_FRESH_BURST_TOKENS": {
+      "on": "2026-11-01",
+      "replaced_by": null
</file context>

# ---------------------------------------------------------------------------


class TestV1Deprecation:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This deletion removes the only test for the v1 response’s successor-version link. Keep or adapt a 410 contract test that asserts both deprecation headers so clients retain migration discoverability.

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_record_usage.py, line 183:

<comment>This deletion removes the only test for the v1 response’s `successor-version` link. Keep or adapt a 410 contract test that asserts both deprecation headers so clients retain migration discoverability.</comment>

<file context>
@@ -83,55 +83,6 @@ def test_import_at_module_level(self):
 # ---------------------------------------------------------------------------
 
 
-class TestV1RecordUsage:
-    @staticmethod
-    def _get_v1_body():
-        return _extract_function_body(_read_sync_source(), 'sync_local_files')
-
-    def test_record_usage_called_in_v1(self):
</file context>

@Git-on-my-level

Copy link
Copy Markdown
Member Author

When this PR returns to the merge queue, please update its branch against current main and let backend CI run on the refreshed PR. Link the fresh test_pipeline_env_surface_holds_its_budget pass and the tested head or merge SHA in the merge handoff. The November 30 budget audit found overdue entries in this PR’s older GitHub merge ref, so the previous CI run does not establish coverage for the refreshed base.

Quality tracking and merge-ref audit

This branch was successfully deployed

1 active (outdated) deployment
staging - docs — 8215b6ce Deployed Nov 1, 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