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(ci): the golden corpus, and a package opened the way a player opens it

esengine36e4a50b5ee2
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 6a8ebe14f..ab1c37e99 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -527,6 +527,15 @@ jobs:
ELECTRON_DISABLE_SANDBOX: '1'
run: xvfb-run -a node scripts/editor-checks/run.mjs
+ # The golden corpus, packaged and opened the way a player opens it. Exporting
+ # was checked and the engine was checked; the package itself never was, which
+ # is where a wrong export default or a path that only resolves in the editor
+ # survives every other green check and ships.
+ - name: Launch the golden packages (PR tier)
+ env:
+ ELECTRON_DISABLE_SANDBOX: '1'
+ run: xvfb-run -a node tools/verify-golden.mjs --tier pr
+
# The SAME pixel assertions on the WebGPU backend — Dawn renders through the
# bundled SwiftShader Vulkan (--use-webgpu-adapter=swiftshader), so a GPU-less
# runner verifies the second backend for real: WGSL twins, the reflected
diff --git a/.gitignore b/.gitignore
index 2c6076b7e..3bfc662d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -145,3 +145,6 @@ native/ios/Content/*
# identity the exported project declares. See native/README.md.
native/ios/App/Info.plist
native/ios/app.generated.yml
+
+# verify-golden's package scratch (exports it launches and throws away)
+/.golden/
diff --git a/desktop/scripts/launch-export.mjs b/desktop/scripts/launch-export.mjs
new file mode 100644
index 000000000..e4ea751da
--- /dev/null
+++ b/desktop/scripts/launch-export.mjs
@@ -0,0 +1,151 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file launch-export.mjs — a packaged web build actually starts, and draws.
+ *
+ * Exporting is checked (export-project reports errors, warnings and size) and
+ * the ENGINE is checked (verify:render). Between them sits the thing nobody ran
+ * in CI: the package itself, opened the way a player opens it. That gap is
+ * where a wrong export default, a missing runtime config or a path that only
+ * resolves in the editor survives every green check and ships.
+ *
+ * Serves the export over http (a build fetches its manifest and assets; file://
+ * refuses those) and asks the same two questions verify-native-boot asks of a
+ * native package: did it reach ready, and is the frame more than one flat
+ * colour — because a build that boots to black passes every other check.
+ *
+ * electron desktop/scripts/launch-export.mjs --dir <exportDir> [options]
+ * --out <file.png> write the captured frame
+ * --w / --h surface size (default 640x360)
+ * --settle <n> frames to let run before capturing (default 30)
+ * --timeout <ms> how long to wait for the first frame (default 30000)
+ * --allow-flat accept a single-colour frame (a deliberately blank scene)
+ */
+import { app, BrowserWindow } from 'electron';
+import http from 'node:http';
+import { readFile, writeFile } from 'node:fs/promises';
+import { existsSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { onRendererConsole } from './rendererConsole.mjs';
+
+// capturePage pixels go through the OS display profile; pin sRGB so a colour
+// judgement reads the same on a wide-gamut machine as on a CI runner.
+app.commandLine.appendSwitch('force-color-profile', 'srgb');
+
+const argv = process.argv.slice(2);
+const flag = (name, fallback) => {
+ const i = argv.indexOf(`--${name}`);
+ return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[i + 1] : fallback;
+};
+const has = (name) => argv.includes(`--${name}`);
+
+const DIR = path.resolve(flag('dir', ''));
+const OUT = flag('out', '');
+const W = Number(flag('w', '640'));
+const H = Number(flag('h', '360'));
+const SETTLE = Number(flag('settle', '30'));
+const TIMEOUT = Number(flag('timeout', '30000'));
+
+const MIME = {
+ '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript',
+ '.json': 'application/json', '.wasm': 'application/wasm', '.png': 'image/png',
+ '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp', '.ktx2': 'image/ktx2',
+ '.mp3': 'audio/mpeg', '.ogg': 'audio/ogg', '.wav': 'audio/wav', '.m4a': 'audio/mp4',
+ '.mp4': 'video/mp4', '.esv': 'video/mp4', '.css': 'text/css', '.svg': 'image/svg+xml',
+ '.atlas': 'text/plain', '.skel': 'application/octet-stream', '.txt': 'text/plain',
+};
+
+/** Serve the export directory. Range requests are not implemented: a build that
+ * needs them (video seek) would read as a broken asset here, not a broken server. */
+function serve(root) {
+ const server = http.createServer(async (req, res) => {
+ try {
+ let rel = decodeURIComponent(new URL(req.url, 'http://x').pathname).replace(/^\/+/, '');
+ if (rel === '') rel = 'index.html';
+ const abs = path.join(root, rel);
+ if (!abs.startsWith(root)) { res.writeHead(403).end(); return; }
+ const bytes = await readFile(abs);
+ res.writeHead(200, { 'content-type': MIME[path.extname(abs).toLowerCase()] ?? 'application/octet-stream' })
+ .end(bytes);
+ } catch {
+ res.writeHead(404).end();
+ }
+ });
+ return new Promise((resolve) => server.listen(0, '127.0.0.1', () => resolve(server)));
+}
+
+/** Is more than one colour on screen? The question a boot-to-black build fails. */
+function frameIsLive(image) {
+ const { width, height } = image.getSize();
+ const buf = image.toBitmap(); // BGRA
+ const first = [buf[0], buf[1], buf[2]];
+ const step = Math.max(1, Math.floor((width * height) / 4000));
+ for (let p = 0; p < width * height; p += step) {
+ const i = p * 4;
+ if (Math.abs(buf[i] - first[0]) > 8 || Math.abs(buf[i + 1] - first[1]) > 8 || Math.abs(buf[i + 2] - first[2]) > 8) {
+ return true;
+ }
+ }
+ return false;
+}
+
+async function main() {
+ if (!DIR || !existsSync(path.join(DIR, 'index.html'))) {
+ console.error(`✗ no index.html under ${DIR || '(--dir not given)'}`);
+ app.exit(2);
+ return;
+ }
+ const server = await serve(DIR);
+ const base = `http://127.0.0.1:${server.address().port}/`;
+
+ const win = new BrowserWindow({
+ width: W, height: H, show: false,
+ webPreferences: { offscreen: false, backgroundThrottling: false },
+ });
+ await win.webContents.session.clearCache();
+
+ const errors = [];
+ const stop = onRendererConsole(win.webContents, (msg) => {
+ if (/error|uncaught|failed/i.test(msg)) errors.push(msg.slice(0, 300));
+ if (msg.startsWith('[engine]')) console.log(` ${msg}`);
+ });
+ win.webContents.on('render-process-gone', (_e, d) => errors.push(`render process gone: ${d.reason}`));
+
+ await win.loadURL(base);
+
+ // Wait for a real frame rather than a wall-clock guess: the engine paints when
+ // its wasm and assets are in, which is exactly the part a package can get wrong.
+ const painted = await win.webContents.executeJavaScript(`
+ new Promise((resolve) => {
+ const deadline = Date.now() + ${TIMEOUT};
+ let frames = 0;
+ const tick = () => {
+ const c = document.querySelector('canvas');
+ if (c && c.width > 0 && c.height > 0) frames++;
+ if (frames >= ${SETTLE}) return resolve(true);
+ if (Date.now() > deadline) return resolve(false);
+ requestAnimationFrame(tick);
+ };
+ requestAnimationFrame(tick);
+ })
+ `).catch((e) => { errors.push(String(e)); return false; });
+
+ const image = await win.webContents.capturePage();
+ if (OUT) await writeFile(OUT, image.toPNG());
+ stop();
+ server.close();
+
+ const live = frameIsLive(image);
+ const ok = painted && live && errors.length === 0;
+ console.log(`${ok ? '✓' : '✗'} ${path.basename(DIR)} — painted=${painted} live=${live} errors=${errors.length}`);
+ for (const e of errors.slice(0, 5)) console.log(` ${e}`);
+ if (!painted) console.log(' no canvas ever sized — the package did not start');
+ if (painted && !live && !has('allow-flat')) console.log(' one flat colour — it started and drew nothing');
+ app.exit(ok || (live === false && has('allow-flat') && painted && !errors.length) ? 0 : 1);
+}
+
+app.whenReady().then(main).catch((e) => {
+ console.error('✗ launch-export failed:', e);
+ app.exit(2);
+});
diff --git a/package.json b/package.json
index 04900644b..2565bf928 100644
--- a/package.json
+++ b/package.json
@@ -17,7 +17,7 @@
"emsdk:setup": "node build-tools/toolchain/setup-emsdk.js",
"asset-meta": "node tools/asset-meta.js",
"migrate-asset-refs": "node tools/migrate-asset-refs.js",
- "verify": "pnpm --filter ./sdk exec tsc --noEmit && pnpm --filter @estella/editor exec tsc --noEmit && node tools/api-surface.mjs --check && node tools/check-cycles.mjs && node tools/check-layers.mjs && node tools/check-project-settings.mjs && node tools/check-workflows.mjs && node tools/check-tool-calls.mjs && node tools/check-inspector-door.mjs && node tools/check-dirty-source.mjs && node tools/check-path-sandbox.mjs && node tools/check-key-codes.mjs && node tools/check-comment-style.mjs && node tools/check-cpp-tests.mjs && node tools/check-release-metadata.mjs && node tools/component-reference.mjs --check",
+ "verify": "pnpm --filter ./sdk exec tsc --noEmit && pnpm --filter @estella/editor exec tsc --noEmit && node tools/api-surface.mjs --check && node tools/check-cycles.mjs && node tools/check-layers.mjs && node tools/check-project-settings.mjs && node tools/check-workflows.mjs && node tools/check-tool-calls.mjs && node tools/check-inspector-door.mjs && node tools/check-dirty-source.mjs && node tools/check-path-sandbox.mjs && node tools/check-key-codes.mjs && node tools/check-comment-style.mjs && node tools/check-cpp-tests.mjs && node tools/check-release-metadata.mjs && node tools/check-golden.mjs && node tools/component-reference.mjs --check",
"perf": "node tools/perf-guard.mjs --check",
"scale": "node tools/perf-budget.mjs",
"stress-project": "node tools/stress-project.mjs",
diff --git a/tools/check-golden.mjs b/tools/check-golden.mjs
new file mode 100644
index 000000000..a422cf3c5
--- /dev/null
+++ b/tools/check-golden.mjs
@@ -0,0 +1,92 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file check-golden.mjs — the certification corpus says what it covers, or says why not.
+ *
+ * The Golden Project Suite is an argument that a release ships working games. An
+ * argument with a silent hole in it is worse than no argument: "the suite is
+ * green" then means "the suite is green about the things it happens to run".
+ *
+ * So every capability the suite claims must have a project behind it, every
+ * project must exist and be packageable, and every target must be a real export
+ * target. A capability nothing covers is allowed — declared in KNOWN_GAPS, with
+ * a reason, so the hole is a sentence somebody wrote.
+ */
+import { existsSync, readFileSync } from 'node:fs';
+import path from 'node:path';
+import {
+ GOLDEN, CAPABILITIES, KNOWN_GAPS, TIERS, TARGETS,
+ atTier, uncoveredCapabilities, nonGoldenExamples, projectDir,
+} from './goldenProjects.mjs';
+
+const problems = [];
+const fail = (msg) => problems.push(msg);
+
+// 1. Every golden id is a project that exists and declares a scene to open.
+const seen = new Set();
+for (const g of GOLDEN) {
+ if (seen.has(g.id)) fail(`"${g.id}" is listed twice`);
+ seen.add(g.id);
+
+ const manifest = path.join(projectDir(g.id), 'project.esproject');
+ if (!existsSync(manifest)) {
+ fail(`"${g.id}" has no examples/${g.id}/project.esproject — a golden project must be packageable`);
+ continue;
+ }
+ let parsed;
+ try {
+ parsed = JSON.parse(readFileSync(manifest, 'utf8'));
+ } catch (e) {
+ fail(`"${g.id}" has an unreadable manifest: ${e.message}`);
+ continue;
+ }
+ // Every stage after "open" needs a scene to open; an export with no entry
+ // scene packages an empty game and still exits 0.
+ const scene = parsed.defaultScene;
+ if (!scene) fail(`"${g.id}" declares no defaultScene — the chain has nothing to open`);
+ else if (!existsSync(path.join(projectDir(g.id), scene))) {
+ fail(`"${g.id}" names a defaultScene that is not there: ${scene}`);
+ }
+
+ if (!TIERS.includes(g.tier)) fail(`"${g.id}" has tier "${g.tier}" (have: ${TIERS.join(', ')})`);
+ if (!g.targets?.length) fail(`"${g.id}" names no targets — then nothing packages it`);
+ for (const t of g.targets ?? []) {
+ if (!TARGETS.includes(t)) fail(`"${g.id}" names target "${t}" (have: ${TARGETS.join(', ')})`);
+ }
+ if (!g.certifies?.length) fail(`"${g.id}" certifies nothing — say what it is in the suite for`);
+ for (const c of g.certifies ?? []) {
+ if (!CAPABILITIES.includes(c)) fail(`"${g.id}" certifies "${c}", which is not a declared capability`);
+ }
+}
+
+// 2. No capability is claimed by the suite and covered by nobody.
+for (const c of uncoveredCapabilities()) {
+ fail(`nothing certifies "${c}" — add a project, or declare the gap in KNOWN_GAPS with a reason`);
+}
+
+// 3. A declared gap that something now covers is stale bookkeeping.
+const covered = new Set(GOLDEN.flatMap((g) => g.certifies));
+for (const c of Object.keys(KNOWN_GAPS)) {
+ if (!CAPABILITIES.includes(c)) fail(`KNOWN_GAPS names "${c}", which is not a declared capability`);
+ else if (covered.has(c)) fail(`"${c}" is declared a gap but ${[...covered].includes(c) ? 'a project certifies it' : ''} — drop the entry`);
+}
+
+// 4. Every tier can actually run something.
+for (const tier of TIERS) {
+ if (atTier(tier).length === 0) fail(`tier "${tier}" selects no projects`);
+}
+
+if (problems.length) {
+ console.error('check-golden: the certification corpus does not hold up.\n');
+ for (const p of problems) console.error(` ${p}`);
+ process.exit(1);
+}
+
+const gaps = Object.keys(KNOWN_GAPS).length;
+const pairs = TIERS.map((t) => `${t} ${atTier(t).length}`).join(' / ');
+console.log(
+ `check-golden: ${GOLDEN.length} golden project(s) certify ${covered.size}/${CAPABILITIES.length} capabilities`
+ + `, ${gaps} declared gap(s) — ok (${pairs})`,
+);
+const rest = nonGoldenExamples();
+if (rest.length) console.log(` ${rest.length} example(s) outside the corpus (smoke-tested, not certified)`);
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
new file mode 100644
index 000000000..63c52bfaa
--- /dev/null
+++ b/tools/goldenProjects.mjs
@@ -0,0 +1,167 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file goldenProjects.mjs — the certification corpus, as a registry.
+ *
+ * Every stage verifier already exists and every one picked its own corpus:
+ * editor-checks builds synthetic fixtures, verify-native-boot takes all 42
+ * examples, verify-desktop-render takes one. So no single project was ever
+ * carried from the editor through a package and back, and the seams between
+ * stages are exactly where the shipping bugs live — configuration lost at
+ * package time, input never wired to the host, export defaults wrong.
+ *
+ * A golden entry names a project that must survive the WHOLE chain, what it
+ * certifies, and which tier pays for it. The gate over this file
+ * (check-golden.mjs) refuses a capability nobody covers unless the gap is
+ * declared here in the open.
+ */
+import { readdirSync, existsSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
+const EXAMPLES = path.join(ROOT, 'examples');
+
+/** Cheapest tier a project runs at; each tier also runs everything cheaper. */
+export const TIERS = ['pr', 'nightly', 'release'];
+
+/** Export targets a golden project can be asked to package + launch for. */
+export const TARGETS = ['web', 'playable', 'desktop', 'wechat', 'android', 'ios'];
+
+/**
+ * What the suite claims to cover. A capability here with no project behind it
+ * is a hole in the release argument, so the gate fails on one that is not in
+ * {@link KNOWN_GAPS}.
+ */
+export const CAPABILITIES = [
+ 'physics', 'input', 'animation',
+ 'ecs', 'particles', 'audio',
+ 'ui-layout', 'text', 'localization',
+ 'spine', 'material', 'asset-lifecycle',
+ 'tilemap', 'tile-collision',
+ 'touch', 'safe-area', 'pause-resume',
+ 'single-file', 'startup-size',
+ 'hot-update', 'rollback',
+ 'networking',
+ 'persistence', 'save-versioning',
+];
+
+/**
+ * Capabilities the corpus does NOT cover yet, each with the reason. Declared so
+ * the hole is visible in the gate's output instead of being mistaken for
+ * coverage — the same bargain check-project-settings strikes.
+ */
+export const KNOWN_GAPS = {
+ localization: 'no example swaps locale at runtime; rich-text covers glyphs, not translation',
+ touch: 'no example drives synthetic touch; input-actions is keyboard + gamepad',
+ 'safe-area': 'safe-area insets are exercised by the UI mode viewport, not by a project',
+ 'pause-resume': 'lifecycle suspend/resume is covered by native hosts, not by a golden project',
+ rollback: 'hot-update-demo swaps forward; nothing exercises a failed manifest rolling back',
+ // Measured: hello-world exports a 2.82MB single file, video-puzzle 3.22MB — so
+ // the floor is the runtime, not the game, and no project reaches the 2MB cap.
+ 'startup-size': 'the playable runtime floor (~2.8MB) exceeds the 2MB default profile cap; see REARCH_EXPORT',
+};
+
+/**
+ * The corpus. `certifies` is the claim, `targets` the packages that must build
+ * AND launch, `tier` the cheapest run that pays for it. Existing examples on
+ * purpose — a parallel suite would be a second set of games to keep alive.
+ */
+export const GOLDEN = [
+ {
+ id: 'platformer',
+ certifies: ['physics', 'input', 'animation'],
+ targets: ['web', 'desktop', 'android'],
+ tier: 'pr',
+ },
+ {
+ id: 'space-shooter',
+ certifies: ['ecs', 'particles', 'audio'],
+ targets: ['web', 'desktop', 'android'],
+ tier: 'pr',
+ },
+ {
+ id: 'ui-controls',
+ certifies: ['ui-layout', 'text'],
+ targets: ['web', 'desktop'],
+ tier: 'pr',
+ },
+ {
+ id: 'tilemap-demo',
+ certifies: ['tilemap', 'tile-collision'],
+ targets: ['web', 'desktop', 'android'],
+ tier: 'pr',
+ },
+ {
+ id: 'spine-demo',
+ certifies: ['spine', 'material', 'asset-lifecycle'],
+ targets: ['web', 'desktop', 'android', 'ios'],
+ tier: 'nightly',
+ },
+ {
+ id: 'save-load',
+ certifies: ['persistence', 'save-versioning'],
+ targets: ['web', 'desktop'],
+ tier: 'nightly',
+ },
+ {
+ id: 'hot-update-demo',
+ certifies: ['hot-update'],
+ targets: ['web', 'android'],
+ tier: 'nightly',
+ },
+ {
+ id: 'multiplayer-arena',
+ certifies: ['networking'],
+ targets: ['web', 'desktop'],
+ tier: 'nightly',
+ },
+ {
+ id: 'video-puzzle',
+ certifies: ['single-file'],
+ targets: ['playable', 'web'],
+ tier: 'nightly',
+ },
+ {
+ id: 'input-actions',
+ certifies: ['input'],
+ targets: ['web', 'desktop', 'wechat'],
+ tier: 'release',
+ },
+];
+
+const rank = (tier) => TIERS.indexOf(tier);
+
+/** Golden projects that run at `tier` — cheaper tiers included (they are cumulative). */
+export function atTier(tier) {
+ const want = rank(tier);
+ if (want < 0) throw new Error(`unknown tier "${tier}" (have: ${TIERS.join(', ')})`);
+ return GOLDEN.filter((g) => rank(g.tier) <= want);
+}
+
+/** Every (project, target) pair a tier must package and launch. */
+export function matrixAtTier(tier) {
+ return atTier(tier).flatMap((g) => g.targets.map((target) => ({ id: g.id, target })));
+}
+
+/** Capabilities claimed by no project and not declared as a gap. */
+export function uncoveredCapabilities() {
+ const covered = new Set(GOLDEN.flatMap((g) => g.certifies));
+ return CAPABILITIES.filter((c) => !covered.has(c) && !(c in KNOWN_GAPS));
+}
+
+/** Examples that exist on disk but are not part of the certification corpus. */
+export function nonGoldenExamples() {
+ if (!existsSync(EXAMPLES)) return [];
+ const golden = new Set(GOLDEN.map((g) => g.id));
+ return readdirSync(EXAMPLES, { withFileTypes: true })
+ .filter((e) => e.isDirectory() && existsSync(path.join(EXAMPLES, e.name, 'project.esproject')))
+ .map((e) => e.name)
+ .filter((n) => !golden.has(n))
+ .sort();
+}
+
+/** Absolute path to a golden project's directory. */
+export function projectDir(id) {
+ return path.join(EXAMPLES, id);
+}
diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjs
new file mode 100644
index 000000000..297ed56a7
--- /dev/null
+++ b/tools/verify-golden.mjs
@@ -0,0 +1,83 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file verify-golden.mjs — carry each golden project through package → launch.
+ *
+ * The registry says which projects a tier certifies and for which targets; this
+ * runs that matrix. Web and playable are driven here because both launch in the
+ * Electron already on hand; desktop/android/ios packages are launched by
+ * verify-desktop-render and verify-native-boot, which own their toolchains.
+ *
+ * Reports every pair rather than stopping at the first failure — a release
+ * argument wants the whole matrix, not the first thing that broke.
+ *
+ * node tools/verify-golden.mjs --tier pr
+ * node tools/verify-golden.mjs --tier nightly --only platformer,spine-demo
+ * node tools/verify-golden.mjs --tier pr --shots <dir>
+ */
+import { spawnSync } from 'node:child_process';
+import { mkdirSync, rmSync } from 'node:fs';
+import path from 'node:path';
+import { atTier, projectDir, ROOT } from './goldenProjects.mjs';
+
+const argv = process.argv.slice(2);
+const flag = (n, d) => {
+ const i = argv.indexOf(`--${n}`);
+ return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[i + 1] : d;
+};
+
+const TIER = flag('tier', 'pr');
+const ONLY = flag('only', '');
+const SHOTS = flag('shots', '');
+const WORK = flag('work', path.join(ROOT, '.golden'));
+/** Targets this runner owns; the rest belong to the native/desktop verifiers. */
+const OWNED = new Set(['web', 'playable']);
+
+const DESKTOP = path.join(ROOT, 'desktop');
+if (SHOTS) mkdirSync(SHOTS, { recursive: true });
+
+const only = ONLY ? new Set(ONLY.split(',').map((s) => s.trim())) : null;
+const projects = atTier(TIER).filter((g) => !only || only.has(g.id));
+
+const pairs = projects.flatMap((g) => g.targets.filter((t) => OWNED.has(t)).map((t) => ({ id: g.id, target: t })));
+const deferred = projects.flatMap((g) => g.targets.filter((t) => !OWNED.has(t)).map((t) => `${g.id}:${t}`));
+
+console.log(`golden ${TIER}: ${projects.length} project(s), ${pairs.length} pair(s) here`
+ + (deferred.length ? `, ${deferred.length} left to the platform verifiers` : ''));
+
+const results = [];
+for (const { id, target } of pairs) {
+ const out = path.join(WORK, `${id}-${target}`);
+ rmSync(out, { recursive: true, force: true });
+
+ const exported = spawnSync(process.execPath, [
+ path.join(DESKTOP, 'scripts', 'export-project.mjs'), projectDir(id),
+ '--platform', target, '--out', out,
+ ], { encoding: 'utf8', cwd: ROOT });
+
+ if (exported.status !== 0) {
+ results.push({ id, target, stage: 'package', ok: false, why: (exported.stderr || exported.stdout || '').trim().slice(-300) });
+ console.log(`✗ ${id} ${target} — package failed`);
+ continue;
+ }
+
+ const launch = spawnSync('npx', [
+ 'electron', path.join('scripts', 'launch-export.mjs'),
+ '--dir', out,
+ ...(SHOTS ? ['--out', path.join(SHOTS, `${id}-${target}.png`)] : []),
+ ], { encoding: 'utf8', cwd: DESKTOP });
+
+ const line = (launch.stdout || '').split('\n').find((l) => l.startsWith('✓') || l.startsWith('✗')) ?? '';
+ const ok = launch.status === 0;
+ results.push({ id, target, stage: 'launch', ok, why: ok ? '' : (line || (launch.stdout || launch.stderr || '').trim().slice(-300)) });
+ console.log(`${ok ? '✓' : '✗'} ${id} ${target}${ok ? '' : ` — ${line || 'launch failed'}`}`);
+ if (!ok) for (const l of (launch.stdout || '').split('\n').slice(-6)) if (l.trim()) console.log(` ${l}`);
+}
+
+const bad = results.filter((r) => !r.ok);
+console.log(`\ngolden ${TIER}: ${results.length - bad.length}/${results.length} pair(s) packaged and launched`);
+for (const d of deferred) console.log(` deferred: ${d}`);
+if (bad.length) {
+ for (const b of bad) console.log(` ✗ ${b.id} ${b.target} (${b.stage})`);
+ process.exit(1);
+}