Skip to content

feat(mobile): edit host address, report device model, fix iOS 27 launch - #7949

Closed
bbingz wants to merge 5 commits into
stablyai:mainfrom
bbingz:feat/mobile-edit-host-and-device-identity
Closed

bbingz wants to merge 5 commits into
stablyai:mainfrom
bbingz:feat/mobile-edit-host-and-device-identity

Conversation

@bbingz

@bbingz bbingz commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Edit host on mobile: long-press a desktop → Edit host (replaces Rename). Change display name and connection address without re-pairing, so LAN vs Tailscale IP switches work when the computer is not nearby.
  • Desktop paired-device label: mobile reports its marketing model (e.g. iPhone 15 Pro Max) during e2ee_auth; the device registry renames the QR-time placeholder (Mobile <date>).
  • iOS 27 launch fix: Expo config plugin adopts the UIKit scene lifecycle (UIApplicationSceneManifest + SceneDelegate) so builds with Xcode 27 / iOS 27 no longer SIGTRAP at launch (UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption).

Verified on physical iPhone 17 Pro Max (iOS 27 beta) after local Release install: app stays up and JS bundle loads.

Test plan

  • Mobile: long-press a paired host → Edit host → rename only → list updates, no reconnect required
  • Mobile: edit address to a reachable LAN IP → Save → host reconnects with new endpoint; pairing token unchanged
  • Mobile: reject invalid address input without writing storage
  • Desktop Settings → Mobile → Paired Devices: after reconnect, name shows phone model instead of Mobile <date>
  • cd mobile && pnpm exec vitest run src/transport/host-endpoint.test.ts src/transport/host-store-endpoint.test.ts src/transport/device-identity.test.ts
  • Desktop: pnpm exec vitest run src/main/runtime/rpc/e2ee-channel.test.ts src/main/runtime/device-registry-name.test.ts (when root deps available)
  • iOS: npx expo prebuild --platform ios then build/run on iOS 27 simulator or device — app launches without SIGTRAP

Notes

  • mobile/ios remains gitignored; the scene lifecycle change is applied via mobile/plugins/ios-uikit-scene-lifecycle.js on prebuild.
  • Local Debug builds still need Metro; Release embeds main.jsbundle.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds a mobile edit-host screen with endpoint normalization and saved-host updates, replacing the in-place rename modal with navigation to the new screen. It adds mobile device display-name helpers, sends the device name in the E2EE auth handshake, stores the reported name on the channel, and updates the runtime device registry name on handshake completion. It also introduces an Expo iOS config plugin that rewrites the native app lifecycle to use a SceneDelegate-based setup and registers that plugin in Expo config.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the summary and test plan, but it omits required Screenshots, AI Review Report, and Security Audit sections. Add the missing template sections and include the required cross-platform review and security audit details.
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: host editing, device model reporting, and the iOS 27 launch fix.
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.

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

🧹 Nitpick comments (3)
mobile/src/transport/host-endpoint.test.ts (1)

4-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a test for displayHostEndpoint with an IPv6 URL.

The existing suite doesn't cover IPv6 display. A test would have caught the bracket-loss bug described above.

✅ Suggested test addition
   it('shows host:port for websocket URLs', () => {
     expect(displayHostEndpoint('ws://192.168.1.10:6768')).toBe('192.168.1.10:6768')
     // Why: URL omits default scheme ports (443 for wss); use a non-default port.
     expect(displayHostEndpoint('wss://desk.example:8443')).toBe('desk.example:8443')
   })
+
+  it('wraps IPv6 hostname in brackets', () => {
+    expect(displayHostEndpoint('ws://[fd7a:115c:a1e0::1]:6768')).toBe(
+      '[fd7a:115c:a1e0::1]:6768'
+    )
+  })
mobile/src/transport/host-store-endpoint.test.ts (1)

30-57: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding a multi-host preservation test.

The current test only has one host in storage. A test with two hosts would verify that updateHostEndpoint modifies only the matching host and leaves others untouched.

mobile/app/h/[hostId]/edit.tsx (1)

73-76: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Store full NormalizeHostEndpointResult in the memo to avoid double normalization.

normalizeHostEndpoint is called again in the render IIFE at line 245 to retrieve the error message. Storing the full result eliminates the redundant call and simplifies the preview/error rendering.

♻️ Proposed refactor
   const normalizedPreview = useMemo(() => {
-    const result = normalizeHostEndpoint(address, { fallbackPort })
-    return result.ok ? result.endpoint : null
-  }, [address, fallbackPort])
+    return normalizeHostEndpoint(address, { fallbackPort })
+  }, [address, fallbackPort])

Update canSave and rendering to use .ok / .endpoint / .error directly:

   const nameChanged = host != null && nameTrimmed.length > 0 && nameTrimmed !== host.name
   const endpointChanged =
-    host != null && normalizedPreview != null && normalizedPreview !== host.endpoint
+    host != null && normalizedPreview.ok && normalizedPreview.endpoint !== host.endpoint
   const canSave =
     host != null &&
     nameTrimmed.length > 0 &&
-    normalizedPreview != null &&
+    normalizedPreview.ok &&
     (nameChanged || endpointChanged) &&
     !saving
-            {normalizedPreview ? (
+            {normalizedPreview.ok ? (
               <Text style={styles.preview} numberOfLines={2}>
-                Connects to {normalizedPreview}
+                Connects to {normalizedPreview.endpoint}
               </Text>
             ) : address.trim().length > 0 ? (
               <Text style={styles.previewError}>
-                {(() => {
-                  const result = normalizeHostEndpoint(address, { fallbackPort })
-                  return result.ok ? null : result.error
-                })()}
+                {normalizedPreview.error}
               </Text>
             ) : null}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ebda01e4-956b-461d-a201-42b000e0ace6

📥 Commits

Reviewing files that changed from the base of the PR and between 8adfef4 and 38464006e429883a2a83e009f26f41644370352f.

📒 Files selected for processing (17)
  • mobile/app.json
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/app/h/_layout.tsx
  • mobile/app/index.tsx
  • mobile/plugins/ios-uikit-scene-lifecycle.js
  • mobile/src/transport/device-identity.test.ts
  • mobile/src/transport/device-identity.ts
  • mobile/src/transport/host-endpoint.test.ts
  • mobile/src/transport/host-endpoint.ts
  • mobile/src/transport/host-store-endpoint.test.ts
  • mobile/src/transport/host-store.ts
  • mobile/src/transport/rpc-client.ts
  • src/main/runtime/device-registry-name.test.ts
  • src/main/runtime/device-registry.ts
  • src/main/runtime/rpc/e2ee-channel.test.ts
  • src/main/runtime/rpc/e2ee-channel.ts
  • src/main/runtime/runtime-rpc.ts

Comment thread mobile/src/transport/device-identity.ts Resolved
Comment thread mobile/src/transport/host-endpoint.ts Resolved
@AmethystLiang
AmethystLiang requested a review from Jinwoo-H July 9, 2026 16:50
@bbingz
bbingz force-pushed the feat/mobile-edit-host-and-device-identity branch from e38eaa4 to e4a608e Compare July 10, 2026 01:51

@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

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 90a6fa13-426f-49a7-aa9c-ec2f1115932f

📥 Commits

Reviewing files that changed from the base of the PR and between e38eaa41b335a485642b057c7aba5847e6ce3bc0 and e4a608ed23bd39f8998ec37af4289e363f716dd9.

⛔ Files ignored due to path filters (1)
  • mobile/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • mobile/app.json
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/app/h/_layout.tsx
  • mobile/app/index.tsx
  • mobile/package.json
  • mobile/plugins/ios-uikit-scene-lifecycle.js
  • mobile/src/transport/device-identity.test.ts
  • mobile/src/transport/device-identity.ts
  • mobile/src/transport/host-endpoint.test.ts
  • mobile/src/transport/host-endpoint.ts
  • mobile/src/transport/host-store-endpoint.test.ts
  • mobile/src/transport/host-store.ts
  • mobile/src/transport/rpc-client.ts
  • src/main/runtime/device-registry-name.test.ts
  • src/main/runtime/device-registry.ts
  • src/main/runtime/rpc/e2ee-channel.test.ts
  • src/main/runtime/rpc/e2ee-channel.ts
  • src/main/runtime/runtime-rpc.ts
🚧 Files skipped from review as they are similar to previous changes (16)
  • mobile/app.json
  • mobile/src/transport/device-identity.ts
  • mobile/package.json
  • mobile/src/transport/host-store-endpoint.test.ts
  • src/main/runtime/rpc/e2ee-channel.test.ts
  • mobile/src/transport/rpc-client.ts
  • src/main/runtime/runtime-rpc.ts
  • mobile/src/transport/host-store.ts
  • src/main/runtime/device-registry.ts
  • mobile/src/transport/device-identity.test.ts
  • src/main/runtime/device-registry-name.test.ts
  • mobile/app/h/_layout.tsx
  • src/main/runtime/rpc/e2ee-channel.ts
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/src/transport/host-endpoint.test.ts
  • mobile/app/index.tsx

Comment thread mobile/src/transport/host-endpoint.ts Resolved
bbingz and others added 5 commits July 10, 2026 18:13
Add an Edit host screen so paired desktops can change name and connection
endpoint without re-pairing (LAN vs Tailscale IP switches). Report the
phone marketing model during e2ee_auth so desktop Paired Devices shows
e.g. "iPhone 15 Pro Max" instead of "Mobile <date>".

Also adopt the iOS 27 UIScene lifecycle via an Expo config plugin so
local/TestFlight builds no longer SIGTRAP at launch under Xcode 27 SDK.
- Guard SceneDelegate launchOptions injection and fail if bootstrap rewrite misses
- Use expo-device modelName for iOS marketing names (SDK 55)
- Preserve IPv6 brackets and original ws/wss scheme on host endpoint edit
- Add expo-device to mobile pnpm-lock.yaml so frozen install succeeds
- Reject illegal bare hosts (path/query/spaces) before persistence
- SceneDelegate merges cold urlContexts and forwards warm openURLContexts
  so orca://pair deep links are not dropped under UIScene lifecycle
- Short-circuit AppDelegate rewrites on the bootstrap marker and fail if
  configurationForConnecting cannot be inserted after a partial pass
- Preserve explicit ws :80 / wss :443 that URL.port hides from callers
@bbingz

bbingz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by three focused, rebased PRs:

Each replacement targets current main, is independently reviewable/revertible, and includes focused verification. Independent review also drove follow-up fixes for malformed IPv6, React Native transport layering, partial iOS scene migration, and missing Xcode Sources membership.

Closing this conflicting umbrella PR to avoid duplicate review and merge work.

@bbingz bbingz closed this Jul 11, 2026
@bbingz
bbingz deleted the feat/mobile-edit-host-and-device-identity branch August 1, 2026 00:47
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.

2 participants