Repository navigation
refactor: split oversized product source files - #9853
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
Monitor follow-up complete. Changed:
Verification passed:
|
|
@cursor sync main |
|
Synced What landed from main (9 commits), including:
Conflicts resolved:
Key ports from main into split modules:
|
Sync main PTT handoff fixes (#9825) into the split RealtimeHubController modules. Resolved conflicts in RealtimeHubController.swift and the product line-count ratchet baseline while preserving the file-split ownership seams. Co-authored-by: David Zhang <[email protected]>
|
@cursor address CI failure and merge conflicts |
|
Addressed the CI failures and merge conflicts. Pushed CI failures fixed
Merge conflicts resolved (latest
|
Resolve merge conflicts and fix CI regressions from the main sync: - Drop duplicate RealtimeHub policy types from ControllerSupport (live in SessionPolicies) to fix Swift compile errors. - Keep split APIClient.swift transport boundary; feature APIs stay in APIClient+*.swift extensions. - Extract voice-output helpers into RealtimeHubController+VoiceOutput.swift so SessionLifecycle stays under the 1,500-line product ratchet. - Merge pr_preflight imports and retain the 1,500-line APIClient inventory cap. Co-authored-by: David Zhang <[email protected]>
Restore the pre-warm screen-evidence capture and terminal completion policy lost when RealtimeHubController was split. Source-inspection coverage now reads the owning PushToTalk extension directly. Verification: xcrun swift test -c debug --package-path Desktop --filter RealtimeHubBargeInContinuityTests; ./scripts/swift-test-suites.sh; all desktop/macos/tests/test-*.sh; make preflight.
|
@cursor address merge conflicts |
|
Resolved merge conflicts and synced with latest Conflicts resolved
Also mergedRemote branch updates ( Verification
CI should re-run on the push. |
Resolve merge conflicts after syncing latest main: - Keep split RealtimeHubController modules; reject monolithic re-inline. - Update product line-count baseline: sync.py at 1981, omit split transcribe.py and RealtimeHubController.swift entries. - Port PTT agent routing (#9859) into split modules: preserve native provider continuation on spawn receipts, drop spawn acknowledgement playback, and simplify output presentation policy calls. Co-authored-by: David Zhang <[email protected]>
Co-authored-by: David Zhang <[email protected]>
Document the provider, gateway, feature-coordinator, and persistence boundaries required by the package architecture-map ratchet. Verification: python3 .github/scripts/test_check_package_architecture_maps.py; python3 .github/scripts/check_package_architecture_maps.py --base origin/main; make preflight.
## Summary - Replace the shared product-file line-count baseline with 15 deterministic, ownership-scoped JSON shards. - Keep file caps and `raise_justifications` together in the same shard, with no mutable global index/manifest. - Preserve mandatory same-PR downward ratcheting; a post-merge writer is deliberately **not** made authoritative. - Load the legacy monolithic baseline at historical refs so this migration preserves raise/removal validation for branches spanning the transition. ## Why The monolithic baseline received 35 commits in roughly 46 hours and became a conflict hotspot for unrelated backend, Rust, and macOS work. PR #9853 had to reconcile it repeatedly while rebasing. The new `baseline_shard_relative()` uses only stable source-path ownership rules: - `backend/{database,routers,utils,other}` - `desktop-rust` - immediate `Desktop/Sources/<subsystem>` Swift shards, plus a `root` shard This avoids replacing the hotspot with a central registry. The checker aggregates shards in memory and rejects duplicate, misplaced, unsupported, or orphaned entries. ## Sol critique incorporated - Keep same-PR downward updates: a nonblocking post-merge bot would permit a source to regrow against its stale higher cap before the bot writes the reduction. - Rewrite only the shard(s) owning changed source paths. - Keep each justification beside its cap and validate global aggregation. - Support legacy-at-base and sharded-at-head transition validation. ## Verification - `python3 -m py_compile .github/scripts/check_product_file_line_count_ratchet.py .github/scripts/test_check_product_file_line_count_ratchet.py` - `python3 .github/scripts/test_check_product_file_line_count_ratchet.py` — 8 passed - `python3 .github/scripts/test_run_checks.py` — 20 passed - `python3 .github/scripts/check_product_file_line_count_ratchet.py --changed-files /tmp/omi-ratchet-changed-files.txt --base origin/main` - confirmed the 44 file caps and 31 justifications match the legacy baseline exactly across 15 shards Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/9942?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
… session starts (#11505) # fix(listen): send the first onboarding question when a speech-profile session starts ## Problem The speech profile page (onboarding and Settings > Profile > Speech Profile) shows no question and its progress bar never moves. Audio still streams and a conversation/recording appears later, so the session looks half-alive. The question flow is server-driven: the client renders whatever `onboarding_question` event the backend pushes, and computes progress as `question_index / total_questions`. PR #9853 split `transcribe.py` into `routers/listen/`, and the split dropped the one-shot kickoff `spawn(onboarding_handler.send_current_question(), ...)` that existed since the flow shipped (#3859). `ListenSessionRuntime._bootstrap` still constructs the `OnboardingHandler`, but nothing ever sends question 0 — `OnboardingHandler.send_current_question` is only reachable after an answer or a skip, which can never happen before the first question exists. The client waits forever on an empty screen at 0%. ## Fix Restore the kickoff at handler creation in `_bootstrap`, spawned through the session task supervisor (same placement and semantics as the pre-refactor code). ## Regression test `test_bootstrap_sends_first_onboarding_question_before_any_audio` runs the real `_bootstrap` with a real `OnboardingHandler` and a recording websocket, and asserts that — with no segments having arrived — the client receives exactly one `onboarding_question` event (question 0 of `len(ONBOARDING_QUESTIONS)`) and the question transcript segment is enqueued with the Omi speaker id. This test fails on `main` today and would have caught the drop in #9853. The existing `_bootstrap` onboarding test's stub handler grew a `send_current_question` coroutine and a real task supervisor, since the production path now calls it. ## Failure class Failure-Class: none No existing class matches "one-shot side effect dropped while splitting a module"; this is the first known instance of that cause in this subsystem, so it lands as an instance fix plus the behavioral guard test above. ## Verification - `BACKEND_UNIT_TEST_FILE_LIST=/tmp/omi-target.txt bash test.sh` (file = `tests/unit/test_listen_runtime_regressions.py`): **20 passed** (includes the new test and the two updated bootstrap tests). - Full unit-suite run surfaced 7 unrelated files exiting status 1 with **all assertions passing** (e.g. "13 passed" + status 1) — the fast-unit CPU duration guard tripping under heavy parallel load on my machine; those files pass when run normally and none touch the listen runtime. - Not exercised against a live device end-to-end: the fix is backend-only and the affected path needs a prod-like STT session; the regression test drives the real `_bootstrap` + `OnboardingHandler` wiring. ## Product invariants affected none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/11505?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
… session starts PR BasedHardware#9853's split of transcribe.py into routers/listen/ dropped the spawn(onboarding_handler.send_current_question()) kickoff, so onboarding-mode sessions never received the first onboarding_question event: the speech profile page showed no question and its progress bar stayed at 0% forever. Restore the kickoff at handler creation in ListenSessionRuntime._bootstrap and add the regression test that would have caught the drop. Failure-Class: none
## Summary - Replace the shared product-file line-count baseline with 15 deterministic, ownership-scoped JSON shards. - Keep file caps and `raise_justifications` together in the same shard, with no mutable global index/manifest. - Preserve mandatory same-PR downward ratcheting; a post-merge writer is deliberately **not** made authoritative. - Load the legacy monolithic baseline at historical refs so this migration preserves raise/removal validation for branches spanning the transition. ## Why The monolithic baseline received 35 commits in roughly 46 hours and became a conflict hotspot for unrelated backend, Rust, and macOS work. PR BasedHardware#9853 had to reconcile it repeatedly while rebasing. The new `baseline_shard_relative()` uses only stable source-path ownership rules: - `backend/{database,routers,utils,other}` - `desktop-rust` - immediate `Desktop/Sources/<subsystem>` Swift shards, plus a `root` shard This avoids replacing the hotspot with a central registry. The checker aggregates shards in memory and rejects duplicate, misplaced, unsupported, or orphaned entries. ## Sol critique incorporated - Keep same-PR downward updates: a nonblocking post-merge bot would permit a source to regrow against its stale higher cap before the bot writes the reduction. - Rewrite only the shard(s) owning changed source paths. - Keep each justification beside its cap and validate global aggregation. - Support legacy-at-base and sharded-at-head transition validation. ## Verification - `python3 -m py_compile .github/scripts/check_product_file_line_count_ratchet.py .github/scripts/test_check_product_file_line_count_ratchet.py` - `python3 .github/scripts/test_check_product_file_line_count_ratchet.py` — 8 passed - `python3 .github/scripts/test_run_checks.py` — 20 passed - `python3 .github/scripts/check_product_file_line_count_ratchet.py --changed-files /tmp/omi-ratchet-changed-files.txt --base origin/main` - confirmed the 44 file caps and 31 justifications match the legacy baseline exactly across 15 shards Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/9942?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->


Fixes #9838
Summary
Root cause and guard
The oversized modules combined unrelated state transitions and transport concerns, making their contracts hard to exercise after extraction. The new modules keep one authoritative owner per boundary and the tests execute those boundaries through controllable fakes. The line-count ratchet now removes all four old baseline entries and also validates deleted source paths.
Verification
backend/test.shbackend/scripts/typecheck.sh(0 errors)backend/testing/e2e/run.sh -k listen_sttdesktop/macos/scripts/agent-logic-harness.shxcrun swift build -c debug --package-path Desktopxcrun swift test --package-path Desktop --filter 'APIClient|RealtimeHubResumeOnceGateTests'cargo test(367 passed)make preflightThe named desktop QA bundle compiled but was not launched: this machine has no signing identity, and ad-hoc signing would reset Screen Recording permissions for the production/beta Omi apps.
Product invariants affected
Failure-Class: none