Skip to content

fix(e2e): wait for terminal remount after golden worktree switch - #21837

Merged
nwparker merged 1 commit into
mainfrom
fix/golden-worktree-switch-remount
Sep 20, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/golden-worktree-switch-remount

Conversation

@nwparker

@nwparker nwparker commented Sep 20, 2026 •

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

Problem

Mac release-cut golden creates a worktree, keeps its terminal isolated, and switches back failed with Active terminal PaneManager did not finish mounting. The sidebar aria-current update can land before activeWorktreeId and the original worktree's PaneManager remount.

A sibling golden also remounted Landing on mac after closing the left sidebar (terminal.cols stayed 0).

Fix

  • After switching back, wait for the store worktree id and ensureTerminalVisible before waiting on the PaneManager.
  • After closing sidebars in the sibling file-link golden, re-assert the source worktree and the terminal tab.
  • Restore golden-worktree-create-switch.spec.ts from the workflow ref so older cut SHAs pick up the harness.

Linux and Windows goldens on the cut already passed; only mac hit this.

Mac release goldens failed after switching back to the original worktree:
sidebar aria-current landed while the store still pointed at the child tab,
so waitForActiveTerminalManager timed out. Wait for activeWorktreeId, force
the terminal tab visible, and restore this spec from the workflow ref so
older cut SHAs pick up the harness.
@coderabbitai

coderabbitai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: bd79b7b3-dd00-4d1c-9ddc-c08429a53c97

📥 Commits

Reviewing files that changed from the base of the PR and between 3cadcab and ef80544.

📒 Files selected for processing (4)
  • .github/workflows/release-cut.yml
  • config/scripts/release-e2e-dispatch-contract.test.mjs
  • tests/e2e/golden-terminal-file-link.spec.ts
  • tests/e2e/golden-worktree-create-switch.spec.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The golden tests now restore the expected active worktree after sidebar closure and wait for store activation and terminal visibility during worktree switching. The release workflow also restores the worktree-switching golden spec from the workflow ref, and its contract test verifies that command.

Priority: ⬇️ Low

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the failure and fix, but it omits several required template sections, including the linked issue, visual proof or an explicit N/A explanation, testing checklist details, AI di… Add the missing required sections. Include a linked issue after “Fixes #”, provide before-and-after visual proof or write N/A with a reason, complete the testing checkboxes and list verification steps and platforms, complete the AI Disclo…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: waiting for terminal remount completion after a golden worktree switch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 3…
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 explains the failure and fix, but it omits several required template sections, including the linked issue, visual proof or an explicit N/A explanation, testing checklist details, AI disclosure, review, boundary, notes, and the final checklist.

Resolution

Add the missing required sections. Include a linked issue after “Fixes #”, provide before-and-after visual proof or write N/A with a reason, complete the testing checkboxes and list verification steps and platforms, complete the AI Disclosure section, address Review and the agent skill boundary, add Notes covering compatibility concerns, and complete the final checklist.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

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.

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

ℹ️ No critical issues — one minor comment/behaviour mismatch inline.

Reviewed changes

  • Golden worktree-switch remount wait — after clicking back to the original worktree, poll the store for the original activeWorktreeId and call ensureTerminalVisible before waiting on the PaneManager, so the isolation assertion runs against the remounted tab.
  • File-link sidebar-close recovery — after closing the sidebars, re-assert the source worktree and terminal before the terminal.cols > 120 poll, guarding against the mac CI drop that remounts Landing.
  • Release-cut harness restore — adds golden-worktree-create-switch.spec.ts to the workflow-ref restore list and pins it in the dispatch-contract test.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Comment on lines +253 to +257
// Why: closing the left sidebar can drop activeWorktreeId on mac CI,
// which remounts Landing and leaves terminal.cols at 0.
if (state && state.activeWorktreeId !== sourceWorktreeId) {
state.setActiveWorktree(sourceWorktreeId)
}

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.

This guard reads the state snapshot captured before setSidebarOpen/setRightSidebarOpen, so it evaluates the pre-close activeWorktreeId and cannot observe a drop caused by the close — the ensureTerminalVisible call below is what actually recovers. Consider re-reading window.__store.getState() after the setters, or adjusting the comment, so the stated rationale matches the behavior.

@nwparker
nwparker merged commit 72d61c4 into main Sep 20, 2026
37 checks passed
@nwparker
nwparker deleted the fix/golden-worktree-switch-remount branch September 20, 2026 21:28
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