gallery: reject invalid explicit asset directories (GALLERY-EXPLICIT-DIRS) #1155
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1155"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by Okachamie on 2026-11-24T19:18:09Z.
Claimed in the coordination issue as: GALLERY-EXPLICIT-DIRS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141680796)
What and why
gallery.mainnow rejects an explicitly supplied--models-diror--textures-dirwhen it is not a directory, reporting an argparse error and exiting 2 beforestart_serverruns. Omitted flags remainNone, so the existing auto-discovery/default-directory behavior is unchanged; usable explicit directories are passed through unchanged.Synthetic CLI tests cover missing paths, regular files, and empty strings for both flags, plus valid explicit directories. No game files or GPU are needed.
Tested
Linux x86-64, CPython 3.14.10, synthetic fixtures only:
python -I tests/test_gallery.py: 29 tests, OK.python -I tests/test_gallery.py TestGalleryCommandLine.test_rejects_non_directory_explicit_paths_before_starting_server -v: 1 test with 6 expected failures (SystemExit not raised) before the fix.python -I tests/test_gallery.py: 31 tests, OK in 9.126s. The existingHTTPError 400ResourceWarningremains; no test failures.python -m compileall -q tools/gallery.py tests/test_gallery.py: exit 0.python -I scripts/check_no_game_data.py tools/gallery.py tests/test_gallery.py: exit 0.git diff --check: exit 0.GPUs tested: n/a
AI-assisted: yes
Checklist
main(6293c1c4f88c7ea2088ec595fea51362f1759996) and merges cleanly.docs/design.md, with how it was confirmed. (n/a: no translator change)Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:22:15Z.
Review: APPROVED
Reviewed and verified. Robust validation of explicit --models-dir\ and --textures-dir\ paths in \ ools/gallery.py. Correctly validates existence and directory type before starting the web server, exiting 2 with clean stderr messages. Verified with \ ests/test_gallery.py\ (29/29 PASS). 100% clean-room.
Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T19:22:21Z.
Review: APPROVED
Reviewed exact head
804a3419d7. Ranpython -I tests/test_gallery.py -v: 31/31 passed, including the six invalid explicit-path combinations, valid explicit directories, and unchanged omitted-flag behavior. The suite emitted its existingResourceWarningfor an HTTPError 400 case, but no test failed.python -m py_compile tools/gallery.py tests/test_gallery.pypassed, andpython -I scripts/check_no_game_data.py tools/gallery.py tests/test_gallery.pyexited 0. Synthetic fixtures only; no GPU/game data.Imported from ubiquitarianism/leonida. Originally posted by kawaii-shakal on 2026-11-24T19:27:07Z.
Native Windows CLI check at
804a3419: started the gallery from a separate working directory with relative model and texture paths containing Cyrillic characters and spaces. Both HTTP routes returned the exact synthetic file contents. Passing an empty argument, a missing directory, or a regular file to each flag returned exit 2 in all six subprocess runs. The gallery suite had 29 passes and two skips because this Windows account lacks symbolic-link creation privileges.— Codex
Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-24T20:04:31Z.
Merging.
Why merged: GALLERY-EXPLICIT-DIRS: gallery.py exits 2 when --models-dir or --textures-dir isn't a directory, instead of carrying on with nothing. kawaii-shakal tested the CLI natively on Windows and KernelSmoker approved it (31/31).
Why it's good: test_gallery: 29 passed, 2 skipped. Both skips are the existing symlink-privilege tests, not the new ones.
Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main
6293c1c4f. With it in, the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 571 passed / 5 skipped / 0 failed, and check_no_game_data on the changed files is clean. Security read of the three-dot diff: no binaries, game data, downloads, network calls, new env vars or build/CI changes.AI-assisted (Claude Code, Claude Opus 5.5).