fix(modtool): a folder mod named with punctuation imports instead of being refused #3112

Merged
HumanBean merged 2 commits from HumanBean/Longshot:fix/mod-slug-punctuation into main 2026-12-03 20:42:01 +00:00
Owner

Summary

Adding a folder mod (a romfs/ or exefs/ folder with no mod.toml) fails when its name has punctuation next to a space. A player's Fierce Deity Armor + Reskins gave:

its mod.toml: id: "local/fierce-deity-armor---reskins" is not owner/name (a-z, 0-9, . _ -)

The importer wrote one - for each character an id does not take, and the manifest check refuses two of . _ - together, so it refused the mod.toml it had just made. slug() in game/crates/modtool/src/import.rs now writes one separator per run and puts none at either end, also after the 64-byte cut. Every slug that was accepted before comes out the same.

To see it on main: longshot-builder mod import of a folder with that name and a romfs/ in it.

Workaround for players until this is released: rename the folder to letters, numbers and single spaces.

The Launcher has its own copy of this rule; its fix is a separate pull request in LongshotLauncher.

Testing

Tested: Linux (CachyOS), game-free.

  • The new test fails at the test commit with the player's error, and passes with the fix.
  • cargo test -p modtool: 257 passed, 2 ignored.
  • A real longshot-builder mod import of a made-up Fierce Deity Armor + Reskins/romfs/a.bin added local/fierce-deity-armor-reskins, exit 0.
  • mise run test: 875 passed, 12 skipped, 3 failed (test_utf8_paths.py, test_run_all_junit.py, test_lifter.py). The failure read in test_lifter.py is in build-core lint, formatting and a build-driver test, none of which this changes. Not yet confirmed on main: that run is queued.
  • No game was started (opened without it at the requester's instruction).

Still to test:

  • Any PC: import a folder mod with punctuation in its name, start the game, expecting the mod listed and its files loaded (by hand).
  • Windows: add the same folder through the Launcher or the Mods tab, expecting it to be added (by hand).

Measurements

Nothing to time: this only changes the id made once when a mod is imported.

Before: main @ 76092c5e After: this PR @ 3d10b73f
Importing Fierce Deity Armor + Reskins refused (new test fails) added as local/fierce-deity-armor-reskins

Risks

Two folders whose names differ only in punctuation (A + B, A B) now get the same id; before, one of them could not be imported at all. Mods already imported keep their ids. A revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (No game run.)
  • mise run test passes (any failure that also fails on main is named). (main comparison still queued.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Adding a folder mod (a `romfs/` or `exefs/` folder with no `mod.toml`) fails when its name has punctuation next to a space. A player's `Fierce Deity Armor + Reskins` gave: > its mod.toml: id: "local/fierce-deity-armor---reskins" is not owner/name (a-z, 0-9, . _ -) The importer wrote one `-` for each character an id does not take, and the manifest check refuses two of `.` `_` `-` together, so it refused the `mod.toml` it had just made. `slug()` in `game/crates/modtool/src/import.rs` now writes one separator per run and puts none at either end, also after the 64-byte cut. Every slug that was accepted before comes out the same. To see it on `main`: `longshot-builder mod import` of a folder with that name and a `romfs/` in it. Workaround for players until this is released: rename the folder to letters, numbers and single spaces. The Launcher has its own copy of this rule; its fix is a separate pull request in LongshotLauncher. ## Testing **Tested:** Linux (CachyOS), game-free. - The new test fails at the test commit with the player's error, and passes with the fix. - `cargo test -p modtool`: 257 passed, 2 ignored. - A real `longshot-builder mod import` of a made-up `Fierce Deity Armor + Reskins/romfs/a.bin` added `local/fierce-deity-armor-reskins`, exit 0. - `mise run test`: 875 passed, 12 skipped, 3 failed (`test_utf8_paths.py`, `test_run_all_junit.py`, `test_lifter.py`). The failure read in `test_lifter.py` is in `build-core` lint, formatting and a `build-driver` test, none of which this changes. **Not yet confirmed on `main`**: that run is queued. - **No game was started** (opened without it at the requester's instruction). **Still to test:** - Any PC: import a folder mod with punctuation in its name, start the game, expecting the mod listed and its files loaded (by hand). - Windows: add the same folder through the Launcher or the Mods tab, expecting it to be added (by hand). ## Measurements Nothing to time: this only changes the id made once when a mod is imported. | | Before: main @ 76092c5e | After: this PR @ 3d10b73f | |---|---|---| | Importing `Fierce Deity Armor + Reskins` | refused (new test fails) | added as `local/fierce-deity-armor-reskins` | ## Risks Two folders whose names differ only in punctuation (`A + B`, `A B`) now get the same id; before, one of them could not be imported at all. Mods already imported keep their ids. A revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (No game run.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (`main` comparison still queued.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
fix(modtool): a folder mod named with punctuation imports instead of being refused
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 12s
PR description / Title and description (pull_request_target) Failing after 6s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 15s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Failing after 1m18s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 10m43s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m58s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m34s
CI / Website build and checks (pull_request) Failing after 1m14s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 48m40s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m7s
3d10b73f2f
Each character an id does not take became its own '-', so "A + B" made
"a---b", which the manifest check refuses.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
HumanBean changed title from WIP: fix(modtool): a folder mod named with punctuation imports instead of being refused to fix(modtool): a folder mod named with punctuation imports instead of being refused 2026-12-03 20:41:57 +00:00
HumanBean deleted branch fix/mod-slug-punctuation 2026-12-03 20:42:02 +00:00
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!3112
No description provided.