fix(tools): refuse a progress output set whose reports are the same file #12301
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12301"
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 boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T08:28:05Z.
What
tools/progress.py::write_sitewritesprogress.json, the two badges,progress.svgandprogress.htmlone after another. When two of those names already refer to the same file (a hardlink, for example), the later write replaces the earlier report through the alias:progress.jsonends up holding the HTML page. The existing reports are now compared withsamefilebefore anything is written, and the run fails naming the two aliased files and leaving every report unchanged (mainreports it withparser.error, exit 2, no traceback).tools/progress_history.pyhas the same problem and is covered by #12195, so this PR touches onlyprogress.py. The existingprogress_history --cacheguard is not involved.Two commits: the fix, then the test (
test_aliased_reports_are_refused_and_left_unchanged, real hardlinks: exit 2, both names in the message, no traceback, and all five reports keep their bytes).Fixes #12055 for the
progress.pyhalf.Tested
python3 -m unittest test_progressintools/tests: 46 tests pass. The new test fails (error) againstmain'stools/progress.py.tools/check_conventions.py --base upstream/mainandgit diff --checkpass. Linux only; the test skips where hard links are unavailable.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)progress.pyhalf;progress_history.pyis #12195)Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-28T11:18:10Z.
Review: COMMENTED
Reviewed head
8076937960on macOS (APFS), merged onto currentmain3a40945e62(merge-tree clean).check_conventions --base upstream/mainpasses.1. The new test errors on Python 3.9, the documented floor (
docs/dev/BUILD.md: "Python 3.9 or newer enables the Python regression tests").Path.hardlink_towas added in 3.10:The rest of
tools/testsusesos.link(source, link)(test_pad_timeline, test_stubgen, test_import_audit, test_configure_seed and others). CI didn't catch this because ctest runs a newer interpreter.2. Two links to one missing target still alias.
exists()follows symlinks, so a pair of dangling symlinks to the same name gets skipped by both checks:That is the clobber described in #12055, through a symlink instead of a hardlink. Comparing
os.path.realpathtargets as well assamefilecatches it. A loop (progress.json -> progress.json) still reaches the existing OSError path unchanged.3. Test strength. On head these mutants of
require_distinct_reportspass all 46 tests:if not path.exists(): continue→if False:, andpaths[index + 1:]→paths[index + 2:]. The fixture's only pair is json/html (not adjacent) and all five files exist. A test with an adjacent pair and the other reports missing kills both. With the diff below, the realpath arm'sindex + 2mutant and theother.exists()drop survive. Both are redundant with the samefile arm for the shapes tested, so I'd call them equivalent.Suggested diff (48 tests in the module: 46 + 2 new), green on 3.9.6 / 3.13 / 3.14, and on the merge with
mainon 3.9.6 and 3.13. Onmain'sprogress.pythe new missing-target test fails. With the realpath arm reverted tostr(path), the missing-target test fails:Everything else looks right. The guard runs before the first write,
ValueErroris mapped toparser.errorbefore theOSErrorarm, and the original test checks all five reports keep their bytes.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T11:28:19Z.
Review: APPROVED
Reviewed
80769379600be119784ba001b4b83e76a69eac3d— approve. All five progress-site outputs are checked for existing file aliases before the first write, preventing hardlinked reports from overwriting each other.Windows/Python 3.11: head test_progress.py: 46 passed, 0 skipped (46 total); base test_progress.py: 45 passed, 0 skipped (45 total). The CLI hardlink case preserves the reports and emits a usage error on head; the same case fails against old production. The change guards aliases, not general transactional recovery from later filesystem write failures. Full command/output evidence is retained locally. Hosted CI and mergeability are rechecked before publication. No game or full product execution is claimed.