Skip to content

feat(mobile): edit saved host endpoints - #8294

Merged
AmethystLiang merged 9 commits into
stablyai:mainfrom
bbingz:bbingz/mobile-host-endpoint-edit
Jul 15, 2026
Merged

AmethystLiang merged 9 commits into
stablyai:mainfrom
bbingz:bbingz/mobile-host-endpoint-edit

Conversation

@bbingz

@bbingz bbingz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a focused mobile edit route for a saved Remote Orca host name and endpoint
  • validate hostnames, IPv4, bracketed IPv6, ws/wss URLs, and ports before persisting
  • preserve the existing pairing token and public key when only connection metadata changes
  • force reconnect only when the endpoint changes
  • reject paths, queries, userinfo, invalid/multiple IPv6 compression, and ports outside 1–65535

This is the host-endpoint replacement extracted from #7949. It intentionally excludes device identity and iOS scene-lifecycle work.

Refs #7949

Screenshots

No screenshot attached. The change adds an edit affordance and reuses the existing mobile form primitives; no desktop UI changes.

Testing

  • mobile Vitest: 2 files / 25 tests
  • mobile TypeScript
  • mobile oxlint
  • targeted oxfmt --check
  • pnpm check:max-lines-ratchet
  • git diff --check origin/main...HEAD
  • RED-to-GREEN regression for malformed IPv6 such as multiple ::
  • mobile simulator/device interaction
  • Electron/E2E/GUI

AI Review Report

Independent review ended spec PASS / quality APPROVED. It checked explicit default ports, IPv6 bracket handling, URL/userinfo/path rejection, endpoint-change reconnect behavior, and preservation of pairing credentials.

A final gate found that the first validator accepted malformed IPv6 with multiple compression markers; the fix now reuses the standard URL parser for bracketed IPv6 and has focused regression coverage.

Security Audit

  • editing a host never rewrites or exposes its pairing token/public key
  • validation rejects embedded credentials, paths, queries, fragments, and invalid ports
  • only saved host connection metadata is mutated
  • no new dependency, native permission, command execution, or unrestricted IPC

Compatibility

The endpoint normalizer preserves ws/wss and IPv4/IPv6 forms used by the existing transport. No desktop, SSH command, keyboard, filesystem, or Git-provider behavior changes.

Notes

Validation used Node 26.5.0 while the repository declares Node 24; checks passed with the expected engine warning.

@coderabbitai

coderabbitai Bot commented Jul 11, 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

Adds a mobile “Edit host” screen that loads and edits host names and WebSocket endpoints, validates endpoint formats, persists endpoint changes, refreshes host state, and reconnects when needed. Registers the nested edit route and replaces inline renaming with navigation to it. Adds endpoint parsing utilities and tests, plus storage update tests.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The template is mostly filled, but the AI Review Report lacks the required explicit macOS/Linux/Windows cross-platform compatibility confirmation. Add an explicit note that the review checked macOS, Linux, and Windows behavior, including shortcuts, labels, paths, shell behavior, and Electron-specific differences.
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% 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 is concise and accurately describes the main change: editing saved host endpoints on mobile.
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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f7376076-e23e-4f9b-8931-19b01b351aef

📥 Commits

Reviewing files that changed from the base of the PR and between ff8192a and fb91184b2f4a5ffdae99bce8ce08d164d00c65de.

📒 Files selected for processing (7)
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/app/h/_layout.tsx
  • mobile/app/index.tsx
  • 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

Comment thread mobile/src/transport/host-endpoint.ts Resolved
@bbingz

bbingz commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bbingz

bbingz commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bbingz
bbingz force-pushed the bbingz/mobile-host-endpoint-edit branch from b36e5ff to 20fce37 Compare July 14, 2026 00:31

@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-endpoint.ts (1)

44-67: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider consolidating the two raw-authority parsers.

extractExplicitPortFromWebsocketUrl and parseRawSchemeAuthority both re-implement the same authority-walking steps (bracket detection, @ userinfo split, path/query boundary search) to extract different fields (port vs. hostname/flags). They're currently consistent, but the file already had one bug (fixed in a prior review round) stemming from divergent handling between related parsing paths. A single parseRawSchemeAuthority-style function returning { hostname, port, hasUserInfo, hasPathOrQuery } would remove this duplication and the risk of the two drifting apart again.

Also applies to: 205-230


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d52e273b-ea62-414b-b23c-34c86deaf5a7

📥 Commits

