Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

test(desktop): verify official old releases upgrade to fixed installers (#776)

tianma-ifccaabbd688b4
diff --git a/.github/workflows/desktop-release-bridge.yml b/.github/workflows/desktop-release-bridge.yml
new file mode 100644
index 00000000..cafa17dc
--- /dev/null
+++ b/.github/workflows/desktop-release-bridge.yml
@@ -0,0 +1,111 @@
+name: Verify official old-to-new desktop updates
+
+on:
+ workflow_dispatch:
+ inputs:
+ candidate_run:
+ description: Desktop build run containing the actual candidate installers
+ type: string
+ required: true
+ previous_tag:
+ description: Published release to upgrade from
+ type: string
+ required: true
+ default: v2.17.0
+ windows_signature:
+ description: Offline signature envelope for the candidate Windows manifest (public signature only)
+ type: string
+ required: true
+
+permissions:
+ contents: read
+ actions: read
+
+jobs:
+ release-bridge:
+ if: github.repository == 'tianma-if/edgeever'
+ name: Official release bridge ${{ matrix.platform }} ${{ matrix.arch }}
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 25
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - platform: macOS
+ runner: macos-15
+ arch: arm64
+ artifact: edgeever-desktop-macOS-arm64-staging
+ pattern: EdgeEver-*-mac-arm64.zip
+ - platform: macOS
+ runner: macos-15-intel
+ arch: x64
+ artifact: edgeever-desktop-macOS-x64-staging
+ pattern: EdgeEver-*-mac-x64.zip
+ - platform: Windows
+ runner: windows-latest
+ arch: x64
+ artifact: edgeever-desktop-Windows-x64-staging
+ pattern: EdgeEver-*-windows-x64.exe
+ - platform: Linux
+ runner: ubuntu-22.04
+ arch: x64
+ artifact: edgeever-desktop-Linux-x64-staging
+ pattern: EdgeEver-*-linux-x64.AppImage
+ env:
+ GH_TOKEN: ${{ github.token }}
+ CANDIDATE_RUN: ${{ inputs.candidate_run }}
+ PREVIOUS_TAG: ${{ inputs.previous_tag }}
+ steps:
+ - uses: actions/checkout@v5
+ - uses: oven-sh/setup-bun@v2
+
+ - name: Download unmodified old release and candidate installers
+ shell: bash
+ env:
+ ARTIFACT_NAME: ${{ matrix.artifact }}
+ OLD_PATTERN: ${{ matrix.pattern }}
+ run: |
+ mkdir -p "$RUNNER_TEMP/release-bridge/previous" "$RUNNER_TEMP/release-bridge/candidate"
+ gh run download "$CANDIDATE_RUN" --repo "$GITHUB_REPOSITORY" --name "$ARTIFACT_NAME" --dir "$RUNNER_TEMP/release-bridge/candidate"
+ gh release download "$PREVIOUS_TAG" --repo "$GITHUB_REPOSITORY" --pattern "$OLD_PATTERN" --dir "$RUNNER_TEMP/release-bridge/previous"
+
+ - name: Restore offline Windows signature without changing the manifest
+ if: runner.os == 'Windows'
+ shell: pwsh
+ env:
+ SIGNATURE_ENVELOPE: ${{ inputs.windows_signature }}
+ run: |
+ $path = Join-Path $env:RUNNER_TEMP 'release-bridge/candidate/latest-windows.json.sig'
+ [IO.File]::WriteAllText($path, $env:SIGNATURE_ENVELOPE, [Text.UTF8Encoding]::new($false))
+
+ - name: Verify signed Windows candidate independently
+ if: runner.os == 'Windows'
+ shell: bash
+ run: node scripts/verify-windows-update-release.mjs "$RUNNER_TEMP/release-bridge/candidate"
+
+ - name: Exercise actual macOS or Windows upgrade and profile startup
+ if: runner.os != 'Linux'
+ run: node scripts/verify-native-release-bridge.mjs "${{ runner.temp }}/release-bridge"
+
+ - name: Exercise official old AppImage to actual candidate upgrade
+ if: runner.os == 'Linux'
+ shell: bash
+ run: |
+ sudo apt-get update
+ sudo apt-get install --yes libfuse2 xvfb
+ old_image="$(find "$RUNNER_TEMP/release-bridge/previous" -name '*.AppImage' -print -quit)"
+ new_image="$(find "$RUNNER_TEMP/release-bridge/candidate" -name '*.AppImage' -print -quit)"
+ version="$(basename "$new_image" | sed -E 's/^EdgeEver-([0-9]+\.[0-9]+\.[0-9]+)-.*/\1/')"
+ chmod +x "$old_image"
+ mkdir -p "$RUNNER_TEMP/release-bridge/evidence"
+ set -o pipefail
+ xvfb-run -a bun scripts/verify-linux-appimage-update.mjs "$old_image" "$new_image" "$version" | tee "$RUNNER_TEMP/release-bridge/evidence/result.json"
+
+ - name: Save official release bridge evidence
+ if: always()
+ uses: actions/upload-artifact@v6
+ with:
+ name: release-bridge-evidence-${{ matrix.platform }}-${{ matrix.arch }}
+ path: ${{ runner.temp }}/release-bridge/evidence
+ retention-days: 14
+ if-no-files-found: warn
diff --git a/scripts/verify-native-release-bridge.mjs b/scripts/verify-native-release-bridge.mjs
new file mode 100644
index 00000000..bd43c247
--- /dev/null
+++ b/scripts/verify-native-release-bridge.mjs
@@ -0,0 +1,155 @@
+import { createServer } from "node:http";
+import { createServer as createTcpServer } from "node:net";
+import { spawn, spawnSync } from "node:child_process";
+import { createHash } from "node:crypto";
+import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync, createReadStream, statSync, renameSync } from "node:fs";
+import { join, resolve, dirname, basename } from "node:path";
+
+if (process.env.GITHUB_ACTIONS !== "true") throw new Error("Release bridge runs only on disposable CI runners");
+const root = resolve(process.argv[2]);
+const previous = join(root, "previous");
+const candidate = join(root, "candidate");
+const evidence = join(root, "evidence");
+const installed = join(root, "installed");
+const profile = join(root, "profile");
+for (const path of [evidence, installed, profile]) mkdirSync(path, { recursive: true });
+const candidateName = readdirSync(candidate).find((name) => process.platform === "darwin" ? name.endsWith(".zip") : name.endsWith(".exe"));
+const version = /EdgeEver-(\d+\.\d+\.\d+)-/.exec(candidateName)?.[1];
+if (!version) throw new Error("Candidate installer version missing");
+const digest = (path) => createHash("sha256").update(readFileSync(path)).digest("hex");
+const wait = (ms) => new Promise((yes) => setTimeout(yes, ms));
+const until = async (fn, description) => {
+ const deadline = Date.now() + 240_000;
+ while (Date.now() < deadline) { const value = await fn(); if (value) return value; await wait(200); }
+ throw new Error(`Timed out: ${description}`);
+};
+let executable, expectedAsar;
+if (process.platform === "darwin") {
+ const oldZip = readdirSync(previous).find((name) => name.endsWith(".zip"));
+ for (const [archive, destination] of [[join(previous, oldZip), installed], [join(candidate, candidateName), join(root, "expected")]]) {
+ const result = spawnSync("ditto", ["-x", "-k", archive, destination], { encoding: "utf8" });
+ if (result.status !== 0) throw new Error(result.stderr);
+ }
+ executable = join(installed, "EdgeEver.app/Contents/MacOS/EdgeEver");
+ expectedAsar = join(root, "expected/EdgeEver.app/Contents/Resources/app.asar");
+ const path = join(candidate, candidateName);
+ const checksum = createHash("sha512").update(readFileSync(path)).digest("base64");
+ writeFileSync(join(candidate, "latest-mac.yml"), `version: ${version}\nfiles:\n - url: ${candidateName}\n sha512: ${checksum}\n size: ${statSync(path).size}\npath: ${candidateName}\nsha512: ${checksum}\n`);
+} else {
+ const oldExe = readdirSync(previous).find((name) => name.endsWith(".exe"));
+ const result = spawnSync(join(previous, oldExe), ["/S", `/D=${installed}`], { encoding: "utf8" });
+ if (result.status !== 0) throw new Error(`Old release NSIS installation failed: ${result.status}`);
+ executable = join(installed, "EdgeEver.exe");
+ // The updated application's version plus updater-verified signed installer
+ // hashes establish provenance. The bridge does not extract/repack NSIS.
+}
+const logPath = join(profile, "logs/desktop.log");
+const installedAsar = process.platform === "darwin" ? join(dirname(executable), "../Resources/app.asar") : join(installed, "resources/app.asar");
+const originalAsarDigest = digest(installedAsar);
+const server = createServer((request, response) => {
+ const name = basename(new URL(request.url, "http://127.0.0.1").pathname);
+ const allowed = [candidateName, "latest-mac.yml", "latest.yml", "latest-windows.json", "latest-windows.json.sig"];
+ if (!allowed.includes(name) || !existsSync(join(candidate, name))) { response.writeHead(404).end(); return; }
+ const path = join(candidate, name);
+ response.writeHead(200, { "Content-Length": statSync(path).size });
+ createReadStream(path).pipe(response);
+});
+await new Promise((yes) => server.listen(0, "127.0.0.1", yes));
+const feed = `http://127.0.0.1:${server.address().port}/`;
+const children = [];
+const launch = async (update) => {
+ const portServer = createTcpServer();
+ await new Promise((yes) => portServer.listen(0, "127.0.0.1", yes));
+ const port = portServer.address().port;
+ await new Promise((yes) => portServer.close(yes));
+ const child = spawn(executable, [`--inspect-brk=127.0.0.1:${port}`, `--user-data-dir=${profile}`], {
+ env: { ...process.env, EDGE_EVER_DISABLE_AUTO_UPDATE: update ? "0" : "1" }, stdio: ["ignore", "pipe", "pipe"],
+ });
+ children.push(child);
+ for (const stream of [child.stdout, child.stderr]) stream.on("data", (chunk) => {
+ const path = join(evidence, update ? "old-process.log" : "new-process.log");
+ writeFileSync(path, chunk, { flag: "a" });
+ });
+ const endpoint = await until(async () => {
+ try { return (await (await fetch(`http://127.0.0.1:${port}/json/list`)).json())[0]?.webSocketDebuggerUrl; } catch { return null; }
+ }, "isolated loopback main-process debugger");
+ const socket = new WebSocket(endpoint);
+ await new Promise((yes, no) => { socket.addEventListener("open", yes, { once: true }); socket.addEventListener("error", no, { once: true }); });
+ let serial = 0;
+ const pending = new Map();
+ let paused = false;
+ socket.addEventListener("message", ({ data }) => {
+ const message = JSON.parse(String(data));
+ if (message.method === "Debugger.paused") paused = true;
+ if (message.id) { const callbacks = pending.get(message.id); pending.delete(message.id); if (message.error) callbacks.reject(new Error(JSON.stringify(message.error))); else callbacks.resolve(message.result); }
+ });
+ const send = (method, params = {}) => new Promise((resolveCall, reject) => {
+ const id = ++serial; pending.set(id, { resolve: resolveCall, reject }); socket.send(JSON.stringify({ id, method, params }));
+ });
+ await send("Runtime.enable");
+ await send("Debugger.enable");
+ await send("Runtime.runIfWaitingForDebugger");
+ await until(() => paused, "main process pauses before startup");
+ const expression = `(() => {
+ const req = process.getBuiltinModule('module').createRequire(process.resourcesPath + '/app.asar/package.json');
+ const { app, net, dialog } = req('electron');
+ app.isInApplicationsFolder = () => true;
+ app.setPath('userData', ${JSON.stringify(profile)});
+ req('node:fs').writeFileSync(${JSON.stringify(join(evidence, update ? "old-version.json" : "new-version.json"))}, JSON.stringify({version: app.getVersion(), executable: process.execPath}));
+ if (${JSON.stringify(update)}) {
+ const { autoUpdater } = req('electron-updater');
+ autoUpdater.setFeedURL({provider:'generic',url:${JSON.stringify(feed)}});
+ autoUpdater.disableDifferentialDownload = true;
+ const fetch = net.fetch.bind(net);
+ net.fetch = (url, options) => {
+ const value = String(url);
+ const prefix = 'https://github.com/tianma-if/edgeever/releases/download/v${version}/';
+ return fetch(value.startsWith(prefix) ? ${JSON.stringify(feed)} + value.slice(prefix.length) : url, options);
+ };
+ const install = autoUpdater.quitAndInstall.bind(autoUpdater);
+ autoUpdater.quitAndInstall = (silent) => { autoUpdater.autoRunAppAfterInstall = false; return install(silent, false); };
+ dialog.showMessageBox = async (...args) => {
+ const options = args.at(-1);
+ return {response: options.buttons?.some(button => /restart|重启/i.test(button)) ? 0 : 1, checkboxChecked:false};
+ };
+ }
+ return true;
+ })()`;
+ const evaluated = await send("Runtime.evaluate", { expression, returnByValue: true });
+ if (evaluated.exceptionDetails) throw new Error(JSON.stringify(evaluated.exceptionDetails));
+ await send("Debugger.resume");
+ socket.close(); // Node must not wait for an attached debugger during quit.
+ return child;
+};
+const result = { platform: process.platform, arch: process.arch, candidateVersion: version, candidateRun: process.env.CANDIDATE_RUN };
+try {
+ await launch(true);
+ await until(() => {
+ try { return digest(installedAsar) !== originalAsarDigest && (!expectedAsar || digest(installedAsar) === digest(expectedAsar)); } catch { return false; }
+ }, "official old release installs the real candidate payload");
+ await until(() => children[0].exitCode !== null, "old release exits");
+ if (existsSync(logPath)) renameSync(logPath, join(evidence, "old-desktop.log"));
+ await launch(false);
+ await until(() => {
+ if (!existsSync(logPath)) return false;
+ const value = readFileSync(logPath, "utf8");
+ return value.includes('"renderer.bootstrap-ready"') && value.includes('"sidecar.ready"');
+ }, "updated application opens the same isolated user profile");
+ const newVersion = JSON.parse(readFileSync(join(evidence, "new-version.json"), "utf8"));
+ if (newVersion.version !== version) throw new Error(`Installed version mismatch: ${newVersion.version}`);
+ result.ok = true;
+ result.old = JSON.parse(readFileSync(join(evidence, "old-version.json"), "utf8"));
+ result.new = newVersion;
+ result.installedAsarSha256 = digest(installedAsar);
+} catch (error) { result.ok = false; result.error = error.stack; process.exitCode = 1; }
+finally {
+ if (existsSync(logPath)) writeFileSync(join(evidence, "new-desktop.log"), readFileSync(logPath));
+ writeFileSync(join(evidence, "result.json"), JSON.stringify(result, null, 2));
+ console.log(JSON.stringify(result, null, 2));
+ for (const child of children) {
+ if (child.exitCode !== null) continue;
+ if (process.platform === "win32") spawnSync("taskkill", ["/PID", String(child.pid), "/T", "/F"], { stdio: "ignore" });
+ else child.kill("SIGTERM");
+ }
+ server.closeAllConnections(); server.close();
+}