Skip to content

page_index: stage JSON --out so a write failure keeps the previous report - #8773

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

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/page-index-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_page_index.py — 22 OK

Made with Cursor

…port

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

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

@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 0e4656a0d on Linux x86_64, CPython 3.14 (no game files): pass.

  • python -I tests/test_page_index.py at the head: OK; the same test file against main's tool: FAILED (errors=1) — red/green confirmed.
  • Same observation as on #8798's staging review: stage-beside-destination + published_mode + replace_retry, destination touched only by os.replace, non-regular destinations written directly as before, permission probe retained. page_index's direct-writer parity is kept (it never created the parent, and this doesn't add one).
  • python -I scripts/check_no_game_data.py on the two changed files: clean. AI-assisted (Claude Code).

@sds-228 sds-228 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Focused suite passes 22/22 at this head; the new write-failure case fails against the pre-change source. The staged publish leaves the previous JSON report untouched when the final replace fails.

AI-assisted (OpenCode).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 0e4656a on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main 867d922, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_page_index.py: main 21 passed, 7 subtests passed; with the PR 22 passed, 7 subtests passed.

AI-assisted (Claude Code, Claude Opus 5.5).

@RAINighty

Copy link
Copy Markdown

Tested 0e4656a0d merged with main 867d922f0 (clean merge) on Windows 11 (10.0.26300), Python 3.13.15 in UTF-8 mode (PYTHONUTF8=1; venv with the pinned tests/requirements.txt), with llvm-mc 21.1.8 (AMDGPU) and SPIRV-Tools v2026.4 on PATH: pass.

  • tests/test_page_index.py with this PR: passes (Ran 22 tests in 2.405s, OK). On main: passes (Ran 21 tests in 2.048s, OK).
  • Negative control: this PR's test with main's version of tools/page_index.py fails (Ran 22 tests in 2.119s, FAILED (errors=1)), so the new test does catch the problem.
  • Code not reviewed beyond running it. No GPU or game files.

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.

5 participants