Skip to content

bvh_tri_probe: name a --json directory as typed, not through repr() - #6708

Merged
shayderrr merged 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/5-bvhtriprobe-jsonpath
Nov 23, 2026
Merged

shayderrr merged 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/5-bvhtriprobe-jsonpath

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

EGEN-BVHTRIPROBE-JSONPATH

tools/bvh_tri_probe.py refuses a --json value that is a directory (or blank) with

error: --json 'C:\Users\me\tmp' is not a file path

The repr() there quotes the path and doubles every backslash on Windows, while the write-error line 10 lines below (error: cannot write --json {args.json_out}: ...) already prints the path as typed. The guard now echoes the value as typed, and says (empty) for a blank one instead of a pair of quotes.

Test

python -I tests\test_bvh_tri_probe.py
  • With tools/bvh_tri_probe.py as on main (the two new cases present, the tool not yet changed): FAILED (failures=2), both test_json_directory_is_named_as_typed and test_json_empty_is_a_named_error.
  • With this branch: Ran 17 tests in 0.700s, OK.

No GPU needed: CPU-only unit tests; the hardware path is covered with a stand-in oracle.

Notes

  • One line in the tool, split over three commits: the fix, the directory case, the blank case.
  • (empty) rather than nothing for a blank value: echoing a blank path as typed would leave a double space in the message. A whitespace-only value is treated like an empty one, which is what the guard already did with not args.json_out.strip().
  • Independent of bvh_tri_probe: an unusable --write-kernels path is one error line and exit 2 #6364 (the --write-kernels write path in the same file); this changes only the --json argument guard and adds its two cases.

AI-assisted.

repr() quotes the path and doubles every backslash on Windows, while the write-error line below it already prints the path as typed.
Fails on the previous commit: repr() turned C:\\Users\\...\\tmp into 'C:\\\\Users\\\\...\\\\tmp'.
… as ''

With the path echoed as typed, a blank value would leave a gap in the message; say (empty) instead.
@Ingenioeren

Copy link
Copy Markdown
Contributor

Tested 249d190d on Windows build 26200, Python 3.11.4. CPU-only synthetic tests, run by the Leonida batch runner (AI-assisted setup).

  • python -I -B tests/test_bvh_tri_probe.py: 17 run, OK.

@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent Windows CPU verification (Python 3.14.3, Windows 11 Build 26300, head 249d190db, base 1cc6e3c12, zero game data):

  • Negative control on main (1cc6e3c12):
    • --json <dir>: printed error: --json 'C:\\Users\\...' is not a file path\n, quoting the directory and doubling every backslash (\\\\).
    • --json " ": printed error: --json ' ' is not a file path\n with quoted whitespace instead of (empty).
  • On PR head 249d190db:
    • --json <dir>: prints error: --json <dir> is not a file path\n matching the path as typed without repr quotes or doubled backslashes.
    • --json " ": prints error: --json (empty) is not a file path\n.
  • Verification:
    • git diff --check origin/main...HEAD: clean.
    • python -m compileall -q tools/bvh_tri_probe.py tests/test_bvh_tri_probe.py: clean.
    • python -I tests/test_bvh_tri_probe.py: 17/17 OK.

Clean and ready to merge.

AI-assisted.

@shayderrr shayderrr left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Summary

tools/bvh_tri_probe.py changes the --json path diagnostic from {args.json_out!r} to {args.json_out.strip() or '(empty)'}. repr() doubled every Windows backslash; a blank value now prints (empty). Tests assert the exact one-line messages for a directory path and whitespace-only input.

Why merge

The error names the path the user actually typed and stays readable on Windows, matching the tool's other diagnostics.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary

tools/bvh_tri_probe.py changes the --json path diagnostic from {args.json_out!r} to {args.json_out.strip() or '(empty)'}. repr() doubled every Windows backslash; a blank value now prints (empty). Tests assert the exact one-line messages for a directory path and whitespace-only input.

Why merge

The error names the path the user actually typed and stays readable on Windows, matching the tool's other diagnostics.

Verdict: Approve

@shayderrr
shayderrr merged commit 2382459 into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
josevictorp added a commit to josevictorp/Leonida that referenced this pull request Nov 23, 2026
ItsNotRexed#6708 added two --json tests at the same spot in tests/test_bvh_tri_probe.py. Both blocks stay; 18 tests pass.
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