Reviewing files that changed from the base of the PR and between 91bfdb5 and 20fce37b67c521acacfa718bbf46c7ea74780651.

📒 Files selected for processing (8)
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/app/h/_layout.tsx
  • mobile/app/index.tsx
  • mobile/src/host-edit-route-accessibility.test.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
🚧 Files skipped from review as they are similar to previous changes (7)
  • mobile/src/transport/host-store-endpoint.test.ts
  • mobile/src/host-edit-route-accessibility.test.ts
  • mobile/src/transport/host-endpoint.test.ts
  • mobile/app/h/_layout.tsx
  • mobile/app/h/[hostId]/edit.tsx
  • mobile/src/transport/host-store.ts
  • mobile/app/index.tsx

@bbingz
bbingz force-pushed the bbingz/mobile-host-endpoint-edit branch from 20fce37 to c9080a3 Compare July 14, 2026 00:38
@AmethystLiang

Copy link
Copy Markdown
Contributor

reviewing

AmethystLiang and others added 3 commits July 14, 2026 20:25
…ix) before landing host-endpoint-edit fixes
Two independent review rounds found the same class of foot-gun: a
superseded mutator (updateHostEndpoint, then renameHost) left in
host-store.ts after the atomic updateHostNameAndEndpoint refactor, with
zero remaining callers. Either could be reintroduced by a future caller
and silently regress the non-atomic name/endpoint race the atomic
function was written to close, so both are removed.

