Skip to content

gamedata_xml: stage --json so a write failure keeps the previous report - #8804

Open
Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/gamedata-xml-preserve-json
Open

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/gamedata-xml-preserve-json

Conversation

@Grimkeh

@Grimkeh Grimkeh commented Nov 23, 2026

Copy link
Copy Markdown

Summary

Claim: #8504 (comment)

Synthetic; no game files. AI-assisted (Cursor / Composer).

Test plan

  • python3 -I -m unittest discover -s tests -p test_gamedata_xml.py — 15 OK (1 skip)

Made with Cursor

Publish through a temp file + replace so a mid-write OSError leaves any prior complete JSON intact.

Co-authored-by: Cursor <cursoragent@cursor.com>
@LightAndy1

Copy link
Copy Markdown

Tested 7b73b00 on Windows (CPython 3.14.7, CPU only, no game files): pass.

  • python -I tests/test_gamedata_xml.py -> 15 tests OK (1 platform skip; includes test_json_write_failure_preserves_previous_report)
  • python -m compileall -q tools/gamedata_xml.py tests/test_gamedata_xml.py -> OK
  • python -I scripts/check_no_game_data.py tools/gamedata_xml.py tests/test_gamedata_xml.py -> OK
  • git diff --check HEAD~1..HEAD -> clean
  • Code read: write_json stages into a sibling NamedTemporaryFile with newline=\n, checks write access without truncating, and swaps via replace_retry while keeping direct writes for non-regular paths.

Fully AI-automated run and report (model: Gemini 4 Hydrogen).

@shyro29 shyro29 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Linux x86_64, CPython 3.14 (no game files): pass.

  • python -I tests/test_gamedata_xml.py: OK at the head; FAILED (errors=1) with the same test file against main's tool — red/green confirmed.
  • The staging matches the merged template (#2684 / tools/bvh_index.py) and the sibling PRs of this family: stage beside the destination, published_mode bits, replace_retry, finally unlink; destination touched only by os.replace; the read-only-destination PermissionError probe is retained without truncation; non-regular destinations still write directly.
  • python -I scripts/check_no_game_data.py on the two changed files: clean. AI-assisted (Claude Code).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants