Skip to content

Guard: older sessions' moved editor tabs get the right workspace id (tests only) - #30172

Merged
Jinwoo-H merged 1 commit into
mainfrom
e2-6/p7-stale-worktree-id-guard
Oct 18, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
e2-6/p7-stale-worktree-id-guard

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​32
Prod 0 0 0 0

ELI5

Older versions of Orca could save an editor tab with the wrong workspace label after Orca moved that tab to the workspace that owns its file. This PR adds two tests proving that today's code fixes that label when such a saved session is loaded. No app code changes.

What Changed

Tests only (dark, layout-owner build only for the second test's path).

  • Before: a session saved before Keep an editor tab Orca moved to its file's workspace across restart; record editor renames in main (dark) #29930 can hold an editor tab, filed under workspace B, whose own workspace id still says workspace A (where it was before Orca moved it). Nothing pinned what happens to that stale id.
  • After: two tests pin that it is corrected:
    1. The shared session loader and saver: a stored session whose editor tab entry under one workspace names another workspace's id is saved back with the workspace's own id, and loading the saved result reports no further changes.
    2. The window drawn from the main process's layout (the build where the main process owns the layout): after main's first snapshot, the window's editor tab carries the workspace's own id.

Both tests fail if the saver stops writing the workspace's own id on tab bar entries (checked by temporarily changing that line).

Why

Upcoming work moves more of the layout into the main process. These tests make sure old saved sessions keep loading correctly through that path before it changes. Adding a load-time repair was considered, but the saver already writes the right id, so a test is enough.

Linked Issue

N/A (internal follow-up to #29930)

Visual Proof

N/A: tests only, no behaviour change.

Testing

  • Automated tests added
  • pnpm tc: pass
  • pnpm run check:code-quality:changed: pass (0 new findings)
  • layout-writer and focus-read ratchets: OK
  • pnpm run audit:anti-slop: pass
  • vitest (--maxWorkers=4): src/shared/workspace-layout, the window frame sync test and the restored editor restart test, 37 files, 318 tests pass
  • No product file changed (2 test files, +33/-1). The shipped bundle is unaffected.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Tests only: no security, platform, SSH, mobile, compatibility or performance impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…space's id on save and from the first frame

Sessions saved before #29930 can hold a moved editor tab whose
worktree id still names the workspace it came from. Pin that the
saver writes the workspace's own id and that the window's tab carries
it after main's first snapshot. Tests only.
@coderabbitai

coderabbitai Bot commented Oct 18, 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: c5e473bf-482e-408b-9b33-a0e6252a7c6b
📥 Commits

Reviewing files that changed from the base of the PR and between af056df and 281e419.

📒 Files selected for processing: 2
  • src/renderer/src/runtime/workspace-layout-frame-sync.test.ts
  • src/shared/workspace-layout/workspace-layout-load-normalization.test.ts

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

📝 Walkthrough

The change adds regression tests for editor entries whose saved worktreeId differs from the ID of the workspace containing them. The tests check correction during session load and save, and during startup frame synchronization. They also check that entries in the workspace use its ID and that reloading a saved session reports no changes.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 281e4

This change adds regression coverage without changing shipped behavior; both tests check that moved editor tabs receive the containing workspace ID during saving and startup synchronization, leaving no specific merge risk.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: tests that guard the workspace ID for editor tabs moved in older sessions. It is concise and specific.
Description check Passed The description is complete and aligned with the template. It explains the problem, test changes, rationale, linked issue context, lack of visual changes, validation results, scope, and checklist stat…
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: Description check

Explanation

The description is complete and aligned with the template. It explains the problem, test changes, rationale, linked issue context, lack of visual changes, validation results, scope, and checklist status.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · 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.

@Jinwoo-H
Jinwoo-H merged commit b9b1b85 into main Oct 18, 2026
31 checks passed
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