conformance compare: harden crash and image input error handling #2205

Open
github-bot wants to merge 3 commits from github-bot/gh-2205 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-26 05:45 UTC · original
whoalin1:compare-unexpected-exit2 → main · +174 −9 · 5 files · 3 commits · open

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.

**@⁠whoalin1** on GitHub · 2026-11-26 05:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2205) `whoalin1:compare-unexpected-exit2` → `main` · +174 −9 · 5 files · 3 commits · open ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:22:16 +00:00
Author
Owner

@⁠DeadlyChirp on GitHub · 2026-11-26 10:50 UTC · original

Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.

  • tests/test_conformance_compare_crash.py: 2 passed.
  • The same tests against main code: 2 failed, so they catch the bug this PR fixes.

(AI-assisted test run; output checked by hand.)

**@⁠DeadlyChirp** on GitHub · 2026-11-26 10:50 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2205#issuecomment-7189904000) Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main. - `tests/test_conformance_compare_crash.py`: 2 passed. - The same tests against main code: 2 failed, so they catch the bug this PR fixes. (AI-assisted test run; output checked by hand.)
Author
Owner

@⁠real-rusher on GitHub · 2026-11-26 12:23 UTC · original

Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_conformance_compare_crash.py: 2 tests OK. The same file against main's compare.py: 1 failure and 1 error, so it fails on main and passes with the change. compileall clean.

Note for review: #114 and #1324 (both "conformance/compare.py: import traceback, so an unexpected crash exits 2 and not the mismatch code 1") make the same one-line import fix and are still open, so only one of the three should land; this one is the one with a test. It merges cleanly with #2212 and #2213, which also touch compare.py.

AI-assisted: yes (Claude Code)

**@⁠real-rusher** on GitHub · 2026-11-26 12:23 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2205#issuecomment-7191946654) Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_conformance_compare_crash.py: 2 tests OK. The same file against main's compare.py: 1 failure and 1 error, so it fails on main and passes with the change. compileall clean. Note for review: #114 and #1324 (both "conformance/compare.py: import traceback, so an unexpected crash exits 2 and not the mismatch code 1") make the same one-line import fix and are still open, so only one of the three should land; this one is the one with a test. It merges cleanly with #2212 and #2213, which also touch compare.py. AI-assisted: yes (Claude Code)
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-26 13:05 UTC · original

Thanks for the overlap check. I agree only one of these should land. This branch intentionally pairs the one-line unexpected-crash fix with regression coverage, and it merges cleanly with #2212/#2213. I am happy to close or reshape it if the maintainers prefer #114 or #1324, but it is open as the tested candidate. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-26 13:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2205#issuecomment-7192866548) Thanks for the overlap check. I agree only one of these should land. This branch intentionally pairs the one-line unexpected-crash fix with regression coverage, and it merges cleanly with #2212/#2213. I am happy to close or reshape it if the maintainers prefer #114 or #1324, but it is open as the tested candidate. AI-assisted with Devin.
github-bot changed title from conformance compare: report unexpected crashes as tool errors to conformance compare: harden crash and image input error handling 2026-11-26 13:26:18 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2205/head:github-bot/gh-2205'
git switch 'github-bot/gh-2205'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'github-bot/gh-2205'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2205'
git switch 'main'
git merge --squash 'github-bot/gh-2205'
git switch 'main'
git merge --ff-only 'github-bot/gh-2205'
git switch 'main'
git merge 'github-bot/gh-2205'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.