Skip to content

refactor(mobile): group native chat send and stream state - #33640

Merged
nwparker merged 2 commits into
mainfrom
nwparker/refactor-mobile-chat-send-state
Oct 25, 2026
Merged

nwparker merged 2 commits into
mainfrom
nwparker/refactor-mobile-chat-send-state

Conversation

@nwparker

@nwparker nwparker commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Groups 16 native chat send and terminal-stream modules and 15 existing tests under mobile/src/session/native-chat/. Updates direct callers, mocks, runtime source readers, and reliability metadata, removes an unused forwarding type export, and uses concrete module namespaces in three fixtures.

Validation: 907 passing cases on both current main and its integration with this PR, with exact case and outcome parity (78 complete suites plus three filtered RPC suites). All desktop and mobile typechecks, changed-code quality, React Doctor, formatting, normal commit hooks, and the refactor-audit merge gate pass. Two independent native source audits approved the final head; all 43 CI contexts and the required aggregate pass.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fabfff8b-4e88-4d2f-b609-96a6e748578b
Commits

Reviewing files that changed from the base of the PR and between fc6711d and 7521d1e.

Files selected for processing: 3
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/test-support/rpc-recording/adapters/diff-review-action-mount-adapters.ts
  • mobile/src/test-support/rpc-recording/adapters/native-chat-write-mount-adapters.ts
Files skipped from review as they are similar to previous changes: 2
  • mobile/src/test-support/rpc-recording/adapters/diff-review-action-mount-adapters.ts
  • mobile/src/test-support/rpc-recording/adapters/native-chat-write-mount-adapters.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

Walkthrough

Mobile native-chat imports and relative paths now point to modules under the native-chat subdirectory. Related test mocks, reliability-gate entries, RPC pilot scenarios, and test-support adapters use the updated paths. The NativeChatSendClassification type re-export was removed. The summaries report no other runtime logic or test expectation changes.

Priority: Low

Merge Risk: Minimal · up to 7521d

The reviewed relocation changes do not leave an actionable merge-blocking issue in the supplied scope.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 14 functions across 53 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check Warning The description summarizes the refactor and validation results, but it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof or N/A, Testing checklist details, AI Disc… Update the PR description to include all required template headings. Add the linked issue, state N/A with a reason for Visual Proof if there is no UI or interaction change, document testing platforms and checklist status, complete the AI …
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title "refactor(mobile): group native chat send and stream state" names the main change: the native chat send and terminal-stream modules and their tests are moved into mobile/src/session/native-c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "refactor(mobile): group native chat send and stream state" names the main change: the native chat send and terminal-stream modules and their tests are moved into mobile/src/session/native-chat/. The title describes grouping the state, while the summary shows a directory relocation with import updates. The title is partly accurate and specific, and it follows the conventional commit style. It does not name the relocation, but it is related to the main change, so the check passes.

Full details: Description check

Explanation

The description summarizes the refactor and validation results, but it omits most required template sections, including ELI5, Why, Linked Issue, Visual Proof or N/A, Testing checklist details, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist.

Resolution

Update the PR description to include all required template headings. Add the linked issue, state N/A with a reason for Visual Proof if there is no UI or interaction change, document testing platforms and checklist status, complete the AI Disclosure section when applicable, address review and compatibility notes, and complete the required checklist items.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


Review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8da18922-92b1-467d-8138-29dc8ff6ce64
Commits

Reviewing files that changed from the base of the PR and between 65e513b and fc6711d.

