diff --git a/docs/roadmap.md b/docs/roadmap.md index d123108..fb43f93 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1478,6 +1478,14 @@ principles named were durable, accurate and reactive. Found in rally 0x7 by plus slots; a waiting directory that exists while `/proc/locks` can't be read, or a `--queue` that isn't there, is a blind spot ("can't see the queue"), never 0 waiting; with unit tests and a CLI test with real `flock` holders (docs/stalls.md). +- [ ] **RAL-190: The board-ages browser test raced the board's first draw.** From the watchman (2026-11-14): hosted + `check` on PR #275 failed once at the_board_keeps_its_ages_current_and_shows_commits_short with `before: []`. + The cause: the board draws from the page's own fetch of /api/status, which the load event the harness waits on + doesn't wait for; on Murph the draw beat the probe by about 20 ms, and on a loaded runner it lost. The page + was right (no ages before it has read any), so the fix is in the harness. Done when: tests/browser/sign-in.mjs + waits, before any probe, up to 20 s for the board's first draw (`drawnAt`) or the page's own warning, and says + which as `firstDraw`; the ages test asserts "drawn"; and with the page's first /api/status held for 600 ms and + 3 s (a local CDP hold, not committed) the test, which failed as on CI before, passes. - [ ] **RAL-189: Test scripts written without "Text file busy".** From hosted CI on PR #275 (2026-11-14): `levi::tests::output_held_open_after_levi_exits_doesnt_outlast_the_deadline` failed with ETXTBSY (os error 26) running its fake levi. A test wrote the script with `std::fs::write` and ran it, and another thread's diff --git a/tests/browser/sign-in.mjs b/tests/browser/sign-in.mjs index 1afb5b6..39bc3af 100644 --- a/tests/browser/sign-in.mjs +++ b/tests/browser/sign-in.mjs @@ -365,6 +365,23 @@ const after = await evaluate(`(async () => { // each emulated prefers-color-scheme as well, printed as `probes` by scheme (RAL-91). let probe; let probes; +// RAL-190: the board draws from the page's own fetch of /api/status, which the load event doesn't wait +// for, so a probe begun at once could read a board not yet drawn. On Murph the first draw beat the +// probe by about 20 ms; on a loaded hosted runner it lost (PR #275: the ages probe read no ages, then +// five 2.5 s later). The page was right: it can't show ages before it has read any. So before any +// probe, wait up to 20 s for the page's first answer to be shown, a drawn board (`drawnAt`, set once +// `show` has drawn) or its own warning that it couldn't read or draw one, and say which. +let firstDraw; +if (process.env.RALLY_BROWSER_PROBE) { + firstDraw = await evaluate(`(async () => { + if (typeof drawnAt === "undefined") return "not the board"; + const until = Date.now() + 20000; + while (drawnAt === null && freshnessProblem === null && Date.now() < until) { + await new Promise((r) => setTimeout(r, 50)); + } + return drawnAt !== null ? "drawn" : freshnessProblem !== null ? "the page's warning: " + freshnessProblem : "none within 20 s"; + })()`); +} if (process.env.RALLY_BROWSER_PROBE) { const { readFileSync } = await import("node:fs"); const expression = readFileSync(process.env.RALLY_BROWSER_PROBE, "utf8"); @@ -389,4 +406,4 @@ if (process.env.RALLY_BROWSER_RELOAD_PROBE) { reloaded = await evaluate(expression); } clearTimeout(timer); -finish(0, { codePage, after, probe, probes, reloaded }); +finish(0, { codePage, after, firstDraw, probe, probes, reloaded }); diff --git a/tests/web.rs b/tests/web.rs index 82fed64..96d1c8e 100644 --- a/tests/web.rs +++ b/tests/web.rs @@ -1622,6 +1622,8 @@ fn the_board_keeps_its_ages_current_and_shows_commits_short() { let seen = in_browser(&viewer, &chrome, Some(probe)); let probe = &seen["probe"]; assert_eq!(seen["after"]["status"], 200, "{seen}"); + // RAL-190: the probe starts once the board has drawn, so its first read has the ages to read. + assert_eq!(seen["firstDraw"], "drawn", "{seen}"); // Some age moved on by itself between polls, with nothing redrawn. let before = probe["before"].as_array().unwrap(); let after = probe["after"].as_array().unwrap();