Repository navigation
Conversation
Kam471
left a comment
There was a problem hiding this comment.
Ran this at 9716c111 on Windows 11: python -I tests/test_gallery.py -> 4 tests, OK (1 skipped); git diff --check clean.
The gallery now reports an unlistable sub-folder in the model/texture listings instead of silently skipping it, and the endpoint/category tests pass. No blocking issue.
|
Tested
AI-assisted (Devin). |
|
Tested 9716c11 merged with main 03b09a0 (already up to date) on Linux (WSL2) Python 3.12.16 and native Windows 11 Python 3.13.1: pass for the code; the new test itself could not run in my environments.
|
|
Tested 9716c11 on Windows 11, CPython 3.14.7, CPU only (no GPU, no game files).
One thing is not complete. The page does not show the new field. AI-assisted. |
…instead of silently skipping them os.walk() without onerror drops a directory it cannot list, so the gallery served a 200 with a short asset list and no hint the scan was incomplete. Both walks now collect the failure into a scan_errors field the UI can show. Two regressions: the chmod case (skips where chmod is not enforced) and a scandir-forced case that runs on every platform.
9716c11 to
1b195d5
Compare
|
Same story here, chmod does nothing on the runner. Added a scandir-forced regression so the scan_errors guard is exercised on Windows and under root: it locks both sub-folders the same way os.walk would see them and checks the API reports each failure while still listing the root assets. The chmod case stays as the real-filesystem check. Red/green on the new case: fails against main's gallery.py (no scan_errors in the payload), passes with the fix. Full file: 5 tests OK. Rebased on d0835dd, head now 1b195d5. |
|
Tested 1b195d5 merged with main 98fa503 on Linux (Python 3.12.16): pass for the code, with a coverage limit - tests/test_gallery.py 5 tests: 2 OK, 3 ERROR with ConnectionRefusedError, the 3 that open a loopback HTTP server (test_endpoints, which also fails on main here, and the two new unlistable-subfolder tests); I could not connect to my own 127.0.0.1 listener in this environment at all, so I did not get them to run. Instead I called _serve_models_json/_serve_textures_json directly on a handler stub with os.scandir forced to raise PermissionError for a sub-folder: with the PR each returns count 1 and scan_errors listing the locked folder; with upstream/main tools/gallery.py the same script gives count 1 and no scan_errors key. So the behaviour is confirmed; the HTTP tests themselves are unrun here. |
|
Merges cleanly with current main: tools/gallery.py now passes an onerror hook to both os.walk calls and reports failures in a new scan_errors field; test_gallery runs 5 green here with the chmod case executing (re-run). Additive JSON field and only that one test parses the endpoints. No game data; fixtures binary-mode generated bytes. The PR shows no CI checks — worth triggering. AI-assisted: yes. Tested on Linux (RTX 5080 host, CPU-only run). |
Claimed in the coordination issue as: #4421 (comment)
What and why
gallery.py _serve_models_jsonand_serve_textures_jsonwalk the models/textures folders withos.walkand no
onerror. os.walk silently skips a sub-folder it cannot list, so/api/modelsand/api/texturesreturned fewer items with no indication the scan was incomplete. Reproduced on 03b09a0: a models_dir with a
.glb in the root and in a sub-folder lists both; after
chmod 000on the sub-folder the listing drops it andstill returns 200 with no error field. Both walks now pass an
onerrorthat collects the unlistable paths,and each payload gains a
scan_errorslist (empty when the scan is complete). This is the os.walk/onerrorcompleteness gap of #4190 / #4433, adapted to a request handler: surface the skipped folders in the JSON
rather than exit mid-request. #3909 changes the routing only, not these walks.
Tested
Linux, Python 3.14.10, CPU only, no game files (synthetic .glb/.png, local TCPServer as the existing tests).
tests/test_gallery.py::TestGalleryServer::test_unlistable_subfolder_is_reported_not_silently_skipped:chmod 000a models and a textures sub-folder,/api/modelsand/api/texturesreport the folders inscan_errorswhile still listing the root assets (skips when the folders are still listable, e.g. runningas root or on Windows). Red on the base:
scan_errorsabsent (KeyError). Green: whole file 4 OK.python -m compileall -q make_game.py tools tests,git diff --checkclean.Checklist
docs/design.md, with how it was confirmed. (no translator rule changed)AI-assisted (Tacit).