fix(mods): mods added before nightly 1007 are listed once again #410
No reviewers
Labels
No labels
area/build
area/install
area/mods
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!410
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/LongshotLauncher:fix/mods-listed-twice"
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?
Players see their mods twice on the Mods page, and the mods' ExeFS patches are no longer built into the game.
What was wrong
Before nightly 1007 this launcher labelled a mod it added with a
mod.json, and listed it inprofile.json. Since MagicBeanDev/Longshot#2822 the game and the builder readmod.tomlonly. Nothing converted the old labels, somod installedlists one folder twice: by its folder's name, and as the profile's entry with its files "missing".Seen by two players with mods added before nightly 1007. Mods brought over from stable 3.2.0 get it too: that import still writes only a
mod.json.What this changes
At each start, after the import from stable, the launcher writes a
mod.tomlbeside its ownmod.json, with the same id, name and version (src/mods/old_format.rs). It does the same after an import for a builder without mod tools.mod.jsonexactly as this launcher wrote it. Anything else is left alone: other people's mods, a folder withsites.tomlor other folders in it, an id anothermod.tomlhas (read as TOML).mod.json.RomFS) are renamed to lower case, as the builder reads them.mod.toml, so its cheats still run.mod.toml: its patches can be built again, but its cheats no longer run (the builder's own import does the same). The cheat files stay.A folder that has a
mod.tomlalready is no longer given amod.jsonby the import for older builders.Not covered: an entry whose folder is gone stays listed as missing, so the player can remove it.
Tested
Windows 11, Rust 1.99.1 gnullvm with llvm-mingw.
old_format.rs. Undoing each of seven key lines of the review's fixes makes one fail, as undoing the key lines of the first version did.cargo fmt, Clippy with-D warningsand the wholecargo test --lockedpass on this head.tests/test_launcher_core.pypassed onafbbfe4, the Tooling release suite on the first commit.afbbfe4: Windows 11, RTX 5080, driver 621.47, headless, from the repository savekokiri-start, the game built from Longshotmain@ b4d56f526 plus one menu fix (b1b433ee9). On a throwaway profile this code had repaired, it reached play, loaded each mod that was on once, left the one that was off alone, and its log had no errors. Before the repair, the builder listed such a mod twice.Not tested: clicking through the real launcher, building an ExeFS mod into the game, and Linux (CI runs its tests). No screenshots: no view changes, the page only gets fewer rows.
🤖 Generated with Claude Code
Possibly related, for context:
@review
Recommendation: Request changes. The migration can leave a disabled mod enabled after a partial failure, and it can create a duplicate manifest ID. It also skips some folders the launcher itself imported.
The change restores manifests for older local mods and preserves their files, but its recovery and identification logic can leave affected mods in the wrong state or prevent them from loading.
Blocking (3): must change before merging.
src/mods/old_format.rs:122: The claimed-ID check searches for a double-quoted string instead of reading the TOML ID. (more on the line) Do: Parse each manifest as TOML and compare its ID, handling unreadable or invalid manifests conservatively.src/mods/old_format.rs:70: The migration rejects differently capitalized part folders even though the launcher's in-place importer accepts them. (more on the line) Do: Handle the spelling accepted by the importer and ensure the resulting manifest points to parts the builder can use, for example by safely normalizing their names.src/mods/old_format.rs:161: The cheat-folder branch discards the old row without preserving its off setting when a folder-name row exists. (more on the line) Do: Merge the two rows' on settings before removing the old row, keeping the mod off if either row is off.Should fix (1): not blocking, but worth doing before merging.
src/mods/old_format.rs:160: The manifest is published before the corresponding profile changes, and a failed later operation leaves it published permanently. (more on the line) Do: Make publication and profile repair recoverable together, including after a later mod or profile write fails; add a test that retries after such a failure.Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)
@fixcan do L1, L2, L3 and L4.Checks: Still running: 5 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven. The reported synthetic builder run showed one row per repaired mod with its on/off choice, but no real launcher, build, or game run was reported.
Other systems: The migration affects profile files shared with the builder and game on Windows and Linux, including stable imports and older builders. The reported tests ran on Windows; Linux and a real build and game were not tested.
Switches: None.
Reviewed:
255c1a817aagainst3898cb1bb0: Read the repository rules, commit and complete diff; read the new migration and stable-import code in full, and the changed portions and relevant callers of the other changed files. Skimmed related mod tests and documentation. The other changed files were not read in full; no recorded runs or generated files were supplied.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run, as requested. The author reports Windows Rust tests, formatting, Clippy, and the Tooling release suite passing; the launcher core suite was unfinished and CI was still running.
Overlaps and merge order: Not checked; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
@ -0,0 +67,4 @@}if entry.path().is_dir() {let part = PARTS.iter().position(|p| *p == name)?;if !players::is_dir(&dir.join(PARTS[part])) {L3 (blocking): The migration rejects differently capitalized part folders even though the launcher's in-place importer accepts them.
When: On Linux, a mod imported in place with an ExeFS or RomFS directory receives this launcher's mod.json, but the lowercase path checked here does not exist. Every start skips it, leaving the duplicate row and its patches unbuilt.
Do: Handle the spelling accepted by the importer and ensure the resulting manifest points to parts the builder can use, for example by safely normalizing their names.
@ -0,0 +119,4 @@let quoted = format!("\"{id}\"");for entry in fs::read_dir(profile.join("mods"))? {let file = entry?.path().join("mod.toml");if players::is_file(&file) && fs::read_to_string(&file)?.contains("ed) {L2 (blocking): The claimed-ID check searches for a double-quoted string instead of reading the TOML ID.
When: An existing valid manifest containing id = 'local/grass' is not detected. The migration then writes another manifest with that ID, so both folders claim it and neither loads.
Do: Parse each manifest as TOML and compare its ID, handling unreadable or invalid manifests conservatively.
@ -0,0 +157,4 @@let mut file = tempfile::NamedTempFile::new_in(&dir)?;file.write_all(text.as_bytes())?;file.as_file().sync_all()?;file.persist_noclobber(dir.join("mod.toml"))?;L1 (should fix): The manifest is published before the corresponding profile changes, and a failed later operation leaves it published permanently.
When: If a duplicated mod has its folder-name row off and its old-ID row on, the manifest can be written successfully but a later mod's write or the profile write can fail. The profile still contains both original rows; on the next start, old() skips the already-written manifest, so the off choice is never merged into the surviving ID.
Do: Make publication and profile repair recoverable together, including after a later mod or profile write fails; add a test that retries after such a failure.
@ -0,0 +158,4 @@file.write_all(text.as_bytes())?;file.as_file().sync_all()?;file.persist_noclobber(dir.join("mod.toml"))?;} else if pins.iter().any(|p| p["id"] == by_name) {L4 (blocking): The cheat-folder branch discards the old row without preserving its off setting when a folder-name row exists.
When: For a romfs-and-cheats folder whose old-ID row is off and folder-name row is on, migration removes the off row and retains the on row. The mod is enabled despite the player's saved choice.
Do: Merge the two rows' on settings before removing the old row, keeping the mod off if either row is off.
All four are fixed in
afbbfe4, each with a test that fails when its fix is taken out.profile.jsonis written first, then eachmod.toml. If writing one fails, the others are still written and the next start finishes the job. The off choice is already merged by then. Test:a_failed_write_is_done_at_the_next_start_with_the_choices_kept.mod.tomlis read as TOML and itsidcompared, in nested folders too. A file that cannot be read counts as having the id. One that is not valid TOML counts if it names the id. Thetomlcrate was already inCargo.lockat this version.RomFS,ExeFSand so on are renamed to lower case before themod.tomlis written. A folder that holds the same part in two spellings is left alone.main@ b4d56f526 plus one menu fix (b1b433ee9). Still not tested: clicking through the real launcher, building an ExeFS mod, and Linux beyond CI.@review
Recommendation: Request changes. The migration still leaves differently capitalized part folders unchanged for mods kept without a manifest, so those parts can remain unavailable on case-sensitive filesystems.
The change repairs old launcher-labelled mods by merging duplicate profile entries and writing manifests. It preserves existing files and choices, but its case normalization does not cover the manifest-free cheat branch.
Blocking (1): must change before merging.
src/mods/old_format.rs:70: The migration rejects differently capitalized part folders even though the launcher's in-place importer accepts them. When: On Linux, a mod imported in place with an ExeFS or RomFS directory receives this launcher's mod.json, but the lowercase path checked here does not exist. Every start skips it, leaving the duplicate row and its patches unbuilt. Do: Handle the spelling accepted by the importer and ensure the resulting manifest points to parts the builder can use, for example by safely normalizing their names.@fixcan do L3.Since the last review (on
255c1a817a)Resolved: L1 (The manifest is published before the corresponding profile changes, and a failed later ope…); L2 (The claimed-ID check searches for a double-quoted string instead of reading the TOML ID.); L4 (The cheat-folder branch discards the old row without preserving its off setting when a fol…); L5 (The end-to-end repair has not been exercised through a real launcher build and game.)
Still open: L3 (The migration rejects differently capitalized part folders even though the launcher's in-p…)
Checks: Still running: 5 checks.
Also noticed (1; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Unproven for the full repair workflow. A Windows headless game run loaded repaired enabled mods and left a disabled mod off; building an ExeFS mod through the launcher and Linux remain untested.
Other systems: The migration affects profile files and mod folders on Windows and Linux, including stable imports and older builders. Case-sensitive filesystems expose the remaining part-folder issue; the reported game run was on Windows.
Switches: None.
Reviewed:
afbbfe4987against3898cb1bb0: Read AGENTS.md, CONTRIBUTING.md, Cargo.toml and src/mods/old_format.rs; inspected the diff, migration callers and importer. The larger changed files and Cargo.lock were skimmed. No review checklist or pull request template was present.; nothing run (a code review).Checked and fine:
Testing: No commands that build or run the project were executed. The author reports Windows tests and a headless game run; CI is still running.
Overlaps and merge order: Not available from the supplied information.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
L3 is fixed for mods kept without a manifest too, in
a433dad: the part folders are renamed to lower case before the mod's entry changes, in both branches. If a rename fails, the entry stays as it is and the next start tries again. The test now covers aROMFSandCheatsfolder, and it fails with the rename taken out. Clippy and the whole cargo test pass on Windows.@review
Recommendation: Request changes. The migration still leaves some previously imported mods with capitalized part folders, so the builder or game can miss their contents.
The change repairs old mod labels and profile entries so affected mods can be listed and built again. It adds migration and retry logic, but one eligible naming case still bypasses the part-folder repair.
Blocking (1): must change before merging.
src/mods/old_format.rs:70: The migration rejects differently capitalized part folders even though the launcher's in-place importer accepts them. When: On Linux, a mod imported in place with an ExeFS or RomFS directory receives this launcher's mod.json, but the lowercase path checked here does not exist. Every start skips it, leaving the duplicate row and its patches unbuilt. Do: Handle the spelling accepted by the importer and ensure the resulting manifest points to parts the builder can use, for example by safely normalizing their names.@fixcan do L3.Since the last review (on
afbbfe4987)Still open: L3 (The migration rejects differently capitalized part folders even though the launcher's in-p…)
Checks: Still running: 5 checks.
More: does it help, other systems, switches, what was read
Does it help: Unproven: the author reports that a repaired profile reached play and loaded enabled mods on Windows, but an ExeFS build and the real launcher flow have not been tested.
Other systems: The migration runs on Windows and Linux and affects the builder and game’s reading of mod folders. Windows gameplay was reported; Linux and an ExeFS build remain untested.
Switches: None.
Reviewed:
a433dad7a1against3898cb1bb0: Read src/mods/old_format.rs and the repository rules in AGENTS.md and CONTRIBUTING.md in full. Read the changed hunks in Cargo.toml, src/main.rs, src/mods.rs, src/mods/local.rs and src/players/mod.rs; the other changed files were not read in full. The specified checklist and pull request template were absent.; nothing run (a code review).Checked and fine:
Testing: No commands from the project were run. The author reports Windows tests and a gameplay run; CI is still running. A real launcher flow, an ExeFS build and Linux remain untested.
Overlaps and merge order: Unknown; network access is closed.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.
The last case of L3 is fixed in
68a4484: a mod with cheats whose folder is named like its id already (mods/caps,local/caps) has its parts renamed too, and its entry and on/off choice stay as they were. The test covers it, and a mod with cheats alone. Taking out either new line makes it fail. On this head, Clippy with-D warningsand the wholecargo test --lockedpass on Windows.@review
Recommendation: Approve. The remaining migration case is fixed: capitalized part folders are now renamed even when a cheats mod is already listed by its folder name, while its existing choice is preserved. Recommend approval; not approved on the forge.
The launcher repairs older mod entries and labels so affected mods appear once and their ExeFS patches can be built again. The migration adds filesystem work at startup and preserves the documented tradeoff for mods containing both cheats and ExeFS patches.
Since the last review (on
a433dad7a1)Resolved: L3 (The migration rejects differently capitalized part folders even though the launcher's in-p…)
Checks: Still running: 5 checks.
Also noticed (2; not asked for, not blocking)
More: does it help, other systems, switches, what was read
Does it help: Yes for the reported duplicate-listing and loading case: the author reports a repaired profile reached play and loaded enabled mods once on Windows. Building an ExeFS mod and using the real launcher were not tested.
Other systems: The migration runs on Windows and Linux and handles profiles under an edit lock after checking that their paths are idle. The reported game run was on Windows; Linux coverage is limited to the stated CI tests.
Switches: None.
Reviewed:
68a448464bagainst3898cb1bb0: Read AGENTS.md, CONTRIBUTING.md, the full old-format migration and its tests, the change since the ledger head, and the pull request diff; other changed files and surrounding callers were skimmed. No review checklist or pull request template was present at the specified paths.; nothing run (a code review).Checked and fine:
Testing: No commands that execute project code were run. The author reports Windows tests and a game run; real launcher interaction, an ExeFS build and Linux gameplay remain untested.
Overlaps and merge order: None found in the supplied context.
Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.