From 033ca13276e7801b1dc4257c0dc65746e5774f7e Mon Sep 17 00:00:00 2001 From: loonghao Date: Mon, 19 Oct 2026 02:28:02 +0800 Subject: [PATCH] fix(openscreen): resolve Windows installer asset name for 2.1.0+ Upstream renamed the Windows NSIS installer to include an architecture suffix starting with 2.1.0 (Openscreen.Setup.-.exe) and stopped publishing the arch-less Openscreen.Setup..exe. The provider therefore resolved a 404 URL on Windows, failing the provider matrix and turning the required CI Success gate red on main. Select the arch-suffixed installer for 2.1.0+ (x64 and arm64) and keep the arch-less x64 name for the 2.0.x line, which only ever shipped a single x64 installer. Extend the provider tests to cover both naming schemes and update the platform docs. --- .../vx-cli/tests/openscreen_provider_tests.rs | 21 ++++++++++++----- crates/vx-providers/openscreen/provider.star | 23 +++++++++++++++++-- docs/tools/openscreen.md | 4 ++-- docs/zh/tools/openscreen.md | 4 ++-- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/crates/vx-cli/tests/openscreen_provider_tests.rs b/crates/vx-cli/tests/openscreen_provider_tests.rs index 8f236b6c7..9f5c2764e 100644 --- a/crates/vx-cli/tests/openscreen_provider_tests.rs +++ b/crates/vx-cli/tests/openscreen_provider_tests.rs @@ -27,20 +27,27 @@ fn call(name: &str, os: &str, arch: &str, function: &str, args: &[Value]) -> Val } #[rstest::rstest] -#[case("windows", "x64", "Openscreen.Setup.2.0.0.exe")] -#[case("macos", "x64", "Openscreen-Mac-x64-2.0.0.zip")] -#[case("macos", "arm64", "Openscreen-Mac-arm64-2.0.0.zip")] -#[case("linux", "x64", "Openscreen-Linux-2.0.0.AppImage")] +// 2.0.x shipped a single arch-less x64 installer. +#[case("windows", "x64", "2.0.0", "Openscreen.Setup.2.0.0.exe")] +// From 2.1.0 the Windows installer carries an architecture suffix (x64 + arm64). +#[case("windows", "x64", "2.1.0", "Openscreen.Setup.2.1.0-x64.exe")] +#[case("windows", "arm64", "2.1.0", "Openscreen.Setup.2.1.0-arm64.exe")] +#[case("windows", "x64", "2.1.1", "Openscreen.Setup.2.1.1-x64.exe")] +#[case("windows", "arm64", "2.1.1", "Openscreen.Setup.2.1.1-arm64.exe")] +#[case("macos", "x64", "2.0.0", "Openscreen-Mac-x64-2.0.0.zip")] +#[case("macos", "arm64", "2.0.0", "Openscreen-Mac-arm64-2.0.0.zip")] +#[case("linux", "x64", "2.0.0", "Openscreen-Linux-2.0.0.AppImage")] fn test_openscreen_selects_official_distributions( #[case] os: &str, #[case] arch: &str, + #[case] version: &str, #[case] asset: &str, ) { - let url = call("openscreen", os, arch, "download_url", &[json!("2.0.0")]); + let url = call("openscreen", os, arch, "download_url", &[json!(version)]); assert_eq!( url, json!(format!( - "https://github.com/getopenscreen/openscreen/releases/download/v2.0.0/{asset}" + "https://github.com/getopenscreen/openscreen/releases/download/v{version}/{asset}" )) ); } @@ -72,6 +79,8 @@ fn test_openscreen_windows_install_is_silent_and_store_scoped() { #[rstest::rstest] #[case("openscreen", "linux", "arm64")] +// Windows arm64 only gained an installer in 2.1.0; on 2.0.0 there is no such +// asset, so the provider must not fabricate a URL. #[case("openscreen", "windows", "arm64")] fn test_unsupported_distributions_are_not_fabricated( #[case] name: &str, diff --git a/crates/vx-providers/openscreen/provider.star b/crates/vx-providers/openscreen/provider.star index 5ba3f8b58..6c26d7da9 100644 --- a/crates/vx-providers/openscreen/provider.star +++ b/crates/vx-providers/openscreen/provider.star @@ -18,14 +18,33 @@ runtimes = [runtime_def("openscreen", system_paths = [ permissions = github_permissions() fetch_versions = make_fetch_versions("getopenscreen", "openscreen", include_prereleases = False) +def _uses_arch_suffixed_installer(version): + """Windows NSIS assets carry an architecture suffix from 2.1.0 onward. + + The 2.0.x line shipped a single arch-less x64 installer + (``Openscreen.Setup..exe``); starting with 2.1.0 upstream publishes + per-architecture installers (``Openscreen.Setup.-.exe``) for + both x64 and arm64. Requesting the arch-less name on 2.1.0+ returns HTTP 404. + """ + parts = version.split(".") + major = int(parts[0]) + minor = int(parts[1]) if len(parts) > 1 and parts[1].isdigit() else 0 + return major > 2 or (major == 2 and minor >= 1) + def download_url(ctx, version): # The headless CLI and these package names are available from 2.0.0. if int(version.split(".")[0]) < 2: return None os = ctx.platform.os arch = ctx.platform.arch - if os == "windows" and arch == "x64": - asset = "Openscreen.Setup.{}.exe".format(version) + if os == "windows" and arch in ["x64", "arm64"]: + if _uses_arch_suffixed_installer(version): + asset = "Openscreen.Setup.{}-{}.exe".format(version, arch) + elif arch == "x64": + # 2.0.x only ever published the single arch-less x64 installer. + asset = "Openscreen.Setup.{}.exe".format(version) + else: + return None elif os == "macos" and arch in ["x64", "arm64"]: asset = "Openscreen-Mac-{}-{}.zip".format(arch, version) elif os == "linux" and arch == "x64": diff --git a/docs/tools/openscreen.md b/docs/tools/openscreen.md index 8243a5667..63da6a48b 100644 --- a/docs/tools/openscreen.md +++ b/docs/tools/openscreen.md @@ -4,13 +4,13 @@ | Runtime | Windows | Linux | macOS | | --- | --- | --- | --- | -| `openscreen` | Silent user installer into vx store, x64 | AppImage, x64 | App ZIP, x64 / ARM64 | +| `openscreen` | Silent user installer into vx store, x64 / ARM64 | AppImage, x64 | App ZIP, x64 / ARM64 | ```bash vx openscreen --help ``` -Official distributions and the headless help command are supported from version 2.0. Windows uses a silent per-user installer scoped to the vx store. +Official distributions and the headless help command are supported from version 2.0. Windows uses a silent per-user installer scoped to the vx store. Windows ARM64 installers are published from 2.1.0; the 2.0.x line ships a single x64 installer, so pinning `2.0.0` on ARM64 hosts is not supported. Linux extracts the AppImage into the managed store and launches its `AppRun`, so launching does not require a FUSE mount. Extraction failures stop installation. diff --git a/docs/zh/tools/openscreen.md b/docs/zh/tools/openscreen.md index ee680ab7c..751d7f2e5 100644 --- a/docs/zh/tools/openscreen.md +++ b/docs/zh/tools/openscreen.md @@ -4,13 +4,13 @@ | Runtime | Windows | Linux | macOS | | --- | --- | --- | --- | -| `openscreen` | 静默用户安装到 vx store,x64 | AppImage, x64 | 应用 ZIP,x64 / ARM64 | +| `openscreen` | 静默用户安装到 vx store,x64 / ARM64 | AppImage, x64 | 应用 ZIP,x64 / ARM64 | ```bash vx openscreen --help ``` -从 2.0 开始支持官方发行包与无界面的帮助命令。Windows 使用静默用户安装器,安装目录限制在 vx store 内。 +从 2.0 开始支持官方发行包与无界面的帮助命令。Windows 使用静默用户安装器,安装目录限制在 vx store 内。Windows ARM64 安装器自 2.1.0 起提供;2.0.x 系列仅提供 x64 安装器,因此在 ARM64 主机上固定 `2.0.0` 版本不受支持。 Linux 将 AppImage 提取到托管目录,再通过 `AppRun` 启动,无需挂载 FUSE;提取失败时安装会报错停止。