Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions smoke/nudge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { watch } from './support/carnival';
* page's clock is moved on rather than waited out, so the test stays quick.
*/

/** How long a square's frame may take before it is stopped: HANG_MS in src/northpole/frame.ts. */
const DRAW_BUDGET_MS = 1000;

/** Opens the map at jedi4ever's booth, goes in with E, lingers, and comes back out. */
async function enjoyABooth(page: import('@playwright/test').Page) {
await page.clock.install();
Expand All @@ -19,6 +22,10 @@ async function enjoyABooth(page: import('@playwright/test').Page) {
await expect(page).toHaveURL(/#\/booth\/jedi4ever$/);
// Inside for real, so the time moved on counts as time spent in the booth.
await expect(page.locator('.map-frame')).toHaveAttribute('data-visiting', 'booth:jedi4ever');
// The page's clock is every square's too, and a square stopped when its frame took over
// DRAW_BUDGET_MS can't tell a jump from a hang. So each frame asked for before the jump gets
// its whole budget of real time first: going inside is when the page is busiest.
await page.waitForTimeout(DRAW_BUDGET_MS + 250);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Advisory · Pre-existing · The fixed delay leaves the clock-jump race active

At smoke/nudge.spec.ts:25–29, waiting 1,250 ms does not give every pre-jump draw its full real-time budget. While inside the booth, map-frame.ts:48–51 continues scheduling draws, and sandbox-messages.ts:81–89 permits another request once the preceding reply has arrived. A request issued near the end of the delay can therefore still be pending when fastForward advances 65 seconds. Its active 1,000 ms watchdog in frame.ts:61–70 can stop a healthy worker before its reply is processed; the resulting console error is collected by watch() and fails the first test's problems assertion. This race was also possible before the change: the delay reduces entry-time contention but does not eliminate outstanding work as the new comment claims. A safe boundary must account for requests issued during the wait and their outstanding replies, rather than elapsed time alone.

Pre-existing: this is in code the change does not modify, so it is not blocking.

Craft · Maintainability And Code Quality · Markdown

await page.clock.fastForward('01:05');
await page.keyboard.press('Escape');
await expect(page.locator('.visit')).toHaveCount(0);
Expand Down