fssm_header: support UTF-8 BOM index.json, deduplicate index paths, and match .fssm case-insensitively #2272
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2272"
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?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T11:57:34Z.
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.Imported from ubiquitarianism/leonida. Originally posted by real-rusher on 2026-11-26T12:23:24Z.
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)
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-26T12:52:05Z.
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.)
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-27T04:37:56Z.
Review: APPROVED
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).Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T15:07:37Z.
Red/green: the PR tests fail on main
09c153948and pass on head9c6350e5a7(cloud 2).Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)