[PR #1155] [MERGED] gallery: reject invalid explicit asset directories (GALLERY-EXPLICIT-DIRS) #1188

Closed
opened 2026-11-26 20:20:23 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1155
Author: @Okachamie
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: t3/gallery-explicit-dirs


📝 Commits (1)

  • 804a341 gallery: reject invalid explicit asset directories

📊 Changes

2 files changed (+39 additions, -0 deletions)

View changed files

📝 tests/test_gallery.py (+36 -0)
📝 tools/gallery.py (+3 -0)

📄 Description

Claimed in the coordination issue as: GALLERY-EXPLICIT-DIRS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141680796)

What and why

gallery.main now rejects an explicitly supplied --models-dir or --textures-dir when it is not a directory, reporting an argparse error and exiting 2 before start_server runs. Omitted flags remain None, 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:

  • Baseline python -I tests/test_gallery.py: 29 tests, OK.
  • RED 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.
  • GREEN python -I tests/test_gallery.py: 31 tests, OK in 9.126s. The existing HTTPError 400 ResourceWarning remains; no test failures.
  • Synthetic CLI smoke: invalid explicit paths exit 2 without creating default directories or starting the server; valid explicit directories serve one synthetic model and texture; omitted flags still auto-create/discover defaults and serve successfully.
  • 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

  • Based on current main (6293c1c4f88c7ea2088ec595fea51362f1759996) and merges cleanly.
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1155 **Author:** [@Okachamie](https://github.com/Okachamie) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `t3/gallery-explicit-dirs` --- ### 📝 Commits (1) - [`804a341`](https://github.com/ubiquitarianism/leonida/commit/804a3419d7c4842e99471823cd4b638581104ab8) gallery: reject invalid explicit asset directories ### 📊 Changes **2 files changed** (+39 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_gallery.py` (+36 -0) 📝 `tools/gallery.py` (+3 -0) </details> ### 📄 Description Claimed in the coordination issue as: GALLERY-EXPLICIT-DIRS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7141680796) ### What and why `gallery.main` now rejects an explicitly supplied `--models-dir` or `--textures-dir` when it is not a directory, reporting an argparse error and exiting 2 before `start_server` runs. Omitted flags remain `None`, 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: - Baseline `python -I tests/test_gallery.py`: 29 tests, OK. - RED `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. - GREEN `python -I tests/test_gallery.py`: 31 tests, OK in 9.126s. The existing `HTTPError 400` `ResourceWarning` remains; no test failures. - Synthetic CLI smoke: invalid explicit paths exit 2 without creating default directories or starting the server; valid explicit directories serve one synthetic model and texture; omitted flags still auto-create/discover defaults and serve successfully. - `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 - [x] Based on current `main` (`6293c1c4f88c7ea2088ec595fea51362f1759996`) and merges cleanly. - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:20:23 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1188
No description provided.