Skip to content

navmesh_decode: stage JSON --out so a write failure keeps the previous report - #8845

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

Grimkeh wants to merge 1 commit into
ItsNotRexed:mainfrom
Grimkeh:fix/navmesh-decode-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_navmesh_decode.py — 18 OK

Made with Cursor

…s 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>
@Grimkeh

Grimkeh commented Nov 23, 2026

Copy link
Copy Markdown
Author

Overlap note: #8841 also edits tools/navmesh_decode.py (native --deep kernels). Whichever lands second will need a rebase.

@catminou4

Copy link
Copy Markdown

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

@Ysergic

Ysergic commented Nov 23, 2026

Copy link
Copy Markdown

Independent Linux check of 9243f39 against main 867d922: pass, including a real OS write failure rather than a mocked replace.

Bazzite 45 x86-64, Python 3.15.2. I used the test module's hand-built 0DRP fixture in a synthetic archive and invoked the actual navmesh_decode.py CLI in child processes.

For failure cases, only the child gets RLIMIT_FSIZE=64 bytes and SIGXFSZ ignored, so writing the larger JSON raises EFBIG ("File too large"). Both revisions return 2 with the write error:

  • Main truncates the previous 19-byte report and leaves 64 bytes of incomplete JSON.
  • PR keeps the previous report byte-for-byte and leaves no .navmesh_decode-*.tmp file.

Repeated through a symlink destination: same result, with the symlink preserved. Successful unrestricted controls write valid 2,958-byte JSON on both revisions. All eight runs preserve mode 0640 and the input archive's SHA-256.

The existing test_navmesh_decode.py suite also passes 18/18. This checks the JSON --out path on POSIX; no CSV, Windows or game files were involved. AI-assisted with Codex.

@Ysergic

Ysergic commented Nov 23, 2026

Copy link
Copy Markdown

Follow-up integration check with #8841: combined 9243f393605d5a18ef3e0f45ed988a00684aea75 (this PR) and native-navmesh head 8c0ea4a2e1bc3dadf3410eb1f1d96e2155ad9bae locally. git apply --3way resolved the shared-file context cleanly, with no manual edits.

With the real Rust library built and loaded, all 11 native parity tests and 18 report tests passed. Eight actual --deep CLI runs on a handcrafted archive covered native on/off × normal/real RLIMIT_FSIZE=64 write failure × direct/symlink destination. Normal reports matched after excluding elapsed time; every failed write preserved the old report, mode 0640, symlink and input hash, with no leftover staging files.

AI-assisted, Linux x86_64, CPython 3.15.2/Rust 1.100.0; synthetic inputs only, no game files, GPU unused. No integration regression found in this scope.

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