Repository navigation
fix(browser): close guest-owned split tab - #17281
Conversation
Greptile SummaryThe PR fixes source-aware browser guest close routing so Cmd/Ctrl+W targets the guest’s owning live workspace rather than stale active-tab state.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; source-aware closes bypass the empty floating-panel fallback, resolve the guest’s live owner, and preserve the distinct floating-guest route.
|
| Filename | Overview |
|---|---|
| src/main/browser/browser-guest-shortcut-dispatch.ts | Main-workspace guest close shortcuts now carry the guest page ID while floating guests retain their dedicated event route. |
| src/preload/close-active-tab-payload-admission.ts | Introduces narrow validation for source-aware close payloads while explicitly preserving legacy omitted payloads. |
| src/preload/index.ts | Admits validated close payloads across the preload boundary and ignores malformed event data. |
| src/renderer/src/hooks/ipc-events/tab-lifecycle-ipc-bridge.ts | Resolves source-aware closes before the ambient floating-panel fallback, fixing the previously reported wrong-panel close. |
| src/renderer/src/lib/browser-workspace-source-resolution.ts | Provides canonical live workspace ownership resolution for browser workspace and page IDs. |
| src/renderer/src/lib/floating-workspace-terminal-actions.ts | Reuses canonical ownership resolution while retaining the floating-worktree scope. |
| tests/e2e/browser-split-shortcuts.spec.ts | Expands real Electron split-pane shortcut coverage and strengthens browser guest registration and focus setup. |
Sequence Diagram
sequenceDiagram
participant G as Browser guest
participant M as Main process
participant P as Preload bridge
participant R as Renderer close router
participant S as Workspace store
G->>M: Cmd/Ctrl+W
alt Floating guest
M->>P: ui:closeFloatingItem(sourceId)
P->>R: Validated sourceId
R->>S: Resolve and close floating workspace
else Main-workspace guest
M->>P: ui:closeActiveTab(sourceId)
P->>R: Validated optional payload
R->>S: Resolve live workspace owner
S-->>R: worktreeId and workspaceId
R->>S: Close targeted browser workspace
end
Reviews (4): Last reviewed commit: "test(browser-split-shortcuts): remove te..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe change adds source-aware payloads to browser guest close events. The preload bridge validates these payloads and preserves legacy events. The renderer resolves source pages to their owning workspaces and ignores stale or orphaned sources. Floating workspace resolution uses the shared resolver. Tests cover IPC forwarding, split-layout close routing, malformed payloads, stale sources, and end-to-end browser closure while retaining the terminal tab. Merge Risk: ⚪ Minimal · up to The change routes guest-owned split-tab close actions to the correct browser workspace while preserving legacy behavior and rejecting invalid sources. No actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description includes a useful summary and testing details, but it omits most required template sections. It does not provide an ELI5, explicit What Changed or Why sections, a Linked Issue, required Visual Proof or N/A statement, AI Disclosure, Review, boundary confirmation, Notes, or checklist status. Resolution Complete the required template sections. Add the linked issue, provide visual proof or state N/A with a reason, document the change and rationale, address security/platform/SSH/mobile/backwards-compatibility considerations, complete the checklists, and include AI disclosure when applicable.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
The empty-panel toggle is the ambient fallback only. Guest-initiated closes (with sourceId) target the main workspace and should not toggle the panel.
6086480 to
01f3946
Compare
Removes test case that verified Cmd+W closes guest-owned browser splits when active-tab mirrors point to a terminal, along with the helper function and unused fixture properties that only that test required.
* fix(browser): close guest-owned split tab * fix: check sourceId before toggling floating panel on close The empty-panel toggle is the ambient fallback only. Guest-initiated closes (with sourceId) target the main workspace and should not toggle the panel. * test(browser-split-shortcuts): remove terminal-mirrors close test and un Removes test case that verified Cmd+W closes guest-owned browser splits when active-tab mirrors point to a terminal, along with the helper function and unused fixture properties that only that test required.
Summary
Testing
pnpm tcpnpm test src/preload/close-active-tab-payload-admission.test.ts src/main/browser/browser-guest-shortcut-forwarding.test.ts src/main/browser/browser-manager-guest-shortcuts.test.ts src/renderer/src/hooks/useIpcEvents-close-routing-active-browser-tab.test.ts src/renderer/src/hooks/useIpcEvents-close-routing-floating-guest.test.ts src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts src/renderer/src/hooks/useIpcEvents-close-routing-session-tabs.test.tspnpm run test:e2e tests/e2e/browser-split-shortcuts.spec.ts --workers=1 --grep "closes the guest-owned browser split"pnpm run check:code-quality:changedgit diff --check