fssm_header: support UTF-8 BOM index.json, deduplicate index paths, and match .fssm case-insensitively #2272
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2272
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/fssm-header-safety"
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 successfully merged and closed
Claimed in the coordination issue as: FSSM-HEADER-BOM-CASE-GLOB-AND-STAGE-INDEX (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7191354616)
What and why
tools/fssm_header.pypreviously:index.jsonwith"utf-8"instead of"utf-8-sig", causing UTF-8 BOMindex.jsonfiles to failjson.load()silently and fall back to unknown stages.base/index.jsonandbase/../index.jsonwithout deduplicating resolved paths.name.endswith(".fssm"), skipping uppercase/mixed-case.FSSMfiles.main()beforeos.listdir().This opens
index.jsonwith"utf-8-sig", deduplicates candidate paths by normalizedrealpath, matches.fssmcase-insensitively infiles_of(), adds an upfront file-or-directory guard inmain(), and adds unit/CLI tests intests/test_fssm_header.py.Tested
python -I tests/test_fssm_header.py -v(45 passed)upstream/mainbaseline negative control: failed with the new tests before the fixpython -I tests/test_ci_registration.py,python -I tests/test_text_write_line_endings.py,python -I scripts/check_no_game_data.py,python -I -m compileall -q, andgit diff --cached --checkGPUs 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.Verified on main a73a57e1 (Ubuntu 24.04 x86-64, Python 3.13, no GPU). Merges cleanly. With this PR, python -I tests/test_fssm_header.py: 45 tests OK. The PR's test file against main's tool: 3 failures, so the new tests fail on main and pass with the change. compileall clean.
AI-assisted: yes (Claude Code)
Tested on Windows 11, Python 3.12.10, with this PR merged onto current upstream main.
tests/test_fssm_header.py: 45 passed, 6 subtests passed (main: 42 passed).(AI-assisted test run; output checked by hand.)
Approving 9c6350e5a.
stage_indexreads each index once (paths deduplicated by their resolved, case-normalized form) and accepts a BOM,.fssmis matched case-insensitively, and a path that is neither file nor folder is a usage error.Merged onto
maind1dff7949in one batch with 22 other tool PRs of this series (no conflicts), on Linux with Python 3.13.tests/test_fssm_header.py: 45 passed (main: 42). AI-assisted (Claude Code, Claude Opus 5.5).Red/green: the PR tests fail on main 09c153948 and pass on head 9c6350e5a745 (cloud 2).
Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main d48a957bb in GitHub Actions: no new failure.
AI-assisted (Claude Code, Claude Opus 5.5)