mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:55:52 +01:00
[PR #2078] tools/awc_markers: guard --out paths with report_paths and write JSON atomically (AWC-MARKERS-ATOMIC-OUT-AND-PATH-GUARD) #2084
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2084
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2078
Author: @KushGene
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/awc-markers-atomic-out-guard📝 Commits (2)
b3a5a9etools/awc_markers: guard --out paths with report_paths and write JSON atomically (AWC-MARKERS-ATOMIC-OUT-AND-PATH-GUARD)58bda6atests/test_awc_markers: check directory entries instead of alias existence on folding volumes📊 Changes
2 files changed (+206 additions, -12 deletions)
View changed files
📝
tests/test_awc_markers.py(+131 -0)📝
tools/awc_markers.py(+75 -12)📄 Description
Claimed in the coordination issue as: AWC-MARKERS-ATOMIC-OUT-AND-PATH-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172599721)
What and why
Hardens
tools/awc_markers.py--outhandling without touchingiter_banks()or_read()(keeping zero overlap with #1159):--outvalidation & input overwrite guard: Refuses empty/whitespace-only and directory--outpaths before scanning, and checks discovered inputs withreport_paths.same_report_path(catching case-only aliases on case-folding volumes even when--outdoes not exist yet)._write_json_atomiccreates missing parent directories, writes via a sibling temporary file (tempfile.mkstemp(..., prefix=".awc_markers-", suffix=".json")), preserves permissions withfile_mode.published_mode, swaps viareplace_retry.replace, cleans up the temp file on failure, and catchesOSErrorto print a cleanawc_markers: error: cannot write ...line and exit1instead of raising a traceback or truncating an existing report. Output formatting (indent=2, trailing\n, LF) is unchanged.OutputSafetyTestintests/test_awc_markers.py.Tested
OutputSafetyTestmethods intests/test_awc_markers.pyfailed againstmain(e18b59a5b) before the fix (--out ""/" "exited 0 silently, directory--outand missing parent raised tracebacks,--outoverwriting input exited 0, and failed write left existing report broken).python3 -I tests/test_awc_markers.py: 15/15 passed.python3 -I tests/test_text_write_line_endings.py: 3/3 passed.python3 -I tests/test_report_paths.py: 22/22 passed.python3 -I scripts/check_no_game_data.py tools/awc_markers.py tests/test_awc_markers.py: exit 0.python3 -m compileall -q make_game.py tools tests: exit 0.GPUs tested: n/a (CPU-only Python tool and synthetic unit tests on Fedora Linux 45)
AI-assisted: yes (Antigravity)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.