Also covers reconnect-rejection and endpoint-only save paths that were
missing test coverage, and merges origin/main (stablyai#8789) so this lands
without reverting the mobile terminal restore fix.

Co-authored-by: Orca <[email protected]>
@AmethystLiang

Copy link
Copy Markdown
Contributor

Ran 3 rounds of independent automated review + fix passes on this branch (each round spawned a fresh Claude instance to review the full diff, with every claimed fix independently re-verified against the diff/tests before being trusted):

  • Round 1 & 2: found the same class of issue twice — a superseded mutator (updateHostEndpoint, then renameHost) left behind in host-store.ts after the atomic updateHostNameAndEndpoint refactor, with zero remaining callers. Left in place, either was a foot-gun a future caller could reach for and silently reintroduce the non-atomic name/endpoint save race. Both are now removed; updateHostNameAndEndpoint is the sole mutator. Test coverage for endpoint-only saves and post-save reconnect rejection was also added/preserved through the removal.
  • Round 2 also caught that the branch was missing 2 commits from main (release commit + Fix restored mobile terminals and workspace visibility parity #8789's mobile terminal restore fix) — merged cleanly to avoid this PR silently reverting that fix on landing.
  • Round 3: full re-review came back clean — vitest, tsc, and oxlint all pass, and the merge from main byte-matches upstream with no bleed-through into the feature diff.

Pushed the fixes directly to this PR's branch (fast-forward, no history rewrite). Approving and re-triggering CI now.

@AmethystLiang AmethystLiang 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.

Approving after 3 rounds of automated review + fix passes (see comment above for details) — all issues found were fixed, final pass came back clean.

@AmethystLiang

Copy link
Copy Markdown
Contributor

Mobile emulator QA — edit saved host endpoints

Verdict: PASSED (iOS Simulator)

Environment

Item Value
Platform iOS Simulator · iPhone 17 Pro (iOS 26.5)
App com.stably.orca.mobile (Expo dev client)
Metro Running on :8081
Emulator helper Running (orca emulator list, serve-sim :3100)
Branch / PR bbingz/mobile-host-endpoint-edit · this PR
Android Skipped (no booted adb device)

What was exercised

  1. Opened Orca Mobile dev client on the booted simulator
  2. Dismissed notification opt-in → host list with saved desktops
  3. Long-press Host 4 → action sheet shows Edit host
  4. Opened edit form: labeled Name / Address, help copy, live Connects to … preview
  5. Renamed Host 4 → Host 4 QA (Save enabled)
  6. Invalid address 12345 → “Not a valid hostname.”, Save disabled
  7. Valid endpoint 192.168.1.23:6768 → preview Connects to ws://192.168.1.23:6768
  8. Save → returned to home list as Host 4 QA · Connecting…

Results

Check Result Evidence
App loads in simulator (not Expo launcher / redbox) ✅ Pass Screenshot 1
Edit host entry from host action sheet ✅ Pass Screenshot 3
Edit form labels (NAME / ADDRESS) + help text ✅ Pass Screenshot 4
Rename enables Save ✅ Pass Screenshot 5
Invalid address validation ✅ Pass Screenshot 6
Valid endpoint preview ✅ Pass Screenshot 7
Save persists name + endpoint ✅ Pass AsyncStorage + screenshot 8
Reconnect attempted after save ✅ Pass Host 4 QA · Connecting…
Live desktop session after save ⚠️ N/A Desktop not listening on prior LAN pairing ports
Android parity ⚠️ Skipped No booted Android emulator

Persistence (AsyncStorage orca:hosts)

Host ID Name Endpoint
host-1783828857040 Host 1 ws://192.168.1.23:53307
host-1783829804664 Host 2 ws://192.168.1.23:58383
host-1783829989178 Host 3 ws://192.168.1.23:60204
host-1783842112389 Host 4 QA ws://192.168.1.23:6768

Before save: name Host 4, endpoint ws://192.168.1.23:61242.

Supporting unit tests

✓ host-endpoint.test.ts (32)
✓ host-edit-route-accessibility.test.ts (1)
✓ host-edit-save-flow.test.ts (10)
✓ host-store-endpoint.test.ts (5)

Test Files  4 passed
     Tests  48 passed

Screenshot evidence

1 · App loaded

Notification opt-in — confirms Orca Mobile dev client (not Expo launcher / redbox).

1 App loaded

2 · Host list

Saved desktops after dismissing opt-in.

2 Host list

3 · Action sheet

Long-press Host 4 → Connect / Disconnect / Edit host / Remove.

3 Action sheet Edit host

4 · Edit form

Labeled Name / Address fields, help text, live endpoint preview. Save disabled until dirty.

4 Edit form

5 · Rename

Name set to Host 4 QA — Save enabled.

5 Renamed Host 4 QA

6 · Validation

Address 12345 → “Not a valid hostname.” Save disabled.

6 Invalid address

7 · Ready to save

Valid address 192.168.1.23:6768 with preview and enabled Save.

7 Ready to save

8 · After save

Home list shows Host 4 QA · Connecting… (reconnect after endpoint change).

8 After save

Checklist

  • Platform recorded (iOS Simulator, iPhone 17 Pro)
  • Emulator helper running
  • Metro from mobile/
  • Dev-client URL opened
  • App loaded (not Expo launcher / redbox)
  • Changed mobile path exercised (edit form + save)
  • Post-action screenshot with host-list context
  • Paired hosts available (pre-existing; pairing secrets not logged)
  • Android parity (skipped)

Notes

  • Live desktop connectivity after save was not required for this feature’s core claim (edit + persist name/endpoint without re-pairing). Existing paired hosts pointed at stale LAN ports, so status correctly remained Connecting / Can’t connect.
  • Minor cosmetic: floating settings gear slightly overlaps Save on the edit screen; Save still worked via the accessibility target.

Verdict

QA PASSED — Edit saved host endpoints is functional on iOS Simulator: entry from the host action sheet, labeled form, validation, atomic save of name + endpoint, and reconnect attempt after save all behaved as intended. Supporting unit tests (48/48) also passed.


Generated via orca-mobile-emulator-qa · 2026-07-14

- Trims the redundant comment explaining the savingRef race guard down
  to one line.
- Changes the "no longer saved" load-error copy to "was removed" for
  clearer phrasing, updating the matching test expectation.
@bbingz
bbingz deleted the bbingz/mobile-host-endpoint-edit branch August 1, 2026 00:47
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* feat(mobile): edit saved host endpoints

* fix(mobile): reject ambiguous numeric host addresses

* fix(mobile): label edit host inputs

* fix(mobile): make host edit save atomic and remove superseded mutators

Two independent review rounds found the same class of foot-gun: a
superseded mutator (updateHostEndpoint, then renameHost) left in
host-store.ts after the atomic updateHostNameAndEndpoint refactor, with
zero remaining callers. Either could be reintroduced by a future caller
and silently regress the non-atomic name/endpoint race the atomic
function was written to close, so both are removed.

Also covers reconnect-rejection and endpoint-only save paths that were
missing test coverage, and merges origin/main (stablyai#8789) so this lands
without reverting the mobile terminal restore fix.

Co-authored-by: Orca <[email protected]>

* Simplify save-race comment and reword host-removed error message

- Trims the redundant comment explaining the savingRef race guard down
  to one line.
- Changes the "no longer saved" load-error copy to "was removed" for
  clearer phrasing, updating the matching test expectation.

---------

Co-authored-by: Jinjing <[email protected]>
Co-authored-by: Orca <[email protected]>
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