Skip to content

find_hash_lookup: stage --json so a write failure keeps the previous report - #8918

Open
Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/find-hash-lookup-preserve-json
Open

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/find-hash-lookup-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_find_hash_lookup.py — 6 OK

Made with Cursor

…report

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

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

Copy link
Copy Markdown
Contributor

Code read + CPU tests, 9cd4679: pass (tests/test_find_hash_lookup.py → 6 passed).

@check3D

check3D commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent Linux review of 9cd46794 merged cleanly onto main (867d922f) on Ubuntu 24.04, Python 3.12.16 (CPU only, no game files).

  • python -I tests/test_find_hash_lookup.py -v: 6/6 OK (0.36s).
  • Negative control (reverting tools/find_hash_lookup.py with new test kept): 1 error (test_json_write_failure_preserves_previous_report).
  • git diff --check and python -I scripts/check_no_game_data.py: clean.

Minor non-blocking nit: test_json_write_failure_preserves_previous_report could also assert no leftover .find_hash_lookup-*.tmp file remains in tmp after the mocked replace_retry failure.

LGTM.

AI-assisted: yes.

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

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

  • python -I tests/test_find_hash_lookup.py: Ran 6 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.

A behaviour change to note: a report file that is itself writable but sits in a directory the user cannot write now fails (exit 2, previous report intact) where main rewrote it. That is inherent to publishing through a staged file; the agent verified both cases with the real CLI.

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.

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