orca/mobile/scripts
hanjoonchoe f4e46383df
feat(mobile): add session.tabs.list handler to mock server (#9293)
* feat(mobile): add session.tabs.list handler to mock server

The mock WebSocket server had no handler for session.tabs.list, so the
session screen of a paired dev client hung on 'Loading tabs' forever —
the terminal pane, live input, and command input could never be
exercised against the mock. Respond with a single ready terminal tab
wired to the existing term-1 fixture so the whole session surface works
offline.

* fix(mobile): complete the session.tabs.list mock contract

The new mock response omitted four non-optional fields of
RuntimeMobileSessionTabsResult: publicationEpoch and activeGroupId on the
result, and parentTabId and leafId on the terminal tab. Nothing caught it —
the object literal had no type annotation, and MobileSessionTabsStreamHealth
is generic over both result and tab. A shape-incomplete mock yields
untrustworthy repros for exactly the bugs it gets used for (session tabs,
split panes, pane-to-tab attribution).

Fill the fields with host-realistic values: a per-process publisher epoch, a
layout UUID leaf id, and the `${parentTabId}::${leafId}` surface id
mobileTerminalSurfaceId actually emits. Pin the shape with an explicit return
type so a future required field fails typecheck instead of silently drifting.

Move the fixture into its own module: inlining it pushed
mock-server-rpc-handlers.ts to 317 lines against a 300-line max-lines cap,
which broke `pnpm lint` on the parent commit. It registers through the file's
existing delegation chain, after the native-chat scenario so MOCK_NATIVE_CHAT=1
keeps ownership of the method.

Co-authored-by: Hanjoon Choe <hanjoonchoe@gmail.com>

* test(mobile): pin session tabs mock fidelity

Normalize the selector-backed worktree ID like the real runtime and cover the complete terminal surface response so future contract drift fails the mobile suite.

* fix(mobile): share terminal.list worktree resolution with session tabs

Main added `terminalListWorktreeId`, which the rebased session-tabs fixture
duplicated with a different no-selector fallback — `terminal.list` resolved to
the active fake worktree while `session.tabs.list` returned a literal 'mock',
so a session repro saw two different worktree ids for one screen.

* test(mobile): cover the bare session-tabs worktree selector

Answers the review note that only the `id:`-prefixed path was exercised.

* fix(mobile): make the mock publication epoch unique per process

Date.now() can repeat across a sub-millisecond restart, so the epoch did not
actually guarantee the fresh-publisher identity its comment claimed.

---------

Co-authored-by: Brennan Benson <79079362+brennanb2025@users.noreply.github.com>
2026-07-29 18:01:38 -07:00
..
build-terminal-webview-engine.mjs Fix blank mobile terminal on Android devices with outdated WebViews or blocked CDN (#7186) 2026-07-03 15:22:00 -07:00
mobile-expo-cli.mjs refs/heads/handle-mobile-pull-request-issues (#6598) 2026-06-28 00:58:17 -07:00
mobile-lag-scenario.ts Fix mobile workspace parity (#6207) 2026-06-23 17:07:28 -07:00
mock-server-account-rpc.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
mock-server-account-state.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
mock-server-encryption.ts Mobile: worktree-list sidebar for tablet/foldable layouts (#5505) 2026-06-16 16:50:38 -07:00
mock-server-file-preview-data.ts Show full workspace file tree on mobile (#7289) 2026-07-06 15:41:51 -07:00
mock-server-git-state.ts feat(mobile): combine PR sidebar and checks parity (#5641) 2026-06-17 22:52:12 -07:00
mock-server-key-pair.ts fix(mobile): harden native chat send budgets, streams, and stop (#10814) 2026-07-26 22:08:38 -07:00
mock-server-native-chat-scenario.ts fix(mobile): harden native chat send budgets, streams, and stop (#10814) 2026-07-26 22:08:38 -07:00
mock-server-rpc-handlers.ts feat(mobile): add session.tabs.list handler to mock server (#9293) 2026-07-29 18:01:38 -07:00
mock-server-session-tabs-fixture.ts feat(mobile): add session.tabs.list handler to mock server (#9293) 2026-07-29 18:01:38 -07:00
mock-server-terminal-fixtures.ts feat(mobile): add safe Codex rate-limit resets (#9394) 2026-07-24 14:42:04 -07:00
mock-server.ts fix(mobile): harden native chat send budgets, streams, and stop (#10814) 2026-07-26 22:08:38 -07:00
prepare-android-release.mjs fix(mobile): keep Android release versionCode committed (#7271) 2026-07-03 15:26:11 -07:00
repro-terminal-colors.ts Add braces to mobile control flow (#4351) 2026-05-31 21:32:37 -07:00
repro-workspace-picker-lag.ts feat(mobile): combine PR sidebar and checks parity (#5641) 2026-06-17 22:52:12 -07:00
repro-worktree-startup-stream.ts Add braces to mobile control flow (#4351) 2026-05-31 21:32:37 -07:00
start-emulator-pairing-runtime.mjs fix(mobile): harden native chat send budgets, streams, and stop (#10814) 2026-07-26 22:08:38 -07:00
start-emulator.mjs Revert "fix(memory): bound OOM-prone accumulators (#10179)" (#10255) 2026-07-23 18:35:31 -07:00
start-expo.mjs chore(lint): adopt unicorn/prefer-import-meta-properties (error) (#6847) 2026-06-29 23:37:30 -07:00
test-subscribe.ts Add braces to mobile control flow (#4351) 2026-05-31 21:32:37 -07:00