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
feat(gates): the engine's gates hold up without the editor
esenginee62191cf2b55
diff --git a/tools/check-component-fields.mjs b/tools/check-component-fields.mjsindex cf21ddd0d..507222413 100644--- a/tools/check-component-fields.mjs+++ b/tools/check-component-fields.mjs@@ -15,8 +15,8 @@* actually change what happens.*/import { readFileSync } from 'node:fs';-import { execFileSync } from 'node:child_process';import path from 'node:path';+import { listTrackedSources } from './lib/sourceRoots.mjs';import { fileURLToPath } from 'node:url';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');@@ -52,9 +52,14 @@ const components = JSON.parse(// `examples` is in the list because some fields exist to be read by a GAME:// Perception writes what it saw and the engine never looks at it again, so// judging that one by engine sources alone would call an output a dead knob.-const files = execFileSync('git',- ['ls-files', 'src', 'sdk/src', 'desktop/src', 'native', 'plugins', 'examples'],- { cwd: ROOT, encoding: 'utf8' }).split('\n').filter(Boolean);+const { files, missing } = listTrackedSources(['src', 'sdk/src', 'desktop/src', 'native', 'plugins', 'examples']);+// A reader this gate cannot see is a field it will call dead. Naming the gap+// beats judging a smaller corpus and printing the same green either way.+if (missing.length) {+ console.log(`check-component-fields: no editor checkout — ${missing.join(', ')} not scanned for readers.`);+}+/** Fields with no reader HERE, which only a checkout that sees the editor can judge. */+const unverified = [];const sources = files.filter((f) => /\.(cpp|hpp|h|ts|tsx)$/.test(f) && !f.includes('generated')).map((f) => readFileSync(path.join(ROOT, f), 'utf8'));@@ -85,13 +90,23 @@ for (const component of components) {}unusedGaps.delete(name);if (DECLARED_GAPS[name]) continue;- problems.push(`${name} has no reader — an inspector knob that does nothing`);+ (missing.length ? unverified : problems)+ .push(`${name} has no reader — an inspector knob that does nothing`);}}for (const name of unusedGaps) {problems.push(`${name} is listed as a gap but is not a field any more — drop the entry`);}+// Without the editor's sources a field whose only reader is the inspector looks+// dead. That is a verdict this checkout cannot reach, not a defect — report it+// and leave the judgement to a run that can see both sides.+if (unverified.length) {+ console.log(`check-component-fields: ${unverified.length} field(s) have no reader in the sources scanned here;`+ + ' an editor checkout is needed to judge them:');+ for (const u of unverified) console.log(` ${u}`);+}+if (problems.length) {console.error('check-component-fields: a declared field has no reader.\n');for (const p of problems) console.error(` ${p}`);diff --git a/tools/check-cycles.mjs b/tools/check-cycles.mjsindex 33b2836c4..bf03eb0d0 100644--- a/tools/check-cycles.mjs+++ b/tools/check-cycles.mjs@@ -21,6 +21,7 @@*/import madge from 'madge';import path from 'node:path';+import { existsSync } from 'node:fs';import { fileURLToPath } from 'node:url';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');@@ -36,16 +37,23 @@ const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');// than the cycle. Judge a NEW cycle on its own merits; do not read this budget// as permission for one.const BUDGETS = [- { name: 'sdk', entry: 'sdk/src/index.ts', extensions: ['ts'], budget: 0 },- { name: 'editor', entry: 'desktop/src/main.tsx', extensions: ['ts', 'tsx'], budget: 1 },+ { name: 'sdk', entry: 'sdk/src/index.ts', tsconfig: 'sdk', extensions: ['ts'], budget: 0 },+ { name: 'editor', entry: 'desktop/src/main.tsx', tsconfig: 'desktop', extensions: ['ts', 'tsx'], budget: 1 },];let failed = false;-for (const { name, entry, extensions, budget } of BUDGETS) {+for (const { name, entry, tsconfig, extensions, budget } of BUDGETS) {+ // The editor is an optional submodule; an absent entry is nothing to measure.+ // Said out loud, because a budget that silently stops being checked is a budget+ // that always passes.+ if (!existsSync(path.join(ROOT, entry))) {+ console.log(`${name.padEnd(7)} — not checked out, no cycles measured`);+ continue;+ }const res = await madge(path.join(ROOT, entry), {fileExtensions: extensions,- tsConfig: path.join(ROOT, name === 'sdk' ? 'sdk' : 'desktop', 'tsconfig.json'),+ tsConfig: path.join(ROOT, tsconfig, 'tsconfig.json'),detectiveOptions: { ts: { skipTypeImports: true }, tsx: { skipTypeImports: true } },});const cycles = res.circular();diff --git a/tools/check-import-settings.mjs b/tools/check-import-settings.mjsindex 59c7435b1..0803eaa67 100644--- a/tools/check-import-settings.mjs+++ b/tools/check-import-settings.mjs@@ -15,8 +15,8 @@* a reader of a model's `scale`.*/import { readFileSync } from 'node:fs';-import { execFileSync } from 'node:child_process';import path from 'node:path';+import { listTrackedSources } from './lib/sourceRoots.mjs';import { fileURLToPath } from 'node:url';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');@@ -46,8 +46,14 @@ function schemas() {// Every place a setting can be READ: the pipeline (cook + import), the SDK// (loaders) and the editor. The file that declares them is not a reader.-const files = execFileSync('git', ['ls-files', 'pipeline/src', 'sdk/src', 'desktop/src', 'desktop/electron'],- { cwd: ROOT, encoding: 'utf8' }).split('\n').filter(Boolean);+const { files, missing } = listTrackedSources(['pipeline/src', 'sdk/src', 'desktop/src', 'desktop/electron']);+// Same bargain as check-component-fields: a setting whose only reader is in the+// editor would read as a dead knob, so an unscanned root is reported, not hidden.+if (missing.length) {+ console.log(`check-import-settings: no editor checkout — ${missing.join(', ')} not scanned for readers.`);+}+/** Settings with no reader HERE, which only a checkout that sees the editor can judge. */+const unverified = [];const readers = files.filter((f) => /\.(ts|tsx)$/.test(f) && !f.includes('generated') && f !== SPECS.split(path.sep).join('/')).map((f) => readFileSync(path.join(ROOT, f), 'utf8'))@@ -72,13 +78,23 @@ for (const [type, keys] of schemas()) {}unusedGaps.delete(name);if (DECLARED_GAPS[name]) continue;- problems.push(`${name} has no reader — an import knob that does nothing`);+ (missing.length ? unverified : problems)+ .push(`${name} has no reader — an import knob that does nothing`);}}for (const name of unusedGaps) {problems.push(`${name} is listed as a gap but is not a setting any more — drop the entry`);}+// Same bargain as check-component-fields: a setting read only by the editor's+// import panel looks dead from here, and that is a verdict this checkout cannot+// reach rather than a defect.+if (unverified.length) {+ console.log(`check-import-settings: ${unverified.length} setting(s) have no reader in the sources scanned here;`+ + ' an editor checkout is needed to judge them:');+ for (const u of unverified) console.log(` ${u}`);+}+if (problems.length) {console.error('check-import-settings: a declared import setting has no reader.\n');for (const p of problems) console.error(` ${p}`);diff --git a/tools/check-physics3d.mjs b/tools/check-physics3d.mjsindex 3183d2a26..b140bb301 100644--- a/tools/check-physics3d.mjs+++ b/tools/check-physics3d.mjs@@ -23,10 +23,10 @@ import { fileURLToPath } from 'node:url';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');const SMOKE = path.join(ROOT, 'sdk', 'tests', 'physics3d-smoke.mjs');-const WASM = path.join(ROOT, 'desktop', 'public', 'wasm', 'physics3d.wasm');+const WASM = path.join(ROOT, 'build', 'wasm', 'web', 'physics3d.wasm');if (!existsSync(WASM)) {- console.error('check-physics3d: desktop/public/wasm/physics3d.wasm is not built.\n');+ console.error('check-physics3d: build/wasm/web/physics3d.wasm is not built.\n');console.error(' node build-tools/cli.js build -t physics3d');process.exit(1);}diff --git a/tools/check-release-gate.mjs b/tools/check-release-gate.mjsindex b324aaa32..bb9502a61 100644--- a/tools/check-release-gate.mjs+++ b/tools/check-release-gate.mjs@@ -19,6 +19,8 @@ import { RELEASE, CRITERIA } from './releaseGate.mjs';const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');const problems = [];const fail = (m) => problems.push(m);+const HAS_EDITOR = existsSync(path.join(ROOT, 'desktop', 'package.json'));+const unanswerable = new Set();const seen = new Set();for (const c of CRITERIA) {@@ -38,9 +40,18 @@ for (const c of CRITERIA) {// loudly, rather than at whatever moment somebody trusts the list next.if (c.answeredBy && !c.needs?.length) fail(`"${c.id}" names a command but no file it lives in`);for (const rel of c.needs ?? []) {- if (!existsSync(path.join(ROOT, rel))) fail(`"${c.id}" needs ${rel}, which is not there`);+ if (existsSync(path.join(ROOT, rel))) continue;+ // A verifier that lives in the editor cannot be found from a checkout without+ // one. Counted and reported below rather than failed: it is a criterion this+ // checkout cannot answer, which is a different verdict from a broken one.+ if (!HAS_EDITOR && rel.startsWith('desktop/')) { unanswerable.add(c.id); continue; }+ fail(`"${c.id}" needs ${rel}, which is not there`);}}+if (unanswerable.size) {+ console.log(`check-release-gate: no editor checkout — ${unanswerable.size} criterion(s) cannot be answered here:`+ + ` ${[...unanswerable].join(', ')}`);+}if (problems.length) {console.error(`check-release-gate: the ${RELEASE} exit criteria do not hold together.\n`);diff --git a/tools/check-render-scenes.mjs b/tools/check-render-scenes.mjsindex 47ba710a1..77e747b99 100644--- a/tools/check-render-scenes.mjs+++ b/tools/check-render-scenes.mjs@@ -66,16 +66,21 @@ if (existsSync(WORKFLOW)) {}// The convenience scripts are shims over the registry. Letting one carry its own-// env again is how desktop/package.json became the second list.-const pkg = JSON.parse(readFileSync(path.join(ROOT, 'desktop', 'package.json'), 'utf8'));-for (const [name, body] of Object.entries(pkg.scripts ?? {})) {- if (!name.startsWith('verify:render') || !body.includes('headless-verify.mjs')) continue;- fail(`desktop script "${name}" invokes headless-verify itself — make it a verify-render.mjs shim`);-}-for (const [name, body] of Object.entries(pkg.scripts ?? {})) {- const m = /^node \.\.\/tools\/verify-render\.mjs --only (\S+)$/.exec(body ?? '');- if (!m) continue;- if (!seen.has(m[1])) fail(`desktop script "${name}" names scene "${m[1]}", which the registry does not have`);+// env again is how a package.json became the second list. Every manifest that+// declares them is checked — the editor is an optional submodule, so an absent+// one is nothing to check rather than a failure.+const MANIFESTS = ['package.json', path.join('desktop', 'package.json')]+ .filter((rel) => existsSync(path.join(ROOT, rel)));+for (const rel of MANIFESTS) {+ const pkg = JSON.parse(readFileSync(path.join(ROOT, rel), 'utf8'));+ for (const [name, body] of Object.entries(pkg.scripts ?? {})) {+ if (!name.startsWith('verify:render')) continue;+ if (body.includes('render-host/run.mjs')) {+ fail(`${rel} script "${name}" invokes the render host itself — make it a verify-render.mjs shim`);+ }+ const m = /verify-render\.mjs --only (\S+)$/.exec(body ?? '');+ if (m && !seen.has(m[1])) fail(`${rel} script "${name}" names scene "${m[1]}", which the registry does not have`);+ }}if (problems.length) {diff --git a/tools/component-reference.mjs b/tools/component-reference.mjsindex 4c94b6541..8b5e7fe17 100644--- a/tools/component-reference.mjs+++ b/tools/component-reference.mjs@@ -42,8 +42,10 @@ const SNAPSHOT = join(ROOT, 'docs', 'astro', 'src', 'data', 'components.generateconst CURATED = join(ROOT, 'docs', 'astro', 'src', 'data', 'componentDocs.ts');const DOC_PAGES = join(ROOT, 'docs', 'astro', 'src', 'content', 'docs');// The editor's Details panel links each component header at its reference entry;-// the address is derived here so the two can never point at different pages.+// the address is derived here so the two can never point at different pages. The+// editor is an optional submodule, so this is checked when there is one to check.const EDITOR_LINKS = join(ROOT, 'desktop', 'src', 'engine', 'componentDocs.generated.ts');+const HAS_EDITOR = existsSync(join(ROOT, 'desktop', 'package.json'));const mode = process.argv[2];if (mode !== '--check' && mode !== '--update') {@@ -287,8 +289,12 @@ if (mode === '--update') {if (d.missing.length) console.log(` still to describe in componentDocs.ts: ${d.missing.join(', ')}`);if (d.extra.length) console.log(` componentDocs.ts names components that no longer exist: ${d.extra.join(', ')}`);if (!d.missing.length && !d.extra.length) {- writeFileSync(EDITOR_LINKS, editorLinksSource(names));- console.log(` wrote the editor's link table (${names.length} entries)`);+ if (HAS_EDITOR) {+ writeFileSync(EDITOR_LINKS, editorLinksSource(names));+ console.log(` wrote the editor's link table (${names.length} entries)`);+ } else {+ console.log(' editor link table NOT written — no editor checkout to write it into');+ }} else {console.log(" editor link table NOT written — describe the components above first");}@@ -337,8 +343,10 @@ for (const t of curatedTargets()) {}}-const links = editorLinkNames();-if (links === null) problems.push(`missing the editor's link table ${EDITOR_LINKS}`);+const links = HAS_EDITOR ? editorLinkNames() : undefined;+if (links === undefined) {+ console.log("component-reference: no editor checkout — its doc-link table was not checked.");+} else if (links === null) problems.push(`missing the editor's link table ${EDITOR_LINKS}`);else {const dLink = diff(links, snapNames);for (const n of dLink.missing) problems.push(`the editor's Details panel has no doc link for "${n}"`);diff --git a/tools/gates.mjs b/tools/gates.mjsindex e0aa7b8f1..552b3baa7 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -22,6 +22,10 @@ export const SCOPES = ['local', 'ci'];* `run` is a shell command from the repo root. `where` narrows a gate to one* scope and then owes a `why` — a gate that quietly runs in one place is the* thing this file exists to stop.+ *+ * `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.*/export const GATES = [{ id: 'tsc-sdk', run: 'pnpm --filter ./sdk exec tsc --noEmit' },@@ -68,12 +72,12 @@ export const GATES = [// A system's parameters are what the schedule knows about it; the World// 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' },+ { id: 'project-settings', run: 'node tools/check-project-settings.mjs', needs: 'editor' },{ 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' },- { id: 'capabilities', run: 'node tools/check-capabilities.mjs' },- { id: 'inspector-door', run: 'node tools/check-inspector-door.mjs' },+ { id: 'tool-calls', run: 'node tools/check-tool-calls.mjs', needs: 'editor' },+ { id: 'capabilities', run: 'node tools/check-capabilities.mjs', needs: 'editor' },+ { id: 'inspector-door', run: 'node tools/check-inspector-door.mjs', needs: 'editor' },{ id: 'component-fields', run: 'node tools/check-component-fields.mjs' },// …and that each of them can be reached on a device, where the registry is// assembled from ptr accessors rather than from embind.@@ -84,7 +88,7 @@ export const GATES = [{ id: 'wgsl-twin', run: 'node tools/check-wgsl-twin.mjs' },{ id: 'shader-literals', run: 'node tools/check-shader-literals.mjs' },{ id: 'import-settings', run: 'node tools/check-import-settings.mjs' },- { id: 'dirty-source', run: 'node tools/check-dirty-source.mjs' },+ { 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' },{ id: 'comment-style', run: 'node tools/check-comment-style.mjs' },@@ -100,10 +104,10 @@ export const GATES = [where: 'local',why: 'it builds the engine out of the tree `cli native` configured; CI builds every native target from scratch',},- { id: 'verifier-exit', run: 'node tools/check-verifier-exit.mjs' },+ { id: 'verifier-exit', run: 'node tools/check-verifier-exit.mjs', needs: 'editor' },{ id: 'render-scenes', run: 'node tools/check-render-scenes.mjs' },{ id: 'release-metadata', run: 'node tools/check-release-metadata.mjs' },- { id: 'shipped-resources', run: 'node tools/check-shipped-resources.mjs' },+ { id: 'shipped-resources', run: 'node tools/check-shipped-resources.mjs', needs: 'editor' },{ id: 'golden', run: 'node tools/check-golden.mjs' },{id: 'physics3d',@@ -112,7 +116,7 @@ export const GATES = [why: 'it runs the built 3D physics wasm; CI builds that module in its own wasm job',},{ id: 'engine-gaps', run: 'node tools/check-engine-gaps.mjs' },- { id: 'minigame-host', run: 'node tools/check-minigame-host.mjs' },+ { id: 'minigame-host', run: 'node tools/check-minigame-host.mjs', needs: 'editor' },{ id: 'release-gate', run: 'node tools/check-release-gate.mjs' },{ id: 'component-reference', run: 'node tools/component-reference.mjs --check' },{ id: 'api-stability-page', run: 'node tools/api-stability.mjs --check' },@@ -123,8 +127,8 @@ export const GATES = [{ id: 'documents', run: 'node build-tools/cli.js validate-documents' },];-/** The gates a scope runs, in declaration order. */-export function gatesFor(scope) {+/** The gates a scope runs, in declaration order. `hasEditor` gates the editor ones. */+export function gatesFor(scope, hasEditor = true) {if (!SCOPES.includes(scope)) throw new Error(`unknown scope "${scope}" (have: ${SCOPES.join(', ')})`);- return GATES.filter((g) => !g.where || g.where === scope);+ return GATES.filter((g) => (!g.where || g.where === scope) && (hasEditor || g.needs !== 'editor'));}diff --git a/tools/lib/sourceRoots.mjs b/tools/lib/sourceRoots.mjsnew file mode 100644index 000000000..66c95f4cf--- /dev/null+++ b/tools/lib/sourceRoots.mjs@@ -0,0 +1,48 @@+// SPDX-License-Identifier: Apache-2.0+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team+/**+ * @file sourceRoots.mjs — listing tracked sources across the editor boundary.+ *+ * The editor is a submodule: its files are not in this repo's index, so a plain+ * `git ls-files desktop/src` answers with nothing at all. A gate that scans it+ * would then quietly judge a smaller corpus and still print green — the failure+ * mode this exists to refuse. Ask the submodule's own index, and say when there+ * is none to ask.+ */+import { execFileSync } from 'node:child_process';+import { existsSync } from 'node:fs';+import path from 'node:path';+import { fileURLToPath } from 'node:url';++const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');+const EDITOR = 'desktop';++/** Whether an editor checkout is present at all. */+export function hasEditor() {+ return existsSync(path.join(ROOT, EDITOR, 'package.json'));+}++function ls(cwd, args) {+ if (!args.length) return [];+ return execFileSync('git', ['ls-files', ...args], { cwd, encoding: 'utf8' }).split('\n').filter(Boolean);+}++/**+ * Tracked files under `roots` (repo-relative), reading the editor's own index for+ * anything under `desktop/`. Returns `{ files, missing }` — `missing` names the+ * roots that had no checkout, for the caller to report rather than swallow.+ */+export function listTrackedSources(roots) {+ const editorRoots = roots.filter((r) => r === EDITOR || r.startsWith(`${EDITOR}/`));+ const ownRoots = roots.filter((r) => !editorRoots.includes(r));++ const files = ls(ROOT, ownRoots);+ if (!editorRoots.length) return { files, missing: [] };+ if (!hasEditor()) return { files, missing: editorRoots };++ const inner = editorRoots.map((r) => (r === EDITOR ? '.' : r.slice(EDITOR.length + 1)));+ for (const rel of ls(path.join(ROOT, EDITOR), inner)) files.push(`${EDITOR}/${rel}`);+ return { files, missing: [] };+}++export { ROOT, EDITOR };diff --git a/tools/render-host/host.ts b/tools/render-host/host.tsindex 760634d81..61ecb93ad 100644--- a/tools/render-host/host.ts+++ b/tools/render-host/host.ts@@ -72,10 +72,9 @@ async function boot(): Promise<void> {printErr: (t: string) => console.warn('[wasm]', t),};if (backend === 'webgpu') {- // The device has to exist before the module instantiates — the wasm side- // reads it synchronously. The error listener is what makes an invalid- // draw visible; without one Dawn drops it in silence, which reads as a- // black pass with nothing wrong.+ // The device has to exist before the module instantiates (the wasm side+ // reads it synchronously), and the error listener is what makes an invalid+ // draw visible — without one Dawn drops it in silence.const gpu = await acquireWebGPUDevice('webgpu', (m: string) => console.error(m));if (!gpu.device) throw new Error(`WebGPU is not available: ${gpu.reason}`);console.info(`[engine] webgpu adapter: ${gpu.adapter ?? 'unreported'}`);@@ -125,10 +124,9 @@ async function boot(): Promise<void> {});app.enableStats();- // The fixtures are AUTHORING scenes, and authoring mode is what they were- // captured under: gameplay systems (particles, animation, physics, timeline)- // stay frozen so a capture is the same frame every time. ESTELLA_VERIFY_PLAY- // flips this per gate via setRunMode.+ // The fixtures are AUTHORING scenes and were captured in authoring mode, where+ // gameplay systems stay frozen so a capture is the same frame every time.+ // ESTELLA_VERIFY_PLAY flips this per gate via setRunMode.setEditorMode(true);setPlayMode(false);}@@ -160,11 +158,9 @@ async function loadScene(sceneUrl: string, manifestUrl?: string): Promise<numberconst map = loadSceneData(app.world, resolved as Parameters<typeof loadSceneData>[1]);sceneRaw = raw;sourceToEntity = map as unknown as Map<number, number>;- // Both skeletal runtimes render through side modules loaded separately from- // Assets, so their entities are bound after the World exists — through the- // SAME shared loaders the shipped runtime uses. BOTH, because a scene that- // carries one and a host that binds the other renders an empty frame and- // reports no error.+ // Both skeletal runtimes load outside Assets, so they bind after the World+ // exists. BOTH: a scene carrying one against a host that binds the other+ // renders an empty frame and reports no error.const toUrl = (ref: string) =>ref.startsWith(UUID_PREFIX) ? (uuidToUrl.get(ref.slice(UUID_PREFIX.length)) ?? ref) : ref;const entityMap = map as unknown as Map<number, number>;@@ -442,10 +438,9 @@ window.__estellaHeadless = {ext.loseContext();return true;}- // WebGPU has no lose-context extension. Destroying the device is the- // one loss a page can cause, and it reaches the engine as any other- // would. The device IN USE, not the one booted with: after a recovery- // those differ, and destroying the dead one again is not a loss.+ // WebGPU has no lose-context extension; destroying the device is the+ // one loss a page can cause. The device IN USE, not the one booted+ // with — after a recovery those differ.const m = module as unknown as {currentWebGPUDevice?: { destroy?(): void };preinitializedWebGPUDevice?: { destroy?(): void };diff --git a/tools/render-host/run.mjs b/tools/render-host/run.mjsindex 60444402a..fa0432d47 100644--- a/tools/render-host/run.mjs+++ b/tools/render-host/run.mjs@@ -44,9 +44,8 @@ try {const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');// Two hosts answer the same driving surface. The engine's is the default — a-// gate about the renderer should not need an editor to run. The editor's keeps-// the handful whose subject IS an editor door (the reference grid, hit-testing,-// the editor eye, preview renders).+// gate about the renderer should not need an editor to run — and the editor's+// keeps the handful whose subject IS an editor door.const HOSTS = {engine: { dist: path.join(ROOT, 'build', 'render-host'), page: 'index.html' },editor: { dist: path.join(ROOT, 'desktop', 'dist'), page: 'headless.html' },diff --git a/tools/run-gates.mjs b/tools/run-gates.mjsindex ee6c0a41b..f4a39082d 100644--- a/tools/run-gates.mjs+++ b/tools/run-gates.mjs@@ -11,6 +11,7 @@* node tools/run-gates.mjs --scope ci*/import { spawnSync } from 'node:child_process';+import { existsSync } from 'node:fs';import path from 'node:path';import { fileURLToPath } from 'node:url';import { SCOPES, GATES, gatesFor } from './gates.mjs';@@ -28,9 +29,17 @@ if (!SCOPES.includes(SCOPE)) {process.exit(2);}-const gates = gatesFor(SCOPE);+// The editor is an optional submodule; the gates whose subject IS the editor+// cannot run without it. Named below rather than silently dropped — a gate that+// disappears quietly is the same as one that always passes.+const HAS_EDITOR = existsSync(path.join(ROOT, 'desktop', 'package.json'));+const gates = gatesFor(SCOPE, HAS_EDITOR);const skipped = GATES.filter((g) => g.where && g.where !== SCOPE);+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) {+ console.log(` no editor checkout — not running ${noEditor.length} editor gate(s): ${noEditor.map((g) => g.id).join(', ')}`);+}for (const gate of gates) {const r = spawnSync('sh', ['-c', gate.run], { cwd: ROOT, stdio: 'inherit' });@@ -51,5 +60,6 @@ for (const gate of gates) {}}-console.log(`\ngates ${SCOPE}: ${gates.length}/${gates.length} green`);+console.log(`\ngates ${SCOPE}: ${gates.length}/${gates.length} green`+ + (noEditor.length ? ` (${noEditor.length} editor gate(s) had no checkout to run against)` : ''));for (const g of skipped) console.log(` not in this scope: ${g.id} — ${g.why}`);