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 exit criteria ask a host only what that host can answer

esengineff6eace7f3ba
diff --git a/tools/check-release-gate.mjs b/tools/check-release-gate.mjs
index 0297f5dd5..dd69766ca 100644
--- a/tools/check-release-gate.mjs
+++ b/tools/check-release-gate.mjs
@@ -54,7 +54,7 @@ for (const c of CRITERIA) {
// A criterion that can only be answered somewhere particular owes the reason,
// exactly as a gate's `where` owes its `why`: unexplained, it reads as a
// criterion somebody quietly stopped running.
- const HOSTS = ['linux', 'macos', 'android', 'device', 'desktop-and-android'];
+ const HOSTS = ['linux', 'macos', 'android', 'device', 'desktop-and-android', 'dev'];
if (c.host !== undefined) {
if (!HOSTS.includes(c.host)) fail(`"${c.id}" declares host "${c.host}" (have: ${HOSTS.join(', ')})`);
if (!c.why?.trim()) fail(`"${c.id}" narrows to one host without saying why the others cannot answer it`);
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index b71bb346f..b88665f34 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -789,8 +789,8 @@ export const GOLDEN = [
interactGap: 'needs a listen server up before input means anything',
// A packaged frame cannot tell a live session from a dead one, so a run
// settles this instead: check-arena-server serves the project headless over
- // a real socket and drives two clients through it, under static-gates.
- runBy: 'node tools/run-gates.mjs --scope local --complete',
+ // a real socket and drives two clients through it, under the built-engine gates.
+ runBy: 'node tools/run-gates.mjs --scope local --where local',
},
{
id: 'video-puzzle',
diff --git a/tools/releaseGate.mjs b/tools/releaseGate.mjs
index c55772afc..6b8b662cc 100644
--- a/tools/releaseGate.mjs
+++ b/tools/releaseGate.mjs
@@ -254,12 +254,28 @@ export const CRITERIA = [
{
id: 'static-gates',
says: 'every declared contract still holds (api surface, layers, corpus, host shim…)',
- // --complete, because `pnpm run verify` answers "the gates that could run
- // are green" — which on a checkout without the editor was 69 of 80, and
- // exited 0 all the same.
- answeredBy: 'node tools/run-gates.mjs --scope local --complete',
+ // --complete, because `pnpm run verify` answers "the gates that could run are
+ // green" — 69 of 80 without an editor checkout, and exit 0 all the same. `ci`,
+ // not `local`: the seven `local` adds want a built engine no runner here has.
+ answeredBy: 'node tools/run-gates.mjs --scope ci --complete',
needs: ['tools/check-golden.mjs', 'tools/check-minigame-host.mjs'],
},
+ {
+ id: 'gates-that-need-a-built-engine',
+ says: 'the gates a built engine answers — C++ harnesses, the engine off emscripten,'
+ + ' both physics modules, the shader twins, the arena server, and a package that boots',
+ host: 'dev',
+ why: 'each reads something a gate should not download — a pinned Dawn checkout and a build'
+ + ' of it, or the engine and side-module wasm; CI covers them in its own C++ and'
+ + ' engine-coupled jobs, and a release captain answers them together with'
+ + ' `pnpm run gate:run --host dev`',
+ // `--where local` rather than their seven ids: gates.mjs already holds which
+ // gates these are, and a criterion that spelled them again would drift from it
+ // the first time an eighth is added.
+ answeredBy: 'node tools/run-gates.mjs --scope local --where local',
+ needs: ['tools/check-cpp-tests.mjs', 'tools/check-native-build.mjs',
+ 'tools/check-script-failure.mjs'],
+ },
{
id: 'flagship-plays-through',
says: 'the flagship can be played from its first room to its boss, as a package (reached, not defeated)',
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index ec1bc4700..1f0f89977 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -28,6 +28,9 @@ export const NOTES_FLOOR = 'v0.65.0';
* the reader recognises anyway.
*/
export const NOTED = {
+ 'fix(gates): the exit criteria ask a host only what that host can answer':
+ { internal: 'Which CI shard answers which release criterion; no creator runs the list.' },
+
'feat(gates): spacing off the 4px grid is a ratchet, not a demand for zero':
{ internal: "A repository gate over the editor's stylesheets; no creator runs it." },
diff --git a/tools/run-gates.mjs b/tools/run-gates.mjs
index b65d97cfc..7605962b2 100644
--- a/tools/run-gates.mjs
+++ b/tools/run-gates.mjs
@@ -17,6 +17,7 @@
* node tools/run-gates.mjs --scope local
* node tools/run-gates.mjs --scope ci
* node tools/run-gates.mjs --scope local --suites owed
+ * node tools/run-gates.mjs --scope local --where local
* node tools/run-gates.mjs --scope local --keep-going --matrix out.json
*/
import { execFileSync, spawnSync } from 'node:child_process';
@@ -134,18 +135,38 @@ const ONLY = (() => {
const i = argv.indexOf('--only');
return i >= 0 && argv[i + 1] ? argv[i + 1].split(',').map((x) => x.trim()).filter(Boolean) : null;
})();
+/**
+ * Narrow to the gates a scope OWNS — the ones that NAMED it — rather than
+ * everything it runs. One release criterion answers for the gates a built engine
+ * requires, and gates.mjs already holds which those are: naming them again in a
+ * criterion would be the second list this file exists to refuse.
+ */
+const WHERE = (() => {
+ const i = argv.indexOf('--where');
+ return i >= 0 && argv[i + 1] ? argv[i + 1] : null;
+})();
+if (WHERE && !SCOPES.includes(WHERE)) {
+ console.error(`run-gates: unknown --where "${WHERE}" (have: ${SCOPES.join(', ')})`);
+ process.exit(2);
+}
const gates = gatesFor(SCOPE, HAS_EDITOR, { suites: SUITES })
- .filter((g) => !ONLY || ONLY.includes(g.id));
-if (ONLY) {
+ .filter((g) => (!ONLY || ONLY.includes(g.id)) && (!WHERE || g.where === WHERE));
+/** Either form answers for the gates it selected and for nothing else. */
+const NARROWED = Boolean(ONLY || WHERE);
+if (NARROWED) {
// "Complete" is a claim about the whole declared list; a narrowed run cannot
// make it, and letting it try is how 69/69 got read as an answer about 80.
if (COMPLETE) {
- console.error('run-gates: --only cannot be --complete — a narrowed run answers for the gates it named.');
+ console.error('run-gates: a narrowed run cannot be --complete — it answers for the gates it selected.');
process.exit(2);
}
- const missing = ONLY.filter((id) => !gates.some((g) => g.id === id));
- // A typo'd id silently running nothing is a green run that answered nothing —
- // the exact shape every gate in this repo exists to refuse.
+ // A selection that runs nothing is a green run that answered nothing — the
+ // exact shape every gate in this repo exists to refuse.
+ if (!gates.length) {
+ console.error(`run-gates: ${WHERE ? `--where ${WHERE}` : '--only'} selected no gate this scope runs.`);
+ process.exit(2);
+ }
+ const missing = (ONLY ?? []).filter((id) => !gates.some((g) => g.id === id));
if (missing.length) {
console.error(`run-gates: --only named ${missing.length} gate(s) this scope does not run:`
+ ` ${missing.join(', ')}`);
@@ -156,9 +177,9 @@ const skipped = GATES.filter((g) => g.where && g.where !== SCOPE);
/** Suites this run is not paying for — named, never silently absent. */
const unpaid = gatesFor(SCOPE, HAS_EDITOR)
.filter((g) => g.covers?.length && !gates.includes(g));
-/** Everything --only left out, suites included: a narrowed run answers for the
- * gates it named and nothing else, and must not read as a list that went green. */
-const narrowed = ONLY ? gatesFor(SCOPE, HAS_EDITOR).filter((g) => !gates.includes(g)) : [];
+/** Everything a narrowing left out, suites included: such a run answers for the
+ * gates it selected and nothing else, and must not read as a list that went green. */
+const narrowed = NARROWED ? gatesFor(SCOPE, HAS_EDITOR).filter((g) => !gates.includes(g)) : [];
const noEditor = HAS_EDITOR ? [] : GATES.filter((g) => g.needs === 'editor' && (!g.where || g.where === SCOPE));
console.log(`gates ${SCOPE}: ${gates.length} of ${GATES.length}`);
if (noEditor.length) {
@@ -196,15 +217,15 @@ function reportSuites() {
console.log(` ${changed.length} changed path(s) read for suite ownership`
+ `${SUITES.size ? '' : ' — none of them under a suite\'s `owns`'}`);
}
- if (unpaid.length && !ONLY) {
+ if (unpaid.length && !NARROWED) {
const why = SUITE_MODE === 'owed'
? 'nothing changed under what they answer for; CI runs them all'
: `--suites ${SUITE_MODE}; CI runs them`;
console.log(` test suites NOT run: ${unpaid.map((g) => g.id).join(', ')} — ${why}`);
}
if (narrowed.length) {
- console.log(` --only: ${narrowed.length} gate(s) in this scope were NOT run, so this says`
- + ' nothing about them');
+ console.log(` ${WHERE ? `--where ${WHERE}` : '--only'}: ${narrowed.length} gate(s) in this scope`
+ + ' were NOT run, so this says nothing about them');
}
}
@@ -387,3 +408,13 @@ if (COMPLETE) {
process.exit(2);
}
}
+
+// A narrowed run owes the same for the gates it SELECTED: this printed
+// `0/1 green` and exited 0, the text saying native-build answered nothing while
+// the status said the run was clean.
+if (NARROWED && unanswered.length) {
+ console.error(`\n${unanswered.length} of the ${gates.length} gate(s) selected answered nothing here:`
+ + ` ${unanswered.join(', ')}`);
+ console.error(' a narrowed run answers for the gates it selected, so this cannot say they are green.');
+ process.exit(CANNOT_ANSWER);
+}