[PR #2205] conformance compare: harden crash and image input error handling #2209

Open
opened 2026-11-26 21:20:25 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2205
Author: @whoalin1
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: compare-unexpected-exit2


📝 Commits (3)

  • c3b9fb6 conformance compare: report unexpected crashes as tool errors
  • 8754c9b conformance expect: report unreadable images as input errors
  • dbfcd31 conformance: reject invalid critical PNG chunk structure

📊 Changes

5 files changed (+174 additions, -9 deletions)

View changed files

➕ tests/test_conformance_compare_crash.py (+58 -0)
➕ tests/test_conformance_expect_status.py (+51 -0)
📝 tests/test_conformance_png_transparency.py (+32 -0)
📝 tools/conformance/COMPARE.md (+7 -7)
📝 tools/conformance/compare.py (+26 -2)

📄 Description

Summary

  • import traceback in tools/conformance/compare.py, so the existing catch-all can actually print the traceback and return EXIT_ERROR
  • add a regression test proving an unexpected handler crash returns/exits 2 rather than leaking as Python exit 1, the documented pixel-mismatch code

Item: TEST-CONFORMANCE-COMPARE-TRACEBACK

This carries forward the still-uncarried fix in old-pr/9848, originally written by David, reapplied and verified on current main.

Tests

Under the local machine coordination lock:

  • before the one-line fix, the new test fails with NameError: name 'traceback' is not defined and the script-level path exits 1
  • after the fix: python -I tests/test_conformance_compare_crash.py — 2 tests, OK
  • python -m compileall -q tools/conformance/compare.py tests/test_conformance_compare_crash.py — pass
  • git diff --check — pass

No game files, renderer or GPU.

AI-assisted with Devin.

Consolidated conformance hardening

This branch now also includes the two conformance-compare fixes formerly opened as #2212 and #2213:

  • expect returns input-error exit 2 for unreadable, missing, or corrupt images instead of reporting them as ordinary pixel mismatches;
  • PNG parsing rejects invalid critical chunk structure before scanning image data.

The consolidated branch is the original reviewed commit plus cherry-picks 8754c9b90 and dbfcd31ab; no additional code was written during consolidation. Independent reviewers had already verified the individual fixes and reported that the overlapping compare.py branches merge cleanly together.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2205 **Author:** [@whoalin1](https://github.com/whoalin1) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `compare-unexpected-exit2` --- ### 📝 Commits (3) - [`c3b9fb6`](https://github.com/ubiquitarianism/leonida/commit/c3b9fb6403ae93cf7d68232e04fefef3af1a2fbc) conformance compare: report unexpected crashes as tool errors - [`8754c9b`](https://github.com/ubiquitarianism/leonida/commit/8754c9b90073ca9555c35bd015cfe398c8dd061e) conformance expect: report unreadable images as input errors - [`dbfcd31`](https://github.com/ubiquitarianism/leonida/commit/dbfcd31ab890482fb1f008aa9e362486a0424e63) conformance: reject invalid critical PNG chunk structure ### 📊 Changes **5 files changed** (+174 additions, -9 deletions) <details> <summary>View changed files</summary> ➕ `tests/test_conformance_compare_crash.py` (+58 -0) ➕ `tests/test_conformance_expect_status.py` (+51 -0) 📝 `tests/test_conformance_png_transparency.py` (+32 -0) 📝 `tools/conformance/COMPARE.md` (+7 -7) 📝 `tools/conformance/compare.py` (+26 -2) </details> ### 📄 Description ## Summary - import `traceback` in `tools/conformance/compare.py`, so the existing catch-all can actually print the traceback and return `EXIT_ERROR` - add a regression test proving an unexpected handler crash returns/exits 2 rather than leaking as Python exit 1, the documented pixel-mismatch code Item: TEST-CONFORMANCE-COMPARE-TRACEBACK This carries forward the still-uncarried fix in old-pr/9848, originally written by David, reapplied and verified on current main. ## Tests Under the local machine coordination lock: - before the one-line fix, the new test fails with `NameError: name 'traceback' is not defined` and the script-level path exits 1 - after the fix: `python -I tests/test_conformance_compare_crash.py` — 2 tests, OK - `python -m compileall -q tools/conformance/compare.py tests/test_conformance_compare_crash.py` — pass - `git diff --check` — pass No game files, renderer or GPU. AI-assisted with Devin. ## Consolidated conformance hardening This branch now also includes the two conformance-compare fixes formerly opened as #2212 and #2213: - `expect` returns input-error exit 2 for unreadable, missing, or corrupt images instead of reporting them as ordinary pixel mismatches; - PNG parsing rejects invalid critical chunk structure before scanning image data. The consolidated branch is the original reviewed commit plus cherry-picks `8754c9b90` and `dbfcd31ab`; no additional code was written during consolidation. Independent reviewers had already verified the individual fixes and reported that the overlapping compare.py branches merge cleanly together. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2209
No description provided.