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.

fix(gates): "the full gate suite is green" now includes every suite

esengine4c4c5b178f80
diff --git a/tools/check-verification-authority.mjs b/tools/check-verification-authority.mjs
new file mode 100644
index 000000000..fb5648797
--- /dev/null
+++ b/tools/check-verification-authority.mjs
@@ -0,0 +1,105 @@
+#!/usr/bin/env node
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file check-verification-authority.mjs — "the full gate suite is green" has
+ * to mean every suite.
+ *
+ * On 2026-08-30 the gate list reported 76/76 green while four SDK suites did not
+ * compile against the source they test. Nothing was wrong with the gates and
+ * nothing was wrong with the tests: no gate had ever invoked them, so the
+ * sentence everyone was saying meant less than everyone thought it did. A
+ * checkout could delete every SDK test and stay green.
+ *
+ * The fix is not a longer list — a longer list goes stale the same way. It is a
+ * comparison between two DIFFERENT kinds of thing: the directories that hold
+ * tests (the ground), and the `covers` a gate declares (the claim). A suite
+ * nobody runs shows up as ground with no claim over it; a claim over ground that
+ * no longer exists shows up as stale.
+ *
+ * node tools/check-verification-authority.mjs
+ */
+import { spawnSync } from 'node:child_process';
+import { existsSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { GATES } from './gates.mjs';
+import { listTrackedSources, hasEditor } from './lib/sourceRoots.mjs';
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+
+/** Every directory that actually holds a test file, editor included. */
+function directoriesHoldingTests() {
+ const roots = ['sdk', 'pipeline', 'tools', 'compiler', 'plugins', 'desktop'];
+ const { files } = listTrackedSources(roots);
+ const dirs = new Set();
+ for (const rel of files) {
+ if (!/\.test\.(ts|tsx|mts)$/.test(rel)) continue;
+ // The directory a suite is named by — `sdk/tests`, not every subfolder
+ // under it, so a nested helper folder is not a suite of its own.
+ const parts = rel.split('/');
+ const at = parts.lastIndexOf('tests');
+ dirs.add(at > 0 ? parts.slice(0, at + 1).join('/') : path.posix.dirname(rel));
+ }
+ return dirs;
+}
+
+const claimed = new Map();
+for (const gate of GATES) {
+ for (const dir of gate.covers ?? []) {
+ if (claimed.has(dir)) {
+ console.error(`check-verification-authority: ${dir} is claimed by both `
+ + `${claimed.get(dir)} and ${gate.id} — one suite, one runner.`);
+ process.exit(1);
+ }
+ claimed.set(dir, gate.id);
+ }
+}
+
+const findings = [];
+const ground = directoriesHoldingTests();
+
+for (const dir of [...ground].sort()) {
+ // Without an editor checkout its suites are not on the ground to judge; the
+ // gate that runs them declares `needs: 'editor'` and run-gates says so.
+ if (!hasEditor() && dir.startsWith('desktop/')) continue;
+ if (!claimed.has(dir)) {
+ findings.push(`${dir} holds tests and no gate runs them — `
+ + `"the full gate suite is green" would not include it`);
+ }
+}
+
+for (const [dir, gate] of claimed) {
+ if (!existsSync(path.join(ROOT, dir))) {
+ if (!hasEditor() && dir.startsWith('desktop/')) continue;
+ findings.push(`${gate} claims to cover ${dir}, which does not exist`);
+ }
+}
+
+// The summary is part of the authority: "76/76 gates" reads as static checks.
+// ASKED of the reporter rather than grepped out of it — a rule looking for a
+// word is satisfied by a mention that prints nothing.
+const plan = spawnSync(process.execPath,
+ [path.join(ROOT, 'tools', 'run-gates.mjs'), '--scope', 'local', '--plan'],
+ { cwd: ROOT, encoding: 'utf8' });
+const reported = plan.stdout ?? '';
+for (const gate of GATES) {
+ if (!gate.covers?.length) continue;
+ if (!hasEditor() && gate.needs === 'editor') continue;
+ if (!reported.includes(gate.id)) {
+ findings.push(`run-gates does not name ${gate.id} among the suites it runs — `
+ + 'a green line that names no suite is what made this necessary');
+ }
+}
+if (!/test suites run:/.test(reported)) {
+ findings.push('run-gates reports no test suites at all');
+}
+
+if (findings.length === 0) {
+ console.log(`check-verification-authority: ${ground.size} test director(ies), `
+ + `each run by exactly one gate.`);
+ process.exit(0);
+}
+for (const f of findings) console.error(`✗ ${f}`);
+console.error('\nDeclare the suite in tools/gates.mjs (`covers`), or delete the tests.');
+process.exit(1);
diff --git a/tools/gates.mjs b/tools/gates.mjs
index 8aa9893ad..dddd5e685 100644
--- a/tools/gates.mjs
+++ b/tools/gates.mjs
@@ -26,6 +26,11 @@ export const SCOPES = ['local', 'ci'];
* `needs: 'editor'` marks a gate whose SUBJECT is the editor. The editor is an
* optional submodule, so those cannot run in a checkout without one — and a
* skipped gate has to say so, since silence there reads as a clean bill.
+ *
+ * `covers` names the test directories a gate actually runs, which is what makes
+ * "the full gate suite is green" mean something: check-verification-authority
+ * compares the claim against the directories that HOLD tests, so a suite nothing
+ * invokes is a finding rather than a silence.
*/
export const GATES = [
{ id: 'tsc-sdk', run: 'pnpm --filter ./sdk exec tsc --noEmit' },
@@ -74,20 +79,27 @@ export const GATES = [
// prints "No projects matched the filters" and exits 0, so without a checkout
// this gate reported success having type-checked nothing at all.
{ id: 'tsc-editor', run: 'pnpm --filter @estella/editor exec tsc --noEmit', needs: 'editor' },
+ { id: 'editor-tests', run: 'pnpm --filter @estella/editor test',
+ needs: 'editor', covers: ['desktop/tests'] },
// The shipped plugins type-check against the editor's LIVE plugin API surface
// (types.ts, the file authors are handed), so a change to it that no plugin
// could survive fails here rather than in someone else's project.
{ id: 'tsc-plugins', run: 'pnpm -r --filter "./plugins/*" exec tsc --noEmit' },
- { id: 'plugin-tests', run: 'pnpm -r --filter "./plugins/*" test' },
+ { id: 'plugin-tests', run: 'pnpm -r --filter "./plugins/*" test',
+ covers: ['plugins/audio-mixer/tests', 'plugins/ldtk/tests', 'plugins/minigame-services/tests'] },
// The engine's own TS suites (pipeline + tooling). They lived in desktop/tests
// until the editor split, where a checkout without the editor ran none of them.
- { id: 'engine-tests', run: 'pnpm run test' },
+ { id: 'engine-tests', run: 'pnpm run test', covers: ['pipeline/tests', 'tools/tests'] },
+ // The SDK's own suites. They were run by NOTHING until 2026-08-30: the gate
+ // list said 76/76 while four of them did not compile against the source they
+ // test, and only a hand-run vitest found it.
+ { id: 'sdk-tests', run: 'pnpm --filter ./sdk test', covers: ['sdk/tests'] },
// The AOT compiler carries its own oracle: a real example system lowered to
// EIR must move a world exactly the way node moves it.
// It also compiles the emitted C and requires the same bytes back: natively
// with any C compiler, and as wasm where emsdk is unpacked. Without either it
// still passes and PRINTS that the differential did not run — read the log.
- { id: 'compiler-tests', run: 'pnpm --filter @estella/compiler test' },
+ { id: 'compiler-tests', run: 'pnpm --filter @estella/compiler test', covers: ['compiler/tests'] },
// The plugins we ship prove the public API only if they are held to it.
{ id: 'plugin-boundary', run: 'node tools/check-plugin-boundary.mjs' },
// Same shape of rule, other direction: what builds a project may not need the
@@ -102,6 +114,8 @@ export const GATES = [
// escape hatch has to say what it reaches for or the schedule knows nothing.
{ id: 'system-access', run: 'node tools/check-system-access.mjs' },
{ id: 'project-settings', run: 'node tools/check-project-settings.mjs', needs: 'editor' },
+ // "The full gate suite is green" only means something if every suite is in it.
+ { id: 'verification-authority', run: 'node tools/check-verification-authority.mjs' },
{ id: 'workflows', run: 'node tools/check-workflows.mjs' },
{ id: 'tool-spawn', run: 'node tools/check-tool-spawn.mjs' },
{ id: 'tool-calls', run: 'node tools/check-tool-calls.mjs', needs: 'editor' },
diff --git a/tools/run-gates.mjs b/tools/run-gates.mjs
index f4a39082d..87037b2ee 100644
--- a/tools/run-gates.mjs
+++ b/tools/run-gates.mjs
@@ -41,6 +41,29 @@ if (noEditor.length) {
console.log(` no editor checkout — not running ${noEditor.length} editor gate(s): ${noEditor.map((g) => g.id).join(', ')}`);
}
+/** What this scope WOULD run, without running it — so the plan can be inspected
+ * (and checked) without paying for the suite. */
+if (argv.includes('--plan')) {
+ for (const gate of gates) console.log(` ${gate.id}`);
+ reportSuites();
+ for (const g of skipped) console.log(` not in this scope: ${g.id} — ${g.why}`);
+ process.exit(0);
+}
+
+/**
+ * Name the SUITES, not just the count. A line reading "76/76 gates" is heard as
+ * static checks — which is how four broken SDK suites sat behind a green run for
+ * as long as no gate invoked them (see check-verification-authority).
+ */
+function reportSuites() {
+ const suites = gates.filter((g) => g.covers?.length);
+ if (suites.length) console.log(` test suites run: ${suites.map((g) => g.id).join(', ')}`);
+ const unrun = noEditor.filter((g) => g.covers?.length);
+ if (unrun.length) {
+ console.log(` test suites NOT run: ${unrun.map((g) => g.id).join(', ')} — no editor checkout`);
+ }
+}
+
for (const gate of gates) {
const r = spawnSync('sh', ['-c', gate.run], { cwd: ROOT, stdio: 'inherit' });
// A shell that would not start is not a gate that failed. Reported as one it
@@ -62,4 +85,5 @@ for (const gate of gates) {
console.log(`\ngates ${SCOPE}: ${gates.length}/${gates.length} green`
+ (noEditor.length ? ` (${noEditor.length} editor gate(s) had no checkout to run against)` : ''));
+reportSuites();
for (const g of skipped) console.log(` not in this scope: ${g.id} — ${g.why}`);