Repository navigation
fix(js-render): pass the ready-signal timeout in Playwright's options slot - #12248
Merged
Merged
Conversation
… slot
`page.waitForFunction(fn, { timeout: 2500 })` hands the options object to
the page function as its argument, so the wait fell through to Playwright's
30 s default on every snippet that never sets `window.__anyplotReady`
(1,250 of the 1,294 JavaScript implementations). The options now sit in
the third slot. Measured on bar-basic/chartjs: 30.8 s before, 3.2 s after,
pixel-identical PNG.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The reviewed changes have no unresolved issues that would block approval.
No open issues 🎉
What changed in this PR
This pull request fixes the JavaScript render harness so Playwright applies the intended 2.5-second ready-signal timeout instead of the 30-second default.
Changes:
- Corrects the
waitForFunctionargument order by passingnullbefore the timeout options. - Documents the timeout fix and resulting render-time improvement.
| File | Description |
|---|---|
changelog.d/js-render-ready-timeout.md |
Documents the JavaScript render timeout correction and performance benefit. |
automation/js-render/render.mjs |
Corrects the Playwright timeout argument placement for render readiness. |
Review effort: Lite
…dy signal Only a snippet whose source names window.__anyplotReady, or the React entry, can ever set the signal; every other snippet idled through the 2.5 s timeout before the fonts-ready fallback ran. The harness now settles those directly. Measured on bar-basic: chartjs 1.6 s (was 3.2 s after the first commit, 30.8 s on main), echarts 3.1 s (was 31.0 s), muix 0.75 s; PNGs pixel-identical. Suggested by the Gemini Flash review. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
page.waitForFunction(fn, { timeout: 2500 })inautomation/js-render/render.mjsput the options object in Playwright's argument slot, so every snippet that never setswindow.__anyplotReady(1,250 of the 1,294 JavaScript implementations) waited through the 30 s default before the fonts-ready fallback ran.waitForFunction(fn, null, { timeout: 2500 }), and a snippet that cannot send the signal at all (its source does not name__anyplotReadyand it is not the React entry) settles directly instead of idling through the 2.5 s timeout. Same fallback, same screenshot, same checks.Plan
N/A
Test plan
plots/bar-basic/implementations/javascript/{chartjs.js,echarts.js,muix.tsx}rendered with the harness frommainand from this branch, PNGs compared withImageChops.difference(bboxNone= identical, 3200×1800):finishedhandler)Note: the ECharts snippet runs into the 2.5 s timeout on both versions, so its
chart.on("finished")signal never fires underanimation: false; the PNG is identical either way. The 44 snippets that name the signal therefore still pay up to 2.5 s; a follow-up could fire the signal from the harness after ECharts'finishedor drop the handler contract. Not changed here.uv run python -m tools.changelog check --base origin/mainpasses.CI job "Build renderer image and render through the harness" green on the first commit; re-run on this head.
Gemini 3.8 Flash first review: verdict "sound with changes"; its one finding (skip the wait when the signal cannot arrive) is applied in the second commit. Copilot next.