[PR #2272] fssm_header: support UTF-8 BOM index.json, deduplicate index paths, and match .fssm case-insensitively #2278

Open
opened 2026-11-26 21:20:39 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2272
Author: @kirigayakazima
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/fssm-header-safety


📝 Commits (1)

  • 9c6350e fssm_header: support UTF-8 BOM index.json, deduplicate index paths, and match .fssm case-insensitively

📊 Changes

2 files changed (+75 additions, -2 deletions)

View changed files

📝 tests/test_fssm_header.py (+65 -0)
📝 tools/fssm_header.py (+10 -2)

📄 Description

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.py previously:

  • Opened index.json with "utf-8" instead of "utf-8-sig", causing UTF-8 BOM index.json files to fail json.load() silently and fall back to unknown stages.
  • Checked both base/index.json and base/../index.json without deduplicating resolved paths.
  • Filtered directory inputs with name.endswith(".fssm"), skipping uppercase/mixed-case .FSSM files.
  • Accepted existing paths that are neither regular files nor directories in main() before os.listdir().

This opens index.json with "utf-8-sig", deduplicates candidate paths by normalized realpath, matches .fssm case-insensitively in files_of(), adds an upfront file-or-directory guard in main(), and adds unit/CLI tests in tests/test_fssm_header.py.

Tested

  • python -I tests/test_fssm_header.py -v (45 passed)
  • Detached upstream/main baseline negative control: failed with the new tests before the fix
  • python -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, and git diff --cached --check

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • 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.

🔄 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/2272 **Author:** [@kirigayakazima](https://github.com/kirigayakazima) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/fssm-header-safety` --- ### 📝 Commits (1) - [`9c6350e`](https://github.com/ubiquitarianism/leonida/commit/9c6350e5a745d2192adfc9da86cd79cfbbd246c9) fssm_header: support UTF-8 BOM index.json, deduplicate index paths, and match .fssm case-insensitively ### 📊 Changes **2 files changed** (+75 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `tests/test_fssm_header.py` (+65 -0) 📝 `tools/fssm_header.py` (+10 -2) </details> ### 📄 Description 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.py` previously: - Opened `index.json` with `"utf-8"` instead of `"utf-8-sig"`, causing UTF-8 BOM `index.json` files to fail `json.load()` silently and fall back to unknown stages. - Checked both `base/index.json` and `base/../index.json` without deduplicating resolved paths. - Filtered directory inputs with `name.endswith(".fssm")`, skipping uppercase/mixed-case `.FSSM` files. - Accepted existing paths that are neither regular files nor directories in `main()` before `os.listdir()`. This opens `index.json` with `"utf-8-sig"`, deduplicates candidate paths by normalized `realpath`, matches `.fssm` case-insensitively in `files_of()`, adds an upfront file-or-directory guard in `main()`, and adds unit/CLI tests in `tests/test_fssm_header.py`. ### Tested - `python -I tests/test_fssm_header.py -v` (45 passed) - Detached `upstream/main` baseline negative control: failed with the new tests before the fix - `python -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`, and `git diff --cached --check` GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#2278
No description provided.