mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:05:53 +01:00
[PR #2282] tools/pal_stages.py: harden path validation and case-insensitive index lookup #2287
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2287
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2282
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/pal-stages-lookup-guard📝 Commits (1)
7e188ectools/pal_stages.py: guard path type, fold stem lookup safely, and clarify index message📊 Changes
2 files changed (+75 additions, -3 deletions)
View changed files
📝
tests/test_pal_stages.py(+59 -0)📝
tools/pal_stages.py(+16 -3)📄 Description
Claimed in the coordination issue as: PAL-STAGES-INDEX-MESSAGE-CASE-LOOKUP-AND-PATH-GUARD (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7192117999)
What and why
<path>inputs upfront inmain()(tools/pal_stages.py) with anERROR:line on stderr and exit code2before scanning blobs.index.jsonfallback resilience by catching(OSError, ValueError, RecursionError)fromfssm_header.stage_index()and falling back to an empty stage map.lookup_stage()intools/pal_stages.pyfor unambiguous case-folded fallback lookup (casefold()) while leaving ambiguous case collisions unresolved (None)."no inspected blob in index.json"from"no index.json found"whentotal["stage_known"] == 0in text output, matchingtools/fssm_header.py.tests/test_pal_stages.pycovering case-folded lookup, ambiguous case collisions, the index summary distinction, fallback onOSError, and non-file/non-directory path rejection.Tested
python -I tests/test_pal_stages.py -v: 24 passed, 0 failed (detachedupstream/mainbaseline with only the updated test file fails with 1 failure and 2 errors).python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tools/pal_stages.py tests/test_pal_stages.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.