Skip to content

Tell the Mac approval card when a request goes to the iPhone - #355

Merged
sudoHG merged 3 commits into
mainfrom
sudoHG/mac-card-iphone-hint-12067b
Nov 16, 2026
Merged

sudoHG merged 3 commits into
mainfrom
sudoHG/mac-card-iphone-hint-12067b

Conversation

@sudoHG

@sudoHG sudoHG commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #350

Summary

The Mac approval panel's footer now shows one moving number at a time (ADR 0014 → "Amendment: iPhone history, tabs and the Mac card hint (#345)"; #344 decision 6):

State English Simplified Chinese
Waiting for the 20-second send: send time ahead, before the deadline, still eligible, and an active approver below its 16-request limit iPhone can decide in 18 s · Esc to decide later 18 秒后 iPhone 也能处理 · Esc 稍后处理
A copy saved to an approver's inbox (Details' "Sent to") is undecided and open Also on iPhone · Expires in 4:39 · Esc to decide later iPhone 也能处理 · 4:39 后失效 · Esc 稍后处理
Anything else: no approver, not eligible, sealing, first send retrying, every approver full, every copy closed, request ended unchanged Expires in 4:59 · Esc to decide later unchanged 4:59 后失效 · Esc 稍后处理
  • DeviceCoordinator.remoteFooterHint(for:) (read-only, DeviceCoordinator+Presentation.swift) reads the track's phase and send time, remoteSendingAllowed, the active approvers and outstandingCount(for:) against maximumOutstandingPerApprover, the same conditions reconcileRemoteRequests / deliverRemoteRequest use. It changes nothing about when or whether a request is sent.
  • The panel's existing 0.25 s privacy check passes the hint into RemoteApprovalPanelState.footer; it is nil once the request left pending, and a lock still closes the panel at once, so the hint never shows on a locked screen.
  • The footer's TimelineView uses RemoteApprovalFooterSchedule, which ticks just after each whole second before the number's anchor (the send time while waiting, otherwise the expiry), so the countdown changes on time, once a second, 20 → 1, with tabular digits. The count goes through AppLanguage.localizedCount.
  • The card's front, Details and buttons are unchanged; each new render asserts that the front and button identifiers equal a plain prompt's.
  • VoiceOver reads the footer as one sentence (ADR 0014): it is one accessibility element labeled with its text and "Esc to decide later", with the button trait and the decide-later action. Mouse clicks and Esc work as before; the visible text and the label come from the same timeline tick.
  • Recording an approver's decision clears the hint at once, so "Also on iPhone" never shows next to "Approved on".

Diff stat

  .../AskKeyAppKit/App/AppDelegate+Approval.swift    |   4 +-
  .../App/FrozenAgentApprovalPrompt.swift            |  37 +++-
  .../App/RemoteApprovalPanelState.swift             |  94 +++++++++-
  .../Devices/DeviceCoordinator+Presentation.swift   |  24 +++
  .../AskKeyAppKit/Resources/Localizable.xcstrings   |  46 +++++
  .../RemoteApprovalFooterHintTests.swift            | 197 +++++++++++++++++++++
  .../AskKeyAppTests/RemoteApprovalFooterTests.swift | 148 ++++++++++++++++
  .../AskKeyAppTests/RemoteApprovalRenderTests.swift |  95 +++++++---
  Tests/AskKeyE2ETests/ScreenshotE2ETests.swift      |   3 +-
  9 files changed, 611 insertions(+), 37 deletions(-)

Tests

  • swift build: passed.
  • swift test --filter AskKeyAppTests: 853 tests, 1 skipped, 0 failed (main 3a735ec: 836, 1 skipped). New: RemoteApprovalFooterTests (6) and RemoteApprovalFooterHintTests (11).
    • Acceptance 1: the footer sentence through waiting (20 → 1, ticks at +0.01 s and +0.99 s of each second), the due-but-unsaved moment, sent and the fallback, on a fixed clock, in both languages; the schedule's ticks; the panel state, including an approver's decision clearing the hint.
    • The real panel follows the hint through the production step path: in English the sent form grows the panel by one line downward with its top edge fixed, so the buttons stay in place; in Chinese every form keeps one line.
    • Acceptance 2: a request decided on the Mac within 20 seconds never gets .sent and nothing is sent; with only an approver-less iPhone the footer is unchanged through 25 s.
    • Amendment cases: sealing, a first send that is retried until saved, every approver at 16 outstanding (and room again after one closes), removing the last approver / an unavailable account / pausing agent access during the wait, a deadline before the send time, one of two copies closed (still .sent), every copy closed, and the iPhone's own decision.
  • Full suite and desktop flows: left to this PR's CI, as AGENTS.md asks.

Renders

RemoteApprovalRenderTests adds six PNGs to the askkey-remote-approval-renders artifact (36 in all, from 30), built through AppDelegate.makeFrozenApprovalPanel like the existing panel renders, with Details collapsed so the whole front shows:

  • 17-en-panel-footer-iphone-in-18s.png, 17-zh-panel-footer-iphone-in-18s.png: before the send, at 18 s.
  • 18-en-panel-footer-also-on-iphone.png, 18-zh-panel-footer-also-on-iphone.png: after the send, 4:39.
  • 19-en-panel-footer-no-approver.png, 19-zh-panel-footer-no-approver.png: unchanged footer when no approver can take the request.

Details renders 11 and 12 (a saved, still open copy) now show the "Also on iPhone" footer; 13 and 14 are unchanged. A footer render that outlasts the number it shows (0.9 s) is taken again.

