gallery: reject invalid explicit asset directories (GALLERY-EXPLICIT-DIRS) #1155
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1155
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1155/head"
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?
@Okachamie on GitHub · 2026-11-24 19:18 UTC · original
Okachamie:t3/gallery-explicit-dirs→main· +39 −0 · 2 files · 1 commits · merged 2026-11-24 20:04 UTCClaimed in the coordination issue as: GALLERY-EXPLICIT-DIRS (#14)
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)@abnalstlll-byte on GitHub · 2026-11-24 19:22 UTC · original · approved these changes
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.
@KernelSmoker on GitHub · 2026-11-24 19:22 UTC · original · approved these changes
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.@kawaii-shakal on GitHub · 2026-11-24 19:27 UTC · original
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
@QemmHD on GitHub · 2026-11-24 20:04 UTC · original
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).