Files selected for processing: 98
  • config/flaky-test-pattern-baseline.txt
  • config/reliability-gates.jsonc
  • mobile/rpc-foundation/pilot-scenarios.json
  • mobile/src/session/MobileNativeChatOverlay.tsx
  • mobile/src/session/MobileNativeChatView.tsx
  • mobile/src/session/MobileSessionActiveContent.tsx
  • mobile/src/session/__mocks__/mobile-prompt-controller.ts
  • mobile/src/session/mobile-dictation-agent-chat-start.test.tsx
  • mobile/src/session/mobile-dictation-mode-refresh.test.tsx
  • mobile/src/session/mobile-dictation-refused-start-routing.test.tsx
  • mobile/src/session/mobile-native-chat-composer-menu.ts
  • mobile/src/session/mobile-native-chat-controller-contract.ts
  • mobile/src/session/mobile-native-chat-pair-window.test.ts
  • mobile/src/session/mobile-native-chat-pending-baseline.test.ts
  • mobile/src/session/mobile-native-chat-pending-baseline.ts
  • mobile/src/session/mobile-native-chat-permission-send.test.ts
  • mobile/src/session/mobile-native-chat-permission-send.ts
  • mobile/src/session/mobile-native-chat-toggle-action.ts
  • mobile/src/session/mobile-session-route-types.ts
  • mobile/src/session/mobile-structured-agent-session-contract.ts
  • mobile/src/session/mobile-structured-agent-session-rpc.ts
  • mobile/src/session/mobile-structured-agent-session-send.ts
  • mobile/src/session/mobile-structured-composer-command.ts
  • mobile/src/session/mobile-structured-send-delivery.ts
  • mobile/src/session/mobile-terminal-action-sheet-actions.ts
  • mobile/src/session/mobile-worker-takeover-send-sites.test.ts
  • mobile/src/session/native-chat/composer/mobile-native-chat-image-send.ts
  • mobile/src/session/native-chat/composer/use-mobile-native-chat-image-attachments.test.ts
  • mobile/src/session/native-chat/composer/use-mobile-native-chat-image-attachments.ts
  • mobile/src/session/native-chat/mobile-native-chat-eligibility.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-eligibility.ts
  • mobile/src/session/native-chat/mobile-native-chat-pending-echo.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-pending-echo.ts
  • mobile/src/session/native-chat/mobile-native-chat-pending-pasted-content.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-pending-retirement.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-pending-retirement.ts
  • mobile/src/session/native-chat/mobile-native-chat-scope-key.ts
  • mobile/src/session/native-chat/mobile-native-chat-send-classification.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-send-classification.ts
  • mobile/src/session/native-chat/mobile-native-chat-send.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-send.ts
  • mobile/src/session/native-chat/mobile-native-chat-stale-input.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-stale-input.ts
  • mobile/src/session/native-chat/mobile-native-chat-stream-frame.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-stream-frame.ts
  • mobile/src/session/native-chat/mobile-native-chat-streaming-gate.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-streaming-gate.ts
  • mobile/src/session/native-chat/mobile-native-chat-terminal-stream.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-terminal-stream.ts
  • mobile/src/session/native-chat/mobile-native-chat-terminal-write-lock.test.ts
  • mobile/src/session/native-chat/mobile-native-chat-terminal-write-lock.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-input-lease.test.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-input-lease.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-send-error.test.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-send-error.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-session-stream-end.test.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-streaming-bubble.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-terminal-stream.test.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-terminal-stream.ts
  • mobile/src/session/native-chat/use-mobile-native-chat-unconfirmed-sends.ts
  • mobile/src/session/use-mobile-diff-review-send-actions.test.ts
  • mobile/src/session/use-mobile-diff-review-send-actions.ts
  • mobile/src/session/use-mobile-native-chat-active-resolution.ts
  • mobile/src/session/use-mobile-native-chat-answer-send-omp.test.ts
  • mobile/src/session/use-mobile-native-chat-answer-send.test.ts
  • mobile/src/session/use-mobile-native-chat-answer-send.ts
  • mobile/src/session/use-mobile-native-chat-cancel-ask.ts
  • mobile/src/session/use-mobile-native-chat-controller.test.ts
  • mobile/src/session/use-mobile-native-chat-controller.ts
  • mobile/src/session/use-mobile-native-chat-drafts.ts
  • mobile/src/session/use-mobile-native-chat-message-send-draft-lifetime.test.ts
  • mobile/src/session/use-mobile-native-chat-message-send.test.ts
  • mobile/src/session/use-mobile-native-chat-message-send.ts
  • mobile/src/session/use-mobile-native-chat-readability.ts
  • mobile/src/session/use-mobile-native-chat-session-lane.ts
  • mobile/src/session/use-mobile-native-chat-session-option-controller.ts
  • mobile/src/session/use-mobile-native-chat-session-options.test.ts
  • mobile/src/session/use-mobile-native-chat-session-options.ts
  • mobile/src/session/use-mobile-native-chat-session.ts
  • mobile/src/session/use-mobile-native-chat-stop.test.ts
  • mobile/src/session/use-mobile-native-chat-stop.ts
  • mobile/src/session/use-mobile-session-attachments.ts
  • mobile/src/session/use-mobile-session-file-actions.ts
  • mobile/src/session/use-mobile-session-image-attachments.test.tsx
  • mobile/src/session/use-mobile-session-image-attachments.ts
  • mobile/src/session/use-mobile-session-native-chat-dictation.ts
  • mobile/src/session/use-mobile-session-tab-application.ts
  • mobile/src/session/use-mobile-session-terminal-stream-display.ts
  • mobile/src/session/use-mobile-session-terminal-subscription.ts
  • mobile/src/session/use-mobile-structured-agent-session-send.test.tsx
  • mobile/src/session/use-mobile-structured-agent-session.test.tsx
  • mobile/src/session/use-mobile-structured-native-chat-send-bridge.test.ts
  • mobile/src/session/use-mobile-structured-native-chat-send-bridge.ts
  • mobile/src/session/use-mobile-structured-send-with-outcome.ts
  • mobile/src/session/use-mobile-structured-sends.ts
  • mobile/src/test-support/rpc-recording/adapters/diff-review-action-mount-adapters.ts
  • mobile/src/test-support/rpc-recording/adapters/native-chat-write-mount-adapters.ts
  • tests/e2e/nested-agent-idle-session-owner.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

