Keep a clip that starts later playing at its first frame

The e2e 68 check "a clip that starts later" was red in 3 of the last
8 suites (CI tasks 697, 703, 712). Two causes sat on top of each other.

- The check measured too late. It started sampling after play(), and
  under CI load the clock was already at 0.05 to 0.22 s. It now starts
  before the click, like 68d does.
- Measured early, a real bug showed: the video held for one frame at
  its first picture. The first picture triggers a redraw, and the game
  takes its first step in the same frame. readSpeed got both calls with
  the same frame time and divided by 1 ms. The speed came out at 16.7x,
  which counted as a jump, so the player paused.
- readSpeed now measures a step without elapsed wall time against one
  frame at 60 fps. A real jump still counts as a jump.
- e2e 34 "the pause holds the stream" also failed in task 712. Its
  cause is still open. The failure message now names the state before
  the pause, so the next red run shows where the samples got lost.

Tests:
- video-follow.test.ts 18/18, the new test is red without the fix
- e2e 68 on melektaus-atx: ALL PASSED, 21 checks
- Gate on melektaus-atx: CHECK EXIT 0, 314 files, 4853 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-16 08:40:11 +02:00
1 parent 0d7672a5af
commit 5b9d084dfe
4 files changed
+42 -12

No files matched your search

+9 -1
View File
@@ -3986,7 +3986,15 @@ export async function sound(t) {
resumedLong.streaming.skipped === 0 &&
stoppedLong.streaming.playing === 0 &&
stoppedLong.playing === 0,
JSON.stringify({ paused, pausedLater, resumedLong: resumedLong.streaming, stoppedLong }),
// Held before the pause too: it tells a stream that fell behind from the start from one the
// pause made lose its place (CI task 712).
JSON.stringify({
held: heldStreamed.streaming,
paused,
pausedLater,
resumedLong: resumedLong.streaming,
stoppedLong,
}),
);
// The counter-proof: Stream off, the game plays it decoded, and the renderer holds all of it.
+18 -10
View File
@@ -244,20 +244,28 @@ export async function composition(t) {
const p = __gm.state.project;
p.assets.find((a) => a.id === 'cp68-video').clips = [{ id: 'cp68-late', name: 'Late', props: { start: 0.8, end: 0 } }];
p.assets.find((a) => a.id === 'cp68-screen').props.texture = 'cp68-late';`);
await play();
const rows = JSON.parse(
await evaluate(`new Promise((done) => {
const rows = [];
// Sampled from before the click on Play, as in 68d: under load play() settles after the wait is
// over, and the first row was drawn already with the clock running (CI tasks 697, 703, 712).
await evaluate(`{
const rows = [];
const until = performance.now() + 20000;
window.cp68Rows = new Promise((done) => {
const step = () => {
const player = __gm.gameVideo('${id('v')}');
rows.push({ time: ${clock}, drawn: __gm.gameDrawnRect('${id('v')}') !== null,
at: player?.time ?? null, paused: player?.paused ?? null });
if (rows.length >= 240 || !__gm.world()) return done(JSON.stringify(rows));
if (__gm.state.mode === 'play' && __gm.world()) {
const player = __gm.gameVideo('${id('v')}');
rows.push({ time: ${clock}, drawn: __gm.gameDrawnRect('${id('v')}') !== null,
at: player?.time ?? null, paused: player?.paused ?? null });
}
if (rows.length >= 240 || (rows.length > 0 && !__gm.world()) || performance.now() > until)
return done(JSON.stringify(rows));
requestAnimationFrame(step);
};
step();
})`),
);
});
null;
}`);
await play();
const rows = JSON.parse(await evaluate('window.cp68Rows'));
const first = rows.findIndex((row) => row.drawn);
const moving = rows.filter((row) => row.drawn && row.time > 0).slice(0, 3);
check(