Skip to content

Commit 1e65362

Browse files
committed
test(signals): land the extracted pin's flights by hand, not by timer
CI's coverage run (slower than a plain run) let m1's 10 ms lane flight land before the pin's 2 ms sleep ended, so the later write came after the landing and the run asked m1:220 where the pin expects m1:125. The pin compared two timings, not two behaviours. m1's flights now land only when the test lands them, so the later write always comes while the write's flights are up. The pin's expectations are unchanged (D-25, D-22, F-6, F-9), and it still fails on ee0b535's source in all three reader shapes (the m1:220, m1:120, m1:220 triple ask). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_015hPxMkC3jg3Uivh65gvaf2
1 parent bf4d14f commit 1e65362

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

‎packages/signals/tests/verdict-memo-flight-no-reask.test.ts‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,16 @@ it("held write, refresh mid-hold: every shape shows m1's lane answer", async ()
350350
// again (F-9: a re-ask of the same question is no new question). A later
351351
// write before the landing is a new question, asked once.
352352
async function extracted(reader: "value" | "pair" | "split", second: boolean, inline = false) {
353+
// Flights land only when the test lands them, so the later write always
354+
// comes while the write's flights are up, at any runner speed.
355+
const flights: (() => void)[] = [];
356+
const land = async () => {
357+
for (let i = 0; i < 8; i++) {
358+
flights.splice(0).forEach(f => f());
359+
await sleep(0);
360+
flush();
361+
}
362+
};
353363
const [s, setS] = createSignal(1);
354364
const [u, setU] = createSignal(0);
355365
const asks: string[] = [];
@@ -360,7 +370,7 @@ async function extracted(reader: "value" | "pair" | "split", second: boolean, in
360370
const m1 = createMemo(() => {
361371
const q = v() * 10 + s() * 100 + u();
362372
asks.push(`m1:${q}`);
363-
return sleep(10).then(() => q);
373+
return new Promise<number>(r => flights.push(() => r(q)));
364374
});
365375
createLoadingBoundary(
366376
() => {
@@ -383,18 +393,17 @@ async function extracted(reader: "value" | "pair" | "split", second: boolean, in
383393
return dispose;
384394
});
385395
flush();
386-
await settle();
396+
await land();
387397
asks.length = 0;
388398
setS(2);
389399
flush();
390400
if (second) {
391-
await sleep(2);
401+
await sleep(0);
392402
flush();
393403
setU(5);
394404
flush();
395405
}
396-
await settle();
397-
await settle();
406+
await land();
398407
dispose();
399408
return { asks, values };
400409
}

0 commit comments

Comments
 (0)