Checks

  • python3 scripts/check_hygiene.py: passed (size=0, test-support=0, debug=0, local-path=0, non-ascii-name=0, multica=0, cjk=0).
  • python3 scripts/check_module_deps.py: passed.
  • Largest touched source file: AppDelegate+Approval.swift, 496 lines.

Deviations and questions

  • English "Also on iPhone" footer takes two lines. Also on iPhone · Expires in 4:39 · Esc to decide later is about 15 pt wider than the 300-pt card's 268-pt content width at the caption size, so the footer is a ViewThatFits: one line when it fits, otherwise the text and "Esc to decide later" on a line each (render 18-en). The English card therefore grows by one caption line at the moment of the send. Every Chinese form and the other English forms fit on one line. The wording follows the amendment; a shorter English string would avoid the second line if the maintainer prefers.
  • The plural-aware count uses the same key for one and other (iPhone can decide in %lld s), because "s" inflects in neither catalog language; a language that inflects can add plural variations to that key without a code change.
  • Scope extension (approved by the planner): Tests/AskKeyE2ETests/ScreenshotE2ETests.swift:175 now matches "Esc to decide later" with containing: true, because the footer's single VoiceOver label is "Expires in … · Esc to decide later". It was the only exact match on the footer in Tests/ (Tests/UI/required-flows.json has none).
  • VoiceOver behavior (one stop, no announcement per second) is not checked with VoiceOver on a desktop: no local UI runs, and offscreen SwiftUI builds no accessibility tree in swift test.

The approval panel's footer shows one moving number at a time (ADR 0014,
amendment for #345; #344 decision 6). While an eligible request waits for
its 20-second send to an approver with room under the 16-request limit,
it counts down to the send ("iPhone can decide in 18 s"). While a copy
saved to an approver's inbox is outstanding, it says "Also on iPhone ·
Expires in 4:39". Otherwise it is unchanged.

The coordinator gains a read-only accessor for that state, the panel's
privacy check carries it into RemoteApprovalPanelState, and the footer
ticks just after each whole second of the number it shows. A footer too
long for one line puts the text and "Esc to decide later" on a line each.
The card's front, Details, buttons and the sending rules are unchanged.
…ter renders

Recording an approver's decision clears the footer's hint at once, so
"Also on iPhone" never shows next to "Approved on". The footer renders
are taken again when a render outlasts the number it shows, Details
renders 11 and 12 show the saved copy's footer, and a test checks that
the panel follows the hint and that a footer growing to two lines keeps
the panel's top edge, so the buttons stay in place.
ADR 0014 asks VoiceOver to read the footer as one sentence. The footer
is now one accessibility element labeled with its text and "Esc to
decide later", with the button trait and the decide-later action;
mouse and Esc work as before, and the visible text and the label share
one timeline tick. The screenshot flow matches "Esc to decide later"
inside that label (scope extension approved for #350).
@luoji-bot

luoji-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown

Cross review (GPT-6 Astra xhigh + Opus 5.5 xhigh, read-only, two rounds each)

Reviewed head a9341d9; fixes are in 0331cc3 and 84b0ca9. CI run 43746076425 on 84b0ca9 is green on all four jobs: build-and-test 2177 tests, 3 skipped, 0 failed; basic-ui-flows required 18/18 and screenshots 19/19, with captures 12–14 in askkey-basic-ui-evidence; ios-app and release-sdk-window-check also green. askkey-remote-approval-renders has 36 PNGs.

Both reviewers found the coordinator conditions correct: eligibility, the 16-request limit, saved versus unsaved copies, decided and closed copies, and replacements. They also found the timer arithmetic, the lock path, the unchanged card front and the exact Chinese wording correct. No P0.

Fixed

  • P1, both: VoiceOver did not read the footer as one sentence (ADR 0014). The footer is now one accessibility element labeled with its text and "Esc to decide later". It has the button trait and the decide-later action. Mouse and Esc are unchanged. This needed a one-line scope extension, approved by the planner: ScreenshotE2ETests.swift:175 now matches with containing: true. It was the only exact match on the footer in Tests/.
  • P2, both: the render check computed the text before the panel existed. A footer render that takes longer than 0.9 s is taken again. A new test drives the real panel through the production step path: the English sent form grows the panel by one line and keeps its top edge.
  • P3, both: "Also on iPhone" could show next to "Approved on" for up to one 0.25 s check. record now clears the hint.
  • P3, Opus: Details renders 11 and 12 showed a saved copy with the plain footer. They now show "Also on iPhone". Astra called this a better fixture, not a defect.
  • P3, Opus: the tests joined the footer sentence themselves. They now use the production RemoteApprovalFooter.sentence.
  • P3, Opus: the English two-line footer could move the buttons when the copy is saved. Checked offscreen: the panel grows downward by 18 pt with its top edge fixed, so the buttons stay put. The new test above locks this in.

Declined

  • A deadline margin (sendAt + loop interval) for the countdown. Opus withdrew it in round 2, and Astra rejected it. The ADR describes current state, and a margin would hide the hint for requests that can still be sent without covering longer delays.
  • Accessibility-tree assertions in swift test, .updatesFrequently, and a spoken "seconds" label. Offscreen SwiftUI builds no accessibility tree. The polling trait is not evidence of silence. A new spoken string would need the maintainer's approval. Whether VoiceOver announces the ticks still needs a desktop check.
  • AGENTS.md "directing" the review. It is the repository's own rules file, not a PR defect. Both reviewers ignored its workflow steps, and no text in the diff tried to instruct them.

Still open for the maintainer: the English sent form takes two lines on the 300-pt card (render 18-en). A shorter English string would keep it on one line.

@sudoHG
sudoHG merged commit c21c0bb into main Nov 16, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tell the Mac approval card when an unanswered request goes to the iPhone

1 participant