Repository navigation
fix(ci): the CDN smoke test retries a page that never goes idle and names the request that hung - #8733
Conversation
…hole run on a navigation timeout cdn-template-smoke-test.mjs's render() and its retry loop move unchanged to .github/scripts/lib/cdn-page-render.mjs (renderPage, isCleanRender, renderUntilClean), with the navigation and button timeouts as options, so they can be tested. The tests fail on that unchanged code: - with Playwright's page events and no browser (cdn-page-render.test.mjs): a navigation that times out escapes renderPage as a TimeoutError, so renderUntilClean never retries it and nothing names the request that kept the page from going idle; - in Chromium against a local page whose module request is never answered (cdn-page-render.browser.test.mjs, ASTRYX_CDN_SMOKE_BROWSER=1): the same TimeoutError, the one a smoke-test run hit when a CDN request hung. A navigation error that is not a timeout still throws, and a page that goes idle and renders a button is still clean.
…ames the request that hung renderPage now treats a navigation timeout as an unclean render: it tracks the requests the page made that neither finished nor failed, and on Playwright's TimeoutError returns timedOut with those URLs (pendingRequests) instead of throwing. isCleanRender counts it as unclean, so renderUntilClean retries it once, as the script's comment always promised for a CDN blip. Any other navigation error still throws. The script's report names the timeout and every request still in flight, and skips the 'rendered no button' line it would otherwise add for a page that never finished loading.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Changes requested: the retry and the in-flight report work, but each attempt still waits the default 90 s, so a page that hangs on both attempts needs at least 180 s while the CDN step starts with only 110–197 s of the smoke-test job's 15-minute limit left in recent runs, and the job is usually stopped before the report naming the hung request prints. Passing a smaller navigationTimeoutMs from cdn-template-smoke-test.mjs (for example 45 s, so both attempts fit) or deriving it from a deadline would fix it; the new tests already fail on the moved code and pass on the head.
[Automated review]
| if (attempt < ATTEMPTS) console.log(` retry ${attempt} of ${ATTEMPTS - 1}`); | ||
| } | ||
| const result = await renderUntilClean( | ||
| () => renderPage(url, {launch: () => chromium.launch()}), |
There was a problem hiding this comment.
Each attempt here waits the 90 s default, so a page that hangs on both attempts needs at least 180 s of navigation waits. In recent smoke-test runs this step starts 703–790 s into the 15-minute job, leaving 110–197 s, so in most of them the job is stopped before the still in flight report prints. A smaller per-attempt timeout here, for example navigationTimeoutMs: 45_000, keeps both attempts inside the budget.
…adline Each attempt still waits the full 90 s for the network to go idle, so a page that hangs on both attempts takes over 180 s, while the CDN step can start with under two minutes of the smoke-test job's 15-minute limit left: the job is stopped before the report naming the hung request prints. These fail on the current head: - renderUntilClean gives each attempt an equal share of the time left before a deadline, gives the retry what the first attempt left unused, and does not retry once the deadline has passed; - renderPage waits for the navigation no longer than its budget and for the button no longer than what is left of it, and never asks Playwright for a timeout of 0 (no timeout at all); - in Chromium, two attempts at a page that never goes idle finish inside a 4 s deadline, naming the module that hung.
… the step always had renderUntilClean takes a deadline and hands each attempt an equal share of the time left (budgetMs), so the retry gets whatever the first attempt left unused, and starts no attempt once the deadline has passed. renderPage fits an attempt in its budget: the navigation waits no longer than the budget and the button no longer than what is left of it, never 0, which Playwright reads as no timeout. The script gives both attempts together the 90 s its one navigation wait always had, so the retry adds no time to the step and a page that hangs on both still prints the report naming the request that hung before the smoke-test job's 15-minute limit stops it; the retry line says how long is left.
There was a problem hiding this comment.
Recommending approval: a navigation that never goes idle is now retried once inside the step's existing 90 s wait and then reported with the requests still in flight, so a page that hangs on both attempts prints its report before the smoke-test job's 15-minute limit. The new tests fail on the moved, unchanged code and on the previous revision's module, and pass here, including both Chromium tests. Optionally, refresh the description: it still says the render loop moved unchanged and counts 7 tests, and it does not mention that the first attempt now waits at most 45 s.
[Automated review]
…d, not a retried attempt Two places still turn an error into silence, and these fail on the current head: - renderPage reads the first button with .catch(() => null), the line moved unchanged from the script, so a crashed page or a closed target reads as 'rendered no button'. Only a wait that runs out means no button; any other error must throw. - renderUntilClean discards an unclean attempt when it retries, so a CDN request that hung or failed and then served on the retry leaves nothing in the log but 'retry 1 of 1'. onRetry must be handed the discarded attempt, and uncleanFindings must name everything that made a render unclean, so the script can print it. Reading no button within the wait still reports a missing button.
…ows, a retried attempt is printed renderPage turns only a wait that runs out into 'no button'; any other error from reading the button (a crashed page, a closed target) throws, as a navigation error that is not a timeout already did. renderUntilClean hands onRetry the unclean attempt it discards, and uncleanFindings names everything that made a render unclean (the timeout and each request still in flight, console and page errors, failed requests, a missing button). The script prints those findings under the retry line, so a CDN request that hung or failed and then served on the retry shows in the log instead of vanishing behind a green run. The pass and fail rules are unchanged.
There was a problem hiding this comment.
Recommending approval: a page that never reaches network idle is now retried once inside the step's existing 90 s wait and then reported with the requests still in flight, and a blip that clears on the retry still shows in the log. The new tests fail on the moved, unchanged render code and pass here, including both Chromium tests, and this revision's own smoke-test run renders the 0.7.4 starter page clean. Nothing needs to change.
[Automated review]
…odule as merged)
…ork idle Main's render module (meta#8733) still waits for network idle. The starter page imports Core through esm.sh, some 380 module requests, and one request it does not wait on (a web font) can keep the network busy long after the page has rendered, so the wait timed out on a page that works, on both attempts. The render now waits for the page's load event, which waits for the module script and every module it imports, then for the button as before. A page whose module graph never loads still times out with the hung request named. Red first: a page that loaded and rendered, then left a request open, read as a timeout and passes now; the hung-module cases pass as before.
Maintainer impact
A pull request's
smoke-testjob goes red when one CDN starter-page request hangs at jsDelivr or esm.sh:page.gotowaits 90 s for network idle, throwsTimeoutError, and the script exits on that stack trace. The retry meant for this ("so a blip at a CDN is not a red build") never runs, since the throw escapes it, and nothing names the hung request. It happened on #8657 (run); #8660, carrying the same code, passed that minute.Intended invariant
The script's contract: an unclean render is retried once, and a broken page fails saying what went wrong, before the job is stopped. A navigation that never reaches network idle is an unclean render.
Change
render()and its retry loop move unchanged to.github/scripts/lib/cdn-page-render.mjs(renderPage,isCleanRender,renderUntilClean), with the timeouts as options, so they can be tested.renderPagetracks requests that neither finished nor failed. On a navigation timeout it returnstimedOutwith those URLs instead of throwing, whichisCleanRendercounts as unclean, so it is retried. Any other navigation error still throws.renderUntilCleangives each an equal share of the time left before a deadline (the retry gets what the first left) and starts none after it. The step can start with under two minutes of the job's 15-minute limit left (176 s in that run), so two 90 s waits would be stopped before the report.uncleanFindings), so a blip that clears on the retry stays in the log. Only a wait that ran out reads as "no button" (it was.catch(() => null)); any other error throws.Evidence
TimeoutError, in Chromium against a local page whose module never answers and with Playwright's page events alone.still in flight: …/stall.jsat 9.0 s; a hang that clears on the retry prints under the retry line.Scope
Testing
pnpm vitest run --project node .github/scripts: 1,401 pass, 2 skip (the browser tests, gated like the repo's other*.browser.test.mjs).ASTRYX_CDN_SMOKE_BROWSER=1 pnpm vitest run --project node .github/scripts/lib/cdn-page-render.test.mjs .github/scripts/lib/cdn-page-render.browser.test.mjs, afternpx playwright install chromium: 19 pass. At 08fab64 5 fail withTimeoutError; at b98ad86 the 6 deadline cases fail; at 6d8ae99 the crashed button read and the discarded attempt fail.node .github/scripts/cdn-template-smoke-test.mjs: renders 0.7.4 clean./stall.jsmodule and a 9 s render budget retries once, then fails naming that request inside the budget.pnpm check:changesets;pnpm check:knowledge.