pe_inspect: refuse aliased JSON/Markdown report outputs (carry of #384) #3085
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3085"
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 MoonEyes on 2026-12-02T10:29:15Z.
Claimed in the coordination issue as: PE-REPORT-OUTPUT-ALIAS (the original author's item ID, taken from the title of #384; I did not find the claim row itself).
What and why
Carry of #384 (tahffo68hk-hash), unchanged since 2026-11-24 (the only later activity is a maintainer comment and a review asking for a rebase). Branch = main + the author's head (commit
56354fakept) + conflict resolution; I added no commits of my own.The change makes
tools/pe_inspect.pyrefuse a run where the JSON and Markdown report paths of one image are the same file, or where a report path is the same file as a report already written earlier in the run, instead of silently overwriting it. Two new CLI tests intests/test_pe_inspect.pycover both cases.Conflict:
tools/pe_inspect.pyconflicted with main'snoteslist inmain(). I kept both lists (notesand the author'swritten_outputs); nothing of main's was dropped.Review: both reviews asked to use
tools/report_paths.same_report_pathinstead of a privatenormcasecheck. Main already definessame_output_path = same_report_pathinpe_inspect.py, and the author's three new calls usesame_output_path, so the new checks already go throughsame_report_pathafter the merge. No further fix was needed.Tested
Windows 11, no GPU, no game files, on main
a917c54d6plus this branch.python -I tests/test_pe_inspect.py: 80 tests, OK (1 skipped).tools/pe_inspect.pyrestored over the branch, the same command gives 80 tests, FAILED (failures=2):test_cli_refuses_aliased_json_and_markdown_outputsandtest_cli_refuses_output_aliased_to_earlier_report. The file was restored afterwards; the working tree is clean.python -I scripts/check_no_game_data.py tools/pe_inspect.py tests/test_pe_inspect.py: clean.Not run: the full suite, CI.
GPUs tested: n/a (unit tests only)
AI-assisted: yes. Models: Claude Opus 5.5 in Claude Code (carry, conflict resolution, fixes, tests); separate read-only reviewer agent: Claude Opus 5.5.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (Not applicable: no translator rule.)Supersedes #384 once merged; the original stays open until a maintainer decides.
🤖 Generated with Claude Code
Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-12-02T12:20:42Z.
RUN (independent run on Windows, #3085 head
6a4420d13, merged locally intomain9b4d71899withgit merge --no-ff, no conflicts. CI on the head: change-scope, check, linux-python-and-viewer, no-game-data and semantic-tests all pass.)56354fa39(tahffo68hk-hash) is an ancestor of the head through the merge87a5da7a7, under its author's name. The carrier added no commit of their own besides the merges.main'stools/pe_inspect.pydefinessame_output_path = same_report_path(line 38). The three new checks callsame_output_path, so they go throughreport_paths.same_report_path, as the reviews on #384 asked.python -I tests/test_pe_inspect.py -v: main 96 tests OK; merge 98 tests OK. The body's counts (80) are from an oldermain: since then #3060 added 16 tests to this file.python -m pyteston the 13 test files that namepe_inspect: main 189 passed; merge 191 passed.main'stools/pe_inspect.pywith this pull request's test file gives 98 tests and 2 failures,test_cli_refuses_aliased_json_and_markdown_outputsandtest_cli_refuses_output_aliased_to_earlier_report. Both fail on0 != 1:mainwrites through the hard link and exits 0.tools/pe_inspect.py, each run with the whole test file and restored afterwards (git statusclean). 5 of 6 are killed:normcase(abspath(...))instead ofsame_output_path: killed (both tests; hard links have different names).written_outputs.append(json_path)). A later report that is the same file as an earlier image's Markdown report would then be overwritten. The second test links a later Markdown path to an earlier JSON report, never to an earlier Markdown report.Not covered here: Linux and macOS, and the case-variant spelling of an alias (the tests use hard links;
same_report_pathhandles case and has its own tests).Verdict: PASS. Both refusals work, red on
main(silent overwrite through a hard link, exit 0) and green on the merge match the body, and the author's commit is kept. One gap remains: no test aliases a later report to an earlier Markdown report.Machine: Windows 11 Pro 26300 (NTFS), i9-13900K, 64 GB, CPython 3.13.12 (CI uses 3.12); unit tests only, no GPU or game files used.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T12:22:41Z.
Merging. Head
6a4420d13merges cleanly withmainf6dd2242eand does not force a rebase of #2566. Independent check on head6a4420d13: enlight3d's red/green on main + this head (2 failures with main's tool, silent overwrite through a hard link; green 98/98; 5 of 6 mutations killed, the survivor records only the JSON and no test links a report to an earlier Markdown, noted as a gap), comment 7345198847; the original commit of #384 is kept; CI green incl. no-game-data; no open review or question. Merged by MoonEyes.AI-assisted (Claude Code).