From d2bd3f3893d38ca120fd63b7fa33a7908a031574 Mon Sep 17 00:00:00 2001 From: winewill Date: Mon, 2 Nov 2026 14:27:21 +0800 Subject: [PATCH] feat(desktop): rename stable update channel consistently --- .github/workflows/macos-intel-package.yml | 4 +- .github/workflows/macos-package.yml | 4 +- .github/workflows/windows-package.yml | 4 +- apps/desktop/README.i18n.yaml | 4 +- apps/desktop/README.md | 2 +- apps/desktop/README.zh.md | 2 +- apps/desktop/packaging/README.i18n.yaml | 4 +- apps/desktop/packaging/README.md | 2 +- apps/desktop/packaging/README.zh.md | 2 +- apps/desktop/publishing/README.i18n.yaml | 4 +- apps/desktop/publishing/README.md | 2 +- apps/desktop/publishing/README.zh.md | 2 +- apps/desktop/publishing/ci/README.i18n.yaml | 8 ++-- apps/desktop/publishing/ci/README.md | 4 +- apps/desktop/publishing/ci/README.zh.md | 4 +- .../desktop-auto-update-environment.d.mts | 6 +-- .../desktop-auto-update-environment.mjs | 12 +++--- apps/desktop/scripts/desktop-ci-version.mjs | 2 +- apps/desktop/scripts/desktop-publish-route.ts | 4 +- apps/desktop/scripts/desktop-release-store.ts | 2 +- apps/desktop/scripts/desktop-upload-plan.ts | 2 +- .../scripts/electron-builder-config.mjs | 2 +- .../scripts/macos-app-update-config.d.mts | 4 +- .../scripts/macos-app-update-config.mjs | 14 +++---- apps/desktop/scripts/publish-desktop-ci.ts | 2 +- apps/desktop/src/locale.ts | 16 +++---- apps/desktop/src/mandatory-update-policy.ts | 2 +- apps/desktop/src/settings-file.ts | 2 +- apps/desktop/src/update-channel.ts | 2 +- apps/desktop/src/update-coordinator.ts | 2 +- .../src/updates/electron-updater/channel.ts | 2 +- .../desktop-auto-update-environment.spec.ts | 11 +++++ .../tests/desktop-publication-summary.spec.ts | 10 ++--- apps/desktop/tests/desktop-rollback.spec.ts | 14 +++---- .../desktop/tests/desktop-upload-plan.spec.ts | 14 +++---- .../tests/expected/publication-production.md | 10 ++--- .../tests/macos-app-update-config.spec.ts | 8 ++-- apps/desktop/tests/main-startup.spec.ts | 26 ++++++------ apps/desktop/tests/preload-app.spec.ts | 6 +-- apps/desktop/tests/settings-file.spec.ts | 30 ++++++------- apps/desktop/tests/update-channel.spec.ts | 3 +- .../tests/update-configuration.spec.ts | 2 +- apps/desktop/tests/update-coordinator.spec.ts | 36 ++++++++-------- apps/desktop/tests/update-settings.spec.ts | 10 ++--- .../electron-updater/qualification.mjs | 6 +-- apps/web/tests/desktop-channel.e2e.ts | 8 ++-- .../desktop-stable-channel/guide.i18n.yaml | 16 +++++++ .../desktop-stable-channel/guide.md | 18 ++++++++ .../desktop-stable-channel/guide.zh.md | 18 ++++++++ .../src/client/DesktopChannelRow.tsx | 4 +- .../ui-settings-general/src/client/index.ts | 2 +- .../ui-settings-general/src/client/locales.ts | 32 +++++++------- .../client/ui-settings-general/src/types.ts | 2 +- .../tests/apply.client.spec.ts | 4 +- .../tests/components.client.spec.tsx | 10 ++--- .../tests/desktop-channel.client.spec.ts | 42 +++++++++---------- 56 files changed, 267 insertions(+), 203 deletions(-) create mode 100644 docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.i18n.yaml create mode 100644 docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md create mode 100644 docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md diff --git a/.github/workflows/macos-intel-package.yml b/.github/workflows/macos-intel-package.yml index cc835b8933..653f0a8101 100644 --- a/.github/workflows/macos-intel-package.yml +++ b/.github/workflows/macos-intel-package.yml @@ -15,9 +15,9 @@ on: default: test required: true update_channel: - description: '升级通道:nightly 或 latest(须为稳定版本);自动更新不会切换通道' + description: '升级通道:nightly 或 stable(须为稳定版本);默认通道由此打包输入确定' type: choice - options: [nightly, latest] + options: [nightly, stable] default: nightly required: true version_mode: diff --git a/.github/workflows/macos-package.yml b/.github/workflows/macos-package.yml index 073f1e9541..e28dc09a6b 100644 --- a/.github/workflows/macos-package.yml +++ b/.github/workflows/macos-package.yml @@ -15,9 +15,9 @@ on: default: test required: true update_channel: - description: '升级通道:nightly 或 latest(须为稳定版本);自动更新不会切换通道' + description: '升级通道:nightly 或 stable(须为稳定版本);默认通道由此打包输入确定' type: choice - options: [nightly, latest] + options: [nightly, stable] default: nightly required: true version_mode: diff --git a/.github/workflows/windows-package.yml b/.github/workflows/windows-package.yml index 29229605de..76a4b68f10 100644 --- a/.github/workflows/windows-package.yml +++ b/.github/workflows/windows-package.yml @@ -15,9 +15,9 @@ on: default: test required: true update_channel: - description: '升级通道:nightly 或 latest(须为稳定版本);自动更新不会切换通道' + description: '升级通道:nightly 或 stable(须为稳定版本);默认通道由此打包输入确定' type: choice - options: [nightly, latest] + options: [nightly, stable] default: nightly required: true version_mode: diff --git a/apps/desktop/README.i18n.yaml b/apps/desktop/README.i18n.yaml index bc9dc4f216..68bc787000 100644 --- a/apps/desktop/README.i18n.yaml +++ b/apps/desktop/README.i18n.yaml @@ -60,8 +60,8 @@ en: 67bf0a18faa7aa76 zh: 782e14ce62bb939f /deepseek-harness-desktop/updates/local-desktop-settings: - en: 2f2056adf22c62ef - zh: def6d09fbbf35a2b + en: de5a03c9b2cf7796 + zh: 37bbc84a931feb3a /deepseek-harness-desktop/updates/mandatory-update-policy: en: 182a9c6705213e13 zh: 681762f83490f4c6 diff --git a/apps/desktop/README.md b/apps/desktop/README.md index a9099a6b92..60c5ad612c 100644 --- a/apps/desktop/README.md +++ b/apps/desktop/README.md @@ -304,7 +304,7 @@ On first launch, including after an upgrade, Desktop creates this document if it Startup loading never overwrites existing documents; an omitted `updates` object or field resolves to `false`. Set the field to `true` to permit test authentication dialogs, then fully quit and restart the application. Set it back to `false` and restart to suppress them again. Creation, read, or validation failures use the default `false` without blocking startup. Desktop attempts to warn through the Electron console with the file path; unavailable logging does not block startup. Correct the file and restart to apply an explicit setting. Unknown fields are preserved. Installation updates retain this user-data file; Windows uninstallation removes it under the [uninstall rules](#windows-uninstall-rules). -In Desktop **Settings → General → Update channel**, **Stable** selects `latest` and **Development** selects `nightly`. The main process saves `updates.channel` in this same file and applies the choice immediately through IPC; no Host settings service is involved. An omitted channel uses the build-injected package default. External edits and deletion are read only on the next launch; no file watcher runs. The authentication-popup setting remains startup-only. UI writes retain unrelated fields from the latest valid document; external editors must not write concurrently with a UI save. +In Desktop **Settings → General → Update channel**, **Stable** selects `stable` and **Development** selects `nightly`. The main process saves `updates.channel` in this same file and applies the choice immediately through IPC; no Host settings service is involved. An omitted channel uses the build-injected package default. External edits and deletion are read only on the next launch; no file watcher runs. The authentication-popup setting remains startup-only. UI writes retain unrelated fields from the latest valid document; external editors must not write concurrently with a UI save. During a UI switch, the selector shows the pending choice with a loading indicator. Failure restores the actual runtime selection and shows a short toast; ordinary save failures keep the current channel and update target accessible. Invalid startup settings or failure to retire the previous update suspends ordinary updates while the application remains usable. The update indicator retains the suspension reason independently of download progress; open it for recovery guidance and, for settings errors, the file path. Fix the file and restart, or select a valid channel in Settings; malformed JSON must be repaired first. A known mandatory-update block remains enforced. Successful switching retires pending checks, downloads and installation eligibility before checking the new feed, including when both feeds advertise the same version. Switching never downgrades or installs automatically. Installation preparation rejects UI switches; once `quitAndInstall()` hands off, file edits cannot cancel that installation. diff --git a/apps/desktop/README.zh.md b/apps/desktop/README.zh.md index f73e9f9576..f1fc864e08 100644 --- a/apps/desktop/README.zh.md +++ b/apps/desktop/README.zh.md @@ -304,7 +304,7 @@ Electron 主进程在启动时读取一次 `app.getPath('userData')/desktop/sett 启动读取不会覆盖已有文件;缺少 `updates` 对象或该字段时均按 `false` 处理。将字段设为 `true` 后完全退出并重启应用,即可允许测试鉴权弹窗。改回 `false` 并重启即可再次禁止。创建、读取或校验失败时使用默认值 `false`,不阻止启动。Desktop 尝试在 Electron 控制台记录包含文件路径的警告;日志不可用也不阻止启动。修正文件并重启后才会应用显式设置。未知字段会保留。安装更新保留此用户数据文件;Windows 卸载按[卸载规则](#windows-uninstall-rules)删除它。 -在桌面版**设置 → 通用设置 → 更新渠道**中,**正式版**选择 `latest`,**开发版**选择 `nightly`。主进程在同一文件中保存 `updates.channel`,并通过 IPC 立即应用选择,不依赖 Host 设置服务。省略 channel 时使用打包注入的包内默认值。外部编辑和删除仅在下次启动读取,不运行文件监听器。鉴权弹窗设置仍须重启生效。UI 写入保留最新有效文件中的其他字段;外部编辑器不能与 UI 保存同时写入。 +在桌面版**设置 → 通用设置 → 更新渠道**中,**正式版**选择 `stable`,**开发版**选择 `nightly`。主进程在同一文件中保存 `updates.channel`,并通过 IPC 立即应用选择,不依赖 Host 设置服务。省略 channel 时使用打包注入的包内默认值。外部编辑和删除仅在下次启动读取,不运行文件监听器。鉴权弹窗设置仍须重启生效。UI 写入保留最新有效文件中的其他字段;外部编辑器不能与 UI 保存同时写入。 UI 切换期间,选择器显示待应用选项和加载指示;失败时恢复实际运行渠道,并显示简短 toast。普通保存失败不会阻止使用当前渠道及旧更新目标。启动配置无效或旧更新清理失败会暂停普通更新,主应用仍可使用。更新入口独立于下载进度保留暂停原因,点击可查看恢复方法;配置错误另显示文件路径。修正文件后重启,或在设置中选择有效渠道;JSON 损坏须先修复文件。已知强更阻塞继续生效。切换成功时先收尾检查、下载并撤销安装资格,再检查新渠道;两个渠道版本号相同也遵循该规则。切换不降级,也不自动安装。安装准备期间拒绝 UI 切换;调用 `quitAndInstall()` 交接后,编辑文件不能取消本次安装。 diff --git a/apps/desktop/packaging/README.i18n.yaml b/apps/desktop/packaging/README.i18n.yaml index c39bb71bc3..c9e8ef139e 100644 --- a/apps/desktop/packaging/README.i18n.yaml +++ b/apps/desktop/packaging/README.i18n.yaml @@ -18,8 +18,8 @@ en: 0b35c7471c09b27a zh: cc4a382b99fc3210 /desktop-packaging/release-versions: - en: 3f38ab26ee195b39 - zh: f00eddafa8f3b9ca + en: 8d09a324cde88ae1 + zh: 308d4902bd01f046 /desktop-packaging/configuration-and-local-builds: en: 5b4f0f80a117f202 zh: ff05be196c181087 diff --git a/apps/desktop/packaging/README.md b/apps/desktop/packaging/README.md index 28aa9ff9c7..96328662e0 100644 --- a/apps/desktop/packaging/README.md +++ b/apps/desktop/packaging/README.md @@ -63,7 +63,7 @@ pnpm --dir apps/desktop run package:win:x64 --build-version 0.1.6-alpha.1.202609 A production release publishes the product version and takes no `--build-version`. Uploading one tags the packaged commit as `desktop-v` once the artifacts are public; a build from a modified checkout is not tagged, and a tagging failure prints the command to run by hand rather than failing a completed upload. Test and local builds are deliberately left untagged, and every artifact records `dshBuildCommit` and `dshBuildDirty` in its manifest so a build handed over directly remains traceable. -The installer embeds `DSH_DESKTOP_UPDATE_CHANNEL` (`nightly` by default, or `latest`) independently of version and deployment. Automatic updates remain on that channel even for a stable version; manually installing the other channel switches it. Latest packages reject prerelease versions. A stable product can produce a nightly `-test..` build, but that version ranks below the stable base and cannot upgrade an already installed higher version. Keep automatic downgrade disabled; stable corrective releases require a product version bump. CI version selection and publication are documented in [CI publication](../publishing/ci/README.md#package-and-publish). +The installer embeds `DSH_DESKTOP_UPDATE_CHANNEL` (`nightly` by default, or `stable`) independently of version and deployment. Automatic updates remain on that channel even for a stable version; manually installing the other channel switches it. Stable-channel packages reject prerelease versions. A stable product can produce a nightly `-test..` build, but that version ranks below the stable base and cannot upgrade an already installed higher version. Keep automatic downgrade disabled; stable corrective releases require a product version bump. CI version selection and publication are documented in [CI publication](../publishing/ci/README.md#package-and-publish). diff --git a/apps/desktop/packaging/README.zh.md b/apps/desktop/packaging/README.zh.md index 2e87933826..84581366d2 100644 --- a/apps/desktop/packaging/README.zh.md +++ b/apps/desktop/packaging/README.zh.md @@ -63,7 +63,7 @@ pnpm --dir apps/desktop run package:win:x64 --build-version 0.1.6-alpha.1.202609 production 发布使用产品版本本身,不传 `--build-version`。其上传成功后会把打包所用 commit 打成 `desktop-v<版本>` 标签;来自有改动工作区的构建不打标签,打标签失败也只打印手工命令,不会让已完成的上传变成失败。test 与本地构建有意不留标签,而所有产物的清单都记录 `dshBuildCommit` 与 `dshBuildDirty`,直接分发的构建同样可溯源。 -安装包独立于版本和发布环境内置 `DSH_DESKTOP_UPDATE_CHANNEL`(默认 `nightly`,也可选择 `latest`)。自动更新始终保留该通道,即使安装的是稳定版本;手动安装另一通道的包才会切换。latest 包拒绝预发布版本。稳定产品可生成 nightly 的 `-test..` 构建,但该版本低于稳定基准,不能升级已安装的更高版本。保持自动降级关闭;稳定修复版需要提升产品版本。CI 版本选择与发布见 [CI 发布](../publishing/ci/README.zh.md#package-and-publish)。 +安装包独立于版本和发布环境内置 `DSH_DESKTOP_UPDATE_CHANNEL`(默认 `nightly`,也可选择 `stable`)。自动更新始终保留该通道,即使安装的是稳定版本;手动安装另一通道的包才会切换。stable 包拒绝预发布版本。稳定产品可生成 nightly 的 `-test..` 构建,但该版本低于稳定基准,不能升级已安装的更高版本。保持自动降级关闭;稳定修复版需要提升产品版本。CI 版本选择与发布见 [CI 发布](../publishing/ci/README.zh.md#package-and-publish)。 diff --git a/apps/desktop/publishing/README.i18n.yaml b/apps/desktop/publishing/README.i18n.yaml index 99b4b44aef..ae50a03293 100644 --- a/apps/desktop/publishing/README.i18n.yaml +++ b/apps/desktop/publishing/README.i18n.yaml @@ -21,8 +21,8 @@ en: eed7c4ed0d4e2758 zh: 026fe6076e11018e /desktop-publication/publish-installers-and-update-feeds: - en: 3c3e3a09573c4386 - zh: c851ae6a94f2284a + en: 81b0df7268e80a87 + zh: 35a3dc184f9a4442 /desktop-publication/fixed-installer-downloads: en: ce8296f8f1ee881e zh: 749ab63bd6ed4248 diff --git a/apps/desktop/publishing/README.md b/apps/desktop/publishing/README.md index b9bb98af2b..2e5ead449f 100644 --- a/apps/desktop/publishing/README.md +++ b/apps/desktop/publishing/README.md @@ -61,7 +61,7 @@ pnpm run upload:mac:arm64 The target dotenv file for internal-test packaging explicitly sets `DSH_DESKTOP_AUTO_UPDATE_ENV=test` and `DOWNLOAD_TEST_ORIGIN=https://download-test.deepseek.com`; uploads use `DOWNLOAD_TEST_COS_BUCKET=bj-toc-download-test-1320056602` and separate test credentials. Both test and production use the fixed Nightly channel; deployment selection does not enable channel switching. -Early internal-test packages use the `test` deployment. Select `production` explicitly only for a production release; changing upload credentials does not retarget an existing package. Packaging requires no COS credentials, disables electron-builder publishing, strips COS credentials from child processes, and records completion only after signing and notarization succeed. Upload validates this record, deployment, target, shared version, filenames, sizes, and SHA-512 before reading credentials. Packages and blockmaps upload before YAML; historical objects are retained. Every release publishes `nightly.yml` or `nightly-mac.yml`; stable releases also publish `latest.yml` or `latest-mac.yml` pointing at the same artifacts. Published YAML uses absolute binary URLs. The uploader leaves Cache-Control unset, including the empty header the COS SDK would otherwise add: deployment infrastructure owns cache policy, with uncached feeds and separately configurable binary caching. Serialize publication per target and verify public artifacts and feed contents before release qualification. +Early internal-test packages use the `test` deployment. Select `production` explicitly only for a production release; changing upload credentials does not retarget an existing package. Packaging requires no COS credentials, disables electron-builder publishing, strips COS credentials from child processes, and records completion only after signing and notarization succeed. Upload validates this record, deployment, target, shared version, filenames, sizes, and SHA-512 before reading credentials. Packages and blockmaps upload before YAML; historical objects are retained. Each package publishes only its selected channel: `nightly.yml` / `nightly-mac.yml` or `stable.yml` / `stable-mac.yml`. Published YAML uses absolute binary URLs. The uploader leaves Cache-Control unset, including the empty header the COS SDK would otherwise add: deployment infrastructure owns cache policy, with uncached feeds and separately configurable binary caching. Serialize publication per target and verify public artifacts and feed contents before release qualification. Windows NSIS uploads require the generated, nonempty `.exe.blockmap` beside the installer. The blockmap is uploaded before channel YAML; NSIS installer metadata does not require the embedded `blockMapSize` used by the separate web-installer format. File-plan tests use the pinned builder's blockmap generator, not a hand-authored embedded-map field. diff --git a/apps/desktop/publishing/README.zh.md b/apps/desktop/publishing/README.zh.md index 0f64fb31ee..86594f9ddf 100644 --- a/apps/desktop/publishing/README.zh.md +++ b/apps/desktop/publishing/README.zh.md @@ -61,7 +61,7 @@ pnpm run upload:mac:arm64 内测打包在目标 `.env` 中显式设置 `DSH_DESKTOP_AUTO_UPDATE_ENV=test` 和 `DOWNLOAD_TEST_ORIGIN=https://download-test.deepseek.com`;上传使用 `DOWNLOAD_TEST_COS_BUCKET=bj-toc-download-test-1320056602` 及独立测试凭据。test 和 production 都使用固定 Nightly 通道,部署选择不提供通道切换。 -前期内测包使用 `test` 部署。只有正式发布才显式选择 `production`;更换上传凭据不会改变已有安装包的更新目标。打包不需要 COS 凭据,会禁用 electron-builder 发布、移除子进程的 COS 凭据,并且仅在签名与公证成功后记录完成状态。上传在读取凭据前验证该记录、部署、目标、共同版本号、文件名、大小与 SHA-512。安装包和 blockmap 先于 YAML 上传;历史对象继续保留。每个版本发布 `nightly.yml` 或 `nightly-mac.yml`;稳定版本还发布指向相同产物的 `latest.yml` 或 `latest-mac.yml`。发布的 YAML 使用安装包绝对 URL。上传器不设置 Cache-Control,包括 COS SDK 否则会添加的空头部:缓存策略由部署基础设施负责,清单不缓存,安装包缓存单独配置。同一目标应串行发布,并在发布验收前验证公网产物与清单内容。 +前期内测包使用 `test` 部署。只有正式发布才显式选择 `production`;更换上传凭据不会改变已有安装包的更新目标。打包不需要 COS 凭据,会禁用 electron-builder 发布、移除子进程的 COS 凭据,并且仅在签名与公证成功后记录完成状态。上传在读取凭据前验证该记录、部署、目标、共同版本号、文件名、大小与 SHA-512。安装包和 blockmap 先于 YAML 上传;历史对象继续保留。每个包仅发布自身选定渠道的清单:`nightly.yml` / `nightly-mac.yml` 或 `stable.yml` / `stable-mac.yml`。发布的 YAML 使用安装包绝对 URL。上传器不设置 Cache-Control,包括 COS SDK 否则会添加的空头部:缓存策略由部署基础设施负责,清单不缓存,安装包缓存单独配置。同一目标应串行发布,并在发布验收前验证公网产物与清单内容。 Windows NSIS 上传要求安装包旁存在生成的非空 `.exe.blockmap`。blockmap 先于通道 YAML 上传;NSIS 安装包元数据不要求另一种 web-installer 格式使用的内嵌 `blockMapSize`。文件清单测试使用固定版本构建器的 blockmap 生成器,而不是手工编造内嵌映射字段。 diff --git a/apps/desktop/publishing/ci/README.i18n.yaml b/apps/desktop/publishing/ci/README.i18n.yaml index 14ef478ed7..e01a4e7c0c 100644 --- a/apps/desktop/publishing/ci/README.i18n.yaml +++ b/apps/desktop/publishing/ci/README.i18n.yaml @@ -24,11 +24,11 @@ en: 0f43f2e193e95043 zh: 1c1efb062c06f7b8 /desktop-ci-publication/package-and-publish: - en: f7c12d343891e547 - zh: da596ee1366c2046 + en: ee8d79ac75482502 + zh: 1d986a76860ed262 /desktop-ci-publication/recovery-and-records: - en: b62a7484929f9941 - zh: c9dd06c77098e6ef + en: 4ff6f0673d057ca8 + zh: 7171d060dd86db9a /desktop-ci-publication/restore-a-channel: en: d82e2ccf70cce397 zh: d93dcb77cc4b463e diff --git a/apps/desktop/publishing/ci/README.md b/apps/desktop/publishing/ci/README.md index 5009bf87e7..4c224d2a7b 100644 --- a/apps/desktop/publishing/ci/README.md +++ b/apps/desktop/publishing/ci/README.md @@ -70,7 +70,7 @@ Environment approval gates this workflow, not arbitrary code running under the s For publication to either test or production, choose Windows `signing=signed` or leave macOS **Skip notarization** unchecked. Unsigned and unnotarized packages are only for internal debugging; they cannot publish or provide automatic updates. Before installing dependencies, the hosted routing job rejects debugging artifacts identified by the selected run and attempt. Missing artifact metadata does not establish eligibility: the original machine still validates its retained manifest and signatures. A debugging-package rejection requires a new signed/notarized package and its run ID / attempt; retrying publication cannot qualify the existing bytes. -Select the platform's `Package Desktop` workflow, preset, source, channel and version mode. `source_ref` accepts repository branch names (for example `feature/desktop-update`) or `dsh-v*` tags for test; production accepts only `master` or `dsh-v*` tags. Names matching `dsh-v` followed by a digit and letters, digits, dots or hyphens are treated as tags, even if a branch has that name. Tags must match the selected product version. We recommend dispatching the packaging workflow from `master` and enter the source separately; raw commit SHAs, PR refs and fork repositories are not supported. The selected source must contain the CI adapters, so older sources fail before dependency installation. Only select trusted branches: their build code runs on the signing machine. This is an operating convention, not enforced workflow-origin or credential isolation. Publication uses the recorded commit and requires it to remain in the selected branch history; normal branch advances are allowed, deletion or a diverging force-push rejects. Tag publication requires the tag to still resolve to the recorded commit. Dispatch the publisher from `master`; its hosted routing job rejects other refs before scheduling the original machine. The packaged source commit is recorded separately. `version_mode=default` selects product for production and auto for test; product preserves the selected checkout version, auto appends date/run/attempt, and manual requires `build_version`. A latest package requires a stable version, so test/latest needs product or a stable manual version. The optional `test_release_id` is the test URL prefix: blank retains the machine default, successive upgrade tests on that platform need the same value, and defaults should be rotated periodically. It is not a GitHub run ID. See [packaging configuration](../../packaging/README.md#configuration-and-local-builds) for its validation and rotation limits. +Select the platform's `Package Desktop` workflow, preset, source, channel and version mode. `source_ref` accepts repository branch names (for example `feature/desktop-update`) or `dsh-v*` tags for test; production accepts only `master` or `dsh-v*` tags. Names matching `dsh-v` followed by a digit and letters, digits, dots or hyphens are treated as tags, even if a branch has that name. Tags must match the selected product version. We recommend dispatching the packaging workflow from `master` and enter the source separately; raw commit SHAs, PR refs and fork repositories are not supported. The selected source must contain the CI adapters, so older sources fail before dependency installation. Only select trusted branches: their build code runs on the signing machine. This is an operating convention, not enforced workflow-origin or credential isolation. Publication uses the recorded commit and requires it to remain in the selected branch history; normal branch advances are allowed, deletion or a diverging force-push rejects. Tag publication requires the tag to still resolve to the recorded commit. Dispatch the publisher from `master`; its hosted routing job rejects other refs before scheduling the original machine. The packaged source commit is recorded separately. `version_mode=default` selects product for production and auto for test; product preserves the selected checkout version, auto appends date/run/attempt, and manual requires `build_version`. A stable-channel package requires a stable version, so test/stable needs product or a stable manual version. The optional `test_release_id` is the test URL prefix: blank retains the machine default, successive upgrade tests on that platform need the same value, and defaults should be rotated periodically. It is not a GitHub run ID. See [packaging configuration](../../packaging/README.md#configuration-and-local-builds) for its validation and rotation limits. Packaging only retains files. After success, open **Publish Desktop · COS → Run workflow** on `master`, enter `package_run_id` from the packaging run URL, and optionally enter `package_run_attempt`. Blank selects the latest attempt, which must have succeeded; it never falls back to an older success. An explicit attempt selects that exact successful build. Windows must be signed; macOS must finish notarization and stapling. GitHub job evidence selects the original runner; its local manifest supplies the preset, version, source and channel before approval. No installer or request artifact is downloaded. Retained packages with the old `publishRequested=false` flag remain eligible; missing or changed local files stop publication. @@ -80,7 +80,7 @@ Before installing dependencies on the original runner, preparation and the appro ## Recovery and records -After resolving a failure, re-run the failed publishing job to keep its prepared package attempt, or start a new publication with the explicit original package run and attempt. Re-running all jobs with a blank attempt resolves the latest package attempt again and requires a new approval. Do not rebuild solely to retry an upload. Missing objects are uploaded, identical objects are skipped, and conflicting same-name bytes stop the operation. Unknown write outcomes are reconciled by reading remote bytes. A newer channel version prevents a stale upload from replacing it. Each package updates only its embedded channel: nightly writes `nightly.yml` / `nightly-mac.yml`, latest writes `latest.yml` / `latest-mac.yml`. Latest binaries use a `latest/` subdirectory under the target binary prefix, separate from existing nightly objects. Publishing the same source/version to both channels requires two packages; an existing release tag is reused only for the same source commit. +After resolving a failure, re-run the failed publishing job to keep its prepared package attempt, or start a new publication with the explicit original package run and attempt. Re-running all jobs with a blank attempt resolves the latest package attempt again and requires a new approval. Do not rebuild solely to retry an upload. Missing objects are uploaded, identical objects are skipped, and conflicting same-name bytes stop the operation. Unknown write outcomes are reconciled by reading remote bytes. A newer channel version prevents a stale upload from replacing it. Each package updates only its embedded channel: nightly writes `nightly.yml` / `nightly-mac.yml`, stable writes `stable.yml` / `stable-mac.yml`. Stable-channel binaries use a `stable/` subdirectory under the target binary prefix, separate from existing nightly objects. Publishing the same source/version to both channels requires two packages; an existing release tag is reused only for the same source commit. The sibling `upload-records/` directory retains an operation identity, newline-delimited events and terminal result. Feed-write intents retain both previous and requested YAML. Failures record their stage, safe error classification and diagnostic; COS failures also identify `GetObject` or `PutObject`, plus a validated HTTP status and request ID when available. Access-denied reports name the permission to inspect. Raw provider responses and credentials are excluded. Audit initialization becomes visible only after its files are complete; abandoned `.initializing-*` directories are not scanned for completed publication. Writes and readback are recorded before proceeding; missing terminal results mean interruption, not success. Actions also keeps its operation record as a diagnostic artifact for 30 days. These local records are not tamper-proof. COS readback verifies storage bytes, not public CDN behavior; public download acceptance is separate. diff --git a/apps/desktop/publishing/ci/README.zh.md b/apps/desktop/publishing/ci/README.zh.md index 151032eed9..ae61bde4e9 100644 --- a/apps/desktop/publishing/ci/README.zh.md +++ b/apps/desktop/publishing/ci/README.zh.md @@ -70,7 +70,7 @@ Environment 审批限制此工作流,不限制同一机器账户运行的任 发布到 test 或 production 都必须在 Windows 选择 `signing=signed`,或在 macOS 不勾选**跳过公证**。无签名、无公证的包仅限内部调试,不能发布或用于自动更新。托管路由 job 会在安装依赖前,依据所选 run 和 attempt 对应的 artifact 名称拒绝已标明的调试包。缺少 artifact 元数据不代表允许发布:原机器仍会验证留存清单和签名。遇到调试包拒绝提示时,需重新完成签名或公证,再使用新包的 run ID / attempt 发布;重跑发布不能使现有产物获得发布资格。 -选择对应平台的 `Package Desktop` 工作流、preset、源码、通道和版本模式。test 的 `source_ref` 接受仓库内分支名(如 `feature/desktop-update`)或 `dsh-v*` tag;production 仅接受 `master` 或 `dsh-v*` tag。符合 `dsh-v` 后接数字、其余为字母、数字、点或连字符的名称按 tag 处理,即使存在同名分支。tag 必须与所选产品版本一致。建议从 `master` 启动打包工作流,再单独填写打包源码;不支持直接填写 commit SHA、PR ref 或 fork 仓库。源码必须包含 CI 适配脚本,旧源码会在安装依赖前失败。仅选择可信分支:其构建代码将在签名机器上执行。这是操作约定,不提供工作流来源强制限制或凭据隔离。发布使用记录的 commit,并要求该提交仍在所选分支历史中;正常追加提交不影响发布,删除分支或导致历史分叉的强推会拒绝。tag 发布要求 tag 仍指向记录的提交。从 `master` 发起发布;托管路由 job 会在派发到原机器前拒绝其他 ref。实际打包源码提交单独记录。`version_mode=default` 对 production 选择 product,对 test 选择 auto;product 保留所选源码版本,auto 追加日期/run/attempt,manual 要求填写 `build_version`。latest 包要求稳定版本,因此 test/latest 需选择 product 或稳定的手填版本。可选 `test_release_id` 是测试 URL 前缀:留空沿用机器默认值,同一平台连续升级测试需保持相同值,并应定期轮换默认值。它不是 GitHub run ID。格式校验和轮换限制见[打包配置](../../packaging/README.zh.md#configuration-and-local-builds)。 +选择对应平台的 `Package Desktop` 工作流、preset、源码、通道和版本模式。test 的 `source_ref` 接受仓库内分支名(如 `feature/desktop-update`)或 `dsh-v*` tag;production 仅接受 `master` 或 `dsh-v*` tag。符合 `dsh-v` 后接数字、其余为字母、数字、点或连字符的名称按 tag 处理,即使存在同名分支。tag 必须与所选产品版本一致。建议从 `master` 启动打包工作流,再单独填写打包源码;不支持直接填写 commit SHA、PR ref 或 fork 仓库。源码必须包含 CI 适配脚本,旧源码会在安装依赖前失败。仅选择可信分支:其构建代码将在签名机器上执行。这是操作约定,不提供工作流来源强制限制或凭据隔离。发布使用记录的 commit,并要求该提交仍在所选分支历史中;正常追加提交不影响发布,删除分支或导致历史分叉的强推会拒绝。tag 发布要求 tag 仍指向记录的提交。从 `master` 发起发布;托管路由 job 会在派发到原机器前拒绝其他 ref。实际打包源码提交单独记录。`version_mode=default` 对 production 选择 product,对 test 选择 auto;product 保留所选源码版本,auto 追加日期/run/attempt,manual 要求填写 `build_version`。stable 包要求稳定版本,因此 test/stable 需选择 product 或稳定的手填版本。可选 `test_release_id` 是测试 URL 前缀:留空沿用机器默认值,同一平台连续升级测试需保持相同值,并应定期轮换默认值。它不是 GitHub run ID。格式校验和轮换限制见[打包配置](../../packaging/README.zh.md#configuration-and-local-builds)。 打包只保留文件。成功后,在 `master` 上打开 **Publish Desktop · COS → Run workflow**,填写打包运行 URL 中的 `package_run_id`,并可填写 `package_run_attempt`。留空选择最新尝试,且该尝试必须成功,不会回退到较早的成功尝试;显式填写则选择对应的成功构建。Windows 必须完成签名,macOS 必须完成公证和 stapling。GitHub job 证据确定原 runner,本机清单在审批前提供 preset、版本、源码和通道。不会下载安装包或请求 artifact。旧清单的 `publishRequested=false` 不影响发布资格;本机文件缺失或变化会停止发布。 @@ -80,7 +80,7 @@ Environment 审批限制此工作流,不限制同一机器账户运行的任 ## 恢复与记录 -解决故障后重跑失败的发布 job,以保持准备阶段选定的打包尝试;也可显式填写原打包运行和尝试,发起新的发布。尝试留空时重跑所有 job 会重新解析最新打包尝试,并需要重新审批。不要仅为重试上传而重新打包。缺失对象会上传,相同对象跳过,同名但字节不同的对象会停止操作。写入结果不明时通过读取远端字节核对。频道已有更高版本时,旧上传不能替换它。每个包只更新自身内置通道:nightly 写入 `nightly.yml` / `nightly-mac.yml`,latest 写入 `latest.yml` / `latest-mac.yml`。latest 二进制位于目标二进制前缀下的 `latest/` 子目录,与已有 nightly 对象分离。同一源码和版本发布到两个通道需要分别打包;已有发布 tag 仅在源码提交相同时复用。 +解决故障后重跑失败的发布 job,以保持准备阶段选定的打包尝试;也可显式填写原打包运行和尝试,发起新的发布。尝试留空时重跑所有 job 会重新解析最新打包尝试,并需要重新审批。不要仅为重试上传而重新打包。缺失对象会上传,相同对象跳过,同名但字节不同的对象会停止操作。写入结果不明时通过读取远端字节核对。频道已有更高版本时,旧上传不能替换它。每个包只更新自身内置通道:nightly 写入 `nightly.yml` / `nightly-mac.yml`,stable 写入 `stable.yml` / `stable-mac.yml`。stable 二进制位于目标二进制前缀下的 `stable/` 子目录,与已有 nightly 对象分离。同一源码和版本发布到两个通道需要分别打包;已有发布 tag 仅在源码提交相同时复用。 同级 `upload-records/` 目录保留操作标识、逐行事件和最终结果。频道写入意图同时记录先前和目标 YAML。失败记录阶段、安全错误分类与诊断;COS 失败还标明 `GetObject` 或 `PutObject`,并在可用时记录经过校验的 HTTP 状态码和 request ID。访问拒绝提示会指出需检查的权限。不保存原始服务响应或凭据。审计初始化在文件完整后才可见;遗留的 `.initializing-*` 目录不参与已完成发布的扫描。写入和回读在继续操作前落盘;没有最终结果代表中断,不代表成功。Actions 还将操作记录保存为诊断 artifact,保留 30 天。这些本地记录不防篡改。COS 回读验证存储字节,不代表公开 CDN 行为;公开下载需单独验收。 diff --git a/apps/desktop/scripts/desktop-auto-update-environment.d.mts b/apps/desktop/scripts/desktop-auto-update-environment.d.mts index 4d42b3dd1e..98a6309d14 100644 --- a/apps/desktop/scripts/desktop-auto-update-environment.d.mts +++ b/apps/desktop/scripts/desktop-auto-update-environment.d.mts @@ -17,7 +17,7 @@ export function desktopLatestInstallerFilename(target: DesktopAutoUpdateTarget): /** Public updater URL and object prefixes for one release target. */ export interface DesktopAutoUpdateConfig { readonly environment: DesktopAutoUpdateEnvironment - readonly channel: 'nightly' | 'latest' + readonly channel: 'nightly' | 'stable' readonly target: DesktopAutoUpdateTarget readonly origin: string readonly publicUrl: string @@ -68,7 +68,7 @@ export function desktopBuildRecordFilename(target: DesktopAutoUpdateTarget): str export function desktopUpdateMetadataFilename( version: string, platform: NodeJS.Platform, - channel?: 'nightly' | 'latest', + channel?: 'nightly' | 'stable', ): string /** @@ -104,7 +104,7 @@ export function resolveDesktopUploadConfig( * @param env Packaging settings. * @returns Validated channel. */ -export function resolveDesktopUpdateChannel(env: NodeJS.ProcessEnv): 'nightly' | 'latest' +export function resolveDesktopUpdateChannel(env: NodeJS.ProcessEnv): 'nightly' | 'stable' /** * Read a required nonempty deployment setting. diff --git a/apps/desktop/scripts/desktop-auto-update-environment.mjs b/apps/desktop/scripts/desktop-auto-update-environment.mjs index 835beadd6d..33cff177a2 100644 --- a/apps/desktop/scripts/desktop-auto-update-environment.mjs +++ b/apps/desktop/scripts/desktop-auto-update-environment.mjs @@ -8,11 +8,11 @@ export const DESKTOP_AUTO_UPDATE_ENV = 'DSH_DESKTOP_AUTO_UPDATE_ENV' /** * Resolve the channel embedded in the installer; omitted local settings retain nightly. * @param {NodeJS.ProcessEnv} env Packaging or upload settings. - * @returns {'nightly' | 'latest'} Validated channel. + * @returns {'nightly' | 'stable'} Validated channel. */ export function resolveDesktopUpdateChannel(env) { const channel = env.DSH_DESKTOP_UPDATE_CHANNEL || 'nightly' - if (channel !== 'nightly' && channel !== 'latest') throw new Error('desktop auto-update: invalid update channel') + if (channel !== 'nightly' && channel !== 'stable') throw new Error('desktop auto-update: invalid update channel') return channel } @@ -90,7 +90,7 @@ export function desktopBuildRecordFilename(target) { * Return the electron-builder channel metadata filename for an application version. * @param {string} version - Desktop semantic version. * @param {NodeJS.Platform} platform - Target platform. - * @param {'nightly' | 'latest'} channel - Selected channel; omitted means nightly. + * @param {'nightly' | 'stable'} channel - Selected channel; omitted means nightly. * @returns {string} Channel metadata filename emitted for the target. */ export function desktopUpdateMetadataFilename(version, platform, channel = 'nightly') { @@ -148,7 +148,7 @@ function httpsOrigin(value, name) { * @param {NodeJS.ProcessEnv} env - Packaging or upload environment. * @param {NodeJS.Platform} platform - Target Node.js platform. * @param {string} arch - Target Node.js architecture. - * @returns {{ environment: 'test' | 'production', channel: 'nightly' | 'latest', target: 'mac-arm64' | 'mac-x64' | 'win-x64', origin: string, publicUrl: string, keyPrefix: string, binaryKeyPrefix: string }} Resolved updater configuration. + * @returns {{ environment: 'test' | 'production', channel: 'nightly' | 'stable', target: 'mac-arm64' | 'mac-x64' | 'win-x64', origin: string, publicUrl: string, keyPrefix: string, binaryKeyPrefix: string }} Resolved updater configuration. * @throws {Error} When the test deployment lacks a valid HTTPS origin or a 32-character lowercase hexadecimal release ID. */ export function resolveDesktopAutoUpdateConfig(env, platform, arch) { @@ -177,7 +177,7 @@ export function resolveDesktopAutoUpdateConfig(env, platform, arch) { target, origin, keyPrefix, - binaryKeyPrefix: `${releasePrefix}/bin/${target}${channel === 'latest' ? '/latest' : ''}`, + binaryKeyPrefix: `${releasePrefix}/bin/${target}${channel === 'stable' ? '/stable' : ''}`, publicUrl: `${origin}/${keyPrefix}/`, } } @@ -187,7 +187,7 @@ export function resolveDesktopAutoUpdateConfig(env, platform, arch) { * @param {NodeJS.ProcessEnv} env - Upload environment. * @param {NodeJS.Platform} platform - Target Node.js platform. * @param {string} arch - Target Node.js architecture. - * @returns {{ environment: 'test' | 'production', channel: 'nightly' | 'latest', target: 'mac-arm64' | 'mac-x64' | 'win-x64', origin: string, publicUrl: string, keyPrefix: string, binaryKeyPrefix: string, bucket: string, secretIdEnvName: string, secretKeyEnvName: string }} Resolved upload configuration. + * @returns {{ environment: 'test' | 'production', channel: 'nightly' | 'stable', target: 'mac-arm64' | 'mac-x64' | 'win-x64', origin: string, publicUrl: string, keyPrefix: string, binaryKeyPrefix: string, bucket: string, secretIdEnvName: string, secretKeyEnvName: string }} Resolved upload configuration. * @throws {Error} When the selected deployment lacks a bucket or valid updater configuration. */ export function resolveDesktopUploadConfig(env, platform, arch) { diff --git a/apps/desktop/scripts/desktop-ci-version.mjs b/apps/desktop/scripts/desktop-ci-version.mjs index 8fef629287..3822b8329f 100644 --- a/apps/desktop/scripts/desktop-ci-version.mjs +++ b/apps/desktop/scripts/desktop-ci-version.mjs @@ -24,7 +24,7 @@ export function desktopCiVersion(environment, productVersion, now = new Date()) } candidate = `${desktopBuildVersionPrefix(productVersion)}${date}.${environment.GITHUB_RUN_NUMBER}.${environment.GITHUB_RUN_ATTEMPT}` } - if (environment.DSH_DESKTOP_UPDATE_CHANNEL === 'latest' && candidate.includes('-')) throw new Error('Latest channel requires a stable version; select product or manual stable version') + if (environment.DSH_DESKTOP_UPDATE_CHANNEL === 'stable' && candidate.includes('-')) throw new Error('Stable channel requires a stable version; select product or manual stable version') try { const resolved = validateDesktopBuildVersion(candidate, productVersion) return resolved diff --git a/apps/desktop/scripts/desktop-publish-route.ts b/apps/desktop/scripts/desktop-publish-route.ts index 9b6fedfa42..5c8d7a9ef3 100644 --- a/apps/desktop/scripts/desktop-publish-route.ts +++ b/apps/desktop/scripts/desktop-publish-route.ts @@ -12,7 +12,7 @@ const runSchema = z.object({ const requestSchema = z.object({ source: z.object({ repository: z.string(), runId: z.string(), attempt: z.string(), commit: z.string().regex(/^[a-f0-9]{40}$/u), workflowCommit: z.string(), sourceRef: z.string().min(1), - channel: z.enum(['nightly', 'latest']), + channel: z.enum(['nightly', 'stable']), runnerName: z.string(), target: z.enum(['mac-arm64', 'mac-x64', 'win-x64']), preset: z.enum(['test', 'production']), qualification: z.enum(['signed', 'notarized', 'unsigned', 'unnotarized']), }).refine(source => source.preset === 'test' || /^(?:master|dsh-v[0-9][0-9A-Za-z.-]*)$/u.test(source.sourceRef), @@ -25,7 +25,7 @@ export interface DesktopPublishRoute { readonly attempt: string readonly commit: string readonly sourceRef: string - readonly channel: 'nightly' | 'latest' + readonly channel: 'nightly' | 'stable' readonly runnerName: string readonly runnerLabel: string readonly target: 'mac-arm64' | 'mac-x64' | 'win-x64' diff --git a/apps/desktop/scripts/desktop-release-store.ts b/apps/desktop/scripts/desktop-release-store.ts index c080272e1d..bb3345aa74 100644 --- a/apps/desktop/scripts/desktop-release-store.ts +++ b/apps/desktop/scripts/desktop-release-store.ts @@ -14,7 +14,7 @@ const sourceSchema = z.strictObject({ commit: z.string().regex(/^[a-f0-9]{40}$/u), workflowCommit: z.string().regex(/^[a-f0-9]{40}$/u), sourceRef: z.string().min(1), - channel: z.enum(['nightly', 'latest']), + channel: z.enum(['nightly', 'stable']), runnerName: z.string().min(1), // Storage accepts every Desktop target; CI routing separately limits currently provisioned platforms. target: z.enum(['mac-arm64', 'mac-x64', 'win-x64']), diff --git a/apps/desktop/scripts/desktop-upload-plan.ts b/apps/desktop/scripts/desktop-upload-plan.ts index 1461444fc6..1299dfdae8 100644 --- a/apps/desktop/scripts/desktop-upload-plan.ts +++ b/apps/desktop/scripts/desktop-upload-plan.ts @@ -219,7 +219,7 @@ export async function createDesktopUploadPlan( throw new Error(`desktop upload: ${targetName} package completion record for ${buildVersion} does not match the ${update.environment} update destination`) } - if (update.channel === 'latest' && buildVersion.includes('-')) throw new Error('desktop upload: latest requires a stable version') + if (update.channel === 'stable' && buildVersion.includes('-')) throw new Error('desktop upload: stable requires a stable version') const metadataFilename = desktopUpdateMetadataFilename(buildVersion, target.platform, update.channel) const metadataPath = join(artifactsRoot, metadataFilename) let metadataValue: unknown diff --git a/apps/desktop/scripts/electron-builder-config.mjs b/apps/desktop/scripts/electron-builder-config.mjs index cf0c19e895..399d73a616 100644 --- a/apps/desktop/scripts/electron-builder-config.mjs +++ b/apps/desktop/scripts/electron-builder-config.mjs @@ -102,7 +102,7 @@ export function createElectronBuilderConfig( // the artifact names, the update feed, and the installed app.getVersion() the updater compares against. const productVersion = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8')).version const buildVersion = resolveDesktopBuildVersion(env, productVersion) - if (update?.channel === 'latest' && buildVersion.includes('-')) throw new Error('desktop package: latest requires a stable version') + if (update?.channel === 'stable' && buildVersion.includes('-')) throw new Error('desktop package: stable requires a stable version') const packaged = resolveDesktopBuildCommit(env) return { appId, diff --git a/apps/desktop/scripts/macos-app-update-config.d.mts b/apps/desktop/scripts/macos-app-update-config.d.mts index ce18266c48..926762b9ec 100644 --- a/apps/desktop/scripts/macos-app-update-config.d.mts +++ b/apps/desktop/scripts/macos-app-update-config.d.mts @@ -1,14 +1,14 @@ /** Resolved fields required to embed a macOS updater feed. */ export interface MacOSAppUpdateFeed { readonly publicUrl: string - readonly channel?: 'nightly' | 'latest' + readonly channel?: 'nightly' | 'stable' } /** Packaged electron-updater configuration for macOS. */ export interface MacOSAppUpdateConfig { readonly provider: 'generic' readonly url: string - readonly channel: 'nightly' | 'latest' + readonly channel: 'nightly' | 'stable' readonly updaterCacheDirName: string } diff --git a/apps/desktop/scripts/macos-app-update-config.mjs b/apps/desktop/scripts/macos-app-update-config.mjs index d6b4132c71..bdb400bcde 100644 --- a/apps/desktop/scripts/macos-app-update-config.mjs +++ b/apps/desktop/scripts/macos-app-update-config.mjs @@ -24,24 +24,24 @@ function nonEmptyString(value, label) { /** * Resolve the one generic macOS feed from the final electron-builder configuration. * @param {unknown} publish - Final electron-builder publish setting. - * @returns {{ publicUrl: string, channel?: 'nightly' | 'latest' }} Resolved feed used by the packaged App. + * @returns {{ publicUrl: string, channel?: 'nightly' | 'stable' }} Resolved feed used by the packaged App. */ export function resolveMacOSAppUpdateFeed(publish) { if (!Array.isArray(publish) || publish.length !== 1) { throw new Error('desktop macOS update config: publish must contain exactly one provider') } const provider = object(publish[0], 'publish provider') - if (provider.provider !== 'generic' || !['nightly', 'latest'].includes(provider.channel)) { - throw new Error('desktop macOS update config: publish provider must be generic with nightly or latest channel') + if (provider.provider !== 'generic' || !['nightly', 'stable'].includes(provider.channel)) { + throw new Error('desktop macOS update config: publish provider must be generic with nightly or stable channel') } return { publicUrl: nonEmptyString(provider.url, 'publish provider URL'), channel: resolveDesktopUpdateChannel({ DSH_DESKTOP_UPDATE_CHANNEL: provider.channel }) } } /** * Create the electron-updater configuration embedded before code signing. - * @param {{ publicUrl: string, channel?: 'nightly' | 'latest' }} update - Resolved update feed. + * @param {{ publicUrl: string, channel?: 'nightly' | 'stable' }} update - Resolved update feed. * @param {string} updaterCacheDirName - electron-builder application cache directory. - * @returns {{ provider: 'generic', url: string, channel: 'nightly' | 'latest', updaterCacheDirName: string }} Packaged updater fields. + * @returns {{ provider: 'generic', url: string, channel: 'nightly' | 'stable', updaterCacheDirName: string }} Packaged updater fields. */ export function createMacOSAppUpdateConfig(update, updaterCacheDirName) { return { @@ -55,7 +55,7 @@ export function createMacOSAppUpdateConfig(update, updaterCacheDirName) { /** * Write the updater configuration into an assembled App before signing. * @param {string} resourcesDir - App Contents/Resources directory. - * @param {{ publicUrl: string, channel?: 'nightly' | 'latest' }} update - Resolved update feed. + * @param {{ publicUrl: string, channel?: 'nightly' | 'stable' }} update - Resolved update feed. * @param {string} updaterCacheDirName - electron-builder application cache directory. * @returns {Promise} Resolves after the configuration is durable. */ @@ -67,7 +67,7 @@ export async function writeMacOSAppUpdateConfig(resourcesDir, update, updaterCac /** * Verify the updater configuration inside an assembled macOS App. * @param {string} appPath - Application bundle path. - * @param {{ publicUrl: string, channel?: 'nightly' | 'latest' }} update - Expected update feed. + * @param {{ publicUrl: string, channel?: 'nightly' | 'stable' }} update - Expected update feed. * @param {string | undefined} updaterCacheDirName - Exact cache directory when known. * @returns {Promise} Resolves when the packaged configuration matches the release destination. */ diff --git a/apps/desktop/scripts/publish-desktop-ci.ts b/apps/desktop/scripts/publish-desktop-ci.ts index f9348ec2eb..19dcea3f58 100644 --- a/apps/desktop/scripts/publish-desktop-ci.ts +++ b/apps/desktop/scripts/publish-desktop-ci.ts @@ -17,7 +17,7 @@ import { publishDesktopTag } from './desktop-publish-tag.ts' import { desktopPublishQualificationError } from './desktop-publish-qualification.mjs' const routeSchema = z.object({ runId: z.string(), attempt: z.string(), commit: z.string(), runnerName: z.string(), - sourceRef: z.string(), channel: z.enum(['nightly', 'latest']), + sourceRef: z.string(), channel: z.enum(['nightly', 'stable']), target: z.enum(['mac-arm64', 'mac-x64', 'win-x64']), preset: z.enum(['test', 'production']) }) /** diff --git a/apps/desktop/src/locale.ts b/apps/desktop/src/locale.ts index 2b9d89464a..eeb97f40eb 100644 --- a/apps/desktop/src/locale.ts +++ b/apps/desktop/src/locale.ts @@ -109,7 +109,7 @@ export const en = { updateConfigurationFailed: 'Update settings could not be applied. Fix the configuration file and restart, or select an update channel in Settings.', updateConfigurationRead: 'Updates paused: cannot read settings file. Fix the settings file and restart, or select the channel again in Settings.', updateConfigurationFormat: 'Updates paused: invalid settings file. Fix the settings file and restart, or select the channel again in Settings.', - updateConfigurationChannel: 'Updates paused: channel must be nightly or latest. Fix the settings file and restart, or select the channel again in Settings.', + updateConfigurationChannel: 'Updates paused: channel must be nightly or stable. Fix the settings file and restart, or select the channel again in Settings.', updateConfigurationCleanup: 'Updates paused: cannot discard previous update; restart the app', updateCheckFailedTitle: 'Update Check Failed', updateCheckFailed: 'Could not check for updates. Please try again later.', @@ -294,7 +294,7 @@ export const zh = { updateConfigurationFailed: '更新配置无法应用。请修正配置文件并重启,或在设置中选择更新渠道。', updateConfigurationRead: '更新已暂停:无法读取配置文件。请修正配置文件后重启,或在设置中重新选择渠道', updateConfigurationFormat: '更新已暂停:配置文件格式有误。请修正配置文件后重启,或在设置中重新选择渠道', - updateConfigurationChannel: '更新已暂停:channel 只能是 nightly 或 latest。请修正配置文件后重启,或在设置中重新选择渠道', + updateConfigurationChannel: '更新已暂停:channel 只能是 nightly 或 stable。请修正配置文件后重启,或在设置中重新选择渠道', updateConfigurationCleanup: '更新已暂停:无法清理旧更新,请重启应用', updateCheckFailedTitle: '更新检查失败', updateCheckFailed: '检查更新失败,请稍后重试。', @@ -477,7 +477,7 @@ export const ja = { updateConfigurationFailed: '更新設定を適用できませんでした。設定ファイルを修正して再起動するか、設定で更新チャンネルを選択してください。', updateConfigurationRead: '更新を停止中:設定ファイルを読み取れません. 設定ファイルを修正して再起動するか、設定でチャンネルを選び直してください。', updateConfigurationFormat: '更新を停止中:設定ファイルの形式が不正です. 設定ファイルを修正して再起動するか、設定でチャンネルを選び直してください。', - updateConfigurationChannel: '更新を停止中:channel は nightly または latest にしてください. 設定ファイルを修正して再起動するか、設定でチャンネルを選び直してください。', + updateConfigurationChannel: '更新を停止中:channel は nightly または stable にしてください. 設定ファイルを修正して再起動するか、設定でチャンネルを選び直してください。', updateConfigurationCleanup: '更新を停止中:以前の更新を削除できません。アプリを再起動してください', updateCheckFailedTitle: 'アップデートの確認に失敗しました', updateCheckFailed: 'アップデートを確認できませんでした。後でもう一度お試しください。', @@ -660,7 +660,7 @@ export const es = { updateConfigurationFailed: 'No se pudo aplicar la configuración de actualización. Corrige el archivo y reinicia, o selecciona un canal en Ajustes.', updateConfigurationRead: 'Actualizaciones pausadas: no se puede leer la configuración. Corrige el archivo y reinicia, o vuelve a seleccionar el canal en Ajustes.', updateConfigurationFormat: 'Actualizaciones pausadas: archivo de configuración no válido. Corrige el archivo y reinicia, o vuelve a seleccionar el canal en Ajustes.', - updateConfigurationChannel: 'Actualizaciones pausadas: channel debe ser nightly o latest. Corrige el archivo y reinicia, o vuelve a seleccionar el canal en Ajustes.', + updateConfigurationChannel: 'Actualizaciones pausadas: channel debe ser nightly o stable. Corrige el archivo y reinicia, o vuelve a seleccionar el canal en Ajustes.', updateConfigurationCleanup: 'Actualizaciones pausadas: no se pudo descartar la actualización anterior; reinicia la aplicación', updateCheckFailedTitle: 'Error en la comprobación de actualización', updateCheckFailed: 'No se pudo buscar actualizaciones. Inténtelo de nuevo más tarde.', @@ -843,7 +843,7 @@ export const fr = { updateConfigurationFailed: 'Impossible d’appliquer les paramètres de mise à jour. Corrigez le fichier et redémarrez, ou sélectionnez un canal dans les paramètres.', updateConfigurationRead: 'Mises à jour suspendues : lecture des paramètres impossible. Corrigez le fichier et redémarrez, ou sélectionnez à nouveau le canal dans les paramètres.', updateConfigurationFormat: 'Mises à jour suspendues : fichier de paramètres invalide. Corrigez le fichier et redémarrez, ou sélectionnez à nouveau le canal dans les paramètres.', - updateConfigurationChannel: 'Mises à jour suspendues : channel doit être nightly ou latest. Corrigez le fichier et redémarrez, ou sélectionnez à nouveau le canal dans les paramètres.', + updateConfigurationChannel: 'Mises à jour suspendues : channel doit être nightly ou stable. Corrigez le fichier et redémarrez, ou sélectionnez à nouveau le canal dans les paramètres.', updateConfigurationCleanup: 'Mises à jour suspendues : suppression de la mise à jour précédente impossible ; redémarrez l’application', updateCheckFailedTitle: 'Échec de la vérification de la mise à jour', updateCheckFailed: 'Impossible de vérifier les mises à jour. Veuillez réessayer plus tard.', @@ -1026,7 +1026,7 @@ export const de = { updateConfigurationFailed: 'Die Update-Einstellungen konnten nicht angewendet werden. Korrigiere die Datei und starte neu, oder wähle in den Einstellungen einen Update-Kanal.', updateConfigurationRead: 'Updates pausiert: Einstellungsdatei nicht lesbar. Korrigiere die Datei und starte neu, oder wähle den Kanal erneut in den Einstellungen.', updateConfigurationFormat: 'Updates pausiert: ungültige Einstellungsdatei. Korrigiere die Datei und starte neu, oder wähle den Kanal erneut in den Einstellungen.', - updateConfigurationChannel: 'Updates pausiert: channel muss nightly oder latest sein. Korrigiere die Datei und starte neu, oder wähle den Kanal erneut in den Einstellungen.', + updateConfigurationChannel: 'Updates pausiert: channel muss nightly oder stable sein. Korrigiere die Datei und starte neu, oder wähle den Kanal erneut in den Einstellungen.', updateConfigurationCleanup: 'Updates pausiert: vorheriges Update nicht verwerfbar; App neu starten', updateCheckFailedTitle: 'Update-Überprüfung fehlgeschlagen', updateCheckFailed: 'Es konnte nicht nach Updates gesucht werden. Bitte versuchen Sie es später noch einmal.', @@ -1209,7 +1209,7 @@ export const ru = { updateConfigurationFailed: 'Не удалось применить настройки обновления. Исправьте файл и перезапустите приложение или выберите канал в настройках.', updateConfigurationRead: 'Обновления приостановлены: не удалось прочитать настройки. Исправьте файл и перезапустите приложение или снова выберите канал в настройках.', updateConfigurationFormat: 'Обновления приостановлены: неверный формат файла настроек. Исправьте файл и перезапустите приложение или снова выберите канал в настройках.', - updateConfigurationChannel: 'Обновления приостановлены: channel должен быть nightly или latest. Исправьте файл и перезапустите приложение или снова выберите канал в настройках.', + updateConfigurationChannel: 'Обновления приостановлены: channel должен быть nightly или stable. Исправьте файл и перезапустите приложение или снова выберите канал в настройках.', updateConfigurationCleanup: 'Обновления приостановлены: не удалось удалить предыдущее обновление; перезапустите приложение', updateCheckFailedTitle: 'Проверка обновления не удалась', updateCheckFailed: 'Не удалось проверить наличие обновлений. Пожалуйста, повторите попытку позже.', @@ -1392,7 +1392,7 @@ export const pt = { updateConfigurationFailed: 'Não foi possível aplicar as configurações de atualização. Corrija o arquivo e reinicie, ou selecione um canal nas configurações.', updateConfigurationRead: 'Atualizações pausadas: não foi possível ler as configurações. Corrija o arquivo e reinicie, ou selecione o canal novamente nas configurações.', updateConfigurationFormat: 'Atualizações pausadas: arquivo de configurações inválido. Corrija o arquivo e reinicie, ou selecione o canal novamente nas configurações.', - updateConfigurationChannel: 'Atualizações pausadas: channel deve ser nightly ou latest. Corrija o arquivo e reinicie, ou selecione o canal novamente nas configurações.', + updateConfigurationChannel: 'Atualizações pausadas: channel deve ser nightly ou stable. Corrija o arquivo e reinicie, ou selecione o canal novamente nas configurações.', updateConfigurationCleanup: 'Atualizações pausadas: não foi possível descartar a atualização anterior; reinicie o aplicativo', updateCheckFailedTitle: 'Falha na verificação de atualização', updateCheckFailed: 'Não foi possível verificar se há atualizações. Por favor, tente novamente mais tarde.', diff --git a/apps/desktop/src/mandatory-update-policy.ts b/apps/desktop/src/mandatory-update-policy.ts index b51d58b914..e90125feef 100644 --- a/apps/desktop/src/mandatory-update-policy.ts +++ b/apps/desktop/src/mandatory-update-policy.ts @@ -8,7 +8,7 @@ export interface DesktopPolicyIdentity { readonly platform: 'win32' | 'darwin' readonly bundledDshVersion: string readonly arch: 'x64' | 'arm64' - readonly channel: 'nightly' | 'latest' + readonly channel: 'nightly' | 'stable' } /** Validated deployment choices; test authentication is explicitly enabled, never inferred from a redirect. */ diff --git a/apps/desktop/src/settings-file.ts b/apps/desktop/src/settings-file.ts index 996854a3b0..17eb8e7b9d 100644 --- a/apps/desktop/src/settings-file.ts +++ b/apps/desktop/src/settings-file.ts @@ -6,7 +6,7 @@ import { z } from 'zod' const preferencesSchema = z.object({ allowTestAuthPopupWindow: z.boolean(), - channel: z.enum(['nightly', 'latest']), + channel: z.enum(['nightly', 'stable']), }) const documentSchema = z.looseObject({ updates: z.looseObject({}).optional() }) diff --git a/apps/desktop/src/update-channel.ts b/apps/desktop/src/update-channel.ts index 450dedcd95..85f5e10da1 100644 --- a/apps/desktop/src/update-channel.ts +++ b/apps/desktop/src/update-channel.ts @@ -13,6 +13,6 @@ export function desktopUpdateChannel(manifest: unknown): DesktopUpdateChannel { if (typeof manifest !== 'object' || manifest === null) throw new Error('desktop update: invalid application manifest') if (!('dshDesktopUpdateChannel' in manifest)) return 'nightly' const channel = manifest.dshDesktopUpdateChannel - if (channel !== 'nightly' && channel !== 'latest') throw new Error('desktop update: invalid packaged channel') + if (channel !== 'nightly' && channel !== 'stable') throw new Error('desktop update: invalid packaged channel') return channel } diff --git a/apps/desktop/src/update-coordinator.ts b/apps/desktop/src/update-coordinator.ts index 0beab5ae25..1f388306d5 100644 --- a/apps/desktop/src/update-coordinator.ts +++ b/apps/desktop/src/update-coordinator.ts @@ -275,7 +275,7 @@ export class DesktopUpdateCoordinator { this.cancellation = result.cancellationToken const version = result.updateInfo.version if (valid(version) === null) throw new Error('desktop update: feed version is invalid') - if (this.channel === 'latest' && version.includes('-')) throw new Error('desktop update: latest feed contains a prerelease') + if (this.channel === 'stable' && version.includes('-')) throw new Error('desktop update: stable feed contains a prerelease') this.release = result.isUpdateAvailable && gt(version, this.currentVersion()) ? { kind: 'checked', version } : { kind: 'none' } return this.setState(this.candidate === undefined ? { phase: 'idle' } : { phase: 'available', version }) diff --git a/apps/desktop/src/updates/electron-updater/channel.ts b/apps/desktop/src/updates/electron-updater/channel.ts index 498770159e..169d0cf01b 100644 --- a/apps/desktop/src/updates/electron-updater/channel.ts +++ b/apps/desktop/src/updates/electron-updater/channel.ts @@ -6,7 +6,7 @@ import type { AppUpdater } from 'electron-updater' * @param updater - Updater whose prior operations have settled. * @param channel - Selected distribution channel. */ -export function selectUpdateChannel(updater: AppUpdater, channel: 'nightly' | 'latest'): void { +export function selectUpdateChannel(updater: AppUpdater, channel: 'nightly' | 'stable'): void { updater.channel = channel // The library channel setter enables downgrades. updater.allowDowngrade = false diff --git a/apps/desktop/tests/desktop-auto-update-environment.spec.ts b/apps/desktop/tests/desktop-auto-update-environment.spec.ts index 9fbe629c89..4e2e7f9c70 100644 --- a/apps/desktop/tests/desktop-auto-update-environment.spec.ts +++ b/apps/desktop/tests/desktop-auto-update-environment.spec.ts @@ -119,3 +119,14 @@ describe('desktop auto-update environment', () => { expect(() => desktopUpdateMetadataFilename('1.2.3', 'linux')).toThrow(/unsupported metadata platform/u) }) }) + + +it.each([['darwin', 'arm64', 'mac-arm64', 'stable-mac.yml'], ['darwin', 'x64', 'mac-x64', 'stable-mac.yml'], ['win32', 'x64', 'win-x64', 'stable.yml']] as const) +('routes stable metadata and binaries separately for %s %s', (platform, arch, target, filename) => { + const config = resolveDesktopAutoUpdateConfig({ DSH_DESKTOP_AUTO_UPDATE_ENV: 'production', DSH_DESKTOP_UPDATE_CHANNEL: 'stable' }, platform, arch) + expect(config.channel).toBe('stable') + expect(config.keyPrefix).toBe(`dsh-desk/feeds/${target}`) + expect(config.binaryKeyPrefix).toBe(`dsh-desk/bin/${target}/stable`) + expect(desktopUpdateMetadataFilename('1.0.0', platform, config.channel)).toBe(filename) + expect(() => resolveDesktopAutoUpdateConfig({ DSH_DESKTOP_UPDATE_CHANNEL: 'latest' }, platform, arch)).toThrow(/channel/u) +}) diff --git a/apps/desktop/tests/desktop-publication-summary.spec.ts b/apps/desktop/tests/desktop-publication-summary.spec.ts index 5267d29034..bfb5beb483 100644 --- a/apps/desktop/tests/desktop-publication-summary.spec.ts +++ b/apps/desktop/tests/desktop-publication-summary.spec.ts @@ -6,16 +6,16 @@ import type { DesktopUploadPlan } from '../scripts/desktop-upload-plan.ts' const source: DesktopRetainedSource = { repository: 'owner/repo', runId: '20', attempt: '3', commit: 'a'.repeat(40), workflowCommit: 'b'.repeat(40), - sourceRef: 'dsh-v1.0.0', channel: 'latest', runnerName: 'windows-publisher', target: 'win-x64', + sourceRef: 'dsh-v1.0.0', channel: 'stable', runnerName: 'windows-publisher', target: 'win-x64', preset: 'production', productVersion: '1.0.0', version: '1.0.0', testReleaseId: null, qualification: 'signed', } const plan: DesktopUploadPlan = { environment: 'production', target: 'win-x64', version: '1.0.0', bucket: 'production-1234567890', publicUrl: 'https://download.example.com/dsh-desk/feeds/win-x64/', secretIdEnvName: 'SECRET_ID', secretKeyEnvName: 'SECRET_KEY', artifacts: [ - { path: '/not-read/installer.exe', filename: 'deepseek-harness-1.0.0-win-x64.exe', key: 'dsh-desk/bin/win-x64/latest/deepseek-harness-1.0.0-win-x64.exe', + { path: '/not-read/installer.exe', filename: 'deepseek-harness-1.0.0-win-x64.exe', key: 'dsh-desk/bin/win-x64/stable/deepseek-harness-1.0.0-win-x64.exe', contents: 'installer bytes', contentType: 'application/octet-stream', channelMetadata: false }, - { path: '/not-read/latest.yml', filename: 'latest.yml', key: 'dsh-desk/feeds/win-x64/latest.yml', + { path: '/not-read/stable.yml', filename: 'stable.yml', key: 'dsh-desk/feeds/win-x64/stable.yml', contents: 'version: 1.0.0\n', contentType: 'application/yaml', channelMetadata: true }, ], } @@ -23,8 +23,8 @@ const plan: DesktopUploadPlan = { it('shows production destinations and tag after approval with upload-byte fingerprints', async () => { const summary = await desktopPublicationSummary(source, plan, 'c'.repeat(64)) await expect(summary).toMatchFileSnapshot('./expected/publication-production.md') - expect(summary).toContain('/latest/deepseek-harness-1.0.0-win-x64.exe') - expect(summary).toContain('https://download.example.com/dsh-desk/feeds/win-x64/latest.yml') + expect(summary).toContain('/stable/deepseek-harness-1.0.0-win-x64.exe') + expect(summary).toContain('https://download.example.com/dsh-desk/feeds/win-x64/stable.yml') expect(summary).toContain(createHash('sha256').update('version: 1.0.0\n').digest('hex')) expect(summary).not.toContain('测试 release ID |') expect(summary).not.toContain('SECRET_KEY') diff --git a/apps/desktop/tests/desktop-rollback.spec.ts b/apps/desktop/tests/desktop-rollback.spec.ts index 2bf2151626..f7912ea09b 100644 --- a/apps/desktop/tests/desktop-rollback.spec.ts +++ b/apps/desktop/tests/desktop-rollback.spec.ts @@ -55,17 +55,17 @@ it.each(['missing-file', 'changed-file', 'changed-channel'] as const)('rejects % expect(f.writes).toEqual([]) }) -it('restores nightly when latest already matches and resumes a partially restored pair', async () => { - for (const latestAlreadyMatches of [true, false]) { +it('restores nightly when stable already matches and resumes a partially restored pair', async () => { + for (const stableAlreadyMatches of [true, false]) { const f = fixture() const nightly = f.plan.artifacts[1]! - const plan = { ...f.plan, artifacts: [...f.plan.artifacts, { ...nightly, key: 'feed/latest.yml', filename: 'latest.yml' }] } - f.objects.set('feed/latest.yml', latestAlreadyMatches ? nightly.contents! : 'version: 2.0.0\n') - if (!latestAlreadyMatches) { + const plan = { ...f.plan, artifacts: [...f.plan.artifacts, { ...nightly, key: 'feed/stable.yml', filename: 'stable.yml' }] } + f.objects.set('feed/stable.yml', stableAlreadyMatches ? nightly.contents! : 'version: 2.0.0\n') + if (!stableAlreadyMatches) { const put = f.operations.transport.put.bind(f.operations.transport) const interrupted = { ...f.operations, transport: { ...f.operations.transport, async put(...args: Parameters) { - if (args[0].key === 'feed/latest.yml') throw new Error('fixture interruption') + if (args[0].key === 'feed/stable.yml') throw new Error('fixture interruption') return put(...args) }, } } @@ -73,7 +73,7 @@ it('restores nightly when latest already matches and resumes a partially restore } await expect(rollbackDesktopChannel(plan, '2.0.0', true, f.operations)).resolves.toMatchObject({ status: 'complete' }) expect(f.objects.get('feed/nightly.yml')).toBe(nightly.contents) - expect(f.objects.get('feed/latest.yml')).toBe(nightly.contents) + expect(f.objects.get('feed/stable.yml')).toBe(nightly.contents) expect(f.writes.filter(key => key === 'feed/nightly.yml')).toHaveLength(1) } }) diff --git a/apps/desktop/tests/desktop-upload-plan.spec.ts b/apps/desktop/tests/desktop-upload-plan.spec.ts index def8cb19bf..d213484167 100644 --- a/apps/desktop/tests/desktop-upload-plan.spec.ts +++ b/apps/desktop/tests/desktop-upload-plan.spec.ts @@ -38,7 +38,7 @@ async function fixture( target: DesktopPackageTargetName, version = '1.2.3', environment: 'test' | 'production' = 'test', - channel: 'nightly' | 'latest' = 'nightly', + channel: 'nightly' | 'stable' = 'nightly', ): Promise { const root = await mkdtemp(join(tmpdir(), 'dsh-desktop-upload-')) temporaryDirectories.push(root) @@ -175,14 +175,14 @@ describe('desktop upload plan', () => { .rejects.toThrow(failure === 'checksum' ? /SHA-512/u : /completion record/u) }) - it.each(['test', 'production'] as const)('isolates stable latest packages from nightly in %s', async (environment) => { + it.each(['test', 'production'] as const)('isolates stable-channel packages from nightly in %s', async (environment) => { const nightly = await createDesktopUploadPlan('win-x64', await fixture('win-x64', '1.2.3', environment, 'nightly')) - const latest = await createDesktopUploadPlan('win-x64', await fixture('win-x64', '1.2.3', environment, 'latest')) - expect(latest.artifacts.filter(file => file.channelMetadata).map(file => file.filename)).toEqual(['latest.yml']) + const stable = await createDesktopUploadPlan('win-x64', await fixture('win-x64', '1.2.3', environment, 'stable')) + expect(stable.artifacts.filter(file => file.channelMetadata).map(file => file.filename)).toEqual(['stable.yml']) expect(nightly.artifacts.filter(file => file.channelMetadata).map(file => file.filename)).toEqual(['nightly.yml']) - expect(latest.artifacts.every(file => !nightly.artifacts.some(other => other.key === file.key))).toBe(true) - const prerelease = await fixture('win-x64', '1.2.3-alpha.1', environment, 'latest') - await expect(createDesktopUploadPlan('win-x64', prerelease)).rejects.toThrow(/latest requires a stable version/u) + expect(stable.artifacts.every(file => !nightly.artifacts.some(other => other.key === file.key))).toBe(true) + const prerelease = await fixture('win-x64', '1.2.3-alpha.1', environment, 'stable') + await expect(createDesktopUploadPlan('win-x64', prerelease)).rejects.toThrow(/stable requires a stable version/u) }) it('publishes fixed feeds referencing versioned binaries without overriding CDN cache policy', async () => { diff --git a/apps/desktop/tests/expected/publication-production.md b/apps/desktop/tests/expected/publication-production.md index 9041d1b3d9..a3b93ccb87 100644 --- a/apps/desktop/tests/expected/publication-production.md +++ b/apps/desktop/tests/expected/publication-production.md @@ -7,10 +7,10 @@ | --- | --- | | 发布环境 | production | | 版本号 | 1.0.0 | -| 升级通道 | latest | +| 升级通道 | stable | | 平台 | win-x64 | -| 下载地址预览 | https://download.example.com/dsh-desk/bin/win-x64/latest/deepseek-harness-1.0.0-win-x64.exe
发布后的目标地址,审批前不保证可下载。 | -| 升级 YAML | https://download.example.com/dsh-desk/feeds/win-x64/latest.yml
本次发布将更新此文件;审批前可能不存在或仍指向旧版本。 | +| 下载地址预览 | https://download.example.com/dsh-desk/bin/win-x64/stable/deepseek-harness-1.0.0-win-x64.exe
发布后的目标地址,审批前不保证可下载。 | +| 升级 YAML | https://download.example.com/dsh-desk/feeds/win-x64/stable.yml
本次发布将更新此文件;审批前可能不存在或仍指向旧版本。 | | 打包来源 | 查看打包运行 #20 · 第 3 次尝试
源码:dsh-v1.0.0 @ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
打包机器:windows-publisher | | 签名与公证 | EXE 签名校验通过 | | Git tag | desktop-v1.0.0 | @@ -33,8 +33,8 @@ COS 存储桶:production-1234567890 | 文件 | 大小 | SHA-256 | | --- | --- | --- | -| deepseek-harness-1.0.0-win-x64.exe | 15 字节 | e34210a6de4f653edf588301431c3d69a633638cbf587345cc50a7fed9f38f4c | -| latest.yml | 15 字节 | 8850e6075dda0080c526269a4de29848c32c2a65e3d81f4a64ed8ce53d4b47c1 | +| deepseek-harness-1.0.0-win-x64.exe | 15 字节 | e34210a6de4f653edf588301431c3d69a633638cbf587345cc50a7fed9f38f4c | +| stable.yml | 15 字节 | 8850e6075dda0080c526269a4de29848c32c2a65e3d81f4a64ed8ce53d4b47c1 | diff --git a/apps/desktop/tests/macos-app-update-config.spec.ts b/apps/desktop/tests/macos-app-update-config.spec.ts index bba859fa7c..23e255e48a 100644 --- a/apps/desktop/tests/macos-app-update-config.spec.ts +++ b/apps/desktop/tests/macos-app-update-config.spec.ts @@ -66,10 +66,10 @@ describe('macOS packaged updater configuration', () => { }) -it('seals latest into the macOS updater file and rejects a different expected channel', async () => { +it('seals stable into the macOS updater file and rejects a different expected channel', async () => { const paths = await fixture() - const latest = resolveMacOSAppUpdateFeed([{ provider: 'generic', url: update.publicUrl, channel: 'latest' }]) - await writeMacOSAppUpdateConfig(paths.resourcesDir, latest, 'fixture-updater') - await expect(verifyMacOSAppUpdateConfig(paths.appPath, latest)).resolves.toBeUndefined() + const stable = resolveMacOSAppUpdateFeed([{ provider: 'generic', url: update.publicUrl, channel: 'stable' }]) + await writeMacOSAppUpdateConfig(paths.resourcesDir, stable, 'fixture-updater') + await expect(verifyMacOSAppUpdateConfig(paths.appPath, stable)).resolves.toBeUndefined() await expect(verifyMacOSAppUpdateConfig(paths.appPath, update)).rejects.toThrow(/does not match/u) }) diff --git a/apps/desktop/tests/main-startup.spec.ts b/apps/desktop/tests/main-startup.spec.ts index 8c8fa73d3b..df594bed39 100644 --- a/apps/desktop/tests/main-startup.spec.ts +++ b/apps/desktop/tests/main-startup.spec.ts @@ -367,16 +367,16 @@ vi.mock('../src/update-dialog.ts', () => ({ DesktopUpdateDialog: class { dispose() {} } })) vi.mock('../src/update-coordinator.ts', () => ({ DesktopUpdateCoordinator: class { - selectedChannel: 'nightly' | 'latest' = 'nightly' + selectedChannel: 'nightly' | 'stable' = 'nightly' revision = 0 configurationFailure: 'startup' | 'cleanup' | undefined constructor(publish: (state: DesktopUpdateState) => DesktopUpdateState, beforeRestart: () => Promise, - _updater: unknown, _enabled: unknown, _version: unknown, _downloadResult: unknown, channel: 'nightly' | 'latest') { + _updater: unknown, _enabled: unknown, _version: unknown, _downloadResult: unknown, channel: 'nightly' | 'stable') { this.selectedChannel = channel harness.prepareUpdate = beforeRestart harness.publishUpdate = publish } - async switchChannel(channel: 'nightly' | 'latest', persist: () => Promise) { + async switchChannel(channel: 'nightly' | 'stable', persist: () => Promise) { await persist() this.selectedChannel = channel this.configurationFailure = undefined @@ -509,22 +509,22 @@ describe('desktop main startup', () => { configureTestAuthPopup(true) await readyForUpdate() expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: 'nightly', changing: false }) - expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest')).toEqual({ kind: 'applied', state: { channel: 'latest', packagedChannel: 'nightly', changing: false } }) + expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable')).toEqual({ kind: 'applied', state: { channel: 'stable', packagedChannel: 'nightly', changing: false } }) const path = join(harness.app.getPath('userData'), 'desktop', 'settings.json') - expect(JSON.parse(readFileSync(path, 'utf8'))).toEqual({ updates: { allowTestAuthPopupWindow: true, channel: 'latest' } }) + expect(JSON.parse(readFileSync(path, 'utf8'))).toEqual({ updates: { allowTestAuthPopupWindow: true, channel: 'stable' } }) writeFileSync(path, JSON.stringify({ updates: { channel: 'nightly' } })) - expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: 'latest' }) + expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: 'stable' }) expect(harness.windows[0]!.webContents.send).toHaveBeenCalledWith(DESKTOP_IPC.updatesChannelChanged, - { channel: 'latest', packagedChannel: 'nightly', changing: false }) + { channel: 'stable', packagedChannel: 'nightly', changing: false }) await expect(invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'alpha')).rejects.toThrow('unsupported channel') - expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: 'latest' }) + expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: 'stable' }) }) it('reports a corrupt document without replacing it or pretending a UI save succeeded', async () => { await readyForUpdate() const path = join(harness.app.getPath('userData'), 'desktop', 'settings.json') writeFileSync(path, '{broken') - expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest')).toMatchObject({ kind: 'failed', reason: 'format', state: { channel: 'nightly', changing: false } }) + expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable')).toMatchObject({ kind: 'failed', reason: 'format', state: { channel: 'nightly', changing: false } }) expect(readFileSync(path, 'utf8')).toBe('{broken') expect(await invoke(DESKTOP_IPC.updatesStatus, 'app')).not.toHaveProperty('configurationError') }) @@ -533,7 +533,7 @@ describe('desktop main startup', () => { await readyForUpdate() harness.updateState = { phase: 'ready', version: '1.0.1' } writeFileSync(join(harness.app.getPath('userData'), 'desktop', 'settings.json'), '{broken') - await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest') + await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable') await invoke(DESKTOP_IPC.updatesOpen, 'app') expect(harness.updateInstall).toHaveBeenCalledWith('1.0.1', 0) }) @@ -545,7 +545,7 @@ describe('desktop main startup', () => { await readyForUpdate() expect(await invoke(DESKTOP_IPC.updatesChannelGet, 'app')).toMatchObject({ channel: null, error: 'channel' }) expect(harness.hosts).toHaveLength(1) - expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest')).toEqual({ kind: 'applied', state: { channel: 'latest', packagedChannel: 'nightly', changing: false } }) + expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable')).toEqual({ kind: 'applied', state: { channel: 'stable', packagedChannel: 'nightly', changing: false } }) }) @@ -557,7 +557,7 @@ describe('desktop main startup', () => { this.suspendConfiguration('cache retirement failed', 'cleanup') throw new Error('cache retirement failed') }) - expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest')).toMatchObject({ + expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable')).toMatchObject({ kind: 'failed', reason: 'apply', state: { channel: 'nightly', error: 'cleanup' }, }) expect(await invoke(DESKTOP_IPC.updatesStatus, 'app')).toMatchObject({ configurationError: 'cleanup' }) @@ -577,7 +577,7 @@ describe('desktop main startup', () => { message: en.updateConfigurationChannel, detail: path, }) writeFileSync(path, '{broken') - expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'latest')).toMatchObject({ + expect(await invoke(DESKTOP_IPC.updatesChannelSet, 'app', 'stable')).toMatchObject({ kind: 'failed', reason: 'format', state: { channel: null, error: 'channel' }, }) expect(await invoke(DESKTOP_IPC.updatesStatus, 'app')).toMatchObject({ configurationError: 'channel' }) diff --git a/apps/desktop/tests/preload-app.spec.ts b/apps/desktop/tests/preload-app.spec.ts index 0580ec7881..fa3d2386f0 100644 --- a/apps/desktop/tests/preload-app.spec.ts +++ b/apps/desktop/tests/preload-app.spec.ts @@ -299,13 +299,13 @@ it('exposes channel choices and scoped subscriptions without exposing updater ob await import('../src/preload-app.ts') const api = electron.contextBridge.exposeInMainWorld.mock.calls.find(([name]) => name === 'dshDesktop')?.[1] as DshDesktopProductApi await api.updates.channels.get() - await api.updates.channels.set('latest') - expect(electron.ipcRenderer.invoke.mock.calls).toEqual([[DESKTOP_IPC.updatesChannelGet], [DESKTOP_IPC.updatesChannelSet, 'latest']]) + await api.updates.channels.set('stable') + expect(electron.ipcRenderer.invoke.mock.calls).toEqual([[DESKTOP_IPC.updatesChannelGet], [DESKTOP_IPC.updatesChannelSet, 'stable']]) const listener = vi.fn() const dispose = api.updates.channels.subscribe(listener) const handler = electron.ipcRenderer.on.mock.calls.find(([channel]) => channel === DESKTOP_IPC.updatesChannelChanged)?.[1] as (event: unknown, state: unknown) => void - const state = { channel: 'latest', packagedChannel: 'nightly', changing: false } + const state = { channel: 'stable', packagedChannel: 'nightly', changing: false } handler({}, state) expect(listener).toHaveBeenCalledWith(state) dispose() diff --git a/apps/desktop/tests/settings-file.spec.ts b/apps/desktop/tests/settings-file.spec.ts index 7d5009f380..de0de14c71 100644 --- a/apps/desktop/tests/settings-file.spec.ts +++ b/apps/desktop/tests/settings-file.spec.ts @@ -41,7 +41,7 @@ it.each([ const result = await file.initialize() expect(result).toMatchObject({ kind: 'error', error: { problem: { kind: 'invalid', reason }, path: file.path } }) expect(JSON.stringify(result)).not.toContain('secret-value') - await expect(file.saveUpdates({ channel: 'latest' })).rejects.toMatchObject({ problem: { kind: 'invalid', reason } }) + await expect(file.saveUpdates({ channel: 'stable' })).rejects.toMatchObject({ problem: { kind: 'invalid', reason } }) expect(await readFile(file.path, 'utf8')).toBe(raw) }) @@ -52,7 +52,7 @@ it('keeps an invalid channel independent from the popup preference and repairs o allowTestAuthPopupWindow: { kind: 'valid', value: true }, } }) expect((await readDesktopSettings(root)).updates.allowTestAuthPopupWindow).toBe(true) - expect(await new DesktopUpdateSettings(root, 'latest').load()).toMatchObject({ kind: 'error' }) + expect(await new DesktopUpdateSettings(root, 'stable').load()).toMatchObject({ kind: 'error' }) await file.saveUpdates({ channel: 'nightly' }) expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ other: [1], updates: { channel: 'nightly', allowTestAuthPopupWindow: true, future: { x: 2 }, @@ -63,12 +63,12 @@ it('keeps a valid channel usable when the popup preference is invalid', async () const { root, file } = await fixture('{"updates":{"channel":"nightly","allowTestAuthPopupWindow":"bad"}}') vi.spyOn(console, 'warn').mockImplementation(() => {}) expect((await readDesktopSettings(root)).updates.allowTestAuthPopupWindow).toBe(false) - expect(await new DesktopUpdateSettings(root, 'latest').load()).toEqual({ kind: 'ready', channel: 'nightly' }) - await file.saveUpdates({ channel: 'latest' }) - expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'latest', allowTestAuthPopupWindow: 'bad' } }) + expect(await new DesktopUpdateSettings(root, 'stable').load()).toEqual({ kind: 'ready', channel: 'nightly' }) + await file.saveUpdates({ channel: 'stable' }) + expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'stable', allowTestAuthPopupWindow: 'bad' } }) await file.saveUpdates({ allowTestAuthPopupWindow: true }) expect(await file.read()).toMatchObject({ kind: 'ready', fields: { - allowTestAuthPopupWindow: { kind: 'valid', value: true }, channel: { kind: 'valid', value: 'latest' }, + allowTestAuthPopupWindow: { kind: 'valid', value: true }, channel: { kind: 'valid', value: 'stable' }, } }) }) @@ -83,8 +83,8 @@ it('serializes initializers and patches from separate storage instances without const { root, file } = await fixture() const other = new DesktopSettingsFile(root) await Promise.all([file.initialize(), other.initialize()]) - await Promise.all([file.saveUpdates({ channel: 'latest' }), other.saveUpdates({ allowTestAuthPopupWindow: true })]) - expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'latest', allowTestAuthPopupWindow: true } }) + await Promise.all([file.saveUpdates({ channel: 'stable' }), other.saveUpdates({ allowTestAuthPopupWindow: true })]) + expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'stable', allowTestAuthPopupWindow: true } }) await expect(fs.access(`${file.path}.lock`)).rejects.toMatchObject({ code: 'ENOENT' }) }) @@ -103,7 +103,7 @@ it('preserves a file created by an external writer during exclusive initializati it('reports preparation failure as unchanged and does not create a file', async () => { const { file } = await fixture() vi.spyOn(fs, 'mkdir').mockRejectedValue(Object.assign(new Error('denied'), { code: 'EACCES' })) - await expect(file.saveUpdates({ channel: 'latest' })).rejects.toMatchObject({ problem: { + await expect(file.saveUpdates({ channel: 'stable' })).rejects.toMatchObject({ problem: { kind: 'write', operation: 'save', effect: 'unchanged', } }) await expect(readFile(file.path)).rejects.toMatchObject({ code: 'ENOENT' }) @@ -112,7 +112,7 @@ it('reports preparation failure as unchanged and does not create a file', async it('reports uncertain write completion without reporting a successful save', async () => { const { file } = await fixture('{}') vi.spyOn(atomic, 'writeFileAtomic').mockRejectedValue(new Error('write failed')) - await expect(file.saveUpdates({ channel: 'latest' })).rejects.toMatchObject({ problem: { + await expect(file.saveUpdates({ channel: 'stable' })).rejects.toMatchObject({ problem: { kind: 'write', operation: 'save', effect: 'unknown', } }) expect(await readFile(file.path, 'utf8')).toBe('{}') @@ -126,13 +126,13 @@ it('reports a committed write when lock cleanup fails, without claiming rollback if (path === `${file.path}.lock`) throw new Error('lock cleanup failed') return original(path, options) }) - await expect(file.saveUpdates({ channel: 'latest' })).rejects.toMatchObject({ problem: { + await expect(file.saveUpdates({ channel: 'stable' })).rejects.toMatchObject({ problem: { kind: 'write', operation: 'save', effect: 'written', } }) - expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'latest' } }) + expect(JSON.parse(await readFile(file.path, 'utf8'))).toEqual({ updates: { channel: 'stable' } }) }) -it.each(['nightly', 'latest'])('accepts the same channel at the IPC and file boundaries: %s', async (channel) => { +it.each(['nightly', 'stable'])('accepts the same channel at the IPC and file boundaries: %s', async (channel) => { const { file } = await fixture(JSON.stringify({ updates: { channel } })) expect(isDesktopUpdateChannel(channel)).toBe(true) expect(await file.read()).toMatchObject({ kind: 'ready', fields: { channel: { kind: 'valid', value: channel } } }) @@ -160,13 +160,13 @@ it('reports a partial initialization write as uncertain and preserves it for dia }) it('rereads fields after acquiring the writer lock instead of saving a stale snapshot', async () => { - const { file } = await fixture('{"updates":{"channel":"latest"}}') + const { file } = await fixture('{"updates":{"channel":"stable"}}') const started = Promise.withResolvers() const release = Promise.withResolvers() const holder = atomic.withFileLock(file.path, async () => { started.resolve(undefined) await release.promise - await writeFile(file.path, '{"updates":{"channel":"latest","future":3},"other":4}') + await writeFile(file.path, '{"updates":{"channel":"stable","future":3},"other":4}') }) await started.promise const attempting = Promise.withResolvers() diff --git a/apps/desktop/tests/update-channel.spec.ts b/apps/desktop/tests/update-channel.spec.ts index 8ea7bb98a4..191cd8e5d9 100644 --- a/apps/desktop/tests/update-channel.spec.ts +++ b/apps/desktop/tests/update-channel.spec.ts @@ -3,8 +3,9 @@ import { desktopUpdateChannel } from '../src/update-channel.ts' it('reads the installed channel independently from the current version', () => { expect(desktopUpdateChannel({ version: '1.0.0', dshDesktopUpdateChannel: 'nightly' })).toBe('nightly') - expect(desktopUpdateChannel({ version: '1.0.0', dshDesktopUpdateChannel: 'latest' })).toBe('latest') + expect(desktopUpdateChannel({ version: '1.0.0', dshDesktopUpdateChannel: 'stable' })).toBe('stable') expect(desktopUpdateChannel({ version: '1.0.0' })).toBe('nightly') + expect(() => desktopUpdateChannel({ dshDesktopUpdateChannel: 'latest' })).toThrow(/channel/u) expect(() => desktopUpdateChannel({ dshDesktopUpdateChannel: 'beta' })).toThrow(/channel/u) expect(() => desktopUpdateChannel(null)).toThrow(/manifest/u) }) diff --git a/apps/desktop/tests/update-configuration.spec.ts b/apps/desktop/tests/update-configuration.spec.ts index 6da4e057a5..571fb7c1bc 100644 --- a/apps/desktop/tests/update-configuration.spec.ts +++ b/apps/desktop/tests/update-configuration.spec.ts @@ -30,7 +30,7 @@ it('only exposes a permission hint for a known filesystem permission failure', ( it('provides distinct localized reasons and recovery without raw errors', () => { expect(configurationMessage('read', en)).toContain('cannot read settings') expect(configurationMessage('format', en)).toContain('invalid settings') - expect(configurationMessage('channel', zh)).toContain('nightly 或 latest') + expect(configurationMessage('channel', zh)).toContain('nightly 或 stable') expect(configurationMessage('cleanup', zh)).toContain('请重启应用') expect(configurationMessage('cleanup', en)).not.toContain('settings file') }) diff --git a/apps/desktop/tests/update-coordinator.spec.ts b/apps/desktop/tests/update-coordinator.spec.ts index 3f194e4fd9..275be855c9 100644 --- a/apps/desktop/tests/update-coordinator.spec.ts +++ b/apps/desktop/tests/update-coordinator.spec.ts @@ -39,7 +39,7 @@ describe('desktop release metadata', () => { nodeVersion: '24.17.0', pnpmVersion: '11.7.0', } - expect(() => parseDesktopRelease({ ...base, version: 'latest' })).toThrow(/invalid desktop release metadata/u) + expect(() => parseDesktopRelease({ ...base, version: 'stable' })).toThrow(/invalid desktop release metadata/u) expect(() => parseDesktopRelease({ ...base, hostProtocolVersion: 999 })).toThrow(/invalid desktop release metadata/u) }) }) @@ -47,7 +47,7 @@ describe('desktop release metadata', () => { const coordinators: InstanceType[] = [] afterEach(() => { for (const item of coordinators.splice(0)) item.dispose() }) -function fixture(channel: 'nightly' | 'latest' = 'nightly', version = '1.1.0-alpha.1') { +function fixture(channel: 'nightly' | 'stable' = 'nightly', version = '1.1.0-alpha.1') { const events = new EventEmitter() const checkForUpdates = vi.fn(async () => ({ isUpdateAvailable: true, @@ -244,18 +244,18 @@ it.each([new DesktopUpdatePreparationError('stop-failed', 'private diagnostic'), }) -it('keeps a stable-version nightly installation on nightly and rejects prereleases on latest', async () => { +it('keeps a stable-version nightly installation on nightly and rejects prereleases on stable', async () => { const nightly = fixture('nightly', '1.0.0') expect(nightly.updater.channel).toBe('nightly') expect(nightly.updater.allowPrerelease).toBe(true) expect((await nightly.coordinator.check()).phase).toBe('available') expect(nightly.updater.channel).toBe('nightly') - const latest = fixture('latest', '1.0.0') - expect(latest.updater.channel).toBe('latest') - expect(latest.updater.allowPrerelease).toBe(false) - expect(latest.updater.allowDowngrade).toBe(false) - expect((await latest.coordinator.check()).phase).toBe('error') - expect(latest.downloadUpdate).not.toHaveBeenCalled() + const stable = fixture('stable', '1.0.0') + expect(stable.updater.channel).toBe('stable') + expect(stable.updater.allowPrerelease).toBe(false) + expect(stable.updater.allowDowngrade).toBe(false) + expect((await stable.coordinator.check()).phase).toBe('error') + expect(stable.downloadUpdate).not.toHaveBeenCalled() }) @@ -266,9 +266,9 @@ it('retires a downloaded target and rejects its old confirmation after switching await f.coordinator.download('1.1.0-rc.2') const save = vi.fn(async () => {}) f.checkForUpdates.mockResolvedValueOnce({ isUpdateAvailable: true, updateInfo: { version: '1.2.0' } }) - await f.coordinator.switchChannel('latest', save) + await f.coordinator.switchChannel('stable', save) expect(save).toHaveBeenCalledOnce() - expect(f.coordinator.selectedChannel).toBe('latest') + expect(f.coordinator.selectedChannel).toBe('stable') expect(f.updater.allowDowngrade).toBe(false) expect(f.coordinator.state).toMatchObject({ phase: 'available', version: '1.2.0' }) await f.coordinator.install('1.1.0-rc.2', revision) @@ -279,7 +279,7 @@ it('leaves the current target intact if saving the choice fails', async () => { const f = fixture() await f.coordinator.check() await f.coordinator.download('1.1.0-rc.2') - await expect(f.coordinator.switchChannel('latest', () => Promise.reject(new Error('read only')))).rejects.toThrow('read only') + await expect(f.coordinator.switchChannel('stable', () => Promise.reject(new Error('read only')))).rejects.toThrow('read only') expect(f.coordinator.selectedChannel).toBe('nightly') expect(f.coordinator.state.phase).toBe('ready') await f.coordinator.install('1.1.0-rc.2') @@ -294,7 +294,7 @@ it('discards a check result that belongs to the previous channel', async () => { const checking = f.coordinator.check() await started.promise const saved = Promise.withResolvers() - const switching = f.coordinator.switchChannel('latest', async () => { saved.resolve(undefined) }) + const switching = f.coordinator.switchChannel('stable', async () => { saved.resolve(undefined) }) await saved.promise f.checkForUpdates.mockResolvedValueOnce({ isUpdateAvailable: true, updateInfo: { version: '1.2.0' } }) checked.resolve({ isUpdateAvailable: true, updateInfo: { version: '9.0.0-alpha.1' } }) @@ -327,7 +327,7 @@ it('waits for a cancelled download before checking the new channel and ignores l const downloading = f.coordinator.download('1.1.0-rc.2') await entered.promise const persisted = Promise.withResolvers() - const switching = f.coordinator.switchChannel('latest', async () => { persisted.resolve(undefined) }) + const switching = f.coordinator.switchChannel('stable', async () => { persisted.resolve(undefined) }) await persisted.promise await Promise.resolve() const count = f.states.length @@ -351,7 +351,7 @@ it('rejects a channel switch during installation preparation without persisting f.beforeRestart.mockReturnValueOnce(preparation.promise) const installing = f.coordinator.install('1.1.0-rc.2') const save = vi.fn(async () => {}) - await expect(f.coordinator.switchChannel('latest', save)).rejects.toThrow('installation is in progress') + await expect(f.coordinator.switchChannel('stable', save)).rejects.toThrow('installation is in progress') expect(save).not.toHaveBeenCalled() preparation.resolve(false) await installing @@ -367,7 +367,7 @@ it('does not accept a channel switch after installer handoff even if a later err f.events.emit('error', new Error('native updater failed after handoff')) expect(f.coordinator.state.phase).toBe('error') const save = vi.fn(async () => {}) - await expect(f.coordinator.switchChannel('latest', save)).rejects.toThrow('installation is in progress') + await expect(f.coordinator.switchChannel('stable', save)).rejects.toThrow('installation is in progress') expect(save).not.toHaveBeenCalled() }) @@ -377,7 +377,7 @@ it('suspends updates if retiring a downloaded target fails and recovers on a lat await f.coordinator.download('1.1.0-rc.2') const clear = vi.fn().mockRejectedValueOnce(new Error('locked cache')).mockResolvedValueOnce(undefined) Object.assign(f.updater, { downloadedUpdateHelper: { clear } }) - await expect(f.coordinator.switchChannel('latest', async () => {})).rejects.toThrow('locked cache') + await expect(f.coordinator.switchChannel('stable', async () => {})).rejects.toThrow('locked cache') expect(f.coordinator.configurationFailure).toBe('cleanup') expect(f.coordinator.state).toMatchObject({ phase: 'error', failedOperation: 'configuration' }) const checks = f.checkForUpdates.mock.calls.length @@ -385,7 +385,7 @@ it('suspends updates if retiring a downloaded target fails and recovers on a lat await expect(f.coordinator.install('1.1.0-rc.2')).rejects.toThrow('channel selection is not ready') expect(f.checkForUpdates).toHaveBeenCalledTimes(checks) expect(f.quitAndInstall).not.toHaveBeenCalled() - await f.coordinator.switchChannel('latest', async () => {}) + await f.coordinator.switchChannel('stable', async () => {}) expect(f.coordinator.configurationFailure).toBeUndefined() }) diff --git a/apps/desktop/tests/update-settings.spec.ts b/apps/desktop/tests/update-settings.spec.ts index 54433f5348..010554db4d 100644 --- a/apps/desktop/tests/update-settings.spec.ts +++ b/apps/desktop/tests/update-settings.spec.ts @@ -10,12 +10,12 @@ async function fixture() { const root = await mkdtemp(join(tmpdir(), 'desktop-channel-')) onTestFinished(() => rm(root, { recursive: true, force: true })) await mkdir(join(root, 'desktop')) - return new DesktopUpdateSettings(root, 'latest') + return new DesktopUpdateSettings(root, 'stable') } it('uses the packaged channel for missing settings without recreating the document', async () => { const settings = await fixture() - expect(await settings.load()).toEqual({ kind: 'ready', channel: 'latest' }) + expect(await settings.load()).toEqual({ kind: 'ready', channel: 'stable' }) await expect(readFile(settings.path)).rejects.toMatchObject({ code: 'ENOENT' }) }) @@ -24,11 +24,11 @@ it('preserves other fields during explicit saves and only rereads external edits await writeFile(settings.path, JSON.stringify({ updates: { allowTestAuthPopupWindow: true }, other: 4 })) const startup = await settings.load() await settings.save('nightly') - expect(startup).toEqual({ kind: 'ready', channel: 'latest' }) + expect(startup).toEqual({ kind: 'ready', channel: 'stable' }) expect(JSON.parse(await readFile(settings.path, 'utf8'))).toEqual({ updates: { allowTestAuthPopupWindow: true, channel: 'nightly' }, other: 4 }) expect(await settings.load()).toEqual({ kind: 'ready', channel: 'nightly' }) await writeFile(settings.path, '{}') - expect(await settings.load()).toEqual({ kind: 'ready', channel: 'latest' }) + expect(await settings.load()).toEqual({ kind: 'ready', channel: 'stable' }) }) it.each(['{', 'null', '{"updates":[]}', '{"updates":{"channel":"alpha"}}', '{"updates":{"channel":null}}'])('suspends updates for invalid channel settings: %s', async (raw) => { @@ -55,7 +55,7 @@ it('updates the document initialized by shell settings without losing the popup const root = await mkdtemp(join(tmpdir(), 'desktop-shared-settings-')) onTestFinished(() => rm(root, { recursive: true, force: true })) expect((await readDesktopSettings(root)).updates.allowTestAuthPopupWindow).toBe(false) - const settings = new DesktopUpdateSettings(root, 'latest') + const settings = new DesktopUpdateSettings(root, 'stable') await settings.save('nightly') expect(JSON.parse(await readFile(settings.path, 'utf8'))).toEqual({ updates: { allowTestAuthPopupWindow: false, channel: 'nightly' }, diff --git a/apps/desktop/tests/updates/electron-updater/qualification.mjs b/apps/desktop/tests/updates/electron-updater/qualification.mjs index 0714402476..6a73cdda23 100644 --- a/apps/desktop/tests/updates/electron-updater/qualification.mjs +++ b/apps/desktop/tests/updates/electron-updater/qualification.mjs @@ -56,9 +56,9 @@ async function main() { selectUpdateChannel(target, 'nightly') assert.ok((await target.checkForUpdates()).updateInfo) assert.equal(requests.at(-1), `/nightly${process.platform === 'darwin' ? '-mac' : ''}.yml`) - selectUpdateChannel(target, 'latest') + selectUpdateChannel(target, 'stable') await target.checkForUpdates() - assert.equal(requests.at(-1), `/latest${process.platform === 'darwin' ? '-mac' : ''}.yml`) + assert.equal(requests.at(-1), `/stable${process.platform === 'darwin' ? '-mac' : ''}.yml`) assert.equal(target.allowDowngrade, false) assert.equal(target.allowPrerelease, false) version = '0.9.0' @@ -85,7 +85,7 @@ async function main() { const proxy = target.server if (process.platform === 'darwin') assert.equal(proxy.listening, true) await discardDesktopUpdate(target) - selectUpdateChannel(target, 'latest') + selectUpdateChannel(target, 'stable') if (proxy) assert.equal(proxy.listening, false) assert.equal(helper.file, null) assert.equal(helper.packageFile, null) diff --git a/apps/web/tests/desktop-channel.e2e.ts b/apps/web/tests/desktop-channel.e2e.ts index 9ad351077b..cc0bf9c830 100644 --- a/apps/web/tests/desktop-channel.e2e.ts +++ b/apps/web/tests/desktop-channel.e2e.ts @@ -20,7 +20,7 @@ it('persists a Desktop channel from Settings and keeps external edits startup-on const page = await browser.newPage({ viewport: { width: 1280, height: 900 }, locale: 'en-US' }) const tripwire = watchConsole(page) await page.exposeFunction('readChannel', () => state) - await page.exposeFunction('setChannel', async (channel: 'nightly' | 'latest'): Promise => { + await page.exposeFunction('setChannel', async (channel: 'nightly' | 'stable'): Promise => { try { await settings.save(channel) state = { ...state, channel, error: undefined } @@ -30,11 +30,11 @@ it('persists a Desktop channel from Settings and keeps external edits startup-on await page.addInitScript(() => { const bridge = globalThis as typeof globalThis & { readChannel(): Promise - setChannel(channel: 'nightly' | 'latest'): Promise + setChannel(channel: 'nightly' | 'stable'): Promise } Object.assign(globalThis, { dshDesktop: { protocolVersion: 1, updates: { status: async () => ({ phase: 'idle' }), open: async () => {}, subscribe: () => () => {}, - channels: { get: () => bridge.readChannel(), set: (channel: 'nightly' | 'latest') => bridge.setChannel(channel), + channels: { get: () => bridge.readChannel(), set: (channel: 'nightly' | 'stable') => bridge.setChannel(channel), subscribe: () => () => {} }, } } }) }) @@ -46,7 +46,7 @@ it('persists a Desktop channel from Settings and keeps external edits startup-on await page.getByRole('menuitem', { name: 'Stable', exact: true }).click() await row.getByText('Stable', { exact: true }).waitFor() await page.getByText('Update channel changed', { exact: true }).waitFor() - expect(JSON.parse(await readFile(settings.path, 'utf8'))).toMatchObject({ updates: { channel: 'latest' } }) + expect(JSON.parse(await readFile(settings.path, 'utf8'))).toMatchObject({ updates: { channel: 'stable' } }) await compareOrRefreshGolden(fileURLToPath(new URL('./expected/desktop-channel/stable.expected.md', import.meta.url)), await captureStableAria(page, '[role="group"][aria-label="Update channel"]', scaffold.workspaceCwd), webSnapshotMode()) await writeFile(settings.path, JSON.stringify({ updates: { channel: 'nightly' } })) diff --git a/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.i18n.yaml b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.i18n.yaml new file mode 100644 index 0000000000..ce81afec05 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.i18n.yaml @@ -0,0 +1,16 @@ +# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading +# section, a hash of its English and Chinese blocks outside code blocks and generated regions. +# After editing either side, bring the other along and re-record with: +# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md +/: + en: 754ae2b680f57c78 + zh: b3586f3db403f9e3 +/desktop-stable-channel-name: + en: 085fffc14a9bb6be + zh: 51c269f7b97b6e31 +/desktop-stable-channel-name/change: + en: bca4377ec9032e3b + zh: 6da9f3be04f1cd39 +/desktop-stable-channel-name/migration: + en: 8442b24f420f6be2 + zh: b2517178eccbf8d5 diff --git a/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md new file mode 100644 index 0000000000..9261aa2960 --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md @@ -0,0 +1,18 @@ +--- +kind: upgrade-guide +description: "The Desktop stable update channel is named stable instead of latest." +--- + +# Desktop stable channel name + +English | [中文](guide.zh.md) + +## Change + +Desktop packages, update feeds, and channel configuration use `stable` instead of `latest`. The `nightly` channel is unchanged. The old channel value is rejected; there is no alias. Fixed website downloads named `dsh-latest-*` are unchanged. + +## Migration + +1. Select `stable` in packaging workflows or set `DSH_DESKTOP_UPDATE_CHANNEL=stable` when building a stable-channel package. Build a stable version, without a prerelease suffix. +2. If a local Desktop settings file contains `updates.channel: "latest"`, change the value to `"stable"` and restart Desktop. Omitting the field uses the package default. +3. Publish with the updated tooling: it writes `stable.yml` on Windows and `stable-mac.yml` on macOS within each architecture's feed directory, with stable-channel binaries under `stable/`. Verify the selected channel and requested feed in the test deployment before production publication. Old packages still requesting `latest` feeds do not migrate automatically. diff --git a/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md new file mode 100644 index 0000000000..441693811b --- /dev/null +++ b/docs/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md @@ -0,0 +1,18 @@ +--- +kind: upgrade-guide +description: "桌面正式更新渠道由 latest 更名为 stable。" +--- + +# 桌面正式渠道名称 + +[English](guide.md) | 中文 + +## 变更 + +桌面安装包、更新清单及渠道配置使用 `stable`,不再使用 `latest`。`nightly` 渠道不变。旧渠道值会被拒绝,不提供别名。网站名为 `dsh-latest-*` 的固定下载文件保持不变。 + +## 迁移 + +1. 在打包工作流中选择 `stable`,或在构建正式渠道包时设置 `DSH_DESKTOP_UPDATE_CHANNEL=stable`。使用不含预发布后缀的稳定版本号。 +2. 如果本地桌面配置文件包含 `updates.channel: "latest"`,将该值改为 `"stable"` 并重启桌面应用。省略该字段时使用安装包默认值。 +3. 使用更新后的工具发布:在各架构的清单目录内,Windows 写入 `stable.yml`,macOS 写入 `stable-mac.yml`;正式渠道二进制位于 `stable/` 下。在正式发布前,通过测试部署核对选定渠道和请求的清单。仍请求 `latest` 清单的旧包不会自动迁移。 diff --git a/packages/client/ui-settings-general/src/client/DesktopChannelRow.tsx b/packages/client/ui-settings-general/src/client/DesktopChannelRow.tsx index 23fc133edd..8b5c07e549 100644 --- a/packages/client/ui-settings-general/src/client/DesktopChannelRow.tsx +++ b/packages/client/ui-settings-general/src/client/DesktopChannelRow.tsx @@ -31,7 +31,7 @@ export function DesktopChannelRow({ useChannel, select, t }: { setOpen(false) }} portal align="end" selectedId={channel ?? ''} - items={[{ id: 'latest', label: t('desktop.channel.latest') }, { id: 'nightly', label: t('desktop.channel.nightly') }]} + items={[{ id: 'stable', label: t('desktop.channel.stable') }, { id: 'nightly', label: t('desktop.channel.nightly') }]} onSelect={(id) => { setOpen(false) void select(id as DesktopUpdateChannel) @@ -40,7 +40,7 @@ export function DesktopChannelRow({ useChannel, select, t }: aria-busy={busy} aria-label={t('desktop.channel.title')} aria-haspopup="menu" aria-expanded={open} onClick={() => { setOpen(!open) }}> {channel === undefined || channel === null - ? t('desktop.channel.unavailable') : t(channel === 'latest' ? 'desktop.channel.latest' : 'desktop.channel.nightly')} + ? t('desktop.channel.unavailable') : t(channel === 'stable' ? 'desktop.channel.stable' : 'desktop.channel.nightly')} {busy ? : } } /> diff --git a/packages/client/ui-settings-general/src/client/index.ts b/packages/client/ui-settings-general/src/client/index.ts index e3dd01d407..1dbb241570 100644 --- a/packages/client/ui-settings-general/src/client/index.ts +++ b/packages/client/ui-settings-general/src/client/index.ts @@ -112,7 +112,7 @@ export function apply(ctx: ClientContext): void { ctx.effect(() => () => { channel.dispose() }, 'ui-settings-general: desktop channel') ctx.slots.inject('settings.general.item', () => ctx.slots.register({ name: 'settings.general.item', id: 'desktop-update-channel', order: 95, locale: NS, - inject: () => ({ hooks: { channel: channel.store }, select: (value: 'nightly' | 'latest') => channel.select(value) }), + inject: () => ({ hooks: { channel: channel.store }, select: (value: 'nightly' | 'stable') => channel.select(value) }), }, DesktopChannelRow)) ctx.slots.inject('shell.overlay', () => ctx.slots.register({ name: 'shell.overlay', id: 'desktop-channel-toast', locale: NS, diff --git a/packages/client/ui-settings-general/src/client/locales.ts b/packages/client/ui-settings-general/src/client/locales.ts index d2bc78f2bd..7b1d8231ee 100644 --- a/packages/client/ui-settings-general/src/client/locales.ts +++ b/packages/client/ui-settings-general/src/client/locales.ts @@ -4,7 +4,7 @@ export const zh = { 'desktop.channel.title': '更新渠道', 'desktop.channel.description': '正式版适合日常使用;开发版可提前体验新功能,但可能不稳定。', - 'desktop.channel.latest': '正式版', + 'desktop.channel.stable': '正式版', 'desktop.channel.nightly': '开发版', 'desktop.channel.unavailable': '配置不可用', 'desktop.channel.error': '未能应用更新配置。请点击桌面更新入口查看原因。', @@ -16,7 +16,7 @@ export const zh = { 'desktop.channel.result.apply': '保存失败', 'desktop.update.configuration.read': '更新已暂停:无法读取配置文件', 'desktop.update.configuration.format': '更新已暂停:配置文件格式有误', - 'desktop.update.configuration.channel': '更新已暂停:channel 只能是 nightly 或 latest', + 'desktop.update.configuration.channel': '更新已暂停:channel 只能是 nightly 或 stable', 'desktop.update.configuration.cleanup': '更新已暂停:无法清理旧更新,请重启应用', 'trigger': '设置', 'shortcut.open': '打开设置', @@ -69,7 +69,7 @@ export type SettingsKey = keyof typeof zh export const en = { 'desktop.channel.title': 'Update channel', 'desktop.channel.description': 'Stable is suitable for everyday use. Development offers early access to new features but may be unstable.', - 'desktop.channel.latest': 'Stable', + 'desktop.channel.stable': 'Stable', 'desktop.channel.nightly': 'Development', 'desktop.channel.unavailable': 'Configuration unavailable', 'desktop.channel.error': 'Could not apply update settings. Open the desktop update indicator for details.', @@ -81,7 +81,7 @@ export const en = { 'desktop.channel.result.apply': 'Could not save', 'desktop.update.configuration.read': 'Updates paused: cannot read settings file', 'desktop.update.configuration.format': 'Updates paused: invalid settings file', - 'desktop.update.configuration.channel': 'Updates paused: channel must be nightly or latest', + 'desktop.update.configuration.channel': 'Updates paused: channel must be nightly or stable', 'desktop.update.configuration.cleanup': 'Updates paused: cannot discard previous update; restart the app', 'trigger': 'Settings', 'shortcut.open': 'Open settings', @@ -131,7 +131,7 @@ export const en = { export const ja = { 'desktop.channel.title': '更新チャンネル', 'desktop.channel.description': '安定版は日常的な使用に適しています。開発版では新機能をいち早く試せますが、不安定な場合があります。', - 'desktop.channel.latest': '安定版', + 'desktop.channel.stable': '安定版', 'desktop.channel.nightly': '開発版', 'desktop.channel.unavailable': '設定を利用できません', 'desktop.channel.error': '更新設定を適用できませんでした。デスクトップの更新表示で詳細を確認してください。', @@ -143,7 +143,7 @@ export const ja = { 'desktop.channel.result.apply': '保存できませんでした', 'desktop.update.configuration.read': '更新を停止中:設定ファイルを読み取れません', 'desktop.update.configuration.format': '更新を停止中:設定ファイルの形式が不正です', - 'desktop.update.configuration.channel': '更新を停止中:channel は nightly または latest にしてください', + 'desktop.update.configuration.channel': '更新を停止中:channel は nightly または stable にしてください', 'desktop.update.configuration.cleanup': '更新を停止中:以前の更新を削除できません。アプリを再起動してください', 'trigger': '設定', 'shortcut.open': '設定を開く', @@ -193,7 +193,7 @@ export const ja = { export const es = { 'desktop.channel.title': 'Canal de actualizaciones', 'desktop.channel.description': 'Estable es adecuado para el uso diario. Desarrollo permite probar nuevas funciones antes, pero puede ser inestable.', - 'desktop.channel.latest': 'Estable', + 'desktop.channel.stable': 'Estable', 'desktop.channel.nightly': 'Desarrollo', 'desktop.channel.unavailable': 'Configuración no disponible', 'desktop.channel.error': 'No se pudo aplicar la configuración. Abre el indicador de actualización para ver los detalles.', @@ -205,7 +205,7 @@ export const es = { 'desktop.channel.result.apply': 'No se pudo guardar', 'desktop.update.configuration.read': 'Actualizaciones pausadas: no se puede leer la configuración', 'desktop.update.configuration.format': 'Actualizaciones pausadas: archivo de configuración no válido', - 'desktop.update.configuration.channel': 'Actualizaciones pausadas: channel debe ser nightly o latest', + 'desktop.update.configuration.channel': 'Actualizaciones pausadas: channel debe ser nightly o stable', 'desktop.update.configuration.cleanup': 'Actualizaciones pausadas: no se pudo descartar la actualización anterior; reinicia la aplicación', 'trigger': 'Configuración', 'shortcut.open': 'Abrir configuración', @@ -255,7 +255,7 @@ export const es = { export const fr = { 'desktop.channel.title': 'Canal de mise à jour', 'desktop.channel.description': 'Stable convient à un usage quotidien. Développement permet de découvrir les nouveautés en avance, mais peut être instable.', - 'desktop.channel.latest': 'Stable', + 'desktop.channel.stable': 'Stable', 'desktop.channel.nightly': 'Développement', 'desktop.channel.unavailable': 'Configuration indisponible', 'desktop.channel.error': 'Impossible d’appliquer les paramètres. Ouvrez l’indicateur de mise à jour pour plus de détails.', @@ -267,7 +267,7 @@ export const fr = { 'desktop.channel.result.apply': 'Échec de l’enregistrement', 'desktop.update.configuration.read': 'Mises à jour suspendues : lecture des paramètres impossible', 'desktop.update.configuration.format': 'Mises à jour suspendues : fichier de paramètres invalide', - 'desktop.update.configuration.channel': 'Mises à jour suspendues : channel doit être nightly ou latest', + 'desktop.update.configuration.channel': 'Mises à jour suspendues : channel doit être nightly ou stable', 'desktop.update.configuration.cleanup': 'Mises à jour suspendues : suppression de la mise à jour précédente impossible ; redémarrez l’application', 'trigger': 'Paramètres', 'shortcut.open': 'Ouvrir les paramètres', @@ -317,7 +317,7 @@ export const fr = { export const de = { 'desktop.channel.title': 'Update-Kanal', 'desktop.channel.description': 'Stabil eignet sich für den Alltag. Entwicklung bietet frühzeitigen Zugang zu neuen Funktionen, kann aber instabil sein.', - 'desktop.channel.latest': 'Stabil', + 'desktop.channel.stable': 'Stabil', 'desktop.channel.nightly': 'Entwicklung', 'desktop.channel.unavailable': 'Konfiguration nicht verfügbar', 'desktop.channel.error': 'Update-Einstellungen konnten nicht angewendet werden. Details finden Sie in der Update-Anzeige.', @@ -329,7 +329,7 @@ export const de = { 'desktop.channel.result.apply': 'Speichern fehlgeschlagen', 'desktop.update.configuration.read': 'Updates pausiert: Einstellungsdatei nicht lesbar', 'desktop.update.configuration.format': 'Updates pausiert: ungültige Einstellungsdatei', - 'desktop.update.configuration.channel': 'Updates pausiert: channel muss nightly oder latest sein', + 'desktop.update.configuration.channel': 'Updates pausiert: channel muss nightly oder stable sein', 'desktop.update.configuration.cleanup': 'Updates pausiert: vorheriges Update nicht verwerfbar; App neu starten', 'trigger': 'Einstellungen', 'shortcut.open': 'Einstellungen öffnen', @@ -379,7 +379,7 @@ export const de = { export const ru = { 'desktop.channel.title': 'Канал обновлений', 'desktop.channel.description': 'Стабильный канал подходит для повседневного использования. Канал разработки позволяет раньше попробовать новые функции, но может быть нестабильным.', - 'desktop.channel.latest': 'Стабильный', + 'desktop.channel.stable': 'Стабильный', 'desktop.channel.nightly': 'Разработка', 'desktop.channel.unavailable': 'Настройки недоступны', 'desktop.channel.error': 'Не удалось применить настройки. Откройте индикатор обновления для подробностей.', @@ -391,7 +391,7 @@ export const ru = { 'desktop.channel.result.apply': 'Не удалось сохранить', 'desktop.update.configuration.read': 'Обновления приостановлены: не удалось прочитать настройки', 'desktop.update.configuration.format': 'Обновления приостановлены: неверный формат файла настроек', - 'desktop.update.configuration.channel': 'Обновления приостановлены: channel должен быть nightly или latest', + 'desktop.update.configuration.channel': 'Обновления приостановлены: channel должен быть nightly или stable', 'desktop.update.configuration.cleanup': 'Обновления приостановлены: не удалось удалить предыдущее обновление; перезапустите приложение', 'trigger': 'Настройки', 'shortcut.open': 'Открыть настройки', @@ -441,7 +441,7 @@ export const ru = { export const pt = { 'desktop.channel.title': 'Canal de atualização', 'desktop.channel.description': 'Estável é adequado para o uso diário. Desenvolvimento oferece acesso antecipado a novos recursos, mas pode ser instável.', - 'desktop.channel.latest': 'Estável', + 'desktop.channel.stable': 'Estável', 'desktop.channel.nightly': 'Desenvolvimento', 'desktop.channel.unavailable': 'Configuração indisponível', 'desktop.channel.error': 'Não foi possível aplicar as configurações. Abra o indicador de atualização para ver detalhes.', @@ -453,7 +453,7 @@ export const pt = { 'desktop.channel.result.apply': 'Não foi possível salvar', 'desktop.update.configuration.read': 'Atualizações pausadas: não foi possível ler as configurações', 'desktop.update.configuration.format': 'Atualizações pausadas: arquivo de configurações inválido', - 'desktop.update.configuration.channel': 'Atualizações pausadas: channel deve ser nightly ou latest', + 'desktop.update.configuration.channel': 'Atualizações pausadas: channel deve ser nightly ou stable', 'desktop.update.configuration.cleanup': 'Atualizações pausadas: não foi possível descartar a atualização anterior; reinicie o aplicativo', 'trigger': 'Configurações', 'shortcut.open': 'Abrir configurações', diff --git a/packages/client/ui-settings-general/src/types.ts b/packages/client/ui-settings-general/src/types.ts index f533e4478e..eb69b58020 100644 --- a/packages/client/ui-settings-general/src/types.ts +++ b/packages/client/ui-settings-general/src/types.ts @@ -39,7 +39,7 @@ export interface DesktopUpdateView { } /** Shell-owned channel choices exposed through the isolated preload. */ -export type DesktopUpdateChannel = 'nightly' | 'latest' +export type DesktopUpdateChannel = 'nightly' | 'stable' /** Current runtime selection and application status; failure never implies a successful switch. */ export interface DesktopChannelState { diff --git a/packages/client/ui-settings-general/tests/apply.client.spec.ts b/packages/client/ui-settings-general/tests/apply.client.spec.ts index 4f35ce2c56..f262157136 100644 --- a/packages/client/ui-settings-general/tests/apply.client.spec.ts +++ b/packages/client/ui-settings-general/tests/apply.client.spec.ts @@ -223,8 +223,8 @@ describe('ui-settings-general apply', () => { const row = c.ctx.slots.entries('settings.general.item').find(row => row.options.id === 'desktop-update-channel')! expect(c.ctx.slots.entries('shell.overlay').some(entry => entry.options.id === 'desktop-channel-toast')).toBe(true) const select = row.inject!().select as DesktopChannelRowInjected['select'] - await select('latest') - expect(save).toHaveBeenCalledWith('latest') + await select('stable') + expect(save).toHaveBeenCalledWith('stable') const toast = c.ctx.slots.entries('shell.overlay').find(entry => entry.options.id === 'desktop-channel-toast')! const injected = toast.inject!() const hooks = injected.hooks as DesktopChannelToastInjected['hooks'] diff --git a/packages/client/ui-settings-general/tests/components.client.spec.tsx b/packages/client/ui-settings-general/tests/components.client.spec.tsx index 0d85c5e8fa..e0d85bbf84 100644 --- a/packages/client/ui-settings-general/tests/components.client.spec.tsx +++ b/packages/client/ui-settings-general/tests/components.client.spec.tsx @@ -324,7 +324,7 @@ describe('Host release change confirmation', () => { it('shows channel load errors and waits for an explicit selection to settle', async () => { - let state: { state?: DesktopChannelState; failed: boolean; pending?: 'latest' } = { failed: false } + let state: { state?: DesktopChannelState; failed: boolean; pending?: 'stable' } = { failed: false } const pending = Promise.withResolvers() const select = vi.fn(() => pending.promise) const props = { ...kit, t, select, useChannel: bindSnapshotSelector(createSnapshotStore(state)) } @@ -339,13 +339,13 @@ it('shows channel load errors and waits for an explicit selection to settle', as expect(control.textContent).toContain('Configuration unavailable') fireEvent.click(control) fireEvent.click(screen.getByRole('menuitem', { name: 'Stable' })) - expect(select).toHaveBeenCalledWith('latest') - state = { ...state, pending: 'latest' } + expect(select).toHaveBeenCalledWith('stable') + state = { ...state, pending: 'stable' } view.rerender() expect(control.textContent).toBe('Stable') expect(control.getAttribute('aria-busy')).toBe('true') pending.resolve(undefined) - state = { failed: false, state: { channel: 'latest', packagedChannel: 'nightly', changing: false } } + state = { failed: false, state: { channel: 'stable', packagedChannel: 'nightly', changing: false } } view.rerender() expect(control.textContent).toBe('Stable') fireEvent.click(control) @@ -367,7 +367,7 @@ it('keeps the failure toast after Settings unmounts and rolls back the remounted const reply = Promise.withResolvers() const source = new DesktopChannelSource({ get: async () => state, set: () => reply.promise, subscribe: () => () => {} }) const useChannel = bindSnapshotSelector(source.store) - const select = (channel: 'nightly' | 'latest') => source.select(channel) + const select = (channel: 'nightly' | 'stable') => source.select(channel) const row = render() const toast = render( { source.dismissNotice(sequence) }} />) diff --git a/packages/client/ui-settings-general/tests/desktop-channel.client.spec.ts b/packages/client/ui-settings-general/tests/desktop-channel.client.spec.ts index ba40f44887..7a51b3a215 100644 --- a/packages/client/ui-settings-general/tests/desktop-channel.client.spec.ts +++ b/packages/client/ui-settings-general/tests/desktop-channel.client.spec.ts @@ -3,7 +3,7 @@ import { DesktopChannelSource } from '../src/client/desktop-channel-source.ts' import type { DesktopChannelState, DesktopChannelChangeResult } from '../src/types.ts' const nightly: DesktopChannelState = { channel: 'nightly', packagedChannel: 'nightly', changing: false } -const latest: DesktopChannelState = { ...nightly, channel: 'latest' } +const stable: DesktopChannelState = { ...nightly, channel: 'stable' } function fixture() { const get = Promise.withResolvers() @@ -19,16 +19,16 @@ function fixture() { it('keeps pushed multi-window state ahead of stale replies while settling its own operation', async () => { const f = fixture() f.emit(nightly) - f.get.resolve(latest) + f.get.resolve(stable) await f.get.promise expect(f.source.store.getSnapshot().state).toEqual(nightly) - const pending = f.source.select('latest') - expect(f.source.store.getSnapshot().pending).toBe('latest') + const pending = f.source.select('stable') + expect(f.source.store.getSnapshot().pending).toBe('stable') await f.source.select('nightly') expect(f.select).toHaveBeenCalledOnce() - f.emit(latest) + f.emit(stable) f.emit(nightly) - f.set.resolve({ kind: 'applied', state: latest }) + f.set.resolve({ kind: 'applied', state: stable }) await pending expect(f.source.store.getSnapshot()).toEqual({ state: nightly, failed: false, notice: { sequence: 1, outcome: 'applied' } }) f.source.dispose() @@ -39,13 +39,13 @@ it('rolls back a rejected save and retains a toast across shell broadcasts', asy const f = fixture() f.get.resolve(nightly) await f.get.promise - const pending = f.source.select('latest') + const pending = f.source.select('stable') f.emit({ ...nightly, changing: true }) f.emit(nightly) f.set.resolve({ kind: 'failed', state: nightly, reason: 'format' }) await pending expect(f.source.store.getSnapshot()).toEqual({ state: nightly, failed: false, notice: { sequence: 1, outcome: 'format' } }) - f.emit(latest) + f.emit(stable) expect(f.source.store.getSnapshot().notice?.outcome).toBe('format') await f.source.select('nightly') f.source.dismissNotice(1) @@ -59,22 +59,22 @@ it('reports generic save failure after transport rejection without flagging glob const f = fixture() f.get.resolve(nightly) await f.get.promise - const pending = f.source.select('latest') - f.emit(latest) + const pending = f.source.select('stable') + f.emit(stable) f.set.reject(new Error('IPC closed')) await pending - expect(f.source.store.getSnapshot()).toEqual({ state: latest, failed: false, notice: { sequence: 1, outcome: 'save' } }) + expect(f.source.store.getSnapshot()).toEqual({ state: stable, failed: false, notice: { sequence: 1, outcome: 'save' } }) f.source.dispose() }) it('ignores events, successful replies and new requests after disposal', async () => { const f = fixture() - const pending = f.source.select('latest') + const pending = f.source.select('stable') f.source.dispose() const before = f.source.store.getSnapshot() - f.emit(latest) + f.emit(stable) f.get.resolve(nightly) - f.set.resolve({ kind: 'applied', state: latest }) + f.set.resolve({ kind: 'applied', state: stable }) await pending await f.source.select('nightly') expect(f.select).toHaveBeenCalledOnce() @@ -86,10 +86,10 @@ it('reports initial IPC failure and accepts a later explicit choice response', a f.get.reject(new Error('unavailable')) await Promise.resolve() expect(f.source.store.getSnapshot()).toEqual({ failed: true }) - const pending = f.source.select('latest') - f.set.resolve({ kind: 'applied', state: latest }) + const pending = f.source.select('stable') + f.set.resolve({ kind: 'applied', state: stable }) await pending - expect(f.source.store.getSnapshot()).toEqual({ state: latest, failed: false, notice: { sequence: 1, outcome: 'applied' } }) + expect(f.source.store.getSnapshot()).toEqual({ state: stable, failed: false, notice: { sequence: 1, outcome: 'applied' } }) f.source.dispose() }) @@ -101,7 +101,7 @@ it('ignores rejected reads after an event and all rejected responses after dispo expect(f.source.store.getSnapshot()).toEqual({ state: nightly, failed: false }) f.source.dispose() const closed = fixture() - const writing = closed.source.select('latest') + const writing = closed.source.select('stable') closed.source.dispose() const before = closed.source.store.getSnapshot() closed.get.reject(new Error('late read')) @@ -112,12 +112,12 @@ it('ignores rejected reads after an event and all rejected responses after dispo it('does not let a late initial read overwrite an accepted selection', async () => { const f = fixture() - const pending = f.source.select('latest') - f.set.resolve({ kind: 'applied', state: latest }) + const pending = f.source.select('stable') + f.set.resolve({ kind: 'applied', state: stable }) await pending f.get.resolve(nightly) await f.get.promise - expect(f.source.store.getSnapshot().state).toEqual(latest) + expect(f.source.store.getSnapshot().state).toEqual(stable) f.source.dispose() })