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 cooked check measured the round trip, not the world

esenginea2058bc55b73
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a166fe8c9..0b40bea12 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,6 +74,21 @@ published separately; it ships inside the editor.
and the software rasterizer agree on all four to the byte.
+- **The cooked-build check was failing about two runs in three, and the reason
+ looked like arithmetic.** `verify:cooked` — an exit criterion, and a gate on
+ every PR — steps a fixture 60 fixed frames in a compiled build and in an
+ interpreted one and compares the displacements to a part in 100,000. It reads
+ the two probes from separate `executeJavaScript` calls, and `stepFrames` puts
+ the game's loop back on rAF before it resolves (deliberately: a frame begun
+ inside its own microtask drain swallows an injected input edge). So real frames
+ landed between the two readings.
+
+ Measured across runs, either side came back 0.00, 0.02 or 0.03 units long at
+ random, against a 0.001 tolerance — neither build systematically ahead, which
+ is what says it is the clock and not the code. Reading it inside ONE expression
+ puts the continuation on the microtask queue, where no frame can run: five runs
+ now agree to 4e-5, where before they scattered.
+
- **`check-verifier-owners` — a checker nobody runs is a checker that rots.**
`check-release-gate` holds one direction: every exit criterion has something
answering it. Nothing held the other, and `verify:aot` fell through it — a
diff --git a/tools/launchers/headless-cooked-verify.mjs b/tools/launchers/headless-cooked-verify.mjs
index deef39dd0..bd2760db2 100644
--- a/tools/launchers/headless-cooked-verify.mjs
+++ b/tools/launchers/headless-cooked-verify.mjs
@@ -64,9 +64,17 @@ async function waitForHook(exec) {
* comparison built on it measures the runner.
*/
async function drift(exec, diag) {
- const before = await exec("window.__estellaCooked.probe(['Drifter']).at.Drifter");
- await exec('window.__estellaCooked.step(60, 1/60)');
- const after = await exec("window.__estellaCooked.probe(['Drifter']).at.Drifter");
+ // ONE round trip. `stepFrames` puts the loop back on rAF before it resolves, so
+ // a second `executeJavaScript` reads after some of those frames — measured,
+ // either side came back 0.00, 0.02 or 0.03 long at random against 0.001.
+ const both = await exec(`(async () => {
+ const c = window.__estellaCooked;
+ const before = c.probe(['Drifter']).at.Drifter;
+ await c.step(60, 1 / 60);
+ return { before, after: c.probe(['Drifter']).at.Drifter };
+ })()`);
+ const before = both?.before;
+ const after = both?.after;
if (!before || !after) { diag.push(`no Drifter in the world (before=${!!before} after=${!!after})`); return null; }
return { x: after.x - before.x, y: after.y - before.y };
}