Skip to content

fix(ci): the CDN smoke test retries a page that never goes idle and names the request that hung - #8733

Merged
cixzhang merged 6 commits into
meta:mainfrom
vjeux:uikit/c01-cdn-smoke-retry
Oct 27, 2026
Merged

cixzhang merged 6 commits into
meta:mainfrom
vjeux:uikit/c01-cdn-smoke-retry

Conversation

@vjeux

@vjeux vjeux commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Maintainer impact

A pull request's smoke-test job goes red when one CDN starter-page request hangs at jsDelivr or esm.sh: page.goto waits 90 s for network idle, throws TimeoutError, 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.
  • renderPage tracks requests that neither finished nor failed. On a navigation timeout it returns timedOut with those URLs instead of throwing, which isCleanRender counts as unclean, so it is retried. Any other navigation error still throws.
  • The attempts share the step's one 90 s wait: renderUntilClean gives 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.
  • Nothing is hidden: the script prints what made a retried attempt unclean (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

  • Failure before the change: the new tests fail on the moved, unchanged code with the run's TimeoutError, in Chromium against a local page whose module never answers and with Playwright's page events alone.
  • Success after the change: they pass. With a never-answered module in the real starter page and a 9 s budget, the script retries with 4 s left and reports still in flight: …/stall.js at 9.0 s; a hang that clears on the retry prints under the retry line.
  • Product/runtime behavior verified unchanged: the real script renders 0.7.4 clean end to end; no package file changes.

Scope

  • No intended public API, product behavior, visual direction, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

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, after npx playwright install chromium: 19 pass. At 08fab64 5 fail with TimeoutError; 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.
  • Failure injection: a copy of the script with a never-answered /stall.js module and a 9 s render budget retries once, then fails naming that request inside the budget.
  • pnpm check:changesets; pnpm check:knowledge.

vjeux added 2 commits October 27, 2026 11:46
…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.
@vercel

vercel Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 27, 2026 8:22pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 27, 2026, 8:41 PM UTC

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 27, 2026

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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()}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

vjeux added 2 commits October 27, 2026 12:25
…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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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]

vjeux added 2 commits October 27, 2026 13:07
…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.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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]

@cixzhang
cixzhang merged commit fcf4d7f into meta:main Oct 27, 2026
62 checks passed
@vjeux
vjeux deleted the uikit/c01-cdn-smoke-retry branch October 27, 2026 21:36
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
vjeux added a commit to vjeux/astryx that referenced this pull request Oct 27, 2026
…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.

This branch was successfully deployed

1 active deployment
Preview — 05c04a07 Deployed Oct 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants