tools/gamedata_sps1.py: check --json ancestors and input file kinds upfront #2291
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2291
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/gamedata-sps1-safety"
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 successfully merged and closed
Claimed in the coordination issue as: GAMEDATA-SPS1-UPFRONT-JSON-ANCESTOR-AND-SHADERS-FILE-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192516333)
What and why
os.path.abspath(out_path)andos.path.realpath(out_path)insidecheck_report_path()(tools/gamedata_sps1.py) so--jsonpaths blocked by a regular-file or broken-symlink ancestor (or symlink-to-directory target) fail upfront before reading inputs while keeping the exit code1"error:"contract.main()thattargetis an existing regular file or directory and--shaders(when provided) is an existing regular file, returning exit code2with anERROR:message before reading payloads.tests/test_gamedata_sps1_atomic.py.Tested
python -I tests/test_gamedata_sps1_atomic.py -v: 7 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 3 failures).python -I tests/test_gamedata_sps1.py -v: 7 passed, 0 failed.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/gamedata_sps1.py tests/test_gamedata_sps1_atomic.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.Approving 4f930f0df.
--jsonis refused when the path or its resolved destination is a directory or an ancestor is not one, and--target/--shadersof the wrong kind are usage errors (exit 2) as a missing one already was.Merged onto
maind1dff7949in one batch with 15 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_gamedata_sps1_atomic.py: 7 passed (main: 5). AI-assisted (Claude Code, Claude Opus 5.5).#2291 | head
4f930f0dfa455f74b605275e31618c932ec0047d|python3 -I tests/test_gamedata_sps1_atomic.py -v| red: 7 run, 3 failures | green: 7 passed | Red → greenThe baseline tried to read the input or proceed with output paths that the new assertions expect to reject upfront.
Pinned main
33db04a7010e81c40a7a6a15624525aa0c4a3a58, merged into this PR head. Ubuntu 26.04.1 (WSL2), Python 3.14.4. Full suite: not run. AI-assisted: OpenAI Codex. Batch claim.Merged, thank you @kirigayakazima!
What it does: tools/gamedata_sps1.py: check --json ancestors and input file kinds upfront
How it was checked: sodove tested this PR at head
4f930f0dfon main33db04a70: the PR's own test fails on main and passes with this PR merged in (his result is linked from the batch summary in #1608). We then re-ran the same test locally on Windows 11 and got the same verdict: on main, red (3 failures); with the PR, green (7 OK, 1 skip).CI: the red jobs on this PR fail the same way on main, or on the older main it was built on (the
cs_dpp_cmp.asmtranslator fixture, since fixed on main, and the Windows runner's Visual Studio setup), so none comes from this change.Merged one by one with 20 other PRs of the same reviewed batch, pinned to the tested head.
AI-assisted (Claude Code, Claude Opus 5.5), posted for the maintainers.