Repository navigation
Catch Issues Decoding PNGs - #155
Conversation
✅ Visual Diff Approved❌ Visual Diff Report — FAILED288 images compared: 270 different · 18 added DetailsDifferences (270)
Added Files (18)
Generated by visual-differ at 2026-11-09T22:19:39.695Z View the report. |
These type of errors shutdown the differ and leave us with no useful report. Catch them instead and output the error info.
3041b17 to
a5d30b7
Compare
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟢 Approval recommended
The change consistently converts PNG decode failures into structured comparison outcomes, updates both HTML/Markdown reporting to surface those details safely, and adds expanded unit plus screenshot coverage with fixtures for corrupted/truncated inputs.
No open issues 🎉
What changed in this PR
This pull request makes the visual differ resilient to corrupted/truncated/non-PNG “.png” inputs by catching PNG decode failures and surfacing them as structured, reportable results instead of crashing the run.
Changes:
- Introduce a dedicated PNG decoding error type and propagate decode failures as structured comparison outcomes.
- Update HTML + Markdown report generation to display PNG decoding error details and avoid rendering diff images when decoding fails.
- Expand unit and screenshot tests and add fixtures/samples to cover corrupted/truncated PNG scenarios.
Approval Readiness Assessment
This pull request requires changes.
| File | Summary |
|---|---|
test/visual-differ.test.ts |
Updates expectations so invalid PNGs don’t crash the run and are reported; some assertions currently depend on exact decoder error strings. |
test/report-generator.test.ts |
Adds/updates coverage for HTML report rendering for PNG decoding error rows. |
test/png-file-pair-factory.test.ts |
Adds decode-failure coverage; some assertions currently depend on exact decoder error strings. |
test/markdown-report-generator.test.ts |
Adds/updates Markdown output coverage for PNG decoding error notes; includes exact-string assertions. |
test/helpers/test-utils.ts |
Adds helpers/fixtures to support corrupted/truncated PNG cases and expected result shapes. |
templates/report.html |
Updates report UI to display PNG decoding error details. |
screenshot-tests/report.test.ts |
Updates Playwright coverage for the report UI; includes assertions tied to exact decoder error strings. |
samples/candidate/corrupted-candidate.png |
Adds a corrupted “.png” sample to exercise decoding-failure behavior end-to-end. |
package.json |
Formatting-only change. |
lib/visual-differ.ts |
Converts PNG decode failures into structured comparison results so the run can complete and be reported. |
lib/report-generator.ts |
Plumbs decoding-error metadata into HTML report data and suppresses diff-image rendering when decoding fails. |
lib/png-file-pair-factory.ts |
Wraps PNG decoding failures into a dedicated error type for higher-level handling/reporting. |
lib/markdown-report-generator.ts |
Adds PNG decoding error notes to Markdown output and refactors note generation. |
lib/image-comparer.ts |
Extends comparison result data to carry optional PNG decoding error details. |
lib/errors.ts |
Adds PNG decoding error type(s); naming between pngDecodingFailure vs pngDecodingError is currently inconsistent. |
Review effort: Balanced
These type of errors shutdown the differ and leave us with no useful report. Catch them instead and output the error info.
See https://github.com/ilios/ember-simple-charts/actions/runs/42475065372/job/129449286737?pr=1507 for an example.