Skip to content

fix(mobile): open editor for disconnected hosts - #12575

Merged
brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-edit-host-disconnected
Aug 4, 2026
Merged

brennanb2025 merged 1 commit into
mainfrom
brennanb2025/fix-edit-host-disconnected

Conversation

@brennanb2025

Copy link
Copy Markdown
Contributor

Summary

Fix mobile host editing when the target host is disconnected. The edit action now waits for the root navigator to commit the expected host route before replacing it with the editor, and cancels stale pending transitions on repeat navigation or unmount.

Added regression coverage for the committed-route transition, unrelated host routes, cancellation, and synchronous navigation failures.

Screenshots

Disconnected host opens its populated editor:

edit-host.png

Testing

  • pnpm lint — mobile package
  • pnpm typecheck — mobile package
  • pnpm test — full suite not run; 13 focused mobile tests passed
  • pnpm build — not run; mobile-only navigation change
  • Added or updated high-quality tests that would catch regressions
  • iOS simulator: reproduced the blank disconnected-host page, then verified Edit host opens with populated name and address fields

AI Review Report

Reviewed the navigation state synchronization, pending-transition lifecycle, host ID handling, failure cleanup, and regression tests. The review found the previous requestAnimationFrame replacement could run before Expo Router committed the nested host route; this PR replaces that timing assumption with a committed-state listener and verifies cleanup paths.

Cross-platform compatibility was explicitly checked for macOS, Linux, and Windows. The change uses platform-neutral Expo navigation and does not touch shortcuts, shortcut labels, filesystem paths, shell behavior, or Electron-specific behavior. SSH and folder-workspace behavior are unaffected.

Security Audit

Reviewed route input handling and lifecycle cleanup. Host IDs are encoded for the mounted host URL and passed as route params for the edit route. The change adds no command execution, filesystem access, authentication changes, secrets, dependencies, IPC, or new external input surfaces.

Notes

This changes navigation behavior only; the existing edit-host UI and styling are unchanged.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Mobile host edit navigation now observes navigation state instead of using an animation frame. It replaces the host route only after the matching route commits, supports cancellation, and cleans up listeners on completion or errors. A new React hook manages pending navigation and unmount cleanup. The home screen uses the hook directly for the action sheet edit callback. Tests cover route matching, cancellation, errors, and callback wiring.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: fixing mobile editor navigation for disconnected hosts.
Description check ✅ Passed The description covers the required sections, user-visible behavior, testing, AI review, security audit, platform compatibility, and follow-up notes.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

🧹 Nitpick comments (1)
mobile/src/transport/host-edit-navigation.test.ts (1)

60-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover automatic stale-transition cleanup.

This test invokes controller.cancel(), so it only covers explicit cancellation. Add a transition from an unrelated h route to a non-h route, then emit the requested host route. Assert that the listener is unsubscribed and replace is not called.

Proposed test coverage
+  it('cancels a stale pending replacement after navigation leaves the host flow', () => {
+    const harness = navigationHarness({ index: 0, routes: [{ name: 'index' }] })
+    const replace = vi.fn()
+
+    navigateToMobileHostEdit(harness.navigation, { push: vi.fn(), replace }, 'host-1')
+    harness.setState({ index: 0, routes: [{ name: 'h', params: { hostId: 'host-2' } }] })
+    harness.setState({ index: 0, routes: [{ name: 'index' }] })
+    harness.setState({ index: 0, routes: [{ name: 'h', params: { hostId: 'host-1' } }] })
+
+    expect(harness.unsubscribeState).toHaveBeenCalledOnce()
+    expect(replace).not.toHaveBeenCalled()
+  })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f58e47f-a9db-4575-a8e7-63667e420b79

📥 Commits

Reviewing files that changed from the base of the PR and between 2073f7e and ae6da21.

📒 Files selected for processing (5)
  • mobile/app/index.tsx
  • mobile/src/home-host-edit-navigation-source.test.ts
  • mobile/src/transport/host-edit-navigation.test.ts
  • mobile/src/transport/host-edit-navigation.ts
  • mobile/src/transport/use-open-mobile-host-edit.ts

@brennanb2025
brennanb2025 merged commit d52df52 into main Aug 4, 2026
44 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
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