test: target local Undo at the editable responder and name the refusing focus gate - #13736
teamleaderleo wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository: manaflow-ai/cmux/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Triage note — no overlap found with any other open PR, but this branch is currently unmergeable against its own base ( Checked for duplicates because #13643, #13736, #13744, #13427 and #13414 all read as "app-host test wiring" from the outside. They are not competing:
One cross-reference worth having: #13744 names Also relevant to #13643 landing at all: |
…ng focus gate Reconciled onto fix/app-host-green after a682c55 and manaflow-ai#13759 landed. Dropped: the `TerminalNotificationDirectInteractionTests` portal-owner change. a682c55 ("test: give standalone terminal fixtures a live portal authority") is the same fix for the same three tests, through a `makeLivePortalWorkspace()` fixture instead of `TerminalPortalTestWorkspace`. Two fixtures granting the same portal authority to the same three surfaces is one too many, so this branch no longer touches cmuxTests/TerminalAndGhosttyTests.swift at all. Kept: `terminalHostedEditableResponderKeepsLocalUndo` targets its Cmd+Z menu item at the editable responder. A nil-targeted menu action resolves through `NSApp.keyWindow`, which is nil while the headless host is inactive, so `performKeyEquivalent` returned true while `undo:` reached no responder. The contract under test is cmux's routing -- the menu handles Cmd+Z and the terminal sees no menu miss -- not AppKit target resolution. The sibling `terminalDeclinedUndoCommandFallsBackToTerminalKeyDownWithoutLocalUndo` keeps its nil target and its `undoCallCount == 0` expectation. Kept: the focus-gate diagnostic. manaflow-ai#13759's reconciliation dropped its `MainWindowKeyStatusPin` for 87a7016's `NSApp.activate(ignoringOtherApps:)`, but that remedy lives inside `focusTerminalForTesting`, and none of `automaticApplyDoesNotBypassHiddenTinyFirstResponderDeferral`, `findTerminalRestorePreservesHiddenTinyFirstResponderDeferral` or `testTerminalFirstResponderFeedbackPreservesActiveFocusTransaction` calls that helper -- they build `KeyStatusTestWindow` directly. `applyFirstResponderIfNeeded` gates on `isActive`, `isVisibleInUI`, hidden/geometry, `window.isKeyWindow`, the focus target, the keyboard-focus coordinator and the command palette, and on none of them does app activation bear. So the base has not addressed these three, and their assertions still need to name the gate that refused. The summary now also prints `windowIsKey` and `appActive`, so the next run says whether key status was real or only `KeyStatusTestWindow`'s override. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e44deeb to
c711ef0
Compare
|
Parked — Thornquay 💠 (triage, 2026-09-23). Base |
|
Closing this stale stack in favor of fresh-main replacements. The independent Cmd+Z harness fix is lifted as #13989. The hidden/tiny focus failures this branch instrumented are being repaired and re-run on the macOS 26 PR lane in #13988; that work uses the concrete |
Reconciled onto
fix/app-host-greenat 938dbab. Two things landed underneath this branch and the scope shrank accordingly.Dropped: the
TerminalNotificationDirectInteractionTestsportal owner. a682c55 ("test: give standalone terminal fixtures a live portal authority") is the same fix for the same three tests —testKeyDownRecoveryDoesNotReplayFocusAfterResponderMovesAway,testVisibilityRestoreRefreshesSurfaceWhileTerminalIsInactive,testDirectFirstResponderFocusRefreshesCursorStateAfterForeignResponder— reaching the sameWorkspace.portalRenderingEnabled(for:)authority through a privatemakeLivePortalWorkspace()fixture instead of the sharedTerminalPortalTestWorkspace. Two fixtures granting the same authority to the same three surfaces is one too many, and the base's is the one that shipped. This branch no longer touchescmuxTests/TerminalAndGhosttyTests.swiftat all; that was the only conflicting file.Kept:
WindowKeyDownReplayGuardTests.terminalHostedEditableResponderKeepsLocalUndo. Its Cmd+Z menu item now targets the editable responder. A nil-targeted menu action resolves throughNSApp.keyWindow, which is nil while the headless host is inactive, soperformKeyEquivalentreturned true whileundo:reached no responder. The contract under test is cmux's routing — the menu handles Cmd+Z and the terminal sees no menu miss — not AppKit target resolution. The siblingterminalDeclinedUndoCommandFallsBackToTerminalKeyDownWithoutLocalUndokeeps its nil target and itsundoCallCount == 0expectation, so the negative case is unchanged. Nothing on the base touches this file.Kept, with the premise restated: the focus-gate diagnostic. The original description built on #13672's key-status pin, and #13759's own reconciliation dropped that pin (a
MainWindowKeyStatusPinswizzle ofNSWindow.isKeyWindow) in favour of 87a7016'sNSApp.activate(ignoringOtherApps:). That reads like it supersedes this work. It does not, for these three tests:AppDelegate.focusTerminalForTesting. None ofautomaticApplyDoesNotBypassHiddenTinyFirstResponderDeferral,findTerminalRestorePreservesHiddenTinyFirstResponderDeferralortestTerminalFirstResponderFeedbackPreservesActiveFocusTransactioncalls that helper — they build aKeyStatusTestWindowdirectly, so key status was already pinned true for them before and after.applyFirstResponderIfNeededgates onisActive,surfaceView.isVisibleInUI, hidden/geometry,window.isKeyWindow, the focus target match,allowsTerminalKeyboardFocusandisCommandPaletteEffectivelyVisible. App activation bears on none of them;NSApp.isActiveappears in that file only as adebugRenderStatsfield.So the cause is still unnamed and the assertions still need to say which gate refused.
terminalFocusGateSummarynow also printswindowIsKeyandappActive, so the next run says whether key status was real or onlyKeyStatusTestWindow's override — the one place the base's activation change could plausibly change the answer.Verified:
scripts/check-test-determinism.py(0 findings),tests/test_ci_pbxproj_test_wiring.sh(18/18),scripts/ci/validate_test_execution_registry.py(223 tests), andswiftc -parseon all four changed files. No pbxproj change, so no normalization needed. Not verified: no app-host build or test run was performed locally — a fullxcodebuild testof the cmux app target is not feasible here, so the claim that these tests now pass rests on CI, not on anything I ran.🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.