Repository navigation
Fix cross-window theme background gating after jump-to-unread - #861
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughA new static helper method Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryFixed race condition where background updates during cross-window workspace transitions (e.g.,
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 68aed1e |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
cmuxTests/GhosttyConfigTests.swift (1)
707-722: Consider one extra edge-case assertion for nilsurfaceTabIdwith non-nil selections.You already assert permissive behavior with no selection context; adding this variant would fully lock in the early-return contract when
surfaceTabIdis absent.➕ Suggested test addition
XCTAssertTrue( GhosttyNSView.shouldApplyWindowBackground( surfaceTabId: nil, owningSelectedTabId: nil, activeSelectedTabId: nil ) ) + XCTAssertTrue( + GhosttyNSView.shouldApplyWindowBackground( + surfaceTabId: nil, + owningSelectedTabId: UUID(), + activeSelectedTabId: UUID() + ) + )🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmuxTests/GhosttyConfigTests.swift` around lines 707 - 722, Add a third assertion to testShouldApplyWindowBackgroundAllowsWhenNoSelectionContext that verifies GhosttyNSView.shouldApplyWindowBackground returns true when surfaceTabId is nil but owningSelectedTabId and/or activeSelectedTabId are non-nil; specifically call GhosttyNSView.shouldApplyWindowBackground(surfaceTabId: nil, owningSelectedTabId: UUID(), activeSelectedTabId: nil) and optionally surfaceTabId: nil, owningSelectedTabId: nil, activeSelectedTabId: UUID(), asserting XCTAssertTrue for each to lock in the early-return behavior when surfaceTabId is absent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Sources/GhosttyTerminalView.swift`:
- Around line 2998-3005: The current flatMap collapses "no owning tab manager"
and "owning tab manager exists but its selectedTabId is nil" into the same nil
owningSelectedTabId; change the lookup to first get the owning manager (e.g. let
owningTabManager = tabId.flatMap { appDelegate?.tabManagerFor(tabId: $0) }) and
then derive owningSelectedTabId = owningTabManager?.selectedTabId, and pass both
owningSelectedTabId and an explicit owningManagerExists flag (owningTabManager
!= nil) into shouldApplyWindowBackground (update the shouldApplyWindowBackground
signature/call to accept the new flag) so the logic can distinguish missing
manager vs nil selection when deciding same-window updates.
---
Nitpick comments:
In `@cmuxTests/GhosttyConfigTests.swift`:
- Around line 707-722: Add a third assertion to
testShouldApplyWindowBackgroundAllowsWhenNoSelectionContext that verifies
GhosttyNSView.shouldApplyWindowBackground returns true when surfaceTabId is nil
but owningSelectedTabId and/or activeSelectedTabId are non-nil; specifically
call GhosttyNSView.shouldApplyWindowBackground(surfaceTabId: nil,
owningSelectedTabId: UUID(), activeSelectedTabId: nil) and optionally
surfaceTabId: nil, owningSelectedTabId: nil, activeSelectedTabId: UUID(),
asserting XCTAssertTrue for each to lock in the early-return behavior when
surfaceTabId is absent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 32ebba68-01c8-45d9-951d-58e7bf271d5c
📒 Files selected for processing (2)
Sources/GhosttyTerminalView.swiftcmuxTests/GhosttyConfigTests.swift
|
Addressed CodeRabbit feedback in f303a8e:
Validation rerun:
|
…ow-ai#861) * Fix cross-window theme background gating * Handle owning-manager nil-selection theme edge case * Simplify window background gating helper
Summary
Fix a window-background/theme mismatch that can occur when jumping to unread activity across windows (
Cmd+Shift+U).GhosttyNSView.applyWindowBackgroundIfActive()previously gated updates using the globally activeTabManagerselection, which can be stale during cross-window workspace transitions.This change makes gating selection-aware per owning window:
selectedTabIdwhen availableRegression tests
Added
WindowBackgroundSelectionGateTestsfor:Validation
xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux -configuration Debug -destination 'platform=macOS' buildxcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug -destination 'platform=macOS' -only-testing:cmuxTests/WindowBackgroundSelectionGateTests testscripts/codex-review.sh /Users/lawrencechen/fun/cmuxterm-hq/worktrees/task-workspace-theme-reconciliation(0 findings)Summary by cubic
Fixes a window background/theme mismatch when jumping to unread across windows. Gating now prefers the owning window’s selected tab, allows temporary nil selections, and is centralized in a helper for clearer logic and tests.
Written for commit 18bc760. Summary will update on new commits.
Summary by CodeRabbit
Tests
Refactor