vi.mock('./mobile-native-chat-send', async (importOriginal) => ({
...(await importOriginal<typeof import('./mobile-native-chat-send')>()),
vi.mock('./native-chat/mobile-native-chat-send', async (importOriginal) => ({
...(await importOriginal<typeof import('./native-chat/mobile-native-chat-send')>()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Major · Maintainability & Code Quality · Quick win

Replace the forbidden import() type annotation.

The React Doctor changed-lines gate rejects the type annotation on Line 148. This blocks the static-analysis and typecheck workflow. Use a type-only namespace import for the module type.

Proposed fix
--- "a/mobile/src/session/use-mobile-native-chat-controller.test.ts"
+++ "b/mobile/src/session/use-mobile-native-chat-controller.test.ts"
@@ -144,8 +144,10 @@
   useMobileNativeChatFileSearch: () => ({ nativeChatFilePaths: [], loadNativeChatFiles: vi.fn() })
 }))
 // Keep the real timeout constant available to stale-input heal through the partial send mock.
+import type * as NativeChatSendModule from './native-chat/mobile-native-chat-send'
+
 vi.mock('./native-chat/mobile-native-chat-send', async (importOriginal) => ({
-  ...(await importOriginal<typeof import('./native-chat/mobile-native-chat-send')>()),
+  ...(await importOriginal<typeof NativeChatSendModule>()),
   sendMobileNativeChatMessageWithOutcome: vi.fn()
 }))
 
🧰 Tools
🪛 GitHub Actions: PR 33640 | source 5278961fc310b0dfb4b520e954f4d02f804ef818 | workflow 5278961fc310b0dfb4b520e954f4d02f804ef818 | unit full / 17_static analysis and typecheck.txt

[error] 148-148: React Doctor changed-lines gate failed: typescript/consistent-type-imports — import() type annotations are forbidden. Command: node config/scripts/check-react-doctor-changed.mjs "65e513b193261f8b71a4e1b34c538bfa7f1d0c81".

🪛 GitHub Actions: PR 33640 | source 5278961fc310b0dfb4b520e954f4d02f804ef818 | workflow 5278961fc310b0dfb4b520e954f4d02f804ef818 | unit full / static analysis and typecheck

[error] 148-148: React Doctor changed-lines gate: typescript/consistent-type-imports forbids import() type annotations. Command: node config/scripts/check-react-doctor-changed.mjs "65e513b193261f8b71a4e1b34c538bfa7f1d0c81".

Source: Pipeline failures

const staleInput = modules.load<
typeof import('../../../session/mobile-native-chat-stale-input')
>('mobile/src/session/mobile-native-chat-stale-input.ts')
typeof import('../../../session/native-chat/mobile-native-chat-stale-input')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Major · Maintainability & Code Quality · Quick win

Replace the forbidden import() type annotation.

The changed typeof import(...) annotation fails the React Doctor typescript/consistent-type-imports gate. This blocks the static-analysis workflow.

Use a type-only module import. Apply the same correction to mobile/src/test-support/rpc-recording/adapters/native-chat-write-mount-adapters.ts Line 15.

Use a type-only module import
--- "a/mobile/src/test-support/rpc-recording/adapters/diff-review-action-mount-adapters.ts"
+++ "b/mobile/src/test-support/rpc-recording/adapters/diff-review-action-mount-adapters.ts"
@@ -26,9 +26,11 @@
       const reviewSheets = modules.load<
         typeof import('../../../session/mobile-diff-review-sheets')
       >('mobile/src/session/mobile-diff-review-sheets.ts')
+import type * as MobileNativeChatStaleInput from '../../../session/native-chat/mobile-native-chat-stale-input'
+
-      const staleInput = modules.load<
-        typeof import('../../../session/native-chat/mobile-native-chat-stale-input')
-      >('mobile/src/session/native-chat/mobile-native-chat-stale-input.ts')
+      const staleInput = modules.load<typeof MobileNativeChatStaleInput>(
+        'mobile/src/session/native-chat/mobile-native-chat-stale-input.ts'
+      )
       staleInput.resetMobileNativeChatStaleInputForTests()
       const comment: DiffComment = {
         side: 'modified',
🧰 Tools
🪛 GitHub Actions: PR 33640 | source 5278961fc310b0dfb4b520e954f4d02f804ef818 | workflow 5278961fc310b0dfb4b520e954f4d02f804ef818 | unit full / 17_static analysis and typecheck.txt

[error] 30-30: React Doctor changed-lines gate failed: typescript/consistent-type-imports — import() type annotations are forbidden. Command: node config/scripts/check-react-doctor-changed.mjs "65e513b193261f8b71a4e1b34c538bfa7f1d0c81".

🪛 GitHub Actions: PR 33640 | source 5278961fc310b0dfb4b520e954f4d02f804ef818 | workflow 5278961fc310b0dfb4b520e954f4d02f804ef818 | unit full / static analysis and typecheck

[error] 30-30: React Doctor changed-lines gate: typescript/consistent-type-imports forbids import() type annotations. Command: node config/scripts/check-react-doctor-changed.mjs "65e513b193261f8b71a4e1b34c538bfa7f1d0c81".

Source: Pipeline failures

@nwparker
nwparker merged commit 47d1b31 into main Oct 25, 2026
43 checks passed
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