A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(release): updater manifests may not reference missing release assets
yhh4003f850e079
diff --git a/.github/workflows/release-desktop.yml b/.github/workflows/release-desktop.ymlindex b3797fce3..e118e10d5 100644--- a/.github/workflows/release-desktop.yml+++ b/.github/workflows/release-desktop.yml@@ -535,6 +535,19 @@ jobs:exit 1fi+ # Structural above: did we remember to list it. Referential here: does+ # what we published hold together. The macOS zip is what Squirrel.Mac+ # installs from and it was on no list, so a release without it passed+ # while every macOS auto-update failed fetching the file latest-mac.yml+ # names. A fixed list cannot survive electron-builder renaming an+ # artifact; the manifests always name what the updater will fetch.+ rm -rf .release-manifests && mkdir -p .release-manifests+ echo "$assets" > .release-manifests/assets.txt+ gh release download "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \+ --pattern 'latest*.yml' --dir .release-manifests --clobber+ node tools/check-release-manifest-refs.mjs \+ --assets .release-manifests/assets.txt --manifests .release-manifests+# The notes are what a reader of the release actually gets, and they are# the one thing here no later job would notice missing: 0.52.0 published# with an empty body and every asset present. The draft job writes itdiff --git a/tools/check-release-manifest-refs.mjs b/tools/check-release-manifest-refs.mjsnew file mode 100644index 000000000..0c4b87159--- /dev/null+++ b/tools/check-release-manifest-refs.mjs@@ -0,0 +1,94 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file check-release-manifest-refs.mjs — the updater's manifests name files+ * the release actually carries.+ *+ * The completeness check beside this one asks whether a hand-kept list of names+ * is present. That answers "did we remember to list it", not "does what we+ * published hold together": the macOS zip is what Squirrel.Mac installs from,+ * and it was on no list at all, so a release missing it would have passed while+ * every macOS auto-update failed at the last step.+ *+ * The contract is referential, not structural. latest.yml and latest-mac.yml+ * name the files electron-updater will fetch, resolved against the same+ * directory; anything they name has to be there. That survives electron-builder+ * changing an artifact name, an arch suffix or a channel, none of which a fixed+ * list would.+ *+ * node tools/check-release-manifest-refs.mjs --assets <file> --manifests <dir>+ *+ * `--assets` is one asset name per line, as the release holds them.+ */+import { readFileSync, readdirSync, existsSync } from 'node:fs';+import path from 'node:path';++const argv = process.argv.slice(2);+const opt = (name) => {+ const at = argv.indexOf(name);+ return at >= 0 ? argv[at + 1] : null;+};++const assetsFile = opt('--assets');+const manifestDir = opt('--manifests');+if (!assetsFile || !manifestDir) {+ console.error('usage: --assets <file with one asset name per line> --manifests <dir>');+ process.exit(2);+}++const assets = new Set(readFileSync(assetsFile, 'utf8').split(/\r?\n/)+ .map((l) => l.trim()).filter(Boolean));++/**+ * What a manifest points at. electron-updater writes the file it will fetch as+ * `path:` and each entry of `files:` as `url:`; both are plain names resolved+ * beside the manifest. A url is percent-encoded, so it is decoded before it is+ * compared against what the store lists.+ */+function referencedBy(text) {+ const out = new Set();+ for (const line of text.split(/\r?\n/)) {+ const m = /^\s*(?:-\s*)?(?:url|path):\s*(.+?)\s*$/.exec(line);+ if (!m) continue;+ let name = m[1].replace(/^["']|["']$/g, '');+ try { name = decodeURIComponent(name); } catch { /* leave it as written */ }+ // Only the downloadable payloads; a manifest also carries hashes and dates.+ if (/\.(exe|dmg|zip|AppImage|blockmap)$/i.test(name)) out.add(name);+ }+ return out;+}++const problems = [];+const manifests = existsSync(manifestDir)+ ? readdirSync(manifestDir).filter((f) => /^latest[^/]*\.yml$/i.test(f))+ : [];++if (manifests.length === 0) {+ problems.push(`no latest*.yml in ${manifestDir} — the updater feed is what this checks, and `+ + `a release with no feed is one no installed editor can update from.`);+}++let checked = 0;+for (const file of manifests) {+ const refs = referencedBy(readFileSync(path.join(manifestDir, file), 'utf8'));+ if (refs.size === 0) {+ problems.push(`${file} names no downloadable file — electron-updater would have nothing `+ + `to fetch, which is not something the release's asset list can show.`);+ }+ for (const ref of refs) {+ checked++;+ if (!assets.has(ref)) {+ problems.push(`${file} points at "${ref}" and the release has no such asset. `+ + `An installed editor reading this feed fetches a 404 at the last step.`);+ }+ }+}++if (problems.length) {+ console.error('check-release-manifest-refs: the updater feed and the release disagree.\n');+ for (const p of problems) console.error(` ✗ ${p}\n`);+ process.exit(1);+}++console.log(`check-release-manifest-refs: ${manifests.length} manifest(s), ${checked} reference(s) — `+ + `every file the updater will fetch is in the release.`);diff --git a/tools/fixtures/release-assets.txt b/tools/fixtures/release-assets.txtnew file mode 100644index 000000000..89b8768f3--- /dev/null+++ b/tools/fixtures/release-assets.txt@@ -0,0 +1,11 @@+Estella-Editor-Setup-0.61.0.exe+Estella-Editor-Setup-0.61.0.exe.blockmap+Estella-Editor-0.61.0-arm64.dmg+Estella-Editor-0.61.0-arm64.dmg.blockmap+Estella-Editor-0.61.0-arm64-mac.zip+Estella-Editor-0.61.0-arm64-mac.zip.blockmap+latest.yml+latest-mac.yml+native-templates.json+estella-native-android-0.61.0.zip+estella-native-ios-0.61.0.zipdiff --git a/tools/fixtures/release-manifests/latest-mac.yml b/tools/fixtures/release-manifests/latest-mac.ymlnew file mode 100644index 000000000..2cc31ed62--- /dev/null+++ b/tools/fixtures/release-manifests/latest-mac.yml@@ -0,0 +1,11 @@+version: 0.61.0+files:+ - url: Estella-Editor-0.61.0-arm64-mac.zip+ sha512: 0000000000000000000000000000000000000000000000000000000000000000+ size: 187000000+ - url: Estella-Editor-0.61.0-arm64.dmg+ sha512: 1111111111111111111111111111111111111111111111111111111111111111+ size: 188000000+path: Estella-Editor-0.61.0-arm64-mac.zip+sha512: 0000000000000000000000000000000000000000000000000000000000000000+releaseDate: '2026-09-07T00:00:00.000Z'diff --git a/tools/fixtures/release-manifests/latest.yml b/tools/fixtures/release-manifests/latest.ymlnew file mode 100644index 000000000..30991ea1b--- /dev/null+++ b/tools/fixtures/release-manifests/latest.yml@@ -0,0 +1,8 @@+version: 0.61.0+files:+ - url: Estella-Editor-Setup-0.61.0.exe+ sha512: 2222222222222222222222222222222222222222222222222222222222222222+ size: 160000000+path: Estella-Editor-Setup-0.61.0.exe+sha512: 2222222222222222222222222222222222222222222222222222222222222222+releaseDate: '2026-09-07T00:00:00.000Z'diff --git a/tools/gates.mjs b/tools/gates.mjsindex 2ea5034fb..fd2a36613 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -235,6 +235,10 @@ export const GATES = [// A published desktop artifact has one name, declared, whitespace-free, and// still distinct once the asset store has normalised it.{ id: 'release-artifact-names', run: 'node tools/check-release-artifact-names.mjs', needs: 'editor' },+ // …and that the updater feed a release publishes names files it carries. The+ // gate runs the checker over fixtures; the release job runs it over the real+ // asset list, which is the only place both halves exist at once.+ { id: 'release-manifest-refs', run: 'node tools/check-release-manifest-refs.mjs --assets tools/fixtures/release-assets.txt --manifests tools/fixtures/release-manifests' },{ id: 'shipped-resources', run: 'node tools/check-shipped-resources.mjs', needs: 'editor' },{ id: 'golden', run: 'node tools/check-golden.mjs' },{