Skip to content

rbf0_tree: both error lines name the path as typed, not through repr() (EGEN-RBF0TREE-PATHREPR) - #6690

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

shayderrr merged 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/5-rbf0tree-pathrepr

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/rbf0_tree.py prints the path its one error line is about with {path!r} in the two branches that end a run: the depth-limit RecursionError and the write OSError. On Windows repr() doubles every backslash, so a user who hits either one reads

'C:\\Users\\Lucas\\AppData\\Local\\Temp\\t...\\tree.json': No space left on device

instead of the path they passed. Both lines now print the path as typed, the same fix as #6647 (awc_shorts) and #6618 (bcpack_tool).

Claimed as EGEN-RBF0TREE-PATHREPR (DeepSeek5).

Test

python -I tests/test_rbf0_tree.py

New test OutputTest.test_error_lines_name_the_path_as_typed fails without the change and passes with it (Windows paths; on a POSIX host neither branch's path contains a backslash, so it passes either way).

Before (tool at upstream/main, test added):

FAIL: test_error_lines_name_the_path_as_typed ... [decode_source]
AssertionError: "'C:\\\\Users\\\\Lucas\\\\AppData\\\\Loca[72 chars]it\n" != 'C:\\Users\\Lucas\\AppData\\Local\\Temp\\[56 chars]it\n'
- 'C:\\\\Users\\\\Lucas\\\\AppData\\\\Local\\\\Temp\\\\tmpxai25pzs\\\\deep.bin': tree exceeds the export depth limit
+ C:\\Users\\Lucas\\AppData\\Local\\Temp\\tmpxai25pzs\\deep.bin: tree exceeds the export depth limit
FAIL: test_error_lines_name_the_path_as_typed ... [write_json]
FAILED (failures=2)

After:

Ran 37 tests in 1.674s
OK (skipped=1)

No GPU is needed; nothing here touches the translator or the runtime.

Notes

  • Printed as typed rather than in quotes: every other message in this tool that names a path (out and --csv must be different files, {flag} would overwrite the source {args.source}) already does so, and the line starts with the path.
  • The two !r occurrences were fixed in separate commits so each error branch carries its own testable change; no behaviour other than the message text changes.
  • tests/test_rbf0_tree.py needed io and contextlib imports for the in-process run.
  • Depends on: none. rbf0_tree: guard out/--csv/--xml with the shared report_paths.same_report_path (EGEN-RBF0-TREE-SHARED) #6176 (DeepSeek4) touches the out/--csv guards earlier in the same function; this change is inside the except clauses below them and does not overlap.

AI-assisted.

…eeded

repr() doubles every backslash on Windows, so the one line of a RecursionError read 'C:\\\\out\\\\tree.json'.
Same defect in the OSError line: a refused or full report path came out with doubled backslashes.
Fails on Windows before the two fixes (repr turns C:\\out\\x.json into C:\\\\out\\\\x.json); passes after them, and on POSIX both ways since the path has no backslash there.
@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Independent CPU verification on Windows 11 (CPython 3.14, CPU only, no game data):

  • Negative control on main (1cc6e3c12):
    Running test_error_lines_name_the_path_as_typed against unmodified tools/rbf0_tree.py reproduces 2 failures:

    FAIL: test_error_lines_name_the_path_as_typed (__main__.OutputTest.test_error_lines_name_the_path_as_typed) [decode_source]
    AssertionError: "'C:\\\\Users\\\\...\\\\deep.bin': tree exceeds the export depth limit\n" != 'C:\\Users\\...\\deep.bin: tree exceeds the export depth limit\n'
    
    FAIL: test_error_lines_name_the_path_as_typed (__main__.OutputTest.test_error_lines_name_the_path_as_typed) [write_json]
    AssertionError: "'C:\\\\Users\\\\...\\\\tree.json': No space left on device\n" != 'C:\\Users\\...\\tree.json: No space left on device\n'
    

    confirming that repr() enclosed Windows paths in quotes and doubled every backslash separator.

  • With PR rbf0_tree: both error lines name the path as typed, not through repr() (EGEN-RBF0TREE-PATHREPR) #6690:

    • python -m compileall -q tools/rbf0_tree.py tests/test_rbf0_tree.py: clean, exit 0.
    • python -I tests/test_rbf0_tree.py: 37 tests, 36 passed, 1 skipped (test_report_keeps_the_usual_permission_bits on Windows) in 1.68s.
    • Both error messages output clean, unquoted Windows paths with single backslashes matching the rest of the CLI.
    • git diff --check: clean.

Clean parity fix mirroring #6647 and #6618. Ready to merge.

AI-assisted.

@memorypressure

Copy link
Copy Markdown

Verified at 64abeb1: 37 tests under python -I pass; the two new error-line assertions fail on unmodified main. The path!r to path change is right — the variable tracks the failing stage's path, and repr doubled backslashes on Windows-style paths. Checks pending. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run).

@kapitche

Copy link
Copy Markdown
Contributor

Tested 64abeb1 merged with main 511e382 on Linux/Python 3.12.16: pass

Commands run (merged worktree, -I isolated mode):

  • python -I tests/test_rbf0_tree.py -> Ran 38 tests, OK
  • Negative control: git checkout upstream/main -- tools/rbf0_tree.py, rerun -> FAILED (failures=2): both subtests of the new test_error_lines_name_the_path_as_typed see the old quoted form ('/tmp/.../tree.json': No space left on device) instead of the bare path. Restored with git checkout HEAD -- tools/rbf0_tree.py.

Diff read: the two error lines in main() print {path} instead of {path!r}. On POSIX this removes only the quotes; the doubled Windows backslashes the test docstring mentions were not reproduced here since I ran on Linux only.

@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/rbf0_tree.py main() now prints error paths with {path} instead of {path!r}, so a Windows path appears with single backslashes on the one error line rather than a doubled repr(). tests/test_rbf0_tree.py adds test_error_lines_name_the_path_as_typed, patching decode_source and write_json and asserting exact stderr text for both RecursionError and OSError.

Why merge: Makes error output readable and copy-pasteable on Windows, and the test keeps POSIX behavior unchanged.

Verdict: Approve

@shayderrr

Copy link
Copy Markdown
Collaborator

Summary: tools/rbf0_tree.py main() now prints error paths with {path} instead of {path!r}, so a Windows path appears with single backslashes on the one error line rather than a doubled repr(). tests/test_rbf0_tree.py adds test_error_lines_name_the_path_as_typed, patching decode_source and write_json and asserting exact stderr text for both RecursionError and OSError.

Why merge: Makes error output readable and copy-pasteable on Windows, and the test keeps POSIX behavior unchanged.

Verdict: Approve

@shayderrr
shayderrr merged commit 3f20d0f into ItsNotRexed:main Nov 23, 2026
0 of 2 checks passed
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.

5 participants