fix(dialog): propagate hotkey failures in Go-to-Folder navigation#206
fix(dialog): propagate hotkey failures in Go-to-Folder navigation#206SebTardif wants to merge 3 commits into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 1, 2026, 3:14 PM ET / 19:14 UTC. Summary Reproducibility: yes. at source level: current main discards the two throwing hotkey calls and then types and submits the path. I did not establish a live file-dialog reproduction with an induced production Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Production dialog navigation should stop before typing or submitting when Go-to-Folder hotkey synthesis fails, backed by production-path proof or focused regression coverage. Do we have a high-confidence way to reproduce the issue? Yes at source level: current main discards the two throwing hotkey calls and then types and submits the path. I did not establish a live file-dialog reproduction with an induced production Is this the best way to solve the issue? Yes for the production code: changing the two critical hotkey calls to AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against b0184ad3ef88. Label changesLabel justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Indent main() body to match repository SwiftFormat 4-space indentation convention (was at column 1). Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
496ffb1 to
e201d16
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
Summary
navigateViaGoToFolder()inDialogService+FileDialogNavigation.swiftusestry?on two critical input-synthesis calls: Cmd+Shift+G (open Go-to-Folder sheet) and Cmd+A (select existing text). If either hotkey fails, the error is silently discarded and the method continues, typing the directory path into whatever field currently has focus and pressing Return.Problem
When
InputDriver.hotkeyfails for Cmd+Shift+G (line 212), the Go-to-Folder sheet never opens. The method then:try?)Without the Go-to-Folder sheet, these keystrokes act on the main dialog, potentially navigating to a wrong location or triggering an unintended action. All three callers (lines 145, 175, 183) use
try await, expecting errors to propagate.Fix
Replace
try?withtryon both hotkey calls. The method already declaresasync throws, and all three callers already handle thrown errors viatry await. Adjacent calls in the same method (typeTextValueat line 220,tapKeyat line 221) already usetry.Origin
Introduced in commit
abf29e33(Peter Steinberger, 2026-05-07, "refactor(dialog): split file dialog helpers"). Thetry?was likely carried over from a different context during the refactoring. Present for 54 days.Related
try?swallowing bug class inWatchCaptureSession+Loop.swiftDaemonLaunchPolicy.swiftdaemon poll loopsSpeech.swiftrecorder observerReal behavior proof
Behavior addressed:
try?on Cmd+Shift+G and Cmd+A hotkeys innavigateViaGoToFolder()silently discards input-synthesis failures. If the Go-to-Folder sheet fails to open, the method types the path into the wrong field and submits the dialog. The unfixed pattern executes 4 dangerous steps (wait, select-all, type path, press Return) against the main dialog instead of the Go-to-Folder sheet.Real environment tested: macOS 15.5, Swift 6.3.3 (swiftlang-6.3.3.1.3), built from patched source on
fix/dialog-hotkey-cancellationbranch.Exact steps or command run after this patch:
Evidence after fix: terminal output from the standalone error-propagation proof:
Fix verified in source (both hotkey calls now use
tryinstead oftry?):Line 158 is a separate best-effort call in the path-text-field fallback (not part of this fix). Lines 212 and 218 now propagate errors.
Observed result after fix: The unfixed pattern completes silently after a hotkey failure, executing 4 steps (wait for phantom sheet, select-all in wrong context, type path, submit) against the main dialog. The fixed pattern throws immediately on hotkey failure, executing 0 subsequent steps. The caller receives the error and can retry or report, instead of silently submitting the path to the wrong UI element.
What was not tested: Live macOS Accessibility UI automation with an active file dialog (requires accessibility permissions and a running application with an open NSSavePanel/NSOpenPanel). The standalone proof script reproduces the exact control flow and error propagation semantics of the production method without requiring Accessibility entitlements.