Skip to content

Guard macOS-only desktop actions / 限制 macOS 专属操作的平台范围 - #19

Merged
VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/macos-action-guards
Sep 19, 2026
Merged

VallierDev merged 1 commit into
VallierDev:mainfrom
eerraa:fix/macos-action-guards

Conversation

@eerraa

@eerraa eerraa commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

English · 简体中文

English

Do not offer or automatically invoke macOS-only desktop actions on Windows/Linux. Keep the working macOS paths instead of introducing a second IDE-automation implementation.

Problem

IDE auto-reload, quarantine repair, and native switch notifications rely on AppleScript/System Events or xattr, but their controls and some callers are not restricted to macOS. A saved auto_reload_ide=true can also invoke the unsupported path after a manual account switch, even without another click on the toolbar option.

The failure is at the operating-system boundary; it does not require changing the account-switching algorithm.

Conservative fix

  • Disable the unsupported controls outside macOS and label IDE reload/quarantine repair accordingly. Do not erase the stored preferences, so using the same configuration on macOS can retain them.
  • Guard both frontend reload call sites, and return an explicit unsupported-platform error from native reload/repair entry points before launching platform tools.
  • Guard the two AppleScript notification call sites. The entire proxy.rs diff is those two conditions; request forwarding, account selection, retries, and switching logic are not edited.

Although the changes touch 9 files, the complete diff is +69/−12 lines, including tests: the same platform boundary must be enforced at the controls, callers, and native entry points. This does not implement Windows IDE automation, add terminal/process-control behavior, alter proxy configuration, or add dependencies/localization.

Verification

Local Windows validation at head fd64365 passed:

npm run build
node --test scripts/platform-guards.test.mjs
cargo test --locked --manifest-path src-tauri/Cargo.toml --lib ide_control::tests

The 2 frontend contract tests cover platform classification and both reload call sites. The native Windows test confirms unsupported actions return before launching tools. No running IDE or installed-app state was changed. This is guard coverage, not a claim that macOS automation was exercised on a live desktop.

Independent review: one commit directly on upstream main (f64a44a); no other split PR is required. The intended result is an honest unsupported state on other platforms, not a replacement for the existing macOS functionality.


简体中文

在 Windows/Linux 上不要展示为可用或自动调用 macOS 专属操作;保留现有 macOS 路径,不另起一套 IDE 自动化实现。

问题

IDE 自动重载、隔离属性修复和切号系统通知依赖 AppleScript/System Events 或 xattr,但相关控件及部分调用入口没有限制平台。配置中已保存的 auto_reload_ide=true 也可能在手动切号后触发不受支持的操作,即使用户没有再次点击工具栏开关。

这里的问题在操作系统调用边界,不需要改动账号切换算法。

尽量保守的处理

  • 非 macOS 下禁用不支持的控件,为 IDE 重载和隔离属性修复标明平台限制;不清除已保存的设置,避免同一配置回到 macOS 后丢失原有偏好。
  • 同时限制前端两处重载调用,并在原生重载/修复入口启动平台工具之前明确返回“不支持此平台”的错误。
  • 给两处 AppleScript 通知调用增加平台条件。proxy.rs 的全部修改仅为这两个条件,不改请求转发、账号选择、重试或切号逻辑。

虽然涉及 9 个文件,但含测试的总 diff 仅 +69/−12 行:控件、调用方和原生入口需要一致地限制平台。没有实现 Windows IDE 自动化,没有新增终端启动/进程控制,不改代理配置,也不增加依赖或本地化内容。

验证依据

在 Windows 上针对当前提交 fd64365 完成本地验证:

npm run build
node --test scripts/platform-guards.test.mjs
cargo test --locked --manifest-path src-tauri/Cargo.toml --lib ide_control::tests

2 个前端约束测试覆盖平台识别和两处重载调用;原生 Windows 测试确认不支持的操作会在启动工具前返回。没有操作正在运行的 IDE,也没有修改已安装应用的状态。这些是平台限制测试,不把它表述为 macOS 桌面自动化的实机验证。

**可独立审阅和合并:**直接基于 upstream main(f64a44a)的单个提交,无须先合并其他 PR。目标只是让其他平台明确显示“不支持”,而不是替换已经存在的 macOS 功能。

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.

2 participants