Repository navigation
fix(runtime-gate): decode screenshots without pngjs's sync reader, which Node 27 breaks - #27
Conversation
…ich Node 27 breaks Node 27.0.0-alpha.0.0.0 (now what setup-node's `current` resolves to) turned zlib's stream constructors into ES classes and ended DEP0184 (nodejs/node#64849). pngjs 7.0.0, the latest release, subclasses zlib.Inflate in PNG.sync.read with zlib.Inflate.call(this), so every visual diff threw "Class constructor Inflate cannot be invoked without 'new'" and the crawl exited 2 without writing its report. - crawl.mjs: read screenshots with pngjs's streaming parser, which only calls zlib.createInflate. diff() is async. - The visual diff is advisory, so a screenshot that cannot be compared is now a non-blocking visual-diff-failed warning instead of a crash, and the summary says so instead of "No visual changes". - upgrades.test.mjs: the baseline re-run checks its exit status first (so a crash shows its stack, not "Cannot read properties of null") and that no screenshot failed to decode. - toolkit.test.mjs: an undecodable baseline is a warning, not a crash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnrFoVjnwYcx5eNVMisBw8
|
TanksterAI is on CodeRabbit Free, which includes PR summaries. Ask your admin to upgrade for code reviews.
Summary
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Apprentice, the PNG streams unfold,
|
Independent Claude reviewReviewed at The core fix is correct. On Node 27, Two things in the async path need fixing first. They are small. BlockersNone. Should fix1. pngjs's async parser can still crash the crawl, so the new try/catch does not always hold.
2. No test shows that a real visual change is still reported, so a breakage would now hide silently.
Nits
Checked and fine
Tests run here
CI
Verdict: FIX FIRSTThe Node 27 fix is right and CI proves it. Fix should-fix 1 (one line plus a fixture test) and should-fix 2 (one positive visual-change test) before merging. Then do the pin-bump follow-up as planned. 🤖 Generated with Claude Code |
…hanges still report From the independent review of #27: - readPng(): pngjs's streaming parser never listens for errors on its internal row filter, so a PNG whose pixel data is shorter than its header says, or has a bad filter byte, raised an unhandled 'error' and killed the crawl with no report. Those errors now go through the parser's own error path and reject. This reaches into pngjs internals; package.json pins pngjs at exactly 7.0.0 and the comment says so. - The catch now covers decoding and comparing only. A change that was found stays a change even if saving its diff image fails (that is a separate visual-diff-image-failed warning). - The summary shows how many screenshots could not be compared even when changes were found. - toolkit.test.mjs: the undecodable-baseline test now also uses two small inline PNGs (short pixel data, bad filter byte) that get past the header. A new test overwrites the baseline with a solid black PNG and checks the change, its diff image and no visual-diff warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnrFoVjnwYcx5eNVMisBw8
|
Thanks for the review. I've addressed the Independent Claude review in 050182a. Should fix 1: row-filter errors crash the crawl. Fixed in
Should fix 2: a real visual change must still be reported. Added "a real visual change against the baseline is still reported, with its diff image".
Nits
Tests (Node 22.23.4, Chrome for Testing 153 via CI on 050182a (run 42360119875):
Blob SHAs, all verified against the branch tree:
🤖 Generated with Claude Code |
Independent Claude review (round 2)Reviewed at Round-1 findings
Probes re-run against the PR's exact
|
…ots on Node 27 The four runtime-gate toolkit refs move from 7e22b13 to 087cbb6 (#27): three in runtime-gate.yml, one in runtime-gate-flows.yml. At 7e22b13 the crawl dies in pngjs's PNG.sync.read on Node 27 as soon as a visual baseline exists, which is why runtime-gate-selftest's e2e jobs are red on main. The action's inputs are unchanged between the two commits, so nothing else moves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnrFoVjnwYcx5eNVMisBw8
Moves the four runtime-gate toolkit pins from 7e22b13 to 087cbb6, the squash merge of #27, so the reusable workflow stops crashing in pngjs's PNG.sync.read on Node 27. runtime-gate-selftest is green end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TnrFoVjnwYcx5eNVMisBw8
What
The runtime-gate toolkit (
.github/actions/runtime-gate) no longer usesPNG.sync.readto decode screenshots for the visual diff. It uses pngjs's streaming parser instead. A screenshot that cannot be compared is now a non-blockingvisual-diff-failedwarning, not a crash.Files:
src/crawl.mjs,test/upgrades.test.mjs,test/toolkit.test.mjs. No dependency changes.Why
runtime-gate-selftesthas been red onmainand on #26 since the runners started getting Nodev27.0.0-alpha.0.0.0. That is whatactions/setup-nodewithnode-version: currentnow resolves to (run 42341698574). The last green run (37964786788, 9 Oct) used Nodev26.11.1, with the same toolkit code.lib/sync-inflate.js:18subclasses the old way, withzlib.Inflate.call(this, opts).PNG.sync.readuses it for every non-interlaced PNG, so it now throwsTypeError: Class constructor Inflate cannot be invoked without 'new'.crawl.mjscalledPNG.sync.readindiff(). The exception escapedmain(), the crawl exited 2 and wrote nocrawl.json.diff()runs and crashes. On 9 Oct there was no baseline yet, so the diff never ran.upgrades.test.mjscrashed the same way.again.reportwasnull, so line 129 failed with "Cannot read properties of null (reading 'baseline')". The other 17 tests passed.pngjs's streaming parser (
new PNG().parse()) only callszlib.createInflate. Its stream base is the legacyStreamfunction, which is still a function in Node 27 (lib/internal/streams/legacy.jsat the v27 tag). The legacyzlib.Z_*constants it reads are still exported.PNG.sync.writeuseszlib.deflateSync, which is fine.How it is safe
errorevent is absorbed, so it cannot become an unhandled exception.How it was tested
Node 27 itself could not be installed in my sandbox (nodejs.org is blocked there). So I reproduced the Node 27 behaviour on Node 22.23.4 (LTS) with a
--requirepreload that swapszlib.Inflateand friends for ES-class subclasses, which is exactly what #64849 did. With that preload, the old code fails with the sameTypeErrorand the same "reading 'baseline'" test failure. Without it, the old code passes.The browser was the local Chrome for Testing via
RG_CHROMIUM_PATH, because Playwright's CDN is blocked in my sandbox. CI uses Playwright's own Chromium.On this PR, the Toolkit self-test job runs
npm testfrom this branch on the runner's Node 27, so that is the real Node 27 check.What is left for later
runtime-gate.ymlfrom this repo, and it pins the toolkit at7e22b13255bfa7fadfdec580fc41a359985b0b61. So those two jobs stay red on this PR until the pin moves. After this merges, a follow-up PR should change all four refs to the new commit (the squash-merge commit onmain): three in.github/workflows/runtime-gate.ymland one in.github/workflows/runtime-gate-flows.yml. The ref to change isTanksterAI/.github/.github/actions/runtime-gate@7e22b13255bfa7fadfdec580fc41a359985b0b61. Once that merges, feat(light-lane): Docker-free shared jobs on the run-bound Cloud Run lane, with a lint that keeps them Docker-free #26 needs its base merged in (or a re-run) to go green.node-version: currentnow picks up Node's new Alpha channel (27.0.0-alpha.0.0.0). The self-test uses it on purpose, and the toolkit's own fallbacksetup-nodedoes too. Whether CI should run a pre-release Node is a separate decision.zlib.Inflate.call(this)pattern upstream to pngjs, which hasn't had a release since 2023.🤖 Generated with Claude Code
https://claude.ai/code/session_01TnrFoVjnwYcx5eNVMisBw8