Skip to content

feat(mobile-pairing): combobox with manual network address entry - #1

Open
ppw-stack wants to merge 103 commits into
mainfrom
ppw-stack/sealion
Open

ppw-stack wants to merge 103 commits into
mainfrom
ppw-stack/sealion

Conversation

@ppw-stack

@ppw-stack ppw-stack commented Jun 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Replaces the inner Select of the desktop Settings → Mobile → Network Interface section with a Popover + Command combobox that lets users type a custom IPv4 address or Tailscale MagicDNS hostname as the mobile-pairing QR endpoint. The OS-enumerated interfaces still appear as before; the new Use "<query>" row at the bottom of the list promotes the typed value to a real selection when the input parses as a valid address.

Before: dropdown was limited to OS-discovered interfaces, so Tailscale MagicDNS hostnames, ZeroTier addresses, and any manual LAN IP the OS hadn't surfaced were unreachable.

After: type my-mac.tail-abcd.ts.net (or 192.168.2.50) into the dropdown and pick Use "<address>" — the trigger switches to <address> (custom), the QR is regenerated, and the mobile app can scan it.

The component's public props contract is unchanged, so MobilePairingQrSection.tsx and the parent MobilePane need no edits.

Screenshots

Before/after screenshots are attached to this PR conversation (per AGENTS.md, evidence images are never committed to the repo).

Four captures from a real pnpm dev Electron build (Linux x64, Chinese locale, OS-discovered interfaces):

  1. Trigger closed, Step 2 of 2 ("Pair this computer") — 192.168.0.128 (wlo1) selected from the OS list.
  2. Popover open with Use "my-mac.tail-abcd.ts.net" row — typed a Tailscale MagicDNS hostname; the manual-entry row appears at the bottom of the list.
  3. Trigger in (custom) state after picking the manual entry — my-mac.tail-abcd.ts.net (custom), the QR was reminted against the new endpoint.
  4. Inline error for invalid input — typing not an address shows Enter an IPv4 address or Tailscale MagicDNS hostname in red and suppresses the Use … row.

Testing

  • pnpm lint (oxlint + verify:localization-catalog + verify:localization-coverage) — clean
  • pnpm typecheck — clean across tsconfig.node.json, tsconfig.tc.cli.json, tsconfig.tc.web.json
  • pnpm test (full settings folder + src/shared/network/) — 479 passed / 0 failed (28 new feature-specific assertions across three new/updated test files)
  • pnpm build — clean
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Three test files were added or rewritten:

  • src/shared/network/manual-address.test.ts — 10 vitest cases covering IPv4 boundaries, leading-zero rejection, MagicDNS happy/sad paths, case-insensitivity, 253-char DNS cap, and whitespace trim.
  • src/renderer/src/components/settings/mobile-network-interface-selection.test.ts — 12 vitest cases covering buildComboboxEntries (6) and selectRefreshedNetworkAddress (6, preserved verbatim from existing behavior).
  • src/renderer/src/components/settings/MobileNetworkInterfaceSection.test.tsx — 6 render tests covering trigger label, custom address entry via Use "…" row, inline error + no Use row for invalid input, suppression when typed value matches an existing interface, (custom) label rendering, and empty-interface fallback.

AI Review Report

The implementation was reviewed across the following dimensions before opening this PR:

  • Cross-platform compatibility (macOS / Linux / Windows): No platform-specific code introduced. The component uses shadcn primitives (Popover, Command) already in use across the renderer. No new keyboard shortcuts; no new path handling; no Electron CmdOrCtrl accelerator changes.
  • SSH / remote / local compatibility: No changes to main-process IPC or transport layer. The new flow ends at onSelectedAddressChange(string) — the same contract MobilePairingQrSection already consumes. SSH/headless mode is unaffected.
  • Supported agent and integration compatibility: Out of scope; no integration surface touched.
  • Performance risk: The combobox re-derives entries, queryParse, and selectedIface via useMemo keyed on [networkInterfaces, query] / [networkInterfaces, selectedAddress, customAddress]. The hot path (every keystroke) only does a single substring filter over the interface list (typically <10 entries) plus the regex parser — both O(n) on a tiny n. No measurable cost.
  • UI quality: Follows docs/STYLEGUIDE.md. Uses the documented text-destructive token for the inline error (verified the spec-mentioned text-statusRed was undefined in main.css and switched to the correct existing token). The trigger uses min-w-[220px] and the chevron affordance matches the surrounding settings card pattern. Command shouldFilter={false} is required because we filter manually to keep the Use "…" row visible.
  • Basic security risk: No new IPC, no new auth surface, no new env var. parseManualNetworkAddress rejects malformed input early (whitespace, overlong, leading zeros, non-Tailscale hostnames) so the QR endpoint never sees arbitrary bytes. The (custom) label is purely cosmetic and not parsed downstream.

Security Audit

  • Input handling: All user input flows through parseManualNetworkAddress (trim → length cap → whitespace rejection → IPv4 / MagicDNS regex). Output is a discriminated {ok: true, address} or {ok: false, error} union; consumers narrow before reading address. The entry.address string is never used as a path, shell argument, or SQL — only as a QR endpoint, which is the same data path the OS-enumerated addresses already use.
  • Command execution: None added.
  • Path handling: None added.
  • Auth / secrets: No change. MobilePairingQrSection still receives selectedAddress and handles its own token encoding.
  • Dependencies: Three new devDependencies (@testing-library/react, @testing-library/user-event, @testing-library/jest-dom) — all React testing utilities, widely used, no runtime impact on the shipped app.
  • IPC: No change.
  • Follow-up: None.

Notes

Plan deviations (all intentional, surfaced for reviewer visibility)

The plan was patched twice during implementation to fix ambiguities caught by subagent reviewers — those patches are committed as separate docs(plan): … commits so reviewers can see the divergence trail.

  1. customAddress session state dropped. The plan's selectedIface logic returned null whenever selectedAddress was not in networkInterfaces and not equal to customAddress — but customAddress starts as null, so the trigger rendered "No interfaces found" on first paint even when the parent passed a valid custom address. The implementation treats any unmatched selectedAddress as (custom) directly, which is simpler and matches the spec's UI behavior. The session-scoped nature is preserved by being component-local state.
  2. Controlled cmdk helpers from AgentCombobox not used. The plan referenced createAgentComboboxCommandState / resolveAgentComboboxCommandState / updateAgentComboboxCommandValue to avoid stale highlights when hovering a footer. This combobox has no footer / no external clickable region that would leave a stale highlight, so the simpler <Command shouldFilter={false}> (no value/onValueChange) is sufficient. If a "Manage custom addresses" footer is added later, those helpers should be adopted.
  3. isCustomLabel helper dropped (consistent with deviation feat(mobile-pairing): combobox with manual network address entry #1).

Spec/plan/impl trail

  • Spec doc: docs/reference/2026-06-27-orca-mobile-manual-network-address-design.md (Module 2 was retroactively updated in commit 515a93fcc to match the plan's corrected buildComboboxEntries branching rule).
  • Plan: docs/reference/plans/2026-06-27-orca-mobile-manual-network-address.md (two patches in commits 0876d9721 and f9668b8f4 for test-spec consistency and the filter rule).

Other

  • The locale catalog was regenerated via pnpm sync:localization-catalog to backfill the two new MobileNetworkInterfaceSection translation keys across en / es / ja / ko / zh.
  • No changes to MobilePairingQrSection.tsx, use-mobile-install-qr.ts, main-process code, or the mobile app.

X (Twitter) handle: @YOUR_HANDLE_HERE

ppw-stack and others added 17 commits June 27, 2026 12:05
…MobileHero and Settings section

The Popover + Command + manual-entry UX lived only in the Settings →
Mobile → Network Interface section. The mobile pairing screen
("Step 2 of 2 — Pair this computer") had its own copy of the same
Select-based dropdown that did not support manual address entry. A
user trying to pair with a Tailscale MagicDNS hostname from the
pairing screen could not enter it.

Extract the typeable combobox into a shared
`NetworkInterfaceCombobox` component. Both surfaces now render the
same Popover + Command with manual address entry, the `Use "..."`
row, the inline validation error, and the `(custom)` trigger label.
Settings keeps its own Generate QR button, Refresh + Tooltip, and
Tailnet accordion around the combobox. The pairing screen keeps its
existing layout (label + combobox + refresh icon).

Net deletion: ~160 lines. Net behavior gain: manual address entry is
now reachable from both surfaces, not only Settings.
…s not lost

The Popover content above the CommandList renders the cmdk CommandInput
with only a thin bottom border. Against a white popover background it
visually disappears, especially in the mobile pairing screen where the
popover sits inside a dark phone mockup. Add a subtle `bg-muted/30` +
`py-1` so the input row is unambiguous, without changing the input's
shape or behavior.
…Popover

In `pnpm dev` HMR cycle the cmdk CommandItem `onSelect` dispatch was
unreliable — clicking the item fired the synthetic event but the parent
React state never received it, so the trigger label never updated after
the user picked a manual address or a refreshed interface.

Replace the `Command` + `CommandItem` primitives inside
NetworkInterfaceCombobox with a native `<input>` + `<button>` list
wrapped by Radix `Popover`. The list now responds to the user's first
click without any intermediate effect that could be skipped in dev mode.
The combobox keeps the same props contract, the same placeholder, the
same inline validation, and the same `Use "<address>"` row at the
bottom of the list.

Update MobileNetworkInterfaceSection.test.tsx selectors from
`role=option` (cmdk's) to `role=button` so the integration test still
asserts the right element. All 479 feature tests still pass.
…e race

In dev mode Radix Popover's close-on-pointerdown handler occasionally
fires before React's synthetic click dispatch reaches the option button,
so the parent's selectedAddress never updates after the user picks a
manual address. Bind the commit handler to pointerdown (synchronous,
before any pointer-up / click synthesis) and call event.preventDefault()
to avoid text-selection side effects. Keep onClick as a fallback so
keyboard / touch / programmatic-dispatch paths still work.
…resh

`selectRefreshedNetworkAddress` used to fall back to the first OS
interface whenever `currentAddress` wasn't in the OS-enumerated
list — so a user who typed a Tailscale MagicDNS name saw their
selection snap back to LAN every time `loadNetworkInterfaces`
returned. Treat manual entries as sticky by passing an
`isManual` flag from the caller; `selectRefreshedNetworkAddress`
now keeps the address when the caller says the user typed it.

`MobilePage` tracks `addressIsManual` alongside
`selectedAddress`: `handleAddressChange` flips it on when the
picked address is not in the OS list, and `loadNetworkInterfaces`
passes it through so refresh keeps the choice.
@ppw-stack

Copy link
Copy Markdown
Owner Author

Update (commits a02d8ab → 0876d97 + cleanup):

The first three commits (df81dc50 → f9668b8f → 4967ec995) land the Settings → Mobile → Network Interface section rewrite plus the plan/spec docs, exactly as the original PR body describes. They hit all 479 unit tests and pass lint/typecheck/i18n-catalog/i18n-coverage locally.

After the first manual QA round I caught a real scope miss: the mobile pairing screen ("Step 2 of 2 — Pair this computer") in MobileHero.tsx had its own copy of the same Select that did NOT support manual address entry. The next commits (a02d8ab7 → c973fe8d) extract a shared NetworkInterfaceCombobox and wire both surfaces to it.

Then three real bugs surfaced during manual QA on a real Electron build:

  1. Settings page crash (5ffcfb67): text-statusRed was the spec's documented error token but does not exist in main.css; the trigger silently rendered in body color. Replaced with the existing text-destructive.

  2. Selection reset on refresh (0876d972): selectRefreshedNetworkAddress used to fall back to the first OS-enumerated interface whenever currentAddress was not in the list — so a Tailscale MagicDNS hostname would snap back to LAN every time loadNetworkInterfaces returned. Added an addressIsManual flag in MobilePage and an isManual parameter to selectRefreshedNetworkAddress so manual entries are sticky across refreshes.

  3. Click commit race: onClick on the option buttons races with Radix Popover's close handler in dev mode. Bound the commit to onPointerDown so the handler fires synchronously before the popover close.

The final commit removes two debug console.logs I had added during diagnosis and adds the missing new-combobox-listbox translation key across all locales.

Net effect: manual address entry now works from both the Settings pane and the mobile pairing screen, refresh preserves the user's choice, no console errors. All 479 tests still pass; lint, typecheck, and i18n coverage gates stay green.

Verified manually on a real pnpm dev build (Linux x64, Electron 42).

ppw-stack and others added 12 commits June 27, 2026 22:42
…cycle

Three real bugs from review, plus a regression test:

1. NetworkInterfaceCombobox in MobileHero was disabled when
   `networkInterfaces.length === 0`, which locked users out of the
   only path to type a manual address during a transient empty
   discovery. Pass `disabled={false}` and let the combobox's
   own empty-state copy explain the situation.

2. `selectRefreshedNetworkAddress` returned `undefined` whenever
   `interfaces.length === 0`, even if the user had a manual
   address and `currentAddressIsManual` was true. Keep the manual
   address so a recovering discovery doesn't clobber it.

3. `loadNetworkInterfaces` could rewrite `selectedAddress` (e.g.
   when a refresh swaps to a freshly-discovered tailnet) but never
   updated `addressIsManual`, so the next refresh could revert
   the user back to LAN. Re-derive `addressIsManual` from the
   new address after every refresh.

Adds a regression test in
`mobile-network-interface-selection.test.ts` exercising the
empty-refresh + manual path.
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Neil <neil@stably.ai>
nwparker and others added 29 commits June 28, 2026 21:16
…lyai#6695)

The rich markdown editor rebuilt the entire Table-of-Contents outline on
every content change by running a full-document remark parse
(buildMarkdownTableOfContents), then discarded the result whenever the TOC
panel was closed — which is the default state. The parse is driven by the
300ms-debounced serialize path, so it fired ~3x/sec during sustained typing,
with cost scaling linearly with document size.

Gate the memo on showTableOfContents so the parse only runs when the panel is
actually open. Including showTableOfContents in the deps rebuilds the outline
the moment the panel opens, so there is no stale TOC.

Benchmark (config/scripts/markdown-toc-parse-benchmark.mjs), per content
change while typing:
  175 KiB doc / 200 headings -> ~65 ms median  (13.2 s cumulative over a
                                                 ~1 min typing burst)
  351 KiB doc / 400 headings -> ~138 ms median (27.8 s cumulative)
With the fix this drops to ~0 ms while the panel is closed.

Adds a unit test proving the parse is skipped (and a stable empty-array
reference returned) while closed, and still runs when open.

Co-authored-by: Orca <help@stably.ai>
…tablyai#6682)

Previously, the terminal IME workaround only forwarded punctuation for
macOS CJK input methods. This generalizes the system into a native text
forwarder that also handles:

- Short text replacements for Vietnamese input methods (Telex, VNI).
- Synthesized Unicode inputs with unreliable physical key metadata.

This prevents xterm's kitty keyboard protocol from encoding and
canceling these keydowns before the native glyphs can be committed.
* Gate punctuation forwarding on input source feature

Ensure ASCII and CJK direct punctuation keys are only treated as keydown
candidates if `forwardAsciiPunctuation` is enabled in the current input
source features. This avoids forwarding punctuation when the feature is
disabled, satisfying requirements where certain input methods (such as
Vietnamese) should not have punctuation forwarding enabled.

* Fix macOS IME input mode detection
Fixes stablyai#6619: OMP-owned remote/mobile terminals no longer flicker their tab
label between "OMP" and "Pi".

OMP wraps Pi, so it emits Pi-identity OSC titles and status frames during
active work. On the host, in mirrored remote tabs, and in the title-derived
sidebar rows, those frames were stored verbatim — so an OMP-launched pane
alternated between "OMP" (launch identity) and "Pi" (live frame). The fix
introduces a shared owner-normalization helper (agent-title-owner.ts) that
rewrites Pi-compatible titles/status entries to the authoritative launch
owner, but only when the incoming and owner profiles share the same
titleIdentityGroup — so true Pi sessions, unrelated agents, and custom titles
are left untouched.

Maintainer hardening on top of the original change:
- Skip the new getForegroundProcess probe entirely when launchAgent is already
  known (it is only ever the owner fallback when launchAgent is unknown), and
  gate the onPtyData trigger on a real status transition rather than per-frame
  braille-spinner title churn — avoiding a relay round-trip per output frame on
  SSH/daemon-backed terminals.
- Make the foreground refresh fire-and-forget on the mobile listing hot path
  (listTerminals/getWorktreePs) so latency does not grow per session and a
  throwing snapshot listener cannot abort the liveness sweep.
- Added regression tests + a Why comment on the renderer owner precedence.

Verified: 829 tests pass; node/web/cli typechecks clean; oxlint clean;
reproduced the flicker against main as a negative control and confirmed the
live renderer build collapses interleaved OMP/Pi frames to a stable OMP label
with zero Pi leaks while leaving true-Pi/unrelated/custom titles unchanged.

Co-authored-by: Dvitash <dvitash3414@gmail.com>
The generic `.button` height override was collapsing the expand/collapse
chevron to 20px, pinning it to the top instead of centering it vertically.
Switch to targeting `.button.toggle` and restore `height: 100%` so Monaco's
own layout centers the chevron over the find row.
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Ken Fukuyama <kenfdev@gmail.com>
…lyai#6568)

Headless automation launches (launchAgentBackgroundSession) created an
inactive tab via createTab(..., { activate: false }) without first telling
the renderer to background-mount that worktree's terminal surface. As a
result the hidden surface either never mounted (no entry in
mountedWorktreeIdsRef) or mounted with display:none (zero-size, can't be
measured/fit), so the eager PTY buffer never flushed on the first mount —
the run tab showed only the shell prompt until an unmount/remount gave the
off-screen xterm a real layout box.

Dispatch BACKGROUND_MOUNT_TERMINAL_WORKTREE_EVENT immediately before
createTab, mirroring the established renderer-backed Codex startup path in
useIpcEvents. The Terminal.tsx listener adds the worktree to
mountedWorktreeIdsRef and marks it measurable for a 3000ms window, so the
hidden surface renders with opacity-0/pointer-events-none (a measurable box)
instead of display:none, letting the first xterm fit flush the buffer.

Extract the inline measurable-mount block into
background-terminal-worktree-visibility.ts (behavior-identical, now
unit-tested) and add unit + E2E coverage.

Fixes stablyai#6244

Co-authored-by: ChaDongWun <66347959+lovewave02@users.noreply.github.com>
Adds replace, replace all, match case, whole word, and the editor replace shortcut to the rich markdown editor. Includes review hardening for live replace matching and Unicode-safe whole-word boundaries.
Folder-workspace selectors can now resolve through the existing folder launch-scope path before falling back to normal worktree resolution. This fixes file explorer read/preview/search/list operations for local and SSH-backed folder workspaces without changing git target resolution.

Refs stablyai#6357.
Supersedes stablyai#6363.

Co-authored-by: bennewell35 <newelljben@gmail.com>
…tablyai#6571)

Resume-in-tab/drag-resume queued a cmd.exe-syntax command into a freshly
spawned tab whose live shell is the configured Windows shell (default
PowerShell). PowerShell mis-parsed the cmd ""-doubled wrapper and reported
"is not recognized as an internal or external command, operable program or
batch file", so the session never resumed.

Resolve terminalWindowsShell to a startup-shell family and quote the queued
command per shell (PowerShell Set-Location/$env, POSIX cd for git-bash),
only emitting the cmd /d /s /c wrapper when the live shell is cmd. The
copy-to-clipboard command is unchanged and stays cmd-wrapped.

Fixes stablyai#6152

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Wolfgang Schoenberger <221313372+wolfiesch@users.noreply.github.com>
* Fix Windows worktree force delete cleanup

* Fix Windows cleanup rm option type import
…i#6531)

* Allow deleting files on WSL UNC paths from the file explorer

shell.trashItem cannot move a \wsl.localhost\<distro>\... UNC file to a
Recycle Bin (the WSL virtual volume has none), so fs:deletePath threw and the
file explorer showed an error. For WSL UNC targets, hard-delete via `rm`
inside the distro through wsl.exe (a true delete that honors Linux perms).
Normal local paths still go to the Recycle Bin via shell.trashItem.

Fixes stablyai#6415

* test: make WSL UNC delete tests platform-correct for Linux CI

The two WSL UNC deletePath tests passed on Windows but failed on the
Linux CI runner. They built the worktree root/target from literal
'\wsl.localhost\...' strings, which only resolve as a parent/child
pair under win32 path semantics. On POSIX, path.resolve() treats the
backslashes as ordinary filename characters, so the target was not a
descendant of the registered root and resolveAuthorizedPath denied it
before tryDeleteWslUncPath ran.

Build the UNC-style paths with path.join so they form a real
parent/child pair under both win32 and POSIX path rules. Production
behavior is unchanged; WSL UNC delete remains Windows-only.

---------

Co-authored-by: brennanb2025 <brennanb2025@users.noreply.github.com>
* Keep mobile pairing data on stable userData path

Use the canonical userData path captured before app.setName() when starting the runtime WebSocket server so paired mobile device tokens and E2EE keys survive restarts/updates. Add regression coverage for app-name-driven userData path changes.

Co-Authored-By: Claude <noreply@anthropic.com>

* Migrate mobile pairing files from legacy path

Co-Authored-By: Claude <noreply@anthropic.com>

* Address mobile pairing migration review

Co-Authored-By: Claude <noreply@anthropic.com>

* Document mobile pairing path helpers

Co-Authored-By: Claude <noreply@anthropic.com>

* Explain paired mobile credential migration

Co-Authored-By: Claude <noreply@anthropic.com>

* Harden migrated mobile pairing credentials and tighten tests

Re-assert secure-file permissions after the migration copyFileSync, which
does not carry Windows ACLs, so the copied device tokens and E2EE keypair
keep the current-user-only restriction instead of relying on the runtime's
later lazy re-harden on read.

Import the pairing filename constants from the shared source of truth so a
rename can't silently pass the tests against stale names, and add no-op
regression coverage for the source==target (case-insensitive FS) and
fresh-install (no legacy files) paths.

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
Resolve the File Explorer and Quick Open runtime file-list target through known worktrees so folder workspaces provide their root path, and make connectionId resolution reactive for SSH folder workspaces after store hydration.

Supersedes stablyai#6170.

Co-authored-by: bennewell35 <142949922+bennewell35@users.noreply.github.com>
…tablyai#6350)

* feat(source-control): show submodule diffs with lazy expansion

Dirty submodules now expand inline in Source Control to reveal their
inner changes, with file-level diffs that are read-only from the parent
worktree. Inner status is fetched lazily only when a submodule is
expanded, so status polling never recurses into (possibly nested)
submodules. Adds a submodule-status path across local and SSH runtimes
and git providers.

* feat(source-control): add compare-against-current-branch setting

Adds a global setting (default off) that defaults the Source Control
compare base to the current branch's upstream so the panel prioritizes
local changes instead of the full delta versus the repository default
branch. When the branch has no upstream, the compare view falls back to
working-tree-only. This affects only the compare/diff view; the Pull
Request and rebase merge target are unchanged.

* refactor(source-control): extract submodule status hook and entry-action gates

Moves the lazy submodule-expansion state into a useSourceControlSubmoduleStatus
hook and centralizes per-row stage/unstage/discard eligibility into
source-control-entry-actions, shrinking SourceControl.tsx and keeping the
read-only submodule rules consistent across the row UI, bulk actions, and tests.
The hook adds a generation guard so a slow submodule-status response from a
previous worktree (common over SSH) can't write stale status into the current
panel. On the relay side, configured submodule paths are read through a
short-TTL per-instance cache so a burst of diff clicks does not re-read
.gitmodules over the SSH link. Adds tests for the new modules.

* fix(source-control): address submodule/compare review feedback

- Degrade git.submoduleStatus to an actionable reconnect hint when an older
  SSH relay lacks the RPC, mirroring clone()/worktreeIsClean fallbacks.
- Keep the branch-compare summary while upstream status is still loading so
  it no longer flickers when switching worktrees with prefer-upstream on.
- Mark the compare-base switch as type="button" to avoid form submission.
- Add diff base / source control keywords to the Git settings search catalog.
- Assert the compare-base toggle's own switch state and updateSettings call.

* fix(source-control): address second-round submodule/compare review feedback

- Route submodule inner diffs through resolveSubmoduleWorktreePath so a
  crafted .gitmodules path can't escape the selected worktree
- Clear statusReadsInFlight alongside the diff dedupe on git mutations so a
  post-mutation getStatus() can't join a stale in-flight read
- Clear the SSH diff dedupe in getSubmoduleStatus to mirror getStatus
- Derive list-view selection from the submodule-injected rows so expanded
  submodule children are selectable
- Refresh commit history when the upstream compare base changes

* Support staged submodule expansion and refine default compare base

- Support expanding and diffing staged submodule changes (HEAD vs index) independently of unstaged changes (index vs worktree).
- Track submodule expansion states using a compound key of area and path to prevent conflicts between staged and unstaged listings.
- Update the compare-against-upstream setting to a segmented control for the "Default Compare Base" policy.
- Fall back to the repository default branch when comparing a branch with no upstream, preventing comparison views from unexpectedly disappearing.

* Fix submodule staging behavior, WSL caching, and double-click toggles

- Namespace submodule path cache per WSL distro to prevent cross-distro
  collisions.
- Preserve the staged area of child entries when expanding unstaged
  submodules so staged inner changes do not open empty diffs.
- Prefix oldPath with the submodule path for renamed inner entries.
- Ignore click events where detail > 1 to prevent double-clicks from
  instantly collapsing newly expanded submodules.

* Secure submodule path resolution and prevent stale status updates

* Extract and centralize submodule path validation into a new
  `resolveSubmoduleWorktreePath` helper to prevent path traversal
  exploits when resolving paths from untrusted `.gitmodules` files.
* Invalidate submodule expansion state and increment the query
  generation whenever the active runtime environment or connection
  route changes, preventing out-of-order responses from writing
  stale data.

* Set git identity via CLI config options in test commits

- Extract test email and name into constants.
- Use `-c` config flags to pass user identity to `git commit` dynamically.
- This ensures commits succeed in submodule checkouts or CI environments
  where a local or global identity is not configured.

---------

Co-authored-by: Jinjing <6427696+AmethystLiang@users.noreply.github.com>
…6481)

When Quick Open and File Explorer name search fall back to git ls-files, expand nested git repo placeholders with a bounded readdir walk so monorepo parent workspaces include files inside sub-projects. Keep local main-process and SSH relay behavior aligned, including non-git root fallback and non-zero git failure handling.

Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Wolfgang Schoenberger <221313372+wolfiesch@users.noreply.github.com>
Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
…tom-address dialog

The Settings/MobileHero network selector used a Popover+search-input hybrid
that looked uneven and hid its validation error behind the open popover.

Replace it with a plain Select of discovered interfaces plus an
'Add custom address…' footer row that opens a small dialog for entering a
Tailscale hostname or static IP. Drops the 'MagicDNS' jargon for plainer
copy, keeps the '(custom)' trigger label, and routes all strings through
translate() with real es/ja/ko/zh translations. Removes the now-dead
buildComboboxEntries helper. Also adds the missing scrollbar-sleek class
the old list omitted (was failing pnpm lint).

Co-authored-by: Orca <help@stably.ai>
# Conflicts:
#	src/renderer/src/components/mobile/MobileHero.tsx
ppw-stack added a commit that referenced this pull request Jun 29, 2026
Address three documentation and test-coverage findings from /review on
PR stablyai#6752.

1. mobile/src/i18n/README.md (#6)
   The "Translation keys" section still described a PR1/PR2 split with
   ~30 + ~470 keys across only {en,zh}.json. v2 ships 1004 keys across
   all 5 locales with strict parity. Refreshed to reflect the actual
   rollout and add a sentence on interpolation syntax + pluralization
   (the recent #1 fix made this distinction load-bearing).
   Also refreshed "Testing" to note the hook now has a real rendered
   test instead of the original "no RN test infrastructure" framing.

2. docs/superpowers/specs/2026-06-29-mobile-i18n-v2-design.md (#7)
   The "metro.config.js 兼容性" section said "v2 PR1 must retain v1's
   full metro.config.js changes (watchFolders + nodeModulesPaths +
   disableHierarchicalLookup)". Actual implementation:
     - only added watchFolders = [sharedRoot, i18nLocalesRoot]
     - did NOT add nodeModulesPaths
     - did NOT add disableHierarchicalLookup (which broke pnpm's
       @expo/metro-runtime resolution during local validation)
   Updated the section to describe the actual minimal change with a
   "Spec 修订说明" callout explaining why the original draft was
   wrong and how the v2 implementation ended up aligned with upstream
   defaults.

3. mobile/src/i18n/__tests__/useTranslate.test.ts (stablyai#8)
   The previous test reimplemented the hook's t() closure inline
   instead of calling the real hook — so any regression in
   useTranslate itself would still pass. Replaced with a real hook
   test:
     - Renders a tiny HookHost component via react-dom's createRoot
     - Captures the hook's return value through a useEffect callback
     - Asserts resolvedLanguage === 'zh' (the active language)
     - Asserts fallback path (missing key → defaultValue)
     - Asserts hit path (existing zh key → '设置' not 'Settings')
   Uses `@vitest-environment jsdom` per-file directive to opt in to
   DOM access for `document.createElement('div')` while keeping the
   rest of the mobile test suite on the faster 'node' environment.
   jsdom is already in mobile's transitive deps.

Verification:
- pnpm test: 147/147 files, 979 tests pass
- pnpm exec tsc --noEmit: No errors
- pnpm exec oxlint: clean
- pnpm run verify:localization-catalog: 5 locales × 10903 keys
- pnpm run verify:localization-coverage: 208 allowlisted
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.