Skip to content

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.

feat(gates): the editor names no engine version of its own

esengine3e23d5415cb8
diff --git a/desktop b/desktop
index 6a3703ab2..d325ca6dc 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 6a3703ab2b8c050d575e032562f8b96ef50696e2
+Subproject commit d325ca6dc40ccfc0912fdc62e1c381a2f27ac9de
diff --git a/tools/check-mutator-parity.mjs b/tools/check-mutator-parity.mjs
index 237c9c6cc..3955bf6d1 100644
--- a/tools/check-mutator-parity.mjs
+++ b/tools/check-mutator-parity.mjs
@@ -49,10 +49,7 @@ const REACHED_VIA = {
* adding one is a visible diff — which is the only ratchet a discovered list can
* have without becoming a place to put the next one.
*/
-const OWED = {
- setSpineVersion: 'which Spine runtime the project bundles, a size and compatibility decision with '
- + 'only a read-only diagnostics line in the UI',
-};
+const OWED = {};
if (!existsSync(EDITOR)) {
console.log('check-mutator-parity: no editor checkout — no mutator was judged.');
diff --git a/tools/check-version-authority.mjs b/tools/check-version-authority.mjs
new file mode 100644
index 000000000..dd3e1127b
--- /dev/null
+++ b/tools/check-version-authority.mjs
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file check-version-authority.mjs — the editor offers the versions the engine
+ * actually ships, because it reads the same list.
+ *
+ * Which Spine runtime a project bundles decides what a .skel can be and what the
+ * package weighs. The set of them is SPINE_VERSIONS, which the plugin loads
+ * modules from and the cook packs by — and the editor had two hand-written
+ * copies of it, one validating writes and one that would have filled a dropdown.
+ *
+ * A copy does not fail on the day it is made. It fails the week a release is
+ * vendored: the runtime gains 4.3, an agent can set it because the manifest is
+ * just a string, and the person opening Project Settings is offered 4.2 as the
+ * newest thing that exists. Nothing anywhere reports that.
+ *
+ * So the rule is not "the lists agree" — two lists that agree today is exactly
+ * the state this describes. It is that there is ONE list, and the editor names
+ * no version of its own.
+ */
+import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const REGISTRY = 'sdk/src/sideModules/registry.ts';
+const EDITOR = path.join(ROOT, 'desktop', 'src');
+
+const read = (rel) => readFileSync(path.join(ROOT, rel), 'utf8');
+
+if (!existsSync(EDITOR)) {
+ console.log('check-version-authority: no editor checkout — nothing was judged.');
+ process.exit(0);
+}
+
+// The authority, read rather than restated here too: this gate naming its own
+// versions would be the third copy.
+const declared = /export const SPINE_VERSIONS[^=]*=\s*\[([^\]]*)\]/.exec(read(REGISTRY));
+if (!declared) {
+ console.error(`check-version-authority: SPINE_VERSIONS is not declared in ${REGISTRY} — has it moved?`);
+ process.exit(1);
+}
+const versions = [...declared[1].matchAll(/'([^']+)'/g)].map((m) => m[1]);
+if (versions.length === 0) {
+ console.error('check-version-authority: SPINE_VERSIONS parsed as empty, which cannot be right');
+ process.exit(1);
+}
+
+function sources(dir, out = []) {
+ for (const entry of readdirSync(dir)) {
+ const full = path.join(dir, entry);
+ if (statSync(full).isDirectory()) sources(full, out);
+ else if (/\.tsx?$/.test(entry)) out.push(full);
+ }
+ return out;
+}
+
+const problems = [];
+let scanned = 0;
+// Two or more of them quoted in one file is a list, whatever it is called. One
+// on its own is a version somebody mentioned — a comment, a migration, a test.
+for (const file of sources(EDITOR)) {
+ scanned++;
+ const src = readFileSync(file, 'utf8');
+ const named = versions.filter((v) => src.includes(`'${v}'`));
+ if (named.length < 2) continue;
+ problems.push(`${path.relative(ROOT, file)} names ${named.length} spine versions of its own`
+ + ` (${named.join(', ')}) — read SPINE_VERSIONS instead, or the editor keeps offering the set`
+ + ' it was written with');
+}
+
+// Word-bounded: a bare `includes` is satisfied by `SPINE_VERSIONS_X`, which is
+// how two earlier gates in this campaign passed their own sabotage.
+if (!/\bSPINE_VERSIONS\b/.test(read('desktop/src/project/ProjectStore.ts'))) {
+ problems.push('desktop/src/project/ProjectStore.ts no longer reads SPINE_VERSIONS — whatever it'
+ + ' validates a write against is its own opinion of what the engine ships');
+}
+
+if (problems.length) {
+ console.error(`check-version-authority: ${problems.length} problem(s)`);
+ for (const p of problems) console.error(` - ${p}`);
+ process.exit(1);
+}
+console.log(`check-version-authority: ${versions.length} spine version(s) declared once;`
+ + ` ${scanned} editor file(s) name none of their own.`);
diff --git a/tools/gates.mjs b/tools/gates.mjs
index e02b6edbc..5f630e374 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -189,6 +189,7 @@ export const GATES = [
{ id: 'shadow-plan', run: 'node tools/check-shadow-plan.mjs' },
{ id: 'decision-inventory', run: 'node tools/check-decision-inventory.mjs', needs: 'editor' },
{ id: 'mutator-parity', run: 'node tools/check-mutator-parity.mjs', needs: 'editor' },
+ { id: 'version-authority', run: 'node tools/check-version-authority.mjs', needs: 'editor' },
{ id: 'dirty-source', run: 'node tools/check-dirty-source.mjs', needs: 'editor' },
{ id: 'path-sandbox', run: 'node tools/check-path-sandbox.mjs' },
{ id: 'key-codes', run: 'node tools/check-key-codes.mjs' },
diff --git a/tools/lib/runtimeDecisions.mjs b/tools/lib/runtimeDecisions.mjs
index 5bdd6d936..49594ce13 100644
--- a/tools/lib/runtimeDecisions.mjs
+++ b/tools/lib/runtimeDecisions.mjs
@@ -129,11 +129,7 @@ export const DECISIONS = [
kind: 'agent-parity',
owner: { path: 'desktop/src/project/ProjectStore.ts', probe: /async setSpineVersion/ },
runtime: { has: true, cite: { path: 'pipeline/src/project/format.ts', probe: /spineVersion\?: string/ } },
- editor: {
- has: false,
- owed: 'ProjectStore.setSpineVersion has exactly one caller and it is the automation facade. The '
- + 'only mention in the UI is a read-only diagnostics line naming the version already running',
- },
+ editor: { has: true, cite: { path: 'desktop/src/settings/projectSettings.ts', probe: /'project\.spine\.version'/ } },
agent: { has: true, cite: { path: 'desktop/src/main.tsx', probe: /spineVersion: \(v\) => ProjectStore\.setSpineVersion/ } },
},
{