conformance: reject diff heatmap path collisions #2410

Merged
leonida/mandy
iliko123456789 merged 1 commit from fix/conformance-diff-output-collision into main 2026-11-28 10:58:23 +00:00

Pull request successfully merged and closed

iliko123456789 commented 2026-11-26 22:13:58 +00:00

Claimed in the coordination issue as:
CONFORMANCE-DIFF-OUTPUT-COLLISION

What and why

compare.py diff could overwrite a manifest, an input image, or another heatmap. Overwriting an image needed by a later scene could also produce a false pixel mismatch.

Plan every path before writing heatmaps. Index possible aliases and confirm collisions with the shared same_report_path helper. A collision exits 2 and names both paths. Existing heatmaps at distinct destinations can still be replaced.

Tested

Verified commit 2130199f1 on upstream e5a7c8942.

  • Windows 11 (Python 3.14.7) and Ubuntu WSL (Python 3.14.4).
  • Nine reported regression failures on upstream main. All runnable cases passed with the fix.
  • 968 alias comparisons and 250 ordered batches verified per platform.
  • Non-ASCII temporary directory tests passed.
  • All runnable cases across 10 focused test scripts passed.
  • All 22 comparator self-checks passed.
  • Ubuntu semantic suite: 6,374 tests across 500 files, zero failing files.
  • Compilation, whitespace, CLI help and no-game-data checks passed.
  • No conflicts found with nine overlapping open PRs.

Performance

Synthetic preflight benchmark (seconds):

Scenes Windows before Windows after Ubuntu before Ubuntu after
6 0.030 0.0046 0.0033 0.00045
30 0.865 0.027 0.070 0.0013
100 8.771 0.099 0.712 0.0053
300 64.650 0.345 6.329 0.029

Benchmarks used synthetic 1x1 PNGs. Results for 6 and 30 scenes are medians of three runs. Larger results are single runs.

Known limitations

Windows skipped symlink tests due to insufficient privileges. Ubuntu skipped Windows-specific and case-insensitive-volume tests. Both skipped APFS/HFS+ and five native-renderer tests.

All seven PowerShell conformance tests passed on Windows and were skipped on Ubuntu.

Validation assumes paths and links remain stable during comparison. Many paths sharing an alias key can still trigger repeated comparisons. Legacy Windows code pages may require Python UTF-8 mode for redirected CLI output.

GPUs tested: n/a (CPU-only synthetic tests)

AI-assisted: yes, with Codex

Checklist

  • Based on current main and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption.
  • New translator rule documented (N/A - no translator changes).
Claimed in the coordination issue as: [CONFORMANCE-DIFF-OUTPUT-COLLISION](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7203657923) ### What and why `compare.py diff` could overwrite a manifest, an input image, or another heatmap. Overwriting an image needed by a later scene could also produce a false pixel mismatch. Plan every path before writing heatmaps. Index possible aliases and confirm collisions with the shared `same_report_path` helper. A collision exits 2 and names both paths. Existing heatmaps at distinct destinations can still be replaced. ### Tested Verified commit `2130199f1` on upstream `e5a7c8942`. - Windows 11 (Python 3.14.7) and Ubuntu WSL (Python 3.14.4). - Nine reported regression failures on upstream main. All runnable cases passed with the fix. - 968 alias comparisons and 250 ordered batches verified per platform. - Non-ASCII temporary directory tests passed. - All runnable cases across 10 focused test scripts passed. - All 22 comparator self-checks passed. - Ubuntu semantic suite: 6,374 tests across 500 files, zero failing files. - Compilation, whitespace, CLI help and no-game-data checks passed. - No conflicts found with nine overlapping open PRs. ### Performance Synthetic preflight benchmark (seconds): | Scenes | Windows before | Windows after | Ubuntu before | Ubuntu after | |---:|---:|---:|---:|---:| | 6 | 0.030 | 0.0046 | 0.0033 | 0.00045 | | 30 | 0.865 | 0.027 | 0.070 | 0.0013 | | 100 | 8.771 | 0.099 | 0.712 | 0.0053 | | 300 | 64.650 | 0.345 | 6.329 | 0.029 | Benchmarks used synthetic 1x1 PNGs. Results for 6 and 30 scenes are medians of three runs. Larger results are single runs. ### Known limitations Windows skipped symlink tests due to insufficient privileges. Ubuntu skipped Windows-specific and case-insensitive-volume tests. Both skipped APFS/HFS+ and five native-renderer tests. All seven PowerShell conformance tests passed on Windows and were skipped on Ubuntu. Validation assumes paths and links remain stable during comparison. Many paths sharing an alias key can still trigger repeated comparisons. Legacy Windows code pages may require Python UTF-8 mode for redirected CLI output. GPUs tested: n/a (CPU-only synthetic tests) AI-assisted: yes, with Codex ### Checklist - [x] Based on current main and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption. - [ ] New translator rule documented (N/A - no translator changes).
tiguan26 approved these changes 2026-11-27 04:43:35 +00:00
tiguan26 left a comment

Approving 2130199f1.

Every scene's paths are planned and checked before the first heatmap is written, so a collision fails the run without overwriting an input. find_report_path_collision's candidate keys cover each way same_report_path can match: the resolved path, the normalized key, the case-folded basename (which any case-folding match shares) and the file identity for hard links with unrelated names, so the index cannot miss a pair the pairwise check would catch, and inputs are checked before earlier outputs. Moving the basename test ahead of the split in _same_resolved_name keeps its meaning.

