Skip to content

fix(js-render): pass the ready-signal timeout in Playwright's options slot - #12248

Merged
MarkusNeusinger merged 3 commits into
mainfrom
fix/js-render-ready-timeout
Oct 23, 2026
Merged

MarkusNeusinger merged 3 commits into
mainfrom
fix/js-render-ready-timeout

Conversation

@MarkusNeusinger

@MarkusNeusinger MarkusNeusinger commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • page.waitForFunction(fn, { timeout: 2500 }) in automation/js-render/render.mjs put the options object in Playwright's argument slot, so every snippet that never sets window.__anyplotReady (1,250 of the 1,294 JavaScript implementations) waited through the 30 s default before the fonts-ready fallback ran.
  • The options now sit in the third slot, waitForFunction(fn, null, { timeout: 2500 }), and a snippet that cannot send the signal at all (its source does not name __anyplotReady and it is not the React entry) settles directly instead of idling through the 2.5 s timeout. Same fallback, same screenshot, same checks.
  • Found by the Highcharts 13 before/after pass (chore(js): bump Highcharts to 13.1.1 #12246): a full catalogue render of one library took about 22 minutes at 16 parallel, almost all of it in this wait.

Plan

N/A

Test plan

  • plots/bar-basic/implementations/javascript/{chartjs.js,echarts.js,muix.tsx} rendered with the harness from main and from this branch, PNGs compared with ImageChops.difference (bbox None = identical, 3200×1800):

    Snippet Signal path main this branch
    chartjs (no signal) settle directly 30.8 s 1.6 s
    echarts (finished handler) wait, then settle 31.0 s 3.1 s
    muix (React entry) wait, signal arrives — 0.75 s

    Note: the ECharts snippet runs into the 2.5 s timeout on both versions, so its chart.on("finished") signal never fires under animation: 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' finished or drop the handler contract. Not changed here.

  • uv run python -m tools.changelog check --base origin/main passes.

  • 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.

… 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
Copilot AI lite review requested due to automatic review settings October 23, 2026 06:35
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza

Copilot AI 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.

🟢 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 waitForFunction argument order by passing null before 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
@MarkusNeusinger
MarkusNeusinger merged commit dcfca8c into main Oct 23, 2026
13 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the fix/js-render-ready-timeout branch October 23, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants