conformance compare: harden crash and image input error handling #2205
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2205"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T05:45:13Z.
Summary
tracebackintools/conformance/compare.py, so the existing catch-all can actually print the traceback and returnEXIT_ERRORItem: 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:
NameError: name 'traceback' is not definedand the script-level path exits 1python -I tests/test_conformance_compare_crash.py— 2 tests, OKpython -m compileall -q tools/conformance/compare.py tests/test_conformance_compare_crash.py— passgit diff --check— passNo 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:
expectreturns input-error exit 2 for unreadable, missing, or corrupt images instead of reporting them as ordinary pixel mismatches;The consolidated branch is the original reviewed commit plus cherry-picks
8754c9b90anddbfcd31ab; 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.Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T10:50:18Z.
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
tests/test_conformance_compare_crash.py: 2 passed.(AI-assisted test run; output checked by hand.)
Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T12:23:47Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by whoalin1 on 2026-11-26T13:05:41Z.
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.
Imported from ubiquitarianism/leonida. Originally posted by sodove on 2026-11-28T09:15:08Z.
#2205 | head
dbfcd31ab890482fb1f008aa9e362486a0424e63|python3 -I tests/test_conformance_compare_crash.py -v,python3 -I tests/test_conformance_expect_status.py -v,python3 -I tests/test_conformance_png_transparency.py -v| red: 9 tests, 13 assertion failures, 1 error | green: 9 passed | Red → greenThe baseline produced an incorrect exit status for a handler failure and for missing image input. PNG structure assertions also failed. Failure and error counts include subtest events.
Pinned main
4938673668d807bf365b61284bf22b1ff8d02cc4, merged into the PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:24:57Z.
Windows 11 Verification (
dbfcd31ab8merged withorigin/main02944d4ca1)10.0.26200) NTFS,Python 3.12.10&Python 3.14.5(-I -B), clean non-commit merge ontoorigin/main(0conflicts).origin/maintools/conformance/compare.py):python -I -B tests/test_conformance_expect_status.pyfailed (rc=1,FAILED (failures=2)—AssertionError: 1 != 2on bothstate='missing'andstate='corrupt'when paired with a differing pixel scene, confirmingexpectmasked unreadable-image errors behind exit code1). (Note:import tracebackand PNG chunk ordering checks already landed onorigin/main, sotest_conformance_compare_crash.py2/2andtest_conformance_png_transparency.py6/6add dedicated standalone regression coverage whilecommand_expect+step_expect_missing_and_invalid+COMPARE.mdclose the remaining exit-status gap.)origin/main + #2205):python -I -B tests/test_conformance_compare_crash.py:2/2OKonPython 3.12.10(0.30s) &Python 3.14.5(0.27s).python -I -B tests/test_conformance_expect_status.py:1/1(4/4subtests:matching->0,different->1,missing->2,corrupt->2)OKonPython 3.12.10&Python 3.14.5.python -I -B tests/test_conformance_png_transparency.py:6/6OKonPython 3.12.10(0.11s) &Python 3.14.5(0.07s).python -I -B tools/conformance/compare.py selftest:22/22checksselftest passed(rc=0,0.20s, including UTF-8 BOM manifest loading and missing-imageEXIT_ERROR = 2).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:28:38Z.
Review: COMMENTED
Static audit of head
dbfcd31abagainst the PR base and current main. No builds, tests, or GPU runs were performed.tools/conformance/compare.py:760— On POSIX with a UTF-8 filesystem encoding, a manifest PNG name containing a lone surrogate from\ud800raisesUnicodeEncodeErrorwhen opened.expectexits 2 before printing any scene rows, including those for readable images. Convert path encoding failures to a scene-localToolErrorwith an escaped filename and cover this case alongside a readable scene.tools/conformance/compare.py:1891— The restored traceback prints absolute checkout paths to stderr if the script is invoked by absolute path and a handler raises unexpectedly. Default to repo-relative frames and a sanitized exception summary, with the raw traceback available on request.tools/conformance/compare.py:1722— If an unbufferedselftestwrites to a stdout pipe whose reader has closed,BrokenPipeErrorleaves its scratch directory behind. Include the first print and fixture work in cleanup that runs on unexpected exceptions and preserves deliberate fixture retention for reported failures. This gap also exists on main.The crash regression tests cover Python handler exceptions and verify exit 2. Native process termination is outside that catch, so Windows access violation
0xC0000005and POSIX signal statuses observed as negative return codes bysubprocessremain distinct from exit 1. The PNG tests cover the new chunk checks, and the existing selftest covers truncated chunks, bad CRCs, short scanlines, and unequal image sizes. Input reads use context managers. Existing image diagnostics deliberately identify the input path.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:19:14Z.
Merged at head
85149ce. Python tool and its tests only. The red linux-gpu-tools step (CPU runtime tests) was red on main at the time of the run, so not from this PR. Gap: only the author's test run is posted (new test fails before the fix, passes after); could someone runpython -I tests/test_conformance_compare_crash.pyon current main and post the result? AI-assisted: yes.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:46:32Z.
Correction: passes on 5 of 6 of the PR's tests; 1 skipped here (
test_unencodable_png_name_is_scene_local_and_other_scenes_still_reportneeds POSIX and a UTF-8 filesystem encoding), not covered.AI-assisted (Claude Code).
Earlier comment, superseded by the correction above:
Re-checked after the merge, on
mainbd643e46e(Windows 11 10.0.26300, Python 3.12.4, CPU only): passes on main.python -I tests/test_conformance_compare_crash.py: 4 tests OK.python -I tests/test_conformance_expect_status.py: 2 tests OK, 1 of them skipped.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T17:24:37Z.
Post-merge check by OreoFR on macOS 27.2.1 (26B131), Apple M5, APFS, UTF-8 file system, Python 3.12.16 — covers the test skipped on Windows. Base before merge
9bb67cb53, merged3418c61d(main4364a4fa6), PR head85149ce1a.test_handler_crash_returns_exit_error_with_tracebackandtest_unencodable_png_name_is_scene_local_and_other_scenes_still_report(output empty, nobad\ud800.png).tools/conformance/compare.py): identical before/after, 40 passed, 23 skipped (all Windows-only: PowerShell / cmd.exe /conform_native).UnicodeEncodeErroron POSIX,compare.py:760) is fixed in the final head and covered by that test.No issue found after merge.
AI-assisted: Claude Code