From 7b4265b2aafbbc44f015c27353878988eb595f42 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Thu, 26 Nov 2026 23:28:37 +0800 Subject: [PATCH 1/5] feat(linux): package debs for older glibc --- .github/actions/setup-dim/action.yml | 9 +- .github/workflows/_package-linux.yml | 3 + .../architecture/ci-release-packaging/spec.md | 6 +- docs/issues/uos-debian-package/spec.md | 21 ++++ docs/release-flow.md | 8 +- electron-builder.yml | 20 ++++ package.json | 1 + scripts/ci/assemble-release.mjs | 13 +-- scripts/ci/build-linux-native.sh | 34 ++++++ scripts/ci/classify-package-impact.mjs | 2 + scripts/ci/package-contract.mjs | 10 +- scripts/ci/package-manifest.mjs | 106 ++++++++---------- scripts/ci/smoke-linux-deb.sh | 54 +++++++++ src/main/sync/index.ts | 11 +- test/main/scripts/packageContract.test.ts | 2 +- test/main/scripts/releaseAssembly.test.ts | 51 ++++----- 16 files changed, 238 insertions(+), 113 deletions(-) create mode 100644 docs/issues/uos-debian-package/spec.md create mode 100644 scripts/ci/build-linux-native.sh create mode 100644 scripts/ci/smoke-linux-deb.sh diff --git a/.github/actions/setup-dim/action.yml b/.github/actions/setup-dim/action.yml index 1925e339df..cfdb8c9d56 100644 --- a/.github/actions/setup-dim/action.yml +++ b/.github/actions/setup-dim/action.yml @@ -37,9 +37,10 @@ runs: ~/.cargo/registry ~/.cargo/git native/dim-host/target - key: ${{ runner.os }}-${{ runner.arch }}-dim-release-1.98.1-${{ hashFiles('native/dim-host/Cargo.lock', 'resources/dim-native-host-lock.json') }} - restore-keys: ${{ runner.os }}-${{ runner.arch }}-dim-release-1.98.1- + key: ${{ runner.os }}-${{ runner.arch }}-dim-release-1.98.1-${{ inputs.platform == 'linux' && 'glibc228-' || '' }}${{ hashFiles('native/dim-host/Cargo.lock', 'resources/dim-native-host-lock.json') }} + restore-keys: ${{ runner.os }}-${{ runner.arch }}-dim-release-1.98.1-${{ inputs.platform == 'linux' && 'glibc228-' || '' }} - name: Build pinned native dim host + if: inputs.platform != 'linux' shell: bash env: RUSTUP_TOOLCHAIN: 1.98.1 @@ -49,6 +50,10 @@ runs: CARGO_PROFILE_RELEASE_DEBUG: '0' CARGO_PROFILE_RELEASE_STRIP: symbols run: pnpm run build:dim-host + - name: Build Linux native host and database for glibc 2.28 + if: inputs.platform == 'linux' + shell: bash + run: bash scripts/ci/build-linux-native.sh - name: Save compiled native Rust dependencies if: steps.dim-rust-cache.outputs.cache-hit != 'true' uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5 diff --git a/.github/workflows/_package-linux.yml b/.github/workflows/_package-linux.yml index 93304e1fb2..e30d7ddbaa 100644 --- a/.github/workflows/_package-linux.yml +++ b/.github/workflows/_package-linux.yml @@ -135,6 +135,9 @@ jobs: - name: Package Linux run: pnpm exec electron-builder --linux --${{ inputs.arch }} --publish=never + - name: Install Debian package and exercise glibc 2.28 runtime + run: bash scripts/ci/smoke-linux-deb.sh + - name: Verify packaged DuckDB VSS run: | extension_path="dist/${UNPACKED_DIRECTORY}/resources/app.asar.unpacked/runtime/duckdb/extensions/vss.duckdb_extension" diff --git a/docs/architecture/ci-release-packaging/spec.md b/docs/architecture/ci-release-packaging/spec.md index 45b48d748f..443243d28b 100644 --- a/docs/architecture/ci-release-packaging/spec.md +++ b/docs/architecture/ci-release-packaging/spec.md @@ -101,11 +101,11 @@ assembly fails closed against an explicit six-target contract. - macOS publishes `latest-mac.yml` with x64 and ARM64 ZIP entries plus both ZIP blockmaps. - DMG remains a manual installer and is excluded from updater metadata and blockmap generation. - Linux publishes separate `latest-linux.yml` and `latest-linux-arm64.yml` files that reference the - corresponding AppImage. + corresponding AppImage and Debian package, with the AppImage first for legacy clients. - Every metadata URL resolves to a staged release file, and its SHA-512 and byte size match that file. - Windows and macOS entries are ordered x64 before ARM64, with legacy `path` and `sha512` fields pointing to x64. -- The workflow uploads exactly nineteen assets under the current package target configuration, +- The workflow uploads exactly twenty-one assets under the current package target configuration, including `release-index.json`. ### AC-6 — Package Regression @@ -183,7 +183,7 @@ assembly fails closed against an explicit six-target contract. - Package manifest and release index schema version 2 intentionally reject version 1 producers and consumers. All release jobs execute from one immutable source SHA, so no mixed-version migration path is supported or required. -- The exact nineteen-asset allowlist intentionally rejects new package formats until the contract, +- The exact twenty-one-asset allowlist intentionally rejects new package formats until the contract, tests, and release index are updated together. - Verification-mode macOS package sizes can differ slightly from signed distribution sizes. The initial 90 MiB delta bounds tolerate signing overhead while still catching material omissions. diff --git a/docs/issues/uos-debian-package/spec.md b/docs/issues/uos-debian-package/spec.md new file mode 100644 index 0000000000..c18416d55a --- /dev/null +++ b/docs/issues/uos-debian-package/spec.md @@ -0,0 +1,21 @@ +# Debian packages and UOS compatibility + +[Issue 2556](https://github.com/ThinkInAIXYZ/deepchat/issues/2556) reports UOS with Linux 4.19 and glibc 2.28. The reporter did not identify the CPU architecture. Both supported Linux architectures need a Debian package with architecture-specific dependencies and update metadata. + +## Runtime boundary + +The Linux x64 v1.1.5-beta.1 tarball contains an Electron executable requiring GLIBC_2.25 and a Node executable requiring GLIBC_2.28. Its packaged SQLite binding requires GLIBC_2.34. Its native Dim host imports GLIBC_2.38 and has versioned references up to GLIBC_2.39. A different installer alone cannot make those binaries runnable on UOS. + +Build the startup SQLite binding and the local agent host against glibc 2.28 from the same pinned sources as other platforms. Exercise the built bindings with the packaged Node runtime. Load the S3 backup adapter on demand, so cloud storage dependencies are needed only when performing cloud operations. The packaged OpenDAL and Light OCR bindings currently require GLIBC_2.38 on x64. File search and the preview overlay have separate native dependencies. Their existing platform smoke tests remain on the supported modern Linux runner. + +## Acceptance + +- The release contains one installable Debian package per Linux architecture. AppImage clients keep their existing update URL and Debian clients find a matching package. +- The Debian package declares its system dependencies and can be unpacked by the dpkg shipped with glibc 2.28 distributions. +- Both the encrypted database and the Dim protocol work on a glibc 2.28 userspace. An actual UOS 4.19 launch and the remaining native features need separate verification before declaring full UOS support. + +## Implementation + +- [x] Add Debian to packaging and release validation. +- [ ] Build and exercise the startup and agent binaries on the older userspace. +- [ ] Validate the release assembly, updater metadata, and native package jobs. diff --git a/docs/release-flow.md b/docs/release-flow.md index 2bade470af..021bedbe6f 100644 --- a/docs/release-flow.md +++ b/docs/release-flow.md @@ -88,7 +88,7 @@ This document defines the maintainer release flow for DeepChat without rewriting - The workflow writes the draft only after fail-closed assembly and local revalidation, then verifies the uploaded assets through the GitHub API. Treat the run as successful only after that remote size and digest verification passes. Do not add ad hoc assets to the draft. - - The draft must contain exactly nineteen assets: fourteen target files, four updater metadata + - The draft must contain twenty-one assets, including sixteen target files, four updater metadata files, and `release-index.json`. - If a release run must be retried after a native job has completed, rerun all jobs. Package manifests bind `GITHUB_RUN_ATTEMPT`, so mixing artifacts from different attempts intentionally @@ -158,7 +158,7 @@ Use this sequence when the automatic helper is unavailable, especially on Window git push origin refs/tags/v1.0.0-beta.4 ``` -8. Wait for the Release workflow, review the exact nineteen-asset draft using the checks in the +8. Wait for the Release workflow, review the exact twenty-one-asset draft using the checks in the standard sequence, and publish it manually. 9. Delete the temporary release branch after the release is published. @@ -193,8 +193,8 @@ x64 and ARM64. It recomputes file digests, rejects incomplete checks or unknown - `latest.yml` for Windows x64 and ARM64 NSIS payloads; - `latest-mac.yml` for macOS x64 and ARM64 ZIP payloads, never DMGs; -- separate `latest-linux.yml` and `latest-linux-arm64.yml` AppImage metadata; -- `release-index.json` with six-target evidence and SHA-256 for the other eighteen public files. +- separate `latest-linux.yml` and `latest-linux-arm64.yml` AppImage and Debian metadata; +- `release-index.json` with six-target evidence and SHA-256 for the other twenty public files. Windows ARM64 uses the `build:win:arm64` script, installs only runtime payloads available for `win32/arm64`, and packages only plugins whose manifest declares that target. Artifact names and diff --git a/electron-builder.yml b/electron-builder.yml index 4dade132af..5b1ad8778e 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -140,11 +140,31 @@ linux: target: - AppImage - tar.gz + - deb maintainer: ThinkInAIXYZ category: Utility artifactName: ${name}-${version}-linux-${arch}.${ext} mimeTypes: - x-scheme-handler/deepchat +deb: + packageName: deepchat + compression: xz + depends: + - libc6 (>= 2.28) + - libstdc++6 (>= 8) + - libgtk-3-0 + - libnotify4 + - libnss3 + - libxss1 + - libxtst6 + - xdg-utils + - libatspi2.0-0 + - libuuid1 + - libsecret-1-0 + - libgbm1 + - libcups2 + - libudev1 + - libasound2 npmRebuild: true publish: provider: github diff --git a/package.json b/package.json index b8ee0b4567..4f1e348963 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "DeepChat,一个简单易用的 Agent 客户端", "main": "./out/main/index.js", "author": "ThinkInAIXYZ", + "homepage": "https://deepchatai.cn", "type": "module", "engines": { "node": ">=24.22.1 <25", diff --git a/scripts/ci/assemble-release.mjs b/scripts/ci/assemble-release.mjs index 92be29330a..0e52d0af47 100644 --- a/scripts/ci/assemble-release.mjs +++ b/scripts/ci/assemble-release.mjs @@ -12,7 +12,6 @@ import { expectedReleaseAssetCount, getPublicRoles, getRoleDefinition, - getUpdaterPayloadRole, matchesRoleFileName, PACKAGE_MANIFEST_SCHEMA_VERSION, RELEASE_INDEX_SCHEMA_VERSION, @@ -336,8 +335,6 @@ async function loadTargetPackage(artifactsDirectory, definition, expected) { ) await validatePackageLayout(artifactRoot, manifest, definition) const metadataFile = files.find(({ role }) => role === 'update-metadata') - const updaterRole = getUpdaterPayloadRole(definition) - const updaterPayload = files.find(({ role }) => role === updaterRole.name) const rawMetadata = validateRawUpdateMetadata({ metadata: parseYamlObject( await readFile(metadataFile.path, 'utf8'), @@ -346,7 +343,7 @@ async function loadTargetPackage(artifactsDirectory, definition, expected) { metadataName: metadataFile.name, target: definition, version: expected.version, - updaterPayload + packageFiles: files }) for (const sidecar of definition.roles.filter(({ sidecarFor }) => sidecarFor)) { const payload = files.find(({ role }) => role === sidecar.sidecarFor) @@ -425,7 +422,7 @@ function normalizeSingleArchitectureMetadata(packageEntry, version) { const file = packageEntry.rawMetadata.files[0] const metadata = { version, - files: [file], + files: packageEntry.rawMetadata.files, path: file.url, sha512: file.sha512, releaseDate: selectReleaseDate([packageEntry]), @@ -485,10 +482,8 @@ async function validateFinalMetadata( ) { throw new Error(`${name} releaseDate must be a canonical ISO string`) } - const expectedEntries = - name === 'latest-linux.yml' || name === 'latest-linux-arm64.yml' ? 1 : 2 - if (!Array.isArray(metadata.files) || metadata.files.length !== expectedEntries) { - throw new Error(`${name} must contain ${expectedEntries} updater files`) + if (!Array.isArray(metadata.files) || metadata.files.length !== 2) { + throw new Error(`${name} must contain two updater files`) } for (const file of metadata.files) { const publicAsset = publicAssets.find(({ name: assetName }) => assetName === file.url) diff --git a/scripts/ci/build-linux-native.sh b/scripts/ci/build-linux-native.sh new file mode 100644 index 0000000000..a2bc202f1f --- /dev/null +++ b/scripts/ci/build-linux-native.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +set -euo pipefail + +case "$(uname -m)" in + x86_64) image=quay.io/pypa/manylinux_2_28_x86_64@sha256:55a36963bc0504cdf004011001c1072306402f0b8b83be5a5eba7068f93eec53 ;; + aarch64) image=quay.io/pypa/manylinux_2_28_aarch64@sha256:126d9eea9d6b1717f3e17b2b3ac51da04ef159a5f935dac36fe92d621dc8f246 ;; + *) exit 1 ;; +esac + +rust_prefix="$(rustc +1.98.1 --print sysroot)" +node_prefix="$(node -p "require('node:path').dirname(require('node:path').dirname(process.execPath))")" +cargo_cache="${CARGO_HOME:-$HOME/.cargo}" +mkdir -p "$cargo_cache/registry" "$cargo_cache/git" +docker run --rm -i --user "$(id -u):$(id -g)" \ + -v "$PWD:$PWD" -w "$PWD" \ + -v "$rust_prefix:/opt/build-rust:ro" -v "$node_prefix:/opt/build-node:ro" \ + -v "$cargo_cache/registry:/opt/cargo-cache/registry" -v "$cargo_cache/git:/opt/cargo-cache/git" \ + -e HOME=/tmp -e CARGO_HOME=/tmp/cargo -e CARGO_BUILD_TARGET="$DIM_RUST_TARGET" \ + -e CARGO_BUILD_JOBS=2 -e CARGO_INCREMENTAL=0 -e CARGO_PROFILE_RELEASE_DEBUG=0 \ + -e CARGO_PROFILE_RELEASE_STRIP=symbols "$image" bash -seu <<'BUILD' +export PATH="/opt/build-rust/bin:/opt/build-node/bin:/opt/python/cp312-cp312/bin:$PATH" +mkdir -p "$CARGO_HOME" +ln -s /opt/cargo-cache/{registry,git} "$CARGO_HOME/" +test "$(getconf GNU_LIBC_VERSION)" = 'glibc 2.28' +node scripts/build-dim-host.mjs + +# N-API is shared by the bundled Node and Electron. Use the package's own cipher flags. +sqlite="$(realpath node_modules/better-sqlite3-multiple-ciphers)" +node /opt/build-node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js \ + rebuild --directory="$sqlite" --nodedir=/opt/build-node -- -Dforce_build=1 +sqlite_binding="$sqlite/prebuilds/linux-$(node -p process.arch).node" +install -m 0755 "$sqlite/build/Release/better_sqlite3.node" "$sqlite_binding.tmp" +mv "$sqlite_binding.tmp" "$sqlite_binding" +BUILD diff --git a/scripts/ci/classify-package-impact.mjs b/scripts/ci/classify-package-impact.mjs index bd20fbb916..b777ce79c5 100644 --- a/scripts/ci/classify-package-impact.mjs +++ b/scripts/ci/classify-package-impact.mjs @@ -60,6 +60,8 @@ const windowsPackagePaths = new Set([ const linuxPackagePaths = new Set([ '.github/workflows/_package-linux.yml', + 'scripts/ci/build-linux-native.sh', + 'scripts/ci/smoke-linux-deb.sh', 'build/icon.png', 'resources/linux_tray.png' ]) diff --git a/scripts/ci/package-contract.mjs b/scripts/ci/package-contract.mjs index 8768994ae1..0c7b091461 100644 --- a/scripts/ci/package-contract.mjs +++ b/scripts/ci/package-contract.mjs @@ -97,6 +97,7 @@ const targetDefinitions = [ measured: true, updaterPayload: true }), + role('debian', 'files', ['-linux-amd64.deb'], { updaterPayload: true }), role('archive', 'files', ['-linux-x64.tar.gz', '-linux-x86_64.tar.gz'], { measured: true }), @@ -116,6 +117,7 @@ const targetDefinitions = [ measured: true, updaterPayload: true }), + role('debian', 'files', ['-linux-arm64.deb'], { updaterPayload: true }), role('archive', 'files', ['-linux-arm64.tar.gz', '-linux-aarch64.tar.gz'], { measured: true }), @@ -223,14 +225,10 @@ export function getPublicRoles(target) { return definition.roles.filter(({ public: isPublic }) => isPublic) } -export function getUpdaterPayloadRole(target) { +export function getUpdaterPayloadRoles(target) { const definition = typeof target === 'string' ? getTargetDefinition(target) : getTargetDefinition(target.id) - const matches = definition.roles.filter(({ updaterPayload }) => updaterPayload) - if (matches.length !== 1) { - throw new Error(`Target ${definition.id} must define exactly one updater payload`) - } - return matches[0] + return definition.roles.filter(({ updaterPayload }) => updaterPayload) } export function matchesRoleFileName(fileName, roleDefinition) { diff --git a/scripts/ci/package-manifest.mjs b/scripts/ci/package-manifest.mjs index 1c78dd2f5b..55a67c6d20 100644 --- a/scripts/ci/package-manifest.mjs +++ b/scripts/ci/package-manifest.mjs @@ -15,7 +15,7 @@ import { DARWIN_DISTRIBUTION_CHECK_NAMES, getMeasuredRoles, getTargetDefinition, - getUpdaterPayloadRole, + getUpdaterPayloadRoles, PACKAGE_MANIFEST_SCHEMA_VERSION, resolvePackageSizeExpectedDelta, SHA256_PATTERN, @@ -189,11 +189,7 @@ export async function verifyMacZipDistribution( return true } -function normalizeMetadataFiles(metadata, label) { - if (!Array.isArray(metadata.files) || metadata.files.length !== 1) { - throw new Error(`${label} must contain exactly one updater file`) - } - const file = metadata.files[0] +function validateUpdaterFile(file, payload, label) { if (!file || typeof file !== 'object' || Array.isArray(file)) { throw new Error(`${label} updater file must be an object`) } @@ -210,6 +206,37 @@ function normalizeMetadataFiles(metadata, label) { `${label} updater file has unsupported fields: ${unexpectedFileFields.join(', ')}` ) } + if (file.url !== payload.name) { + throw new Error( + `Updater metadata URL mismatch for ${label}: ${file.url} != ${payload.name}` + ) + } + if ( + typeof file.sha512 !== 'string' || + !SHA512_BASE64_PATTERN.test(file.sha512) || + file.sha512 !== payload.sha512 + ) { + throw new Error(`Updater metadata SHA-512 mismatch for ${label}`) + } + if (!Number.isSafeInteger(file.size) || file.size < 0 || file.size !== payload.bytes) { + throw new Error(`Updater metadata size mismatch for ${label}`) + } + const blockMapSize = file.blockMapSize + if ( + blockMapSize !== undefined && + (!Number.isSafeInteger(blockMapSize) || + blockMapSize <= 0 || + blockMapSize >= payload.bytes) + ) { + throw new Error(`Updater metadata blockMapSize is invalid for ${label}`) + } + if (payload.name.endsWith('.AppImage') && blockMapSize === undefined) { + throw new Error(`Linux updater metadata is missing blockMapSize for ${label}`) + } + const isAdminRightsRequired = file.isAdminRightsRequired + if (isAdminRightsRequired !== undefined && typeof isAdminRightsRequired !== 'boolean') { + throw new Error(`Updater metadata isAdminRightsRequired is invalid for ${label}`) + } return file } @@ -240,7 +267,7 @@ export function validateRawUpdateMetadata({ metadataName, target, version, - updaterPayload + packageFiles }) { const definition = typeof target === 'string' ? getTargetDefinition(target) : getTargetDefinition(target.id) @@ -271,47 +298,19 @@ export function validateRawUpdateMetadata({ `Updater metadata version mismatch for ${definition.id}: ${metadata.version} != ${version}` ) } - const file = normalizeMetadataFiles(metadata, `${definition.id}/${metadataName}`) - if (file.url !== updaterPayload.name) { - throw new Error( - `Updater metadata URL mismatch for ${definition.id}: ${file.url} != ${updaterPayload.name}` - ) - } - if ( - typeof file.sha512 !== 'string' || - !SHA512_BASE64_PATTERN.test(file.sha512) || - file.sha512 !== updaterPayload.sha512 - ) { - throw new Error(`Updater metadata SHA-512 mismatch for ${definition.id}`) - } - if (!Number.isSafeInteger(file.size) || file.size < 0 || file.size !== updaterPayload.bytes) { - throw new Error(`Updater metadata size mismatch for ${definition.id}`) + const label = `${definition.id}/${metadataName}` + const payloads = getUpdaterPayloadRoles(definition).map(({ name }) => + packageFiles.find(({ role }) => role === name) + ) + if (!Array.isArray(metadata.files) || metadata.files.length !== payloads.length) { + throw new Error(`${label} must contain exactly ${payloads.length} updater files`) } - if (metadata.path !== updaterPayload.name || metadata.sha512 !== updaterPayload.sha512) { + const files = payloads.map((payload, index) => + validateUpdaterFile(metadata.files[index], payload, label) + ) + if (metadata.path !== files[0].url || metadata.sha512 !== files[0].sha512) { throw new Error(`Updater metadata legacy fields mismatch for ${definition.id}`) } - const blockMapSize = file.blockMapSize - if ( - blockMapSize !== undefined && - (!Number.isSafeInteger(blockMapSize) || - blockMapSize <= 0 || - blockMapSize >= updaterPayload.bytes) - ) { - throw new Error(`Updater metadata blockMapSize is invalid for ${definition.id}`) - } - if (definition.platform === 'linux' && blockMapSize === undefined) { - throw new Error(`Linux updater metadata is missing blockMapSize for ${definition.id}`) - } - const isAdminRightsRequired = file.isAdminRightsRequired - if (isAdminRightsRequired !== undefined && typeof isAdminRightsRequired !== 'boolean') { - throw new Error(`Updater metadata isAdminRightsRequired is invalid for ${definition.id}`) - } - if ( - definition.platform === 'darwin' && - metadata.files.some(({ url }) => typeof url === 'string' && url.endsWith('.dmg')) - ) { - throw new Error('macOS updater metadata must not contain a DMG') - } if ( typeof metadata.releaseDate !== 'string' || !Number.isFinite(Date.parse(metadata.releaseDate)) || @@ -348,15 +347,7 @@ export function validateRawUpdateMetadata({ return { version, - files: [ - { - url: file.url, - sha512: file.sha512, - size: file.size, - ...(blockMapSize === undefined ? {} : { blockMapSize }), - ...(isAdminRightsRequired === undefined ? {} : { isAdminRightsRequired }) - } - ], + files, path: metadata.path, sha512: metadata.sha512, releaseDate: metadata.releaseDate, @@ -637,8 +628,6 @@ export async function createPackageManifest({ }) } - const updaterRole = getUpdaterPayloadRole(definition) - const updaterPayload = discoveredFiles.find(({ role }) => role === updaterRole.name) const metadataFile = discoveredFiles.find(({ role }) => role === 'update-metadata') const rawMetadata = parseYamlObject( await readFile(path.join(resolvedOutputDirectory, metadataFile.storagePath), 'utf8'), @@ -649,7 +638,7 @@ export async function createPackageManifest({ metadataName: metadataFile.name, target: definition, version: packageInfo.version, - updaterPayload + packageFiles: discoveredFiles }) const stagedReports = [] @@ -689,7 +678,8 @@ export async function createPackageManifest({ 'DeepChat.app' ) const resolvedDmgPath = path.join(resolvedDistDirectory, dmg.name) - const resolvedZipPath = path.join(resolvedOutputDirectory, updaterPayload.storagePath) + const zip = discoveredFiles.find(({ role }) => role === 'updater-payload') + const resolvedZipPath = path.join(resolvedOutputDirectory, zip.storagePath) await verifyCuaMacHelper(resolvedAppPath, { teamId: appleTeamId }) await verifyMacApp(resolvedAppPath, { teamId: appleTeamId }) await verifyMacZip(resolvedZipPath, { teamId: appleTeamId }) diff --git a/scripts/ci/smoke-linux-deb.sh b/scripts/ci/smoke-linux-deb.sh new file mode 100644 index 0000000000..45f82f4498 --- /dev/null +++ b/scripts/ci/smoke-linux-deb.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Debian 10 provides the glibc in the UOS report. Its kernel is shared with the CI runner. +docker run --rm -i -v "$PWD:/source:ro" -w /source \ + -v /etc/ssl/certs/ca-certificates.crt:/tmp/archive-ca.pem:ro \ + debian:buster-slim@sha256:bb3dc79fddbca7e8903248ab916bb775c96ec61014b3d02b4f06043b604726dc bash -seu <<'SMOKE' +test "$(getconf GNU_LIBC_VERSION)" = 'glibc 2.28' +packages=(/source/dist/*-linux-"$(dpkg --print-architecture)".deb) +test "${#packages[@]}" -eq 1 +test "$(dpkg-deb -f "${packages[0]}" Package)" = deepchat +echo 'deb https://archive.debian.org/debian buster main' > /etc/apt/sources.list +apt_options=(-o Acquire::https::CaInfo=/tmp/archive-ca.pem -o Acquire::Check-Valid-Until=false) +apt-get "${apt_options[@]}" update -qq +DEBIAN_FRONTEND=noninteractive apt-get "${apt_options[@]}" install -y --no-install-recommends "${packages[0]}" xvfb xauth +resources=/opt/DeepChat/resources +unpacked="$resources/app.asar.unpacked" +node="$unpacked/runtime/node/bin/node" +test "$(cat "$resources/package-type")" = deb +"$node" - "$unpacked" <<'SQLITE' +const assert = require('node:assert/strict') +const Database = require(process.argv[2] + '/node_modules/better-sqlite3-multiple-ciphers') +const filename = '/tmp/cipher-smoke.db' +const db = new Database(filename) +db.pragma("cipher='sqlcipher'") +db.pragma("key='smoke-test'") +db.exec('CREATE TABLE example(value); INSERT INTO example VALUES (42)') +db.close() +assert.throws(() => new Database(filename).prepare('SELECT value FROM example').get()) +const reopened = new Database(filename) +reopened.pragma("cipher='sqlcipher'") +reopened.pragma("key='smoke-test'") +assert.equal(reopened.prepare('SELECT value FROM example').get().value, 42) +reopened.close() +SQLITE +"$node" scripts/smoke-dim-runtime.mjs --resources-path "$resources" +xvfb-run -a /opt/DeepChat/deepchat --user-data-dir=/tmp/deepchat-profile --disable-gpu \ + --remote-debugging-address=127.0.0.1 --remote-debugging-port=9222 >/tmp/deepchat.log 2>&1 & +app_pid=$! +trap 'kill "$app_pid" 2>/dev/null || true' EXIT +if ! "$node" --input-type=module <<'APP' +import { setTimeout as delay } from 'node:timers/promises' +for (let attempt = 0; attempt < 90; attempt++) { + const pages = await fetch('http://127.0.0.1:9222/json/list').then(r => r.json()).catch(() => []) + if (pages.some(page => page.type === 'page' && page.url.includes('/out/renderer/index.html'))) process.exit(0) + await delay(1000) +} +process.exit(1) +APP +then + cat /tmp/deepchat.log >&2 + exit 1 +fi +SMOKE diff --git a/src/main/sync/index.ts b/src/main/sync/index.ts index 87c01eb6bd..0022523919 100644 --- a/src/main/sync/index.ts +++ b/src/main/sync/index.ts @@ -5,7 +5,7 @@ import path from 'path' import fs from 'fs' import Database from 'better-sqlite3-multiple-ciphers' import type { SyncBackupInfo, CloudSyncResult } from '@shared/types/sync' -import { CloudStorageService } from './cloudStorageService' +import type { CloudStorageService } from './cloudStorageService' import type { DeepchatEventPublisher } from '@shared/contracts/events' import { DataImporter } from './dataImporter' import { @@ -164,11 +164,12 @@ export class SyncService { // === Cloud sync (S3-compatible) === - private buildCloudService(): CloudStorageService { + private async buildCloudService(): Promise { const resolved = this.settings.getResolvedCloudConfig() if (!resolved) { throw new Error('sync.error.cloudNotConfigured') } + const { CloudStorageService } = await import('./cloudStorageService') return new CloudStorageService(resolved) } @@ -206,7 +207,7 @@ export class SyncService { public async testCloudConnection(): Promise { try { - const service = this.buildCloudService() + const service = await this.buildCloudService() await service.testConnection() return { success: true, message: 'sync.success.cloudConnected' } } catch (error) { @@ -217,7 +218,7 @@ export class SyncService { public async uploadLatestBackupToCloud(): Promise { try { - const service = this.buildCloudService() + const service = await this.buildCloudService() const backups = (await this.listBackups()).filter(({ fileName }) => BACKUP_FILE_NAME_REGEX.test(fileName) ) @@ -251,7 +252,7 @@ export class SyncService { public async downloadLatestBackupFromCloud(): Promise { try { - const service = this.buildCloudService() + const service = await this.buildCloudService() const { path: syncFolderPath } = await this.checkSyncFolder() const backupsDir = this.getBackupsDirectory(syncFolderPath) const fileName = await service.downloadLatest(backupsDir) diff --git a/test/main/scripts/packageContract.test.ts b/test/main/scripts/packageContract.test.ts index 248869ba16..b9f87d8fb6 100644 --- a/test/main/scripts/packageContract.test.ts +++ b/test/main/scripts/packageContract.test.ts @@ -62,7 +62,7 @@ describe('CI package contract', () => { 'darwin-x64', 'darwin-arm64' ]) - expect(expectedReleaseAssetCount()).toBe(19) + expect(expectedReleaseAssetCount()).toBe(21) expect(PACKAGE_MANIFEST_SCHEMA_VERSION).toBe(2) expect(RELEASE_INDEX_SCHEMA_VERSION).toBe(2) expect(SHA512_BASE64_PATTERN.test(Buffer.alloc(64).toString('base64'))).toBe(true) diff --git a/test/main/scripts/releaseAssembly.test.ts b/test/main/scripts/releaseAssembly.test.ts index 7073f94722..bf30bd49b0 100644 --- a/test/main/scripts/releaseAssembly.test.ts +++ b/test/main/scripts/releaseAssembly.test.ts @@ -17,7 +17,7 @@ import { assembleRelease } from '../../../scripts/ci/assemble-release.mjs' import { createDefaultPackageSizePolicy, getMeasuredRoles, - getUpdaterPayloadRole, + getUpdaterPayloadRoles, PACKAGE_MANIFEST_SCHEMA_VERSION, RELEASE_INDEX_SCHEMA_VERSION, TARGET_DEFINITIONS @@ -149,12 +149,12 @@ describe('fail-closed release assembly', () => { ) as FinalUpdaterMetadata } - it('assembles six manifests into exactly 19 public release assets', async () => { + it('assembles six manifests into exactly 21 public release assets', async () => { const releaseIndex = await assemble() const entries = (await readdir(outputDirectory)).sort() - expect(entries).toHaveLength(19) + expect(entries).toHaveLength(21) expect(entries).toContain('release-index.json') - expect(releaseIndex.assets).toHaveLength(18) + expect(releaseIndex.assets).toHaveLength(20) expect(releaseIndex).toMatchObject({ version, sourceCommit: sourceSha, @@ -187,12 +187,16 @@ describe('fail-closed release assembly', () => { expect(macOS.files.every(({ url }) => !url.endsWith('.dmg'))).toBe(true) expect(macOS.path).toBe(macOS.files[0].url) - expect(linuxX64.files).toHaveLength(1) + expect(linuxX64.files).toHaveLength(2) expect(linuxX64.files[0].url).toMatch(/-linux-x64\.AppImage$/) expect(linuxX64.files[0]).toHaveProperty('blockMapSize') - expect(linuxArm64.files).toHaveLength(1) + expect(linuxArm64.files).toHaveLength(2) expect(linuxArm64.files[0].url).toMatch(/-linux-arm64\.AppImage$/) expect(linuxArm64.files[0]).toHaveProperty('blockMapSize') + expect(linuxX64.files[1].url).toMatch(/-linux-amd64\.deb$/) + expect(linuxArm64.files[1].url).toMatch(/-linux-arm64\.deb$/) + expect(linuxX64.path).toBe(linuxX64.files[0].url) + expect(linuxArm64.path).toBe(linuxArm64.files[0].url) const windowsTarget = releaseIndex.targets.find(({ id }) => id === 'win32-x64') const macTarget = releaseIndex.targets.find(({ id }) => id === 'darwin-x64') @@ -263,7 +267,7 @@ describe('fail-closed release assembly', () => { workflowRunId, workflowRunAttempt }) - expect(verified.files).toHaveLength(19) + expect(verified.files).toHaveLength(21) const releaseIndexPath = path.join(outputDirectory, 'release-index.json') const originalReleaseIndex = await readFile(releaseIndexPath, 'utf8') @@ -477,7 +481,7 @@ describe('fail-closed release assembly', () => { const files = metadata.files as Array> metadata.files = [files[0], { ...files[0] }] }) - await expect(assemble()).rejects.toThrow(/exactly one updater file/) + await expect(assemble()).rejects.toThrow(/URL mismatch/) await resetFixtures() await updateManifest('darwin-arm64', (manifest) => { @@ -555,29 +559,26 @@ async function createOnePackageArtifact( }) } - const updaterRole = getUpdaterPayloadRole(definition) - const updaterPayload = fileRecords.find(({ role }) => role === updaterRole.name)! - const updaterInspected = await inspectRegularFile( - path.join(root, updaterPayload.storagePath), - root + const updateFiles = await Promise.all( + getUpdaterPayloadRoles(definition).map(async (role) => { + const payload = fileRecords.find((file) => file.role === role.name)! + const { sha512, bytes } = await inspectRegularFile(path.join(root, payload.storagePath), root) + return { + url: payload.name, + sha512, + size: bytes, + ...(payload.name.endsWith('.AppImage') ? { blockMapSize: Math.max(1, bytes - 1) } : {}) + } + }) ) const metadataPath = path.join(metadataDirectory, definition.metadataName) await writeFile( metadataPath, stringify({ version, - files: [ - { - url: updaterPayload.name, - sha512: updaterInspected.sha512, - size: updaterInspected.bytes, - ...(definition.platform === 'linux' - ? { blockMapSize: Math.max(1, updaterInspected.bytes - 1) } - : {}) - } - ], - path: updaterPayload.name, - sha512: updaterInspected.sha512, + files: updateFiles, + path: updateFiles[0].url, + sha512: updateFiles[0].sha512, releaseDate: generatedAt }) ) From aa9aecfed163b5f949f5f4903d6b9b1acf2d3dc8 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Thu, 26 Nov 2026 23:30:20 +0800 Subject: [PATCH 2/5] test(linux): exercise the packaged terminal --- docs/issues/uos-debian-package/spec.md | 4 ++-- electron-builder.yml | 2 ++ package.json | 1 + scripts/ci/smoke-linux-deb.sh | 11 +++++++++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/issues/uos-debian-package/spec.md b/docs/issues/uos-debian-package/spec.md index c18416d55a..13a2da415a 100644 --- a/docs/issues/uos-debian-package/spec.md +++ b/docs/issues/uos-debian-package/spec.md @@ -4,9 +4,9 @@ ## Runtime boundary -The Linux x64 v1.1.5-beta.1 tarball contains an Electron executable requiring GLIBC_2.25 and a Node executable requiring GLIBC_2.28. Its packaged SQLite binding requires GLIBC_2.34. Its native Dim host imports GLIBC_2.38 and has versioned references up to GLIBC_2.39. A different installer alone cannot make those binaries runnable on UOS. +The Linux x64 v1.1.5-beta.1 tarball contains an Electron executable requiring GLIBC_2.25 and a Node executable requiring GLIBC_2.28. Its packaged SQLite binding requires GLIBC_2.34. A Debian 10 ARM64 guest running Linux 4.19 also reproduced the published SQLite and Dim loader failures. Its native x64 Dim host imports GLIBC_2.38 and has versioned references up to GLIBC_2.39. A different installer alone cannot make those binaries runnable on UOS. -Build the startup SQLite binding and the local agent host against glibc 2.28 from the same pinned sources as other platforms. Exercise the built bindings with the packaged Node runtime. Load the S3 backup adapter on demand, so cloud storage dependencies are needed only when performing cloud operations. The packaged OpenDAL and Light OCR bindings currently require GLIBC_2.38 on x64. File search and the preview overlay have separate native dependencies. Their existing platform smoke tests remain on the supported modern Linux runner. +Build the startup SQLite binding and the local agent host against glibc 2.28 from the same pinned sources as other platforms. Exercise the built bindings and a PTY subprocess with the packaged Node runtime. Load the S3 backup adapter on demand, so cloud storage dependencies are needed only when performing cloud operations. The packaged OpenDAL and Light OCR bindings currently require GLIBC_2.38 on x64. File search and the preview overlay have separate native dependencies. Their existing platform smoke tests remain on the supported modern Linux runner. ## Acceptance diff --git a/electron-builder.yml b/electron-builder.yml index 5b1ad8778e..6945008f31 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -148,6 +148,8 @@ linux: - x-scheme-handler/deepchat deb: packageName: deepchat + synopsis: Local-first AI desktop assistant + packageCategory: utils compression: xz depends: - libc6 (>= 2.28) diff --git a/package.json b/package.json index 4f1e348963..3999f291ac 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "description": "DeepChat,一个简单易用的 Agent 客户端", "main": "./out/main/index.js", "author": "ThinkInAIXYZ", + "license": "Apache-2.0", "homepage": "https://deepchatai.cn", "type": "module", "engines": { diff --git a/scripts/ci/smoke-linux-deb.sh b/scripts/ci/smoke-linux-deb.sh index 45f82f4498..734c747be7 100644 --- a/scripts/ci/smoke-linux-deb.sh +++ b/scripts/ci/smoke-linux-deb.sh @@ -8,6 +8,7 @@ docker run --rm -i -v "$PWD:/source:ro" -w /source \ test "$(getconf GNU_LIBC_VERSION)" = 'glibc 2.28' packages=(/source/dist/*-linux-"$(dpkg --print-architecture)".deb) test "${#packages[@]}" -eq 1 +test "$(dpkg-deb -f "${packages[0]}" Architecture)" = "$(dpkg --print-architecture)" test "$(dpkg-deb -f "${packages[0]}" Package)" = deepchat echo 'deb https://archive.debian.org/debian buster main' > /etc/apt/sources.list apt_options=(-o Acquire::https::CaInfo=/tmp/archive-ca.pem -o Acquire::Check-Valid-Until=false) @@ -32,6 +33,16 @@ reopened.pragma("cipher='sqlcipher'") reopened.pragma("key='smoke-test'") assert.equal(reopened.prepare('SELECT value FROM example').get().value, 42) reopened.close() +const pty = require(process.argv[2] + '/node_modules/node-pty') +const child = pty.spawn('/bin/sh', ['-c', 'printf pty-ready']) +let output = '' +child.onData(data => { output += data }) +const timeout = setTimeout(() => process.exit(1), 5000) +child.onExit(({ exitCode }) => { + clearTimeout(timeout) + assert.equal(exitCode, 0) + assert.match(output, /pty-ready/) +}) SQLITE "$node" scripts/smoke-dim-runtime.mjs --resources-path "$resources" xvfb-run -a /opt/DeepChat/deepchat --user-data-dir=/tmp/deepchat-profile --disable-gpu \ From 49442af6341a812aece6da89d82277d8175acd0c Mon Sep 17 00:00:00 2001 From: zerob13 Date: Thu, 26 Nov 2026 23:56:00 +0800 Subject: [PATCH 3/5] fix(linux): verify desktop as a regular user --- README.md | 2 ++ README.zh.md | 2 ++ docs/issues/uos-debian-package/spec.md | 8 ++++---- electron-builder.yml | 3 +++ scripts/ci/smoke-linux-deb.sh | 7 ++++++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index aa7f1abca7..b1b5bb4bae 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,8 @@ Download the latest version for your system from the [GitHub Releases](https://g - macOS: `.dmg` installation file - Linux: `.AppImage` or `.deb` installation file +On Linux, bundled Light OCR on amd64 and arm64 requires glibc 2.38 and libstdc++ with `GLIBCXX_3.4.32`. S3-compatible cloud backup on amd64 also requires glibc 2.38. + **Option 2: Official Website** Download from the [official website](https://deepchatai.cn/#/download). diff --git a/README.zh.md b/README.zh.md index aa76b6a842..f1bc589a6e 100644 --- a/README.zh.md +++ b/README.zh.md @@ -96,6 +96,8 @@ DeepChat 的会话与 Agent 过程基于 Tape.systems 的哲学设计:把过 - macOS: `.dmg`安装文件 - Linux: `.AppImage`或`.deb`安装文件 +Linux 的 amd64 和 arm64 安装包中,自带的 Light OCR 需要 glibc 2.38 及提供 `GLIBCXX_3.4.32` 的 libstdc++。amd64 上的 S3 兼容云备份也需要 glibc 2.38。 + **方式二:官网下载** 从[官网下载页面](https://deepchatai.cn/#/download)获取安装包。 diff --git a/docs/issues/uos-debian-package/spec.md b/docs/issues/uos-debian-package/spec.md index 13a2da415a..4ab035c6b5 100644 --- a/docs/issues/uos-debian-package/spec.md +++ b/docs/issues/uos-debian-package/spec.md @@ -4,9 +4,9 @@ ## Runtime boundary -The Linux x64 v1.1.5-beta.1 tarball contains an Electron executable requiring GLIBC_2.25 and a Node executable requiring GLIBC_2.28. Its packaged SQLite binding requires GLIBC_2.34. A Debian 10 ARM64 guest running Linux 4.19 also reproduced the published SQLite and Dim loader failures. Its native x64 Dim host imports GLIBC_2.38 and has versioned references up to GLIBC_2.39. A different installer alone cannot make those binaries runnable on UOS. +The Linux x64 v1.1.5-beta.1 tarball contains an Electron executable requiring GLIBC_2.25 and a Node executable requiring GLIBC_2.28. Its packaged SQLite binding requires GLIBC_2.34. The x64 Dim host imports GLIBC_2.38 and has versioned references up to GLIBC_2.39. In a Debian 10 ARM64 guest with Linux 4.19, the published application stopped during database initialization because its SQLite binding could not load. The packaged Dim host also failed to load. A different installer alone cannot make those binaries runnable on UOS. -Build the startup SQLite binding and the local agent host against glibc 2.28 from the same pinned sources as other platforms. Exercise the built bindings and a PTY subprocess with the packaged Node runtime. Load the S3 backup adapter on demand, so cloud storage dependencies are needed only when performing cloud operations. The packaged OpenDAL and Light OCR bindings currently require GLIBC_2.38 on x64. File search and the preview overlay have separate native dependencies. Their existing platform smoke tests remain on the supported modern Linux runner. +Build the startup SQLite binding and the local agent host against glibc 2.28 from the same pinned sources as other platforms. Exercise the built bindings and a PTY subprocess with the packaged Node runtime. Load the S3 backup adapter on demand, so cloud storage dependencies are needed only when performing cloud operations. Light OCR requires GLIBC_2.38 and GLIBCXX_3.4.32 on x64 and ARM64. The x64 OpenDAL binding requires GLIBC_2.38. On ARM64, OpenDAL loaded on Linux 4.19/glibc 2.28, completed an in-memory write/read round trip and constructed an S3 operator. File search and the preview overlay have separate native dependencies. Their existing platform smoke tests remain on the supported modern Linux runner. ## Acceptance @@ -17,5 +17,5 @@ Build the startup SQLite binding and the local agent host against glibc 2.28 fro ## Implementation - [x] Add Debian to packaging and release validation. -- [ ] Build and exercise the startup and agent binaries on the older userspace. -- [ ] Validate the release assembly, updater metadata, and native package jobs. +- [x] Build the database binding and Dim host against glibc 2.28 on both architectures. +- [x] Gate distribution on Debian installation, native runtime checks, and desktop startup. Validate both Linux updater payloads during release assembly. diff --git a/electron-builder.yml b/electron-builder.yml index 6945008f31..c75c561755 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -149,6 +149,9 @@ linux: deb: packageName: deepchat synopsis: Local-first AI desktop assistant + description: >- + Run local agents and chat with AI models. Bundled Light OCR on amd64 and arm64 requires + glibc 2.38 and GLIBCXX_3.4.32. S3-compatible cloud backup on amd64 requires glibc 2.38. packageCategory: utils compression: xz depends: diff --git a/scripts/ci/smoke-linux-deb.sh b/scripts/ci/smoke-linux-deb.sh index 734c747be7..4911d129f6 100644 --- a/scripts/ci/smoke-linux-deb.sh +++ b/scripts/ci/smoke-linux-deb.sh @@ -45,7 +45,12 @@ child.onExit(({ exitCode }) => { }) SQLITE "$node" scripts/smoke-dim-runtime.mjs --resources-path "$resources" -xvfb-run -a /opt/DeepChat/deepchat --user-data-dir=/tmp/deepchat-profile --disable-gpu \ +if [[ "$(dpkg --print-architecture)" == arm64 ]]; then + "$node" scripts/smoke-opendal-native.js --project-dir "$unpacked" +fi +install -d -m 0700 -o nobody -g nogroup /tmp/deepchat-user /tmp/deepchat-user/runtime +runuser -u nobody -- env HOME=/tmp/deepchat-user XDG_RUNTIME_DIR=/tmp/deepchat-user/runtime \ + xvfb-run -a /opt/DeepChat/deepchat --disable-gpu \ --remote-debugging-address=127.0.0.1 --remote-debugging-port=9222 >/tmp/deepchat.log 2>&1 & app_pid=$! trap 'kill "$app_pid" 2>/dev/null || true' EXIT From e8ad6c70359f5979b560f1e3cf6e68635d018ea7 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Fri, 27 Nov 2026 00:15:16 +0800 Subject: [PATCH 4/5] fix(linux): install runtime CA certificates --- electron-builder.yml | 1 + scripts/ci/smoke-linux-deb.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/electron-builder.yml b/electron-builder.yml index c75c561755..d6a3a0b3ab 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -155,6 +155,7 @@ deb: packageCategory: utils compression: xz depends: + - ca-certificates - libc6 (>= 2.28) - libstdc++6 (>= 8) - libgtk-3-0 diff --git a/scripts/ci/smoke-linux-deb.sh b/scripts/ci/smoke-linux-deb.sh index 4911d129f6..83baaeb337 100644 --- a/scripts/ci/smoke-linux-deb.sh +++ b/scripts/ci/smoke-linux-deb.sh @@ -10,7 +10,8 @@ packages=(/source/dist/*-linux-"$(dpkg --print-architecture)".deb) test "${#packages[@]}" -eq 1 test "$(dpkg-deb -f "${packages[0]}" Architecture)" = "$(dpkg --print-architecture)" test "$(dpkg-deb -f "${packages[0]}" Package)" = deepchat -echo 'deb https://archive.debian.org/debian buster main' > /etc/apt/sources.list +# The final slim image contains updates from Debian's security suite. +sed -i 's|http://deb.debian.org|https://archive.debian.org|g' /etc/apt/sources.list apt_options=(-o Acquire::https::CaInfo=/tmp/archive-ca.pem -o Acquire::Check-Valid-Until=false) apt-get "${apt_options[@]}" update -qq DEBIAN_FRONTEND=noninteractive apt-get "${apt_options[@]}" install -y --no-install-recommends "${packages[0]}" xvfb xauth From f942a15b5d032cdcfa8193a5498a8a215a0976d2 Mon Sep 17 00:00:00 2001 From: zerob13 Date: Fri, 27 Nov 2026 00:24:18 +0800 Subject: [PATCH 5/5] fix(linux): handle updater and cloud errors --- docs/architecture/ci-release-packaging/spec.md | 1 + scripts/ci/assemble-release.mjs | 8 ++++---- scripts/ci/package-manifest.mjs | 15 ++++++--------- scripts/ci/smoke-linux-deb.sh | 2 +- src/main/sync/index.ts | 6 +++++- .../settings/components/DataSettings.vue | 8 +++++--- src/renderer/src/i18n/bo-CN/sync.json | 1 + src/renderer/src/i18n/da-DK/sync.json | 1 + src/renderer/src/i18n/de-DE/sync.json | 1 + src/renderer/src/i18n/en-US/sync.json | 1 + src/renderer/src/i18n/es-ES/sync.json | 1 + src/renderer/src/i18n/fa-IR/sync.json | 1 + src/renderer/src/i18n/fr-FR/sync.json | 1 + src/renderer/src/i18n/he-IL/sync.json | 1 + src/renderer/src/i18n/id-ID/sync.json | 1 + src/renderer/src/i18n/it-IT/sync.json | 1 + src/renderer/src/i18n/ja-JP/sync.json | 1 + src/renderer/src/i18n/ko-KR/sync.json | 1 + src/renderer/src/i18n/mn-Mong-CN/sync.json | 1 + src/renderer/src/i18n/ms-MY/sync.json | 1 + src/renderer/src/i18n/pl-PL/sync.json | 1 + src/renderer/src/i18n/pt-BR/sync.json | 1 + src/renderer/src/i18n/ru-RU/sync.json | 1 + src/renderer/src/i18n/tr-TR/sync.json | 1 + src/renderer/src/i18n/ug-CN/sync.json | 1 + src/renderer/src/i18n/vi-VN/sync.json | 1 + src/renderer/src/i18n/zh-CN/sync.json | 1 + src/renderer/src/i18n/zh-HK/sync.json | 1 + src/renderer/src/i18n/zh-TW/sync.json | 1 + test/main/scripts/releaseAssembly.test.ts | 17 ++++++++++++++++- test/main/sync/syncService.test.ts | 16 ++++++++++++++++ test/renderer/components/DataSettings.test.ts | 6 ++---- 32 files changed, 79 insertions(+), 23 deletions(-) diff --git a/docs/architecture/ci-release-packaging/spec.md b/docs/architecture/ci-release-packaging/spec.md index 443243d28b..8e380ff5f6 100644 --- a/docs/architecture/ci-release-packaging/spec.md +++ b/docs/architecture/ci-release-packaging/spec.md @@ -116,6 +116,7 @@ assembly fails closed against an explicit six-target contract. - The initial baseline records successful run `29978292769` and source commit `dfb4ba0f34c008c27cfb6bd98a08fdbd36f7b343`. - Windows EXE, Linux AppImage and tarball, and macOS ZIP and DMG enforce upper and lower delta bounds. +- Add Debian installers to the next size baseline once both architectures have distribution artifact sizes and digests. - `package-regression.yml` supports reusable, manual, and scheduled execution, always covers all six targets, and uploads reports rather than complete unsigned installers. - A scheduled failure opens or updates one package-regression issue; the next fully successful diff --git a/scripts/ci/assemble-release.mjs b/scripts/ci/assemble-release.mjs index 0e52d0af47..e072b092f1 100644 --- a/scripts/ci/assemble-release.mjs +++ b/scripts/ci/assemble-release.mjs @@ -418,8 +418,8 @@ function mergeArchitectureMetadata(packages, version) { return metadata } -function normalizeSingleArchitectureMetadata(packageEntry, version) { - const file = packageEntry.rawMetadata.files[0] +function normalizeLinuxMetadata(packageEntry, version) { + const file = packageEntry.rawMetadata.files.find(({ url }) => url.endsWith('.AppImage')) const metadata = { version, files: packageEntry.rawMetadata.files, @@ -619,11 +619,11 @@ export async function assembleRelease({ }, { name: 'latest-linux.yml', - metadata: normalizeSingleArchitectureMetadata(linuxX64, version) + metadata: normalizeLinuxMetadata(linuxX64, version) }, { name: 'latest-linux-arm64.yml', - metadata: normalizeSingleArchitectureMetadata(linuxArm64, version) + metadata: normalizeLinuxMetadata(linuxArm64, version) } ] const metadataAssets = await Promise.all( diff --git a/scripts/ci/package-manifest.mjs b/scripts/ci/package-manifest.mjs index 55a67c6d20..4a458e685a 100644 --- a/scripts/ci/package-manifest.mjs +++ b/scripts/ci/package-manifest.mjs @@ -206,11 +206,6 @@ function validateUpdaterFile(file, payload, label) { `${label} updater file has unsupported fields: ${unexpectedFileFields.join(', ')}` ) } - if (file.url !== payload.name) { - throw new Error( - `Updater metadata URL mismatch for ${label}: ${file.url} != ${payload.name}` - ) - } if ( typeof file.sha512 !== 'string' || !SHA512_BASE64_PATTERN.test(file.sha512) || @@ -305,10 +300,12 @@ export function validateRawUpdateMetadata({ if (!Array.isArray(metadata.files) || metadata.files.length !== payloads.length) { throw new Error(`${label} must contain exactly ${payloads.length} updater files`) } - const files = payloads.map((payload, index) => - validateUpdaterFile(metadata.files[index], payload, label) - ) - if (metadata.path !== files[0].url || metadata.sha512 !== files[0].sha512) { + const files = payloads.map((payload) => { + const file = metadata.files.find((candidate) => candidate?.url === payload.name) + if (!file) throw new Error(`Updater metadata URL mismatch for ${label}: missing ${payload.name}`) + return validateUpdaterFile(file, payload, label) + }) + if (!files.some((file) => metadata.path === file.url && metadata.sha512 === file.sha512)) { throw new Error(`Updater metadata legacy fields mismatch for ${definition.id}`) } if ( diff --git a/scripts/ci/smoke-linux-deb.sh b/scripts/ci/smoke-linux-deb.sh index 83baaeb337..6184c2b581 100644 --- a/scripts/ci/smoke-linux-deb.sh +++ b/scripts/ci/smoke-linux-deb.sh @@ -2,7 +2,7 @@ set -euo pipefail # Debian 10 provides the glibc in the UOS report. Its kernel is shared with the CI runner. -docker run --rm -i -v "$PWD:/source:ro" -w /source \ +docker run --rm -i --shm-size=256m -v "$PWD:/source:ro" -w /source \ -v /etc/ssl/certs/ca-certificates.crt:/tmp/archive-ca.pem:ro \ debian:buster-slim@sha256:bb3dc79fddbca7e8903248ab916bb775c96ec61014b3d02b4f06043b604726dc bash -seu <<'SMOKE' test "$(getconf GNU_LIBC_VERSION)" = 'glibc 2.28' diff --git a/src/main/sync/index.ts b/src/main/sync/index.ts index 0022523919..ab881f10dc 100644 --- a/src/main/sync/index.ts +++ b/src/main/sync/index.ts @@ -169,7 +169,11 @@ export class SyncService { if (!resolved) { throw new Error('sync.error.cloudNotConfigured') } - const { CloudStorageService } = await import('./cloudStorageService') + const { CloudStorageService } = await import('./cloudStorageService').catch( + (cause: unknown) => { + throw new Error('sync.error.cloudComponentUnavailable', { cause }) + } + ) return new CloudStorageService(resolved) } diff --git a/src/renderer/settings/components/DataSettings.vue b/src/renderer/settings/components/DataSettings.vue index e3af463d1e..9ddfc6a646 100644 --- a/src/renderer/settings/components/DataSettings.vue +++ b/src/renderer/settings/components/DataSettings.vue @@ -1212,12 +1212,13 @@ const handleSaveAndTestCloud = () => { } const result = await syncStore.testCloud() if (!result?.success) { - throw new Error(t('settings.data.cloudSync.testFailedTitle')) + cloudOperationError.value = cloudResultDescription(result?.message) ?? null + throw new Error('Cloud connection test failed') } }) .catch((error: unknown) => { console.error('[DataSettings] Failed to save or test cloud config', error) - cloudOperationError.value = t('settings.data.cloudSync.testFailedTitle') + cloudOperationError.value ??= t('settings.data.cloudSync.testFailedTitle') }) .finally(() => { isCloudFeedbackPending.value = false @@ -1270,7 +1271,8 @@ const handlePullFromCloud = async () => { notifyRenderer({ kind: 'error', code: 'settings.data.cloud.pullFailed', - title: t('settings.data.importErrorTitle') + title: t('settings.data.importErrorTitle'), + description: cloudResultDescription(result?.message) }) return } diff --git a/src/renderer/src/i18n/bo-CN/sync.json b/src/renderer/src/i18n/bo-CN/sync.json index 6042189d50..971927ba64 100644 --- a/src/renderer/src/i18n/bo-CN/sync.json +++ b/src/renderer/src/i18n/bo-CN/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "སྤྲིན་གྱིས་ད་དུང་བཀོད་སྒྲིག་བྱས་མེད་པས་སྔོན་ལ་སྤྲིན་འབྲེལ་གྱི་ཆ་འཕྲིན་ཁ་གསབ་དང་ཉར་ཚགས་གནང་རོགས།", "cloudNoBackup": "སྤྲིན་གྱི་ནང་དུ་རྗེས་གྲབས་ཡིག་ཆ་མེད།", "cloudDownloadFailed": "སྤྲིན་གྱི་རྗེས་གྲབས་ཕབ་ལེན་བྱེད་མ་ཐུབ་པ།", + "cloudComponentUnavailable": "S3 གྲབས་ཉར་གྱི་ཆ་ཤས་འདོན་འཇུག་བྱེད་མ་ཐུབ། Linux amd64 ཐོག་ glibc 2.38 ཡང་ན་དེ་ལས་གསར་བ་དགོས།", "cloudOperationFailed": "སྤྲིན་གྱི་བཀོལ་སྤྱོད་ལ་ཕམ་ཉེས་བྱུང་བ།", "noLocalBackup": "ས་གནས་དེ་གར་ཕབ་ལེན་བྱེད་མི་ཐུབ་པས། སྔོན་ལ་རྗེས་གྲབས་བྱེད་རོགས།", "safeStorageUnavailable": "མ་ལག་གི་ལྡེ་མིག་གི་ལྕགས་ཐག་བཀོལ་སྤྱོད་བྱེད་མི་ཐུབ་པས། ལྡེ་མིག་བདེ་འཇགས་ངང་ཉར་ཚགས་བྱེད་མི་ཐུབ།", diff --git a/src/renderer/src/i18n/da-DK/sync.json b/src/renderer/src/i18n/da-DK/sync.json index d5d8ec6710..50fe8a29be 100644 --- a/src/renderer/src/i18n/da-DK/sync.json +++ b/src/renderer/src/i18n/da-DK/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "S3-sikkerhedskopiering kunne ikke indlæses. På Linux amd64 kræver den glibc 2.38 eller nyere.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Systemets nøglering er ikke tilgængelig; den hemmelige nøgle kan ikke gemmes sikkert.", diff --git a/src/renderer/src/i18n/de-DE/sync.json b/src/renderer/src/i18n/de-DE/sync.json index 502f5f4ae2..170437b41e 100644 --- a/src/renderer/src/i18n/de-DE/sync.json +++ b/src/renderer/src/i18n/de-DE/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Die Komponente für S3-Sicherungen konnte nicht geladen werden. Unter Linux amd64 benötigt sie glibc 2.38 oder neuer.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Der Systemschlüsselbund ist nicht verfügbar; der geheime Schlüssel kann nicht sicher gespeichert werden.", diff --git a/src/renderer/src/i18n/en-US/sync.json b/src/renderer/src/i18n/en-US/sync.json index 1aaea5b5e5..abf3781e06 100644 --- a/src/renderer/src/i18n/en-US/sync.json +++ b/src/renderer/src/i18n/en-US/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Could not load the S3 backup component. On Linux amd64 it requires glibc 2.38 or later.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "System keychain unavailable; cannot securely store the secret key.", diff --git a/src/renderer/src/i18n/es-ES/sync.json b/src/renderer/src/i18n/es-ES/sync.json index 96b7e825e7..37a427ec98 100644 --- a/src/renderer/src/i18n/es-ES/sync.json +++ b/src/renderer/src/i18n/es-ES/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "No se pudo cargar el componente de copias de seguridad S3. En Linux amd64 requiere glibc 2.38 o posterior.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "El llavero del sistema no está disponible; no se puede guardar la clave secreta de forma segura.", diff --git a/src/renderer/src/i18n/fa-IR/sync.json b/src/renderer/src/i18n/fa-IR/sync.json index 7713c2cfdf..f8b30c724c 100644 --- a/src/renderer/src/i18n/fa-IR/sync.json +++ b/src/renderer/src/i18n/fa-IR/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "مؤلفهٔ پشتیبان‌گیری S3 بارگذاری نشد. این مؤلفه در لینوکس amd64 به glibc 2.38 یا جدیدتر نیاز دارد.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Keychain سیستم در دسترس نیست؛ کلید محرمانه را نمی‌توان به‌صورت امن ذخیره کرد.", diff --git a/src/renderer/src/i18n/fr-FR/sync.json b/src/renderer/src/i18n/fr-FR/sync.json index 1cb274eba7..5099750bd8 100644 --- a/src/renderer/src/i18n/fr-FR/sync.json +++ b/src/renderer/src/i18n/fr-FR/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Le cloud n'est pas configuré. Renseignez et enregistrez d'abord la connexion cloud.", "cloudNoBackup": "Aucune sauvegarde disponible dans le bucket cloud", "cloudDownloadFailed": "Échec du téléchargement de la sauvegarde depuis le cloud", + "cloudComponentUnavailable": "Impossible de charger le composant de sauvegarde S3. Sous Linux amd64, il nécessite glibc 2.38 ou une version ultérieure.", "cloudOperationFailed": "Échec de l'opération cloud", "noLocalBackup": "Aucune sauvegarde locale à envoyer. Lancez d'abord une sauvegarde.", "safeStorageUnavailable": "Le trousseau système est indisponible ; impossible de stocker la clé secrète en toute sécurité.", diff --git a/src/renderer/src/i18n/he-IL/sync.json b/src/renderer/src/i18n/he-IL/sync.json index 2a28e75954..5c8462763a 100644 --- a/src/renderer/src/i18n/he-IL/sync.json +++ b/src/renderer/src/i18n/he-IL/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "הענן אינו מוגדר. מלא ושמור תחילה את חיבור הענן.", "cloudNoBackup": "אין גיבוי זמין בדלי הענן", "cloudDownloadFailed": "נכשל בהורדת הגיבוי מהענן", + "cloudComponentUnavailable": "לא ניתן לטעון את רכיב הגיבוי ל־S3. ב־Linux amd64 נדרשת glibc בגרסה 2.38 ומעלה.", "cloudOperationFailed": "פעולת הענן נכשלה", "noLocalBackup": "אין גיבוי מקומי להעלאה. הפעל גיבוי תחילה.", "safeStorageUnavailable": "מחזיק המפתחות של המערכת אינו זמין; אי אפשר לשמור את המפתח הסודי באופן מאובטח.", diff --git a/src/renderer/src/i18n/id-ID/sync.json b/src/renderer/src/i18n/id-ID/sync.json index 9824de54f0..fcb43bfd7f 100644 --- a/src/renderer/src/i18n/id-ID/sync.json +++ b/src/renderer/src/i18n/id-ID/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud belum dikonfigurasi. Isi dan simpan koneksi cloud terlebih dahulu.", "cloudNoBackup": "Tidak ada cadangan yang tersedia di bucket cloud", "cloudDownloadFailed": "Gagal mengunduh cadangan dari cloud", + "cloudComponentUnavailable": "Komponen pencadangan S3 gagal dimuat. Di Linux amd64, komponen ini memerlukan glibc 2.38 atau yang lebih baru.", "cloudOperationFailed": "Operasi cloud gagal", "noLocalBackup": "Tidak ada cadangan lokal untuk diunggah. Jalankan pencadangan terlebih dahulu.", "safeStorageUnavailable": "Keychain sistem tidak tersedia; kunci rahasia tidak dapat disimpan dengan aman.", diff --git a/src/renderer/src/i18n/it-IT/sync.json b/src/renderer/src/i18n/it-IT/sync.json index 1d3b33fbd3..90f798aa24 100644 --- a/src/renderer/src/i18n/it-IT/sync.json +++ b/src/renderer/src/i18n/it-IT/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Impossibile caricare il componente di backup S3. Su Linux amd64 richiede glibc 2.38 o successiva.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Il portachiavi di sistema non è disponibile; impossibile salvare la chiave segreta in modo sicuro.", diff --git a/src/renderer/src/i18n/ja-JP/sync.json b/src/renderer/src/i18n/ja-JP/sync.json index b9bc74c900..7bb5c8323c 100644 --- a/src/renderer/src/i18n/ja-JP/sync.json +++ b/src/renderer/src/i18n/ja-JP/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "S3 バックアップ用コンポーネントを読み込めませんでした。Linux amd64 では glibc 2.38 以降が必要です。", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "システムのキーチェーンを利用できないため、シークレットキーを安全に保存できません。", diff --git a/src/renderer/src/i18n/ko-KR/sync.json b/src/renderer/src/i18n/ko-KR/sync.json index a2da43bc47..a7dbc8d2df 100644 --- a/src/renderer/src/i18n/ko-KR/sync.json +++ b/src/renderer/src/i18n/ko-KR/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "S3 백업 구성 요소를 불러올 수 없습니다. Linux amd64에서는 glibc 2.38 이상이 필요합니다.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "시스템 키체인을 사용할 수 없어 비밀 키를 안전하게 저장할 수 없습니다.", diff --git a/src/renderer/src/i18n/mn-Mong-CN/sync.json b/src/renderer/src/i18n/mn-Mong-CN/sync.json index f9f49340eb..db5f51c2b8 100644 --- a/src/renderer/src/i18n/mn-Mong-CN/sync.json +++ b/src/renderer/src/i18n/mn-Mong-CN/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "ᠶᠢ ᠪᠠᠰᠠ ᠲᠣᠬᠢᠷᠠᠭᠤᠯᠤᠭᠰᠠᠨ ᠦᠭᠡᠢ ᠂ ᠡᠭᠦᠯᠡᠨ ᠬᠣᠯᠪᠣᠬᠤ ᠮᠠᠲ᠋ᠧᠷᠢᠶᠠᠯ ᠢ ᠤᠷᠢᠳᠠᠪᠠᠷ ᠲᠠᠭᠯᠠᠵᠤ ᠬᠠᠳᠠᠭᠠᠯᠠᠭᠠᠷᠠᠢ", "cloudNoBackup": "ᠳᠤ ᠪᠡᠯᠡᠳᠭᠡᠯ ᠮᠠᠲ᠋ᠧᠷᠢᠶᠠᠯ ᠪᠠᠶᠢᠬᠤ ᠦᠭᠡᠢ", "cloudDownloadFailed": "ᠡᠭᠦᠯᠡᠨ ᠳᠡᠭᠡᠷ᠎ᠡ ᠡᠴᠡ ᠪᠡᠯᠡᠳᠭᠡᠯ ᠢ ᠪᠠᠭᠤᠯᠭᠠᠵᠤ ᠳᠡᠶᠢᠯᠦᠭᠰᠡᠨ ᠦᠭᠡᠢ", + "cloudComponentUnavailable": "S3 ᠨᠥᠭᠡᠴᠡ ᠬᠤᠪᠢ ᠶᠢᠨ ᠪᠦᠷᠢᠯᠳᠦᠬᠦᠨ ᠢ ᠠᠴᠢᠶᠠᠯᠠᠵᠤ ᠳᠡᠶᠢᠯᠦᠭᠰᠡᠨ ᠦᠭᠡᠢ᠃ Linux amd64 ᠳᠡᠭᠡᠷ᠎ᠡ glibc 2.38 ᠪᠤᠶᠤ ᠲᠡᠭᠦᠨ ᠡᠴᠡ ᠰᠢᠨ᠎ᠡ ᠬᠡᠪᠯᠡᠯ ᠬᠡᠷᠡᠭᠲᠡᠢ᠃", "cloudOperationFailed": "ᠡᠭᠦᠯᠡᠨ ᠠᠵᠢᠯᠯᠠᠵᠤ ᠢᠯᠠᠭᠳᠠᠭᠰᠠᠨ", "noLocalBackup": "ᠣᠷᠤᠨ ᠤ ᠪᠡᠯᠡᠳᠭᠡᠯ ᠬᠢᠵᠦ ᠪᠤᠯᠬᠤ ᠦᠭᠡᠢ᠂ ᠤᠷᠢᠳᠠᠪᠡᠷ ᠪᠡᠯᠡᠳᠭᠡᠯ ᠬᠢᠭᠡᠷᠡᠢ", "safeStorageUnavailable": "ᠰᠢᠰᠲ᠋ᠧᠮ ᠦᠨ ᠬᠢᠨ ᠤ ᠵᠠᠬᠢᠶ᠎ᠠ ᠬᠡᠷᠡᠭᠯᠡᠬᠦ ᠦᠭᠡᠢ ᠪᠣᠯᠵᠠᠢ ᠂ ᠲᠦᠯᠬᠢᠭᠦᠷ ᠢ ᠠᠮᠤᠷ ᠲᠦᠪᠰᠢᠨ ᠬᠠᠳᠠᠭᠠᠯᠠᠵᠤ ᠳᠡᠶᠢᠯᠬᠦ ᠦᠭᠡᠢ ᠃", diff --git a/src/renderer/src/i18n/ms-MY/sync.json b/src/renderer/src/i18n/ms-MY/sync.json index bca907afe2..e67d6278f1 100644 --- a/src/renderer/src/i18n/ms-MY/sync.json +++ b/src/renderer/src/i18n/ms-MY/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Komponen sandaran S3 gagal dimuatkan. Pada Linux amd64, komponen ini memerlukan glibc 2.38 atau lebih baharu.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Keychain sistem tidak tersedia; kunci rahsia tidak boleh disimpan dengan selamat.", diff --git a/src/renderer/src/i18n/pl-PL/sync.json b/src/renderer/src/i18n/pl-PL/sync.json index 6349ec0787..d39485f7eb 100644 --- a/src/renderer/src/i18n/pl-PL/sync.json +++ b/src/renderer/src/i18n/pl-PL/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Nie udało się wczytać komponentu kopii zapasowych S3. W systemie Linux amd64 wymaga on glibc w wersji 2.38 lub nowszej.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Systemowy pęk kluczy jest niedostępny; nie można bezpiecznie zapisać klucza tajnego.", diff --git a/src/renderer/src/i18n/pt-BR/sync.json b/src/renderer/src/i18n/pt-BR/sync.json index 11105e6af2..30fc884b5e 100644 --- a/src/renderer/src/i18n/pt-BR/sync.json +++ b/src/renderer/src/i18n/pt-BR/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Não foi possível carregar o componente de backup S3. No Linux amd64, ele requer a glibc 2.38 ou posterior.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "O chaveiro do sistema não está disponível; não é possível armazenar a chave secreta com segurança.", diff --git a/src/renderer/src/i18n/ru-RU/sync.json b/src/renderer/src/i18n/ru-RU/sync.json index 15dd4b0dbc..8ea4cf3c13 100644 --- a/src/renderer/src/i18n/ru-RU/sync.json +++ b/src/renderer/src/i18n/ru-RU/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Не удалось загрузить компонент резервного копирования S3. В Linux amd64 ему требуется glibc версии 2.38 или новее.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Системная связка ключей недоступна; невозможно безопасно сохранить секретный ключ.", diff --git a/src/renderer/src/i18n/tr-TR/sync.json b/src/renderer/src/i18n/tr-TR/sync.json index a510f83d76..7c058db288 100644 --- a/src/renderer/src/i18n/tr-TR/sync.json +++ b/src/renderer/src/i18n/tr-TR/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "S3 yedekleme bileşeni yüklenemedi. Linux amd64 üzerinde glibc 2.38 veya daha yeni bir sürüm gerekir.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Sistem anahtarlığı kullanılamıyor; gizli anahtar güvenli şekilde saklanamıyor.", diff --git a/src/renderer/src/i18n/ug-CN/sync.json b/src/renderer/src/i18n/ug-CN/sync.json index b9a8673ce6..685005ec16 100644 --- a/src/renderer/src/i18n/ug-CN/sync.json +++ b/src/renderer/src/i18n/ug-CN/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "بۇلۇت تېخى سەپلەنمىگەن؛ ئالدى بىلەن بۇلۇت ئۇلىنىش ئۇچۇرلىرىڭىزنى تولدۇرۇپ ساقلاڭ", "cloudNoBackup": "بۇلۇتتا زاپاس ھۆججەت يوق", "cloudDownloadFailed": "بۇلۇتتىن چۈشۈرۈلگەن زاپاسلاش مەغلۇپ بولدى", + "cloudComponentUnavailable": "S3 زاپاسلاش بۆلىكىنى يۈكلىيەلمىدى. Linux amd64 دا glibc 2.38 ياكى ئۇنىڭدىن يۇقىرى نەشرى كېرەك.", "cloudOperationFailed": "بۇلۇت مەشغۇلاتىدا مەغلۇپ بولۇش", "noLocalBackup": "يەرلىكتە يۈكلىگىلى بولىدىغان زاپاسلاش بولمىسا، ئالدى بىلەن زاپاسلاشنى قىلىڭ", "safeStorageUnavailable": "سىستېما مۇھىم زەنجىرى ئىشلىتىشچان ئەمەس، مۇھىم كۇنۇپكىنى بىخەتەر ساقلاشقا بولمايدۇ.", diff --git a/src/renderer/src/i18n/vi-VN/sync.json b/src/renderer/src/i18n/vi-VN/sync.json index 1807c43c31..9568f50826 100644 --- a/src/renderer/src/i18n/vi-VN/sync.json +++ b/src/renderer/src/i18n/vi-VN/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "Không thể tải thành phần sao lưu S3. Trên Linux amd64, thành phần này yêu cầu glibc 2.38 trở lên.", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "Keychain hệ thống không khả dụng; không thể lưu khóa bí mật một cách an toàn.", diff --git a/src/renderer/src/i18n/zh-CN/sync.json b/src/renderer/src/i18n/zh-CN/sync.json index 3f00394601..04517290ee 100644 --- a/src/renderer/src/i18n/zh-CN/sync.json +++ b/src/renderer/src/i18n/zh-CN/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "尚未配置云端,请先填写并保存云端连接信息", "cloudNoBackup": "云端没有可用的备份文件", "cloudDownloadFailed": "从云端下载备份失败", + "cloudComponentUnavailable": "无法加载 S3 备份组件。此组件在 Linux amd64 上需要 glibc 2.38 或更高版本。", "cloudOperationFailed": "云端操作失败", "noLocalBackup": "本地没有可上传的备份,请先执行一次备份", "safeStorageUnavailable": "系统密钥链不可用,无法安全保存密钥。", diff --git a/src/renderer/src/i18n/zh-HK/sync.json b/src/renderer/src/i18n/zh-HK/sync.json index be6e5295f2..2f0b13d565 100644 --- a/src/renderer/src/i18n/zh-HK/sync.json +++ b/src/renderer/src/i18n/zh-HK/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "無法載入 S3 備份元件。此元件在 Linux amd64 上需要 glibc 2.38 或以上版本。", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "系統鑰匙圈不可用,無法安全儲存密鑰。", diff --git a/src/renderer/src/i18n/zh-TW/sync.json b/src/renderer/src/i18n/zh-TW/sync.json index f64f2f7820..8d00270c00 100644 --- a/src/renderer/src/i18n/zh-TW/sync.json +++ b/src/renderer/src/i18n/zh-TW/sync.json @@ -22,6 +22,7 @@ "cloudNotConfigured": "Cloud is not configured. Fill in and save the cloud connection first.", "cloudNoBackup": "No backup available in the cloud bucket", "cloudDownloadFailed": "Failed to download backup from cloud", + "cloudComponentUnavailable": "無法載入 S3 備份元件。此元件在 Linux amd64 上需要 glibc 2.38 或更新版本。", "cloudOperationFailed": "Cloud operation failed", "noLocalBackup": "No local backup to upload. Run a backup first.", "safeStorageUnavailable": "系統鑰匙圈不可用,無法安全儲存金鑰。", diff --git a/test/main/scripts/releaseAssembly.test.ts b/test/main/scripts/releaseAssembly.test.ts index bf30bd49b0..bdb5680096 100644 --- a/test/main/scripts/releaseAssembly.test.ts +++ b/test/main/scripts/releaseAssembly.test.ts @@ -63,8 +63,9 @@ interface PackageManifest { interface FinalUpdaterMetadata { releaseDate: unknown - files: Array<{ url: string; blockMapSize?: number }> + files: Array<{ url: string; sha512: string; blockMapSize?: number }> path: string + sha512: string } describe('fail-closed release assembly', () => { @@ -461,6 +462,20 @@ describe('fail-closed release assembly', () => { await expect(assemble()).rejects.toThrow(/SHA-512 mismatch/) }) + it('publishes the AppImage as the legacy updater even if the deb finishes first', async () => { + await updateRawMetadata('linux-x64', (metadata) => { + const files = metadata.files as Array<{ url: string; sha512: string }> + files.reverse() + metadata.path = files[0].url + metadata.sha512 = files[0].sha512 + }) + await assemble() + const metadata = await readFinalMetadata('latest-linux.yml') + expect(metadata.files[0].url).toMatch(/\.AppImage$/) + expect(metadata.path).toBe(metadata.files[0].url) + expect(metadata.sha512).toBe(metadata.files[0].sha512) + }) + it('rejects incomplete updater metadata and invalid macOS evidence', async () => { await updateRawMetadata('darwin-x64', (metadata) => { const files = metadata.files as Array> diff --git a/test/main/sync/syncService.test.ts b/test/main/sync/syncService.test.ts index f83ed5cb45..0c9249a722 100644 --- a/test/main/sync/syncService.test.ts +++ b/test/main/sync/syncService.test.ts @@ -771,6 +771,22 @@ describe('SyncService backup import', () => { expect(importDatabase.reopen).not.toHaveBeenCalled() }) + it('reports an unavailable S3 component without blocking local backups', async () => { + const original = await import('../../../src/main/sync/cloudStorageService') + vi.doMock('../../../src/main/sync/cloudStorageService', () => { + throw new Error('Cannot find native binding') + }) + try { + await expect(service.testCloudConnection()).resolves.toEqual({ + success: false, + message: 'sync.error.cloudComponentUnavailable' + }) + await expect(service.listBackups()).resolves.toEqual([]) + } finally { + vi.doMock('../../../src/main/sync/cloudStorageService', () => original) + } + }) + it('normalizes R2 unauthorized cloud errors to a user-facing error key', async () => { cloudStorageMocks.testConnection.mockRejectedValue( new Error( diff --git a/test/renderer/components/DataSettings.test.ts b/test/renderer/components/DataSettings.test.ts index 7c0934a87f..0344316b68 100644 --- a/test/renderer/components/DataSettings.test.ts +++ b/test/renderer/components/DataSettings.test.ts @@ -464,7 +464,7 @@ describe('DataSettings', () => { const { wrapper, syncStore, notifyRenderer } = await setup() syncStore.testCloud.mockResolvedValueOnce({ success: false, - message: 'sync.error.cloudConnectionFailed' + message: 'sync.error.cloudComponentUnavailable' }) await wrapper.get('#cloud-endpoint').setValue('https://account.r2.cloudflarestorage.com/') @@ -477,9 +477,7 @@ describe('DataSettings', () => { expect(notifyRenderer).not.toHaveBeenCalledWith( expect.objectContaining({ code: 'settings.data.cloud.testFailed' }) ) - expect(wrapper.get('[role="alert"]').text()).toContain( - 'settings.data.cloudSync.testFailedTitle' - ) + expect(wrapper.get('[role="alert"]').text()).toContain('sync.error.cloudComponentUnavailable') }) it('reports a failed cloud save as an inline error and preserves the unsaved draft', async () => {