From b1ee3ac14592766e360284fced6e59cd12a9fbd1 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 16:58:57 -0700 Subject: [PATCH 1/2] test: a closed sidebar row may park hidden in the list Lawrence's 5763d7372701 parks a recycled row view hidden in place instead of removing it, so SidebarInsertWhileDisplayAsleepTests' two superview == nil checks failed on base on display hosts. A completed close is now: out of the list or hidden. Co-Authored-By: Claude Opus 5.5 --- .../SidebarInsertWhileDisplayAsleepTests.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift b/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift index 7ea47eeb1f9e..e89dc327b4e5 100644 --- a/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift +++ b/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift @@ -44,6 +44,10 @@ struct SidebarInsertWhileDisplayAsleepTests { return (model, sidebar, window) } + /// A closing row whose completion ran: the list recycled it, which parks it hidden in place + /// (dea9671b35d5/5763d7372701) or, out of the list, takes it out. + private static func recycled(_ row: SidebarRowView) -> Bool { row.superview == nil || row.isHidden } + /// Shows the workspaces `ids` (the selection stays, so new rows open with motion) and /// returns the last one's row. private static func show(_ ids: [Int], in model: SidebarModel, _ sidebar: SidebarView) throws -> SidebarRowView { @@ -100,7 +104,7 @@ struct SidebarInsertWhileDisplayAsleepTests { // No frame draws from here: what was moving must be final now. #expect(opening.alphaValue == 1, "the opening row stopped at alpha \(opening.alphaValue)") #expect(opening.frame.height > 0, "the opening row stopped at height \(opening.frame.height)") - #expect(leaving.allSatisfy { $0.superview == nil }, "the closing row stays in the list: its completion never ran") + #expect(leaving.allSatisfy(Self.recycled), "the closing row stays in the list: its completion never ran") } /// A change replayed at sleep never puts back what a newer reload changed: here the rows a @@ -160,7 +164,7 @@ struct SidebarInsertWhileDisplayAsleepTests { _ = try Self.show([1, 3, 4], in: model, sidebar) try await Task.sleep(for: .seconds(1.5)) - #expect(leaving.allSatisfy { $0.superview == nil }, "the closed row stays in the list: its completion was dropped") + #expect(leaving.allSatisfy(Self.recycled), "the closed row stays in the list: its completion was dropped") } /// The look with the display awake is unchanged: the new row still opens with motion. From ddcce19984717259c7b1678a231c41bcaffd47b7 Mon Sep 17 00:00:00 2001 From: Leo Li Date: Wed, 14 Oct 2026 21:49:43 -0700 Subject: [PATCH 2/2] test: count only a closing row still shown as leaving A row recycled at once now stays parked hidden in the list, so without this the setup would pass for a close that skipped its motion. Co-Authored-By: Claude Opus 5.5 --- .../SidebarInsertWhileDisplayAsleepTests.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift b/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift index e89dc327b4e5..dd6ae78c8abe 100644 --- a/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift +++ b/Packages/macOS/CmuxNext/Tests/CmuxNextAppTests/SidebarInsertWhileDisplayAsleepTests.swift @@ -92,7 +92,7 @@ struct SidebarInsertWhileDisplayAsleepTests { let opening = try Self.show([1, 3, 4], in: model, sidebar) let shown = Set(list.rowViews.values.map(ObjectIdentifier.init)) let leaving = list.subviews.compactMap { $0 as? SidebarRowView } - .filter { before.contains(ObjectIdentifier($0)) && !shown.contains(ObjectIdentifier($0)) } + .filter { before.contains(ObjectIdentifier($0)) && !shown.contains(ObjectIdentifier($0)) && !Self.recycled($0) } try #require(opening.alphaValue < 1, "the new row appeared in one frame with the display awake") try #require(leaving.count == 1, "the removed row did not stay to close its slot") @@ -159,7 +159,7 @@ struct SidebarInsertWhileDisplayAsleepTests { _ = try Self.show([1, 3], in: model, sidebar) let shown = Set(list.rowViews.values.map(ObjectIdentifier.init)) let leaving = list.subviews.compactMap { $0 as? SidebarRowView } - .filter { before.contains(ObjectIdentifier($0)) && !shown.contains(ObjectIdentifier($0)) } + .filter { before.contains(ObjectIdentifier($0)) && !shown.contains(ObjectIdentifier($0)) && !Self.recycled($0) } try #require(leaving.count == 1, "the removed row did not stay to close its slot") _ = try Self.show([1, 3, 4], in: model, sidebar)