From 724d910a0ecc3f05527a3aebdf85da658394c8ab Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Fri, 25 Sep 2026 05:08:19 -0700 Subject: [PATCH] test: restore #14406's sidebar AX walk assertion lost in the #14408 squash #14406 removed the project-panel Context.swift text assertion because SwiftUI does not vend the LazyVStack rows to the AX tree in the app host with no assistive client attached. The #14408 squash (63a6e63) resolved its conflict back to the older wait-for-rows version, so the walk waits the full 5 s and then fails (seen on app-host shard 6 of an unrelated PR). Restore #14406's version; the cycle and depth checks still cover the panel's hosting view. Co-Authored-By: Claude Opus 5.5 (1M context) --- cmuxTests/SidebarAccessibilityTreeTests.swift | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/cmuxTests/SidebarAccessibilityTreeTests.swift b/cmuxTests/SidebarAccessibilityTreeTests.swift index 333da58569d7..29516150b1f7 100644 --- a/cmuxTests/SidebarAccessibilityTreeTests.swift +++ b/cmuxTests/SidebarAccessibilityTreeTests.swift @@ -89,24 +89,16 @@ struct SidebarAccessibilityTreeTests { "A row text field must expose only its own link elements, never AppKit cell aliases." ) - // NSHostingView publishes the project panel's LazyVStack rows to the - // accessibility tree only after SwiftUI's own render pass, which runs on - // a later main-loop turn than the AppKit layout above. Walk until it has. var walk = SidebarAccessibilityTreeWalk() - _ = await AppKitTestEventPump().waitUntil(timeout: .seconds(5)) { - walk = SidebarAccessibilityTreeWalk() - walk.visit(window) - return walk.cycle != nil || walk.textValues.contains { $0.contains("Context.swift") } - } + walk.visit(window) #expect(walk.cycle == nil, "Accessibility children must not point back to an ancestor: \(walk.cycle ?? [])") #expect(walk.maxDepth < 256, "Accessibility walk exceeded the safety depth: \(walk.maxDepth)") #expect(walk.visited.contains(ObjectIdentifier(textView))) #expect(walk.visited.contains(ObjectIdentifier(link))) - // NSHostingView can be ignored in the AX tree; verify its rendered content. - #expect( - walk.textValues.contains { $0.contains("Context.swift") }, - "Project panel text missing from the AX walk: \(walk.textValues.sorted())" - ) + // The walk still descends into the project panel's NSHostingView, so the + // cycle and depth checks cover it. Its SwiftUI rows are not asserted: + // with no assistive client attached, SwiftUI does not vend them in the + // app host, and the walk only ever saw the sidebar row's text. let updated = SidebarWorkspaceRowSuspensionTests.makeModel( customDescription: "Changed https://example.com/updated", workspaceId: model.workspaceId