Skip to content

d3d12_iid_scan: stage --json so a write failure keeps the previous report - #9016

Open
Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/d3d12-iid-scan-preserve-json
Open

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/d3d12-iid-scan-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_d3d12_iid_scan.py — OK

Made with Cursor

…port

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

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

Copy link
Copy Markdown

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

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 483670fb on Linux, CPython 3.14, CPU only, synthetic inputs, merged onto main 867d922f: pass

  • python -I tests/test_d3d12_iid_scan.py: Ran 16 tests, OK. With only the non-test files reverted to main: FAILED (errors=1), so the new tests exercise the change.
  • compileall and scripts/check_no_game_data.py on the changed files: clean.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting.

@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 483670fb on Windows 11 (Python 3.14.3, CPU-only, clean-room synthetic inputs, zero game data): pass.

Test Suite Execution

  • python -I tests/test_d3d12_iid_scan.py: 16/16 passed in 1.02s.
    • Successfully verifies test_json_write_failure_preserves_previous_report: publishes --json through a staged temporary file (.d3d12_iid_scan-*.tmp) and atomic replace_retry().
    • Mid-write or replace failure preserves any existing report intact without truncation.
    • Pre-flights write permissions on existing files via os.close(os.open(destination, os.O_WRONLY)) without truncating the existing report.
    • Handles non-regular destinations cleanly via direct fallback write.

Negative Control

Reverted tools/d3d12_iid_scan.py to origin/main (dde82f27e) while evaluating tests/test_d3d12_iid_scan.py:

  • test_json_write_failure_preserves_previous_report: FAILED (errors=1):
    • AttributeError: <module 'd3d12_iid_scan'> does not have the attribute 'replace_retry' (on main, direct unbuffered open(args.json, "w") truncated destination files immediately).
  • Restoring 483670fb brings all 16 tests cleanly back to green.

Clean-Room & Repository Hygiene

  • git merge-tree --write-tree origin/main 483670fb: clean merge (c4e01ed7).
  • python -m compileall -q tools/d3d12_iid_scan.py tests/test_d3d12_iid_scan.py: clean.
  • python -I scripts/check_no_game_data.py tools/d3d12_iid_scan.py tests/test_d3d12_iid_scan.py: clean (0 violations).
  • git diff --check origin/main: clean (0 whitespace or conflict markers).
  • Line endings: strict Unix LF (\n) preserved.

LGTM!

AI-assisted: verified and reviewed on Windows 11 environment.

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