Skip to content

Preserve editor file identity during SSH host conversion - #26593

Merged
OrcaWin merged 2 commits into
mainfrom
nwparker/remote-editor-duplicate-testing
Oct 9, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
nwparker/remote-editor-duplicate-testing

Conversation

@nwparker

@nwparker nwparker commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​440 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​435
Prod 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​179 $\color{#cf222e}{\Huge{\mathbf{−}}}$​58 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​121

ELI5

After an SSH host becomes a managed server, Orca can keep two internal copies of the same open document behind one visible tab. Keep one file record as its ownership moves to the server.

What Changed

The session mirror now reuses retained editor files while the existing save-quiesce step moves ownership, then keeps the resulting owned file ID on later snapshots. It resolves ordinary files and Markdown previews by workspace, server and mode, and shares one backing file across split tabs. A cached index avoids scanning every open file for each host tab.

The Docker conversion regression is routed to the existing template-building CI lane. Its lane contract is extracted into a separate test file without weakening the existing coverage checks.

Why

The mirror previously assigned a raw path ID, retained the unstamped source file, and appended a server-owned copy with that same ID. The ownership transition then rewrote both. Reusing the file preserves the existing save fence and client draft; merely deleting duplicates afterward would hide the ownership collision and could copy another host’s disk baseline.

Linked Issue

Found while exercising SSH consolidation in #26483. Independent of the other consolidation fixes.

Visual Proof

editor-records-before.png
editor-records-after.png
editor-records-runtime-red.log
editor-records-runtime-green.log

Both versions show one visible tab. The logs establish the internal two-record versus one-record difference; the corrected screenshot also shows the saved remote content restored after a full app restart. No claim of baseline save loss.

Testing

  • Manually exercised hidden macOS Electron renderers against an owned Linux Docker SSH host, using the installed 1.4.223 adhoc server template.
  • Automated regressions added: nine ownership tests fail against the original implementation; ten now pass, including legacy omitted mode, pending splits, previews, host/workspace isolation and client drafts.
  • 390 tests across 48 affected mirror, editor persistence, save lifecycle and CI contract files pass.
  • Identical real conversion spec fails on the original client with two records; corrected client keeps one, saves a real keyboard edit to the host, and restores the saved content and one owned file after full app restart (12.1 s).
  • Full pnpm tc, pnpm lint, changed-code quality, affected-file lint and fresh E2E build pass.

Review

Retained file ownership is changed only by the existing quiesced migration. Other owners’ files stay intact; their disk signatures and drafts are not borrowed. Split tabs retain separate tab identities and share one file record. Preview source IDs follow the owned editable document.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer content copied.

Notes

No RPC fields or opcodes change. Workspace keys and host paths remain opaque, so folder workspaces and Windows paths use the same ownership rules. Runtime validation covers macOS client/Linux SSH host; no Windows runtime claim. The separate Markdown metadata routing fix is #26590.

The optional repository-wide E2E typecheck is not enforced yet and reports unrelated existing errors. A focused config for the new spec reports only three errors in unchanged tests/e2e/helpers/store.ts; the new spec itself has none. Required product typechecks pass.

Checklist

  • Focused change with the mechanism and rationale explained
  • Before/after screenshots and runtime logs attached
  • Self-reviewed for correctness, security and performance
  • Cross-platform, SSH, folder workspace and older-peer compatibility considered
  • Required local checks and runtime regression pass

@OrcaWin
OrcaWin force-pushed the nwparker/remote-editor-duplicate-testing branch from b7b5fb8 to 45a97f3 Compare October 9, 2026 02:21
@OrcaWin
OrcaWin changed the base branch from OrcaWin/phase35 to main October 9, 2026 02:21
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4e31e17b-ab8c-4a28-913a-840fabb82ade
📥 Commits

Reviewing files that changed from the base of the PR and between 73e92c0a125aec245927e630dcf122eb780b2074 and 35bb09d.

📒 Files selected for processing (3)
  • .github/workflows/e2e.yml
  • config/scripts/ci-e2e-job-selection.mjs
  • config/scripts/ci-e2e-job-selection.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

Web-session tab synchronization now resolves mirrored editor files using worktree, runtime environment, mode, and path ownership data. It can retain existing file ownership and share backing files across split tabs. New tests cover ownership, duplicate IDs, previews, drafts, and SSH OrCAD session conversion. CI routes the conversion test to a dedicated Docker lane.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 35bb0

The ownership spec is routed to the Docker conversion lane for changes to each affected production file. No merge-blocking risk was identified in the reviewed changes.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 11 files. (1 skipped: … 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 and concisely describes the main change: preserving editor file identity during SSH host conversion.
Description check Passed The description is complete and covers the required explanation, changes, rationale, issue context, visual proof, testing, review notes, compatibility considerations, and checklist. It references issu…
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 11 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

🔇 Additional comments (12)
src/renderer/src/runtime/web-session-existing-tab-index.ts (1)

10-10: LGTM!

Also applies to: 49-50

src/renderer/src/runtime/web-session-tabs-sync/mirrored-editor-file-identity.ts (1)

1-117: LGTM!

src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts (1)

12-13: LGTM!

Also applies to: 106-150

src/renderer/src/runtime/web-session-tabs-sync/apply-preparation-browser.ts (1)

119-119: LGTM!

Also applies to: 138-141, 155-157, 174-174

src/renderer/src/runtime/web-session-tabs-sync-editor-ownership.test.ts (1)

1-230: LGTM!

src/renderer/src/runtime/web-session-tabs-sync-snapshot-batch.test.ts (1)

351-352: LGTM!

Also applies to: 387-387, 397-397

config/scripts/pr-e2e-source-routing.mjs (1)

17-25: LGTM!

config/scripts/ci-e2e-job-selection.mjs (1)

54-54: LGTM!

Also applies to: 64-65, 107-108

config/scripts/ci-e2e-job-selection.test.mjs (1)

148-163: LGTM!

.github/workflows/e2e.yml (1)

353-354: LGTM!

Also applies to: 588-588, 624-624

config/scripts/pr-e2e-docker-lane-contract.test.mjs (1)

1-76: LGTM!

tests/e2e/ssh-orcad-editor-ownership.spec.ts (1)

37-64: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Remove the debug store subscription before merge.

The [editor-records] subscriber logs every openFiles mutation. Each log includes a full Error().stack and the complete file and tab records. Lines 82-93 and Line 106 add more diagnostic console.log calls. These logs make CI output noisy and serve no purpose for the assertions. Remove them, or gate them behind an env flag.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 96c9d867-8c19-4715-b3c6-14afaa643729
📥 Commits

Reviewing files that changed from the base of the PR and between d191386 and 45a97f3.

📒 Files selected for processing (15)
  • .github/workflows/e2e.yml
  • config/scripts/ci-e2e-job-selection.mjs
  • config/scripts/ci-e2e-job-selection.test.mjs
  • config/scripts/pr-e2e-docker-lane-contract.test.mjs
  • config/scripts/pr-e2e-gate-contract.test.mjs
  • config/scripts/pr-e2e-source-routing.mjs
  • src/renderer/src/runtime/web-session-existing-tab-index.ts
  • src/renderer/src/runtime/web-session-tabs-sync-editor-ownership.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync-snapshot-batch.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync/apply-preparation-browser.ts
  • src/renderer/src/runtime/web-session-tabs-sync/mirrored-editor-file-identity.ts
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-files.ts
  • src/renderer/src/runtime/web-session-tabs-sync/tab-builders.ts
  • src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts
  • tests/e2e/ssh-orcad-editor-ownership.spec.ts
💤 Files with no reviewable changes (3)
  • src/renderer/src/runtime/web-session-tabs-sync/state-equality-files.ts
  • src/renderer/src/runtime/web-session-tabs-sync/terminal-surfaces.ts
  • config/scripts/pr-e2e-gate-contract.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

nwparker and others added 2 commits October 8, 2026 22:01
…ersion

A file opened over the relay in the current session carries route provenance,
so the no-host-evidence check repointed its tab to a fresh clean record and
hid the unsaved draft. Keep any retained record with no runtime owner instead.
@OrcaWin
OrcaWin force-pushed the nwparker/remote-editor-duplicate-testing branch from 73e92c0 to 35bb09d Compare October 9, 2026 05:02
@OrcaWin
OrcaWin merged commit 6a15cd8 into main Oct 9, 2026
39 checks passed
BearMett added a commit to BearMett/orca that referenced this pull request Oct 13, 2026
…h a host pin

Since stablyai#26593 the mirror resolver reuses an existing row for the same owner, so a
row restored from the profile keeps its owned editor: id when the host's
snapshot lands; the bare-path id the spec waited for can no longer appear. The
host now pins its tab after the relaunch and the client must show the pin on the
tab backed by its restored row. The ids-seen list is reported at failure time
instead of being captured empty before polling.
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