Repository navigation
Use the maintainer's wording for the approval card footer and drop the Esc hint - #359
Merged
Merged
Conversation
…e Esc hint The approval panel's footer now shows only its sentence, in the maintainer's wording (#356): "This request will be sent to iPhone in 18 s" while an eligible request waits for its send, and "This request expires in 4:59" otherwise, including after the send. When each form applies, and the countdown, do not change. The footer has its own catalog keys; "Expires in %@", shared with the pending-request list and the pairing sheet, is untouched, and the keys left unused are removed. "Esc to decide later" is gone from the panel. Esc still decides later: the panel is now an AgentApprovalPanel, which takes Esc in sendEvent(_:), where AppKit delivers every key event to the window whichever view is first responder, and hands it to the card's decide-later path. A cancel sent up the responder chain (Command-period) does the same. VoiceOver keeps a way to decide later through a "Decide Later" action on the footer, in both languages. Tests cover the strings in both languages, Esc in the production panel with either first responder, and the footer's VoiceOver action. Renders 17-19 show the new footer; ADR 0014's footer strings and the Why that no longer fit are updated.
The Esc test sent Command-Esc through the panel and expected no decision. The panel passes Esc with a modifier on to AppKit, which turns it into cancelOperation(_:) only while the app is active: on the CI runner it is, so the cancel reached the panel and decided later, as that path is meant to. The test now checks that other keys never decide and that the panel's filter rejects Esc with each modifier, which holds whether or not the test process is active.
- A held Esc decides once: the key approval panel swallows Esc repeats, so they never decide the next queued request. The Esc test covers a repeated Esc. - The screenshot flow asserts that Esc closes the real panel, not only that the request stays pending. - AgentApprovalPanel's doc no longer says Command-period always decides later: AppKit sends a responder-chain cancel only while the app is active, which is why the non-activating panel takes Esc in sendEvent. - Test names and messages that still said "Also on iPhone" or "unchanged", and ADR 0014's #350 task entry, are reworded.
Cross adversarial review (#356)GPT-6 Astra xhigh and Opus 5.5 xhigh reviewed head 57c735b read-only, two rounds each. In round 2 each reviewer ruled on the other's report. Neither found a P0 or P1, and neither found a new defect in round 2. Fixed in 71f4720
Declined
Not verified
Renders at 71f4720CI run 43803709873, artifact
Every footer shows only its sentence, with no Esc hint, and fits on one line in both languages. The buttons are where they were. CI at 71f4720All four jobs are green: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #356
Summary
The Mac approval panel's footer shows only its sentence, in the maintainer's wording: "This request will be sent to iPhone in 18 s" / 「18 秒后将把审批请求发到 iPhone」 while an eligible request waits for its send, and "This request expires in 4:39" / 「审批请求将于 4:39 后失效」 after the send and in every other case ("4:59" without an approver). The countdown and when each form applies are unchanged (
RemoteApprovalFooterHintand the coordinator are untouched)."Esc to decide later" is gone from the panel; Esc still decides later. The panel is now
AgentApprovalPanel(anNSPanelsubclass from the existing factory), which takes Esc insendEvent(_:)and calls the card'sfinish(nil). VoiceOver gets a named "Decide Later" / 「稍后处理」 action on the footer.How Esc is wired
NSPanelhosting the card in anNSHostingController. AppKit hands every key event for a window to that window'ssendEvent(_:), whichever view is first responder, so the panel matches Esc there (keyCode 53, without Command, Control, Option or Shift, as.cancelActionmatched it) and callscancel.makeFrozenApprovalPanelsetscanceltohosting.rootView.prompt.finish(nil)through a weak reference to the hosting controller. That is the same decide-later path the old button used, so the request stays pending. The old SwiftUI.keyboardShortcut(.cancelAction)was a key equivalent on a visible control, and removing the control would have removed the shortcut with it.cancelOperation(_:)is overridden to do the same, so Command-period, or any cancel sent up the responder chain, decides later instead of reachingNSPanel's default. This is intended: Esc with a modifier (for example Command-Esc) is not taken insendEvent(_:)and goes on to AppKit, which in an active app may turn it intocancelOperation:. It then decides later as well, the standard macOS cancel behavior. CI's first run showed exactly this.sendEvent/keyDownwas never turned intocancelOperation:, even withisKeyWindowforced to true. Relying on that path could not be proven without showing a window. AcancelOperation:sent from the hosting view (tryToPerform,interpretKeyEvents) does reach the panel, so SwiftUI does not swallow it.testEscInThePanelDecidesLaterbuilds the production panel and sends a synthetic Esc keyDown to it twice, first with the panel and then with the card's hosting view as first responder. Each Esc decides later. "a" doesn't decide; the panel's filter (AgentApprovalPanel.isEscape) rejects Esc with Command, Control, Option or Shift; and acancelOperation:from the hosting view decides later. Modified Esc is checked through the filter rather than sent, because AppKit turns it intocancelOperation:only while the app is active (true on the CI runner, not locally), which then decides later by design. A repeated Esc decides nothing more. End to end,ScreenshotE2ETests.testPendingRequestsAndAccessRecordspresses Esc in the real panel, asserts that the panel closes, and then expects the request in Pending requests (CI's screenshot step).Renders
CI artifact
askkey-remote-approval-renders, production panel, both languages:17-{en,zh}-panel-footer-send-in-18s(before the send, about 18 s; was…-iphone-in-18s)18-{en,zh}-panel-footer-after-send(after the send, 4:39; was…-also-on-iphone)19-{en,zh}-panel-footer-no-approver(4:59)Renders 11 and 12 (Details, footer in the sent state) also show the new wording. The total stays 36 PNGs.
Diff stat
Tests
swift build: passed.swift test --filter AskKeyAppTests: 856 executed, 1 skipped (ManagementWindowSizingTests.testVisibleWindowLifecycleKeepsTheDesignedFrameOnCI, CI-only), 0 failed. +3 tests versusmain(853 by count):testTheFooterDropsTheEscHintAndLeavesTheSharedExpiryWording,testEscInThePanelDecidesLater,testVoiceOverOffersDecideLaterOnTheFooter. The panel-layout test now checks that the top edge stays for all three forms and that every Chinese form is one line.Checks
python3 scripts/check_hygiene.py: passed (all counts 0).python3 scripts/check_module_deps.py: passed.This request will be sent to iPhone in %lld s,This request expires in %@andDecide Later(en, zh-Hans, qps-ploc). Removed keys left unused:iPhone can decide in %lld s,Also on iPhone · Expires in %@andEsc to decide later.Expires in %@is unchanged.Deviations and questions
Sources/AskKeyAppKit/AgentApprovalPanelFactory.swift(theAgentApprovalPanelsubclass) andSources/AskKeyAppKit/App/AppDelegate+Approval.swift(three lines that connectcancelinmakeFrozenApprovalPanel). Without a control on the card, Esc has to be caught by the window. The dispatch asked for a mechanism that fits the panel's real window type rather than a hidden control.NSScrollView-backed nodes appear. The unit test therefore checks the localized action name and the footer's wiring in the source. The screenshot flow finds theapproval-footerelement in the real panel..sentstays a separate state, so the state logic is unchanged.