Repository navigation
test: fix the dead-key crash and sidebar AX walk failing on main #14406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -95,8 +95,10 @@ struct SidebarAccessibilityTreeTests { | |
| #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") }) | ||
| // 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. | ||
|
Comment on lines
+98
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -euo pipefail
# Inspect the walk implementation and its traversal behavior.
rg -n -C 12 'SidebarAccessibilityTreeWalk' --glob '*.swift' .Repository: manaflow-ai/cmux Length of output: 5936 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- walk implementation ---'
cat -n cmuxTests/SidebarAccessibilityTreeWalk.swift
printf '%s\n' '--- test setup and assertions ---'
sed -n '1,120p' cmuxTests/SidebarAccessibilityTreeTests.swiftRepository: manaflow-ai/cmux Length of output: 8888 Assert that the walk visits
🐛 Suggested fix `#expect`(walk.visited.contains(ObjectIdentifier(textView)))
`#expect`(walk.visited.contains(ObjectIdentifier(link)))
+ `#expect`(
+ walk.visited.contains(ObjectIdentifier(projectView)),
+ "Accessibility walk must visit the project panel hosting view."
+ )🤖 Prompt for AI Agents |
||
|
|
||
| let updated = SidebarWorkspaceRowSuspensionTests.makeModel( | ||
| customDescription: "Changed https://example.com/updated", workspaceId: model.workspaceId | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Replace the
swapConfigForTestingseam with a shared production config-install path.swapConfigForTestingis a#if DEBUGmember. It is named…ForTesting, and no production code calls it. The repository rule for productionSources/files rejects this pattern.The method also creates a second path that writes
config. That path skips the rules thatperformConfigurationReloadenforces at Lines 2135-2148:ghostty_app_update_config_without_surface_propagationinsidesuppressGhosttyReloadActions. The seam does not. Native reload or config-change actions that the update emits then reachhandleActionwithout suppression.appliedConfigurationContentIdentitytogether withconfig. The seam does not. While a test config is installed, the stored identity describes a different config than the one the app holds.Fix: Move the commit step into one internal production method. Call it from
performConfigurationReload, and call it from tests through@testable import. The app then has one code path that owns config replacement. The first step is to call this method from the reload path; if the dead-key tests still pass, the seam can be deleted.♻️ Proposed refactor
Change the
configurationChangedbranch inperformConfigurationReloadto use the same method:In
cmuxTests/CJKIMEInputTests+DeadKeyComposition.swift, replace bothswapConfigForTestingcalls withcommitConfiguration.As per coding guidelines and path instructions, "fail when the diff violates
.github/review-bot-rules/no-test-debug-seam-in-production-source.md: a#if DEBUG(or other test-build-guarded) extension/member that exposes internal state only for tests … a member named likedebug…/…ForTesting". The Swift architectural rule also flags "A new mutable flag, cache, singleton, observer, or side channel that creates another owner for state already owned by a model".📝 Committable suggestion
🤖 Prompt for AI Agents
Sources: Coding guidelines, Path instructions