Skip to content

fix(selection): surface macOS Finder AppleScript errors instead of returning [] - #1085

Merged
Xoshbin merged 1 commit into
mainfrom
fix/finder-applescript-error-handling
Nov 19, 2026
Merged

Xoshbin merged 1 commit into
mainfrom
fix/finder-applescript-error-handling

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner
  • Extract interpret_finder_script_output in selection/platform/macos.rs
    so empty Finder selections (-2753 / -2763) still return Ok(vec![]) while
    other osascript failures (such as -1743 Automation permission denials)
    return Err(SelectionError::OperationFailed) with trimmed stderr or exit status.
  • Use extractErrorMessage in SelectionService.throwSelectionError so
    serialized Rust Diagnostic errors surface developerDetail instead of
    [object Object].
  • Add unit tests for interpret_finder_script_output and SelectionService.

#1074

What changed

  • Before (issue / current behavior):
  • After (fix / new behavior):

Affected areas

  • Launcher UI / UX (visuals, interactions, keyboard shortcuts, settings)
  • SDK / Extensions (asyar-sdk, extension runtime, IPC contracts, manifest)
  • Rust Backend / Platform (Tauri commands, search, storage, OS integration)
  • Docs / Tooling / Other (docs, CI, build scripts, locales)

Manual smoke test & Validation

  • I manually smoke-tested this in the running app (pnpm dev) and visually verified the fix/feature works.

AI usage

  • AI tools helped produce this change.
  • I ran the asyar-contribution skill (.agents/skills/asyar-contribution/SKILL.md), followed it, and reviewed every generated line.

Boundaries

  • Zero-hardcoded-strings i18n policy respected (if UI strings were added/changed).
  • Third-party extension compatibility preserved (no breaking changes to published extension contracts without deprecation/boundary adapter).
  • Hot paths remain fast and unblocked (window reveal, keystroke search, and 120 FPS UI responsiveness).
  • pnpm check:ci (or the relevant inner-loop checks) passes locally.

Summary by CodeRabbit

  • Bug Fixes
    • Improved macOS selection handling so certain Finder errors are treated as an empty selection, while other failures provide clearer error details.

…turning []

- Extract `interpret_finder_script_output` in `selection/platform/macos.rs`
  so empty Finder selections (-2753 / -2763) still return Ok(vec![]) while
  other osascript failures (such as -1743 Automation permission denials)
  return Err(SelectionError::OperationFailed) with trimmed stderr or exit status.
- Use `extractErrorMessage` in `SelectionService.throwSelectionError` so
  serialized Rust `Diagnostic` errors surface `developerDetail` instead of
  `[object Object]`.
- Add unit tests for `interpret_finder_script_output` and `SelectionService`.
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The macOS Finder selection path now distinguishes known empty-selection errors from other failures. The selection service extracts diagnostic text when it converts rejected requests into SelectionError instances.

Changes

Finder Selection Errors

Layer / File(s) Summary
Interpret Finder output
asyar-launcher/src-tauri/src/selection/platform/macos.rs
Successful output is parsed into nonempty lines. Errors containing -2753 or -2763 produce an empty selection. Other errors produce OperationFailed with trimmed stderr or, when stderr is empty, the trimmed exit status. Tests cover these outcomes.
Preserve selection error diagnostics
asyar-launcher/src/services/selection/selectionService.ts, asyar-launcher/src/services/selection/selectionService.test.ts
throwSelectionError uses extractErrorMessage instead of String(error). A test checks that a rejected Rust diagnostic produces an OPERATION_FAILED error with the diagnostic’s developerDetail as its message.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 2436f

This change makes Finder selection errors clearer. Empty selections still return no items, while permission and other failures now surface a readable message. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the two things the PR changes: macOS Finder AppleScript error handling (no longer returning an empty list for failures) and the selection module. The objectives say Finder errors -2753…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title names the two things the PR changes: macOS Finder AppleScript error handling (no longer returning an empty list for failures) and the selection module. The objectives say Finder errors -2753 and -2763 still yield an empty selection, while other osascript failures now return OperationFailed. The title's 'surface ... errors instead of returning []' describes the main behavior change. It does not mention the SelectionService change that uses extractErrorMessage, but the title does not need to cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 294e91e and 2436f3b.

Files selected for processing: 3

  • asyar-launcher/src-tauri/src/selection/platform/macos.rs
  • asyar-launcher/src/services/selection/selectionService.test.ts
  • asyar-launcher/src/services/selection/selectionService.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@Xoshbin
Xoshbin merged commit da8a158 into main Nov 19, 2026
13 checks passed
@Xoshbin
Xoshbin deleted the fix/finder-applescript-error-handling branch November 19, 2026 10:00
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.

1 participant