Skip to content

bvh_match: stage --json so a write failure keeps the previous report - #8974

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

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/bvh-match-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_bvh_match.py — 42 OK (1 skipped)

Made with Cursor

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

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

@abnalstlll-byte abnalstlll-byte 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.

Independent Windows review (commit \ec5415bff8bcaa68ddae73355bad28c916d19b8e)

What changed:

  • \ ools/bvh_match.py:
    • Stages --json\ output through a temporary sibling file and commits atomically with
      eplace_retry.
    • Guarantees an existing valid JSON report is never left in a truncated or corrupt state if write permissions or disk space fail mid-stream.
  • \ ests/test_bvh_match.py:
    • Adds regression coverage verifying that mocked replace failure preserves the prior report.

Verification:

  • Ran \python -I -m unittest discover -s tests -p test_bvh_match.py: 42 OK (1 skipped).
  • Matches the established staged write pattern in #8967, #8954, and #8742.
  • Clean diff: no game data.

Ready to merge.

@catminou4

Copy link
Copy Markdown

Tested on Apple M1 Max, macOS 27.2.1 arm64, Python 3.12.16: python -I tests/test_bvh_match.py → 42 tests OK. No game files. AI-assisted (Devin).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested ec5415b 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_bvh_match.py: main 41 passed, 11 subtests passed; with the PR 42 passed, 11 subtests passed.

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

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.

4 participants