Merged onto main d1dff7949 together with #2403, #2299, #2297, #2330 and #2286 (no conflicts), on Linux with Python 3.13. tests/test_conformance_diff_output_paths.py 9 passed, 1 skipped; tests/test_report_paths.py 24 passed, 1 skipped (main: 23). AI-assisted (Claude Code, Claude Opus 5.5).

Approving 2130199f1. Every scene's paths are planned and checked before the first heatmap is written, so a collision fails the run without overwriting an input. `find_report_path_collision`'s candidate keys cover each way `same_report_path` can match: the resolved path, the normalized key, the case-folded basename (which any case-folding match shares) and the file identity for hard links with unrelated names, so the index cannot miss a pair the pairwise check would catch, and inputs are checked before earlier outputs. Moving the basename test ahead of the split in `_same_resolved_name` keeps its meaning. Merged onto `main` `d1dff7949` together with #2403, #2299, #2297, #2330 and #2286 (no conflicts), on Linux with Python 3.13. `tests/test_conformance_diff_output_paths.py` 9 passed, 1 skipped; `tests/test_report_paths.py` 24 passed, 1 skipped (main: 23). AI-assisted (Claude Code, Claude Opus 5.5).
iliko123456789 commented 2026-11-27 19:44:06 +00:00

Thanks for reviewing and testing my fix! I noticed that the PR is still open, and I couldn't find the changes on the current main branch after the repository move. Does it still need to be merged, or is there anything I need to update on my side?

Thanks for reviewing and testing my fix! I noticed that the PR is still open, and I couldn't find the changes on the current main branch after the repository move. Does it still need to be merged, or is there anything I need to update on my side?
tiguan26 commented 2026-11-28 01:41:42 +00:00

@iliko123456789 nothing to update on your side. The repository move kept the open pull requests as they were, so this one is still waiting to be merged; it is not on main yet. I just checked: your head 2130199f1 still merges cleanly onto the current main (431ceba4f), with no conflicts. Per #2464, the maintainer merges in batches by area (tools first), merging main into each branch and running the suites himself, so it should get picked up in a tools batch. AI-assisted (Claude Code, Claude Opus 5.5).

@iliko123456789 nothing to update on your side. The repository move kept the open pull requests as they were, so this one is still waiting to be merged; it is not on main yet. I just checked: your head 2130199f1 still merges cleanly onto the current main (431ceba4f), with no conflicts. Per #2464, the maintainer merges in batches by area (tools first), merging main into each branch and running the suites himself, so it should get picked up in a tools batch. AI-assisted (Claude Code, Claude Opus 5.5).
zmasi commented 2026-11-28 10:03:41 +00:00

#2410 | head 2130199f1be7e63922735c5b83a1e9b8ce14a365 (merged cleanly with main 33db04a70) | python -I tests/test_conformance_diff_output_paths.py && python -I tests/test_report_paths.py | red on main: FAILED (failures=9, skipped=2) (0 != 2 across NTFS case-insensitive, manifest, and hardlink heatmap collisions) and FAILED (errors=7, skipped=1) (AttributeError: find_report_path_collision) | green on PR+main: 10 tests OK (skipped=2) and 25 tests OK (skipped=1) | Windows 11, Python 3.12.10 | AI-assisted: yes

Audited find_report_path_collision in tools/report_paths.py and check_heatmap_paths / command_diff in tools/conformance/compare.py on Windows 11 NTFS (exercising native case-insensitive volume folding and os.link hardlink alias detection before any heatmap is written). Also passed tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), tests/test_runner_calls_all_tests.py (3 OK), and scripts/check_no_game_data.py on the merged tree.

#2410 | head 2130199f1be7e63922735c5b83a1e9b8ce14a365 (merged cleanly with main 33db04a70) | `python -I tests/test_conformance_diff_output_paths.py && python -I tests/test_report_paths.py` | red on main: `FAILED (failures=9, skipped=2)` (`0 != 2` across NTFS case-insensitive, manifest, and hardlink heatmap collisions) and `FAILED (errors=7, skipped=1)` (`AttributeError: find_report_path_collision`) | green on PR+main: `10 tests OK (skipped=2)` and `25 tests OK (skipped=1)` | Windows 11, Python 3.12.10 | AI-assisted: yes Audited `find_report_path_collision` in `tools/report_paths.py` and `check_heatmap_paths` / `command_diff` in `tools/conformance/compare.py` on Windows 11 NTFS (exercising native case-insensitive volume folding and `os.link` hardlink alias detection before any heatmap is written). Also passed `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), `tests/test_runner_calls_all_tests.py` (`3 OK`), and `scripts/check_no_game_data.py` on the merged tree.
DadaCap commented 2026-11-28 10:58:25 +00:00

Merged, thank you @iliko123456789! This PR (conformance: reject diff heatmap path collisions) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch.

AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.

Merged, thank you @iliko123456789! This PR (conformance: reject diff heatmap path collisions) was checked by zmasi or sodove and then by our own local run of its tests with main merged in, and it passed cleanly, so it went in with its reviewed batch. AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.
Sign in to join this conversation.
No description provided.