Skip to content

tools: sandbox_scene refuses a --out in a missing folder before the scan - #5550

Open
evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/4-sandbox-out-folder
Open

evilclanker9000 wants to merge 1 commit into
ItsNotRexed:mainfrom
evilclanker9000:deepseek/4-sandbox-out-folder

Conversation

@evilclanker9000

Copy link
Copy Markdown
Contributor

tools/sandbox_scene.py opened --out only at the end of build(), so an output in a folder that does not exist ended in a FileNotFoundError traceback after the whole placement scan, the model manifests and every texture had been read. Six other tools already refuse this before doing any work: odrp_7a.py:1197, page_index.py:461, rbf0_index.py:531, restofworld_index.py:513, restofworld_model_join.py:1194 and story_index.py:384 print one line and exit 2.

The same check now runs in main() before build(). Nothing else changes: a valid folder behaves as before.

Test (tests/test_sandbox_scene.py, new case, runs the CLI in a temporary folder):

python -I tests\test_sandbox_scene.py
  • Before the tool change: FAILED (failures=1) — AssertionError: 1 != 2 : Traceback (most recent call last): ... FileNotFoundError: [Errno 2] No such file or directory: '...\rows.jsonl' (7 tests, 1 failure).
  • After: Ran 7 tests in 0.182s / OK.
  • The CLI itself now prints one line: sandbox_scene.py: error: <folder> is not a folder, so <out> cannot be written, exit 2.

No GPU and no game files: the test builds its arguments in a temporary folder and the refusal happens before any input is read.

Notes

  • I picked the existing-folder check over creating the folder, because that is what the six tools above do with an output file; a missing --out folder is a typo in the command, not a path to create.
  • The same argument is also --entities/--models, which still fail with a traceback when they do not exist. That is the input contract covered by tests/test_missing_input_exit_codes.py (tests: cover 21 more tools in the missing-input exit-code test #5376 extends its list), so it stays out of this PR.

AI-assisted.

@shdann

shdann commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 5ddf866 on Windows 11, CPython 3.14.7, CPU only: pass.

py -3.14 -I tests/test_sandbox_scene.py passes all seven tests. Against parent 3faac55, the new test reaches the missing input file and exits with code 1. The head reports the invalid output folder first and exits with code 2.

I also ran the CLI with an empty synthetic rows file, an empty models folder, and --center 1 2. The head rejects both a missing parent and a regular file used as the parent. A bare output filename and a path inside an existing folder both succeed. The scene bytes match the parent in both valid cases (SHA-256 25b7f48d1d754edf686bb0f6643235e320cb7c161a45501062a3dd1955e5c5ee).

AI-assisted.

@neoisg8

neoisg8 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Verified locally on Windows 11 (Python 3.14, CPU-only):

  1. Test Suite: \python -I tests/test_sandbox_scene.py\ passes all 7 tests in 0.146s.
  2. Negative Control: Running against \main\ (commit 3faac55) with unpatched \ ools/sandbox_scene.py\ reproduces the expected failure:
    • \ est_out_folder_missing_is_refused_before_the_scan\ fails (\AssertionError: 1 != 2) because \�uild()\ attempted to open --entities\ first and crashed with unhandled \FileNotFoundError\ (exit code 1) instead of fast-failing with exit code 2 on the missing output directory.
  3. Hygiene: \git diff --check\ is clean, line endings and \python -m compileall -q tools/sandbox_scene.py tests/test_sandbox_scene.py\ pass cleanly. No game data.

LGTM!

AI-assisted.

@evilclanker9000
evilclanker9000 force-pushed the deepseek/4-sandbox-out-folder branch from 5ddf866 to a98b2ad Compare November 23, 2026 11:45
@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Rebased on upstream/main: the branch conflicted with the newer ry/except OSError handler in main(). Resolved by keeping both: the --out folder is checked before the scan (same one-line ERROR: form, exit 2), and the OSError handler still covers an unreadable --entities/--models or an unwritable --out afterwards. python -I tests/test_sandbox_scene.py: 11 tests OK. On upstream/main the missing --out folder is only reported after the scan (ERROR: [Errno 2] No such file or directory), so the new assertion still falls without the change. No GPU needed.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed head 5ddf866.

  • python -I -m pytest tests/test_sandbox_scene.py -q -> 7 passed.
  • git diff --check clean.

os.path.dirname(os.path.abspath(--out)) is checked before build(), so the refusal happens before the scan: exit 2, one ap.error line, no traceback, and the new subprocess test covers it. Paths with no directory component resolve to the cwd, which is correct. No blockers.

@kapitche

kapitche commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Tested a98b2ad merged with main 561b65a on Linux (WSL2) / Python 3.12.16: pass

tests/test_sandbox_scene.py: 11 run, 11 passed, 0 failed. Negative control: with tools/sandbox_scene.py restored from upstream/main the new test_out_folder_missing_is_refused_before_the_scan fails (11 run, 1 failure: the tool only fails after trying the missing --entities, with a different message); fix restored afterwards. The new test runs the tool as a subprocess with -I, so the one-line ERROR and exit 2 are the real CLI behaviour.

@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.

Review

Reviewed correctness fix in PR #5550: tools: sandbox_scene refuses a --out in a missing folder before the scan.

Scope: tests/test_sandbox_scene.py, tools/sandbox_scene.py
Diff: +20 / -1 across 2 file(s).

The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.

Reviewed by shayderrr via automated batch review.

@shayderrr

Copy link
Copy Markdown
Collaborator

Thanks @evilclanker9000 - I went through tools: sandbox_scene refuses a --out in a missing folder before the scan and the diff around tests/test_sandbox_scene.py. The change is tight, the rationale matches the code, and there's nothing here that needs another pass from my side. Approved and squash-merging it into main now. Nice work.

…before the scan

build() opened --out only at the end, so a missing parent folder ended in a FileNotFoundError traceback after the whole placement scan. odrp_7a, page_index, rbf0_index, restofworld_index, restofworld_model_join and story_index already refuse this up front with one ap.error line and exit 2; sandbox_scene now does the same in main().
@evilclanker9000
evilclanker9000 force-pushed the deepseek/4-sandbox-out-folder branch from a98b2ad to a3db69a Compare November 23, 2026 14:47
@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Rebased onto upstream/main at 1cc6e3c after the conflict with #6204 (which added the --out is a folder\ refusal in the same block). Both checks now stand, cheapest first: a folder named by --out and then a missing parent folder, each one ERROR line and exit 2 before any scan.\n\nTest: \python -I tests/test_sandbox_scene.py\ -> Ran 12 tests, OK (includes test_out_directory_is_one_error_line from #6204, test_out_under_a_regular_file_is_one_error_line and this PR's test_out_folder_missing_is_refused_before_the_scan; the last one asserts the 'is not a folder, so' line that only this change prints). No GPU and no game files.\n\nAI-assisted.

@JRamos1993

Copy link
Copy Markdown
Contributor

Tested a3db69ac merged onto main 511e3826 on Windows 11, CPython 3.14.3, CPU only: pass.

  • python -I tests/test_sandbox_scene.py: 12 tests OK.
  • Negative control (tools/sandbox_scene.py from main, the PR's tests kept): tests/test_sandbox_scene.py 12 tests FAILED (failures=1).
  • py_compile on the 2 changed Python files: OK; git diff --check: clean.

No game files. AI-assisted (Claude Code).

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.

7 participants