fix(mods): removing a mod's old entry no longer deletes its only copy #3078

Merged
HumanBean merged 2 commits from llun/Longshot:fix/mod-remove-keeps-unlabelled-folder into main 2026-12-03 14:40:23 +00:00
Member

Summary

A player whose mods an older launcher added sees each one twice on the Mods page, and Remove on the row marked missing deletes the mod's only copy.

The launcher's entry in profile.json names a folder whose mod.json nothing reads any more (since #2822). The game lists that folder as local/<folder>, and the entry as missing. mod remove of the entry deleted the folder all the same.

Now mod remove keeps a folder when the game lists it under another id, or lists another mod inside it. It finds them with the game's own walk (code_mods::walk). The entry goes, so the double goes too. An entry of the folder's own id, a mod with a mod.toml, a folder with no mod in it and a folder no entry names are deleted as before. A path outside mods/ is refused before it is looked at, as before this change.

See it on main: the first commit's test fails, with the folder in deleted. Read another_mod in game/crates/modtool/src/service.rs first.

MagicBeanDev/LongshotLauncher#410 stops the doubling itself. This protects players whose launcher does not have it yet.

Testing

Tested: Windows 11, RTX 5080, driver 621.47. On the first version of this change (d7ad5f9d4; the same for this profile's folder), a throwaway profile with one folder (a RomFS file, a mod.json, no mod.toml) and an entry of another id:

  • This branch's builder listed it twice. mod remove of the missing row answered "deleted": [], the folder stayed, and one row was left.
  • The game then ran headless on that profile from kokiri-start: it reached play, 600 frames, the Insert menu opened, the mod loaded (mods: local/Grass: 1 RomFS files), no error lines. On the profile before the remove it also loaded once. That game was built from main @ b4d56f526 plus one menu fix (b1b433ee9), not from this branch, which changes only the builder's mod remove; a build of this branch did not fit on the disk.

Checks, on 67a669a85: the three new tests pass, the two newer ones failed on the versions before they were fixed, and the first fails on main. Undoing key lines of the guard, one at a time, makes one fail. modtool's service, cmd::state, import, profile, emulators and handle tests, its cargo fmt --check and its Clippy with -D warnings pass. The whole suite ran on d7ad5f9d4: mise run test was stopped near its end for disk space, and the five checks left were then run on their own. All pass but three:

  • test_i18n_complete fails, as it does on main.
  • test_lifter: its rustfmt and Clippy pass, and so does all of cargo test --release --workspace --no-fail-fast (modtool's 230 among them) but every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split (sites, tests/repository.rs), which fails the same way on main @ b4d56f526.
  • test_stack_commit failed once with the PC low on space, and passes alone here and on main.

Still to test:

  • Any PC, the launcher's Mods page: a profile doubled like that, Remove on the row without a switch, expecting the row to go and the folder to stay (by hand)

Measurements

Verdict: fixed: the folder is kept, the test failing on main passes here.

Setup: Windows 11, no game; cargo test -p modtool --lib removing_an_entry

Before: main @ b4d56f526 After: this PR @ 67a669a85
removing_an_entry_keeps_a_folder_that_is_another_mod_to_the_game fails: deleted names the folder passes: deleted is empty

Risks

Removing an entry like that leaves its folder in mods/; the folder's own row still removes it. The launcher's question still says the folder is deleted. A revert is enough. Saves, settings and caches: nothing.

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.
  • mise run test passes (any failure that also fails on main is named).
  • 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.
## Summary A player whose mods an older launcher added sees each one twice on the Mods page, and Remove on the row marked missing deletes the mod's only copy. The launcher's entry in `profile.json` names a folder whose `mod.json` nothing reads any more (since https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2822). The game lists that folder as `local/<folder>`, and the entry as missing. `mod remove` of the entry deleted the folder all the same. Now `mod remove` keeps a folder when the game lists it under another id, or lists another mod inside it. It finds them with the game's own walk (`code_mods::walk`). The entry goes, so the double goes too. An entry of the folder's own id, a mod with a `mod.toml`, a folder with no mod in it and a folder no entry names are deleted as before. A path outside `mods/` is refused before it is looked at, as before this change. See it on `main`: the first commit's test fails, with the folder in `deleted`. Read `another_mod` in `game/crates/modtool/src/service.rs` first. https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/410 stops the doubling itself. This protects players whose launcher does not have it yet. ## Testing **Tested:** Windows 11, RTX 5080, driver 621.47. On the first version of this change (d7ad5f9d4; the same for this profile's folder), a throwaway profile with one folder (a RomFS file, a `mod.json`, no `mod.toml`) and an entry of another id: - This branch's builder listed it twice. `mod remove` of the missing row answered `"deleted": []`, the folder stayed, and one row was left. - The game then ran headless on that profile from `kokiri-start`: it reached play, 600 frames, the Insert menu opened, the mod loaded (`mods: local/Grass: 1 RomFS files`), no error lines. On the profile before the remove it also loaded once. That game was built from `main` @ b4d56f526 plus one menu fix (b1b433ee9), not from this branch, which changes only the builder's `mod remove`; a build of this branch did not fit on the disk. Checks, on 67a669a85: the three new tests pass, the two newer ones failed on the versions before they were fixed, and the first fails on `main`. Undoing key lines of the guard, one at a time, makes one fail. modtool's `service`, `cmd::state`, `import`, `profile`, `emulators` and `handle` tests, its `cargo fmt --check` and its Clippy with `-D warnings` pass. The whole suite ran on d7ad5f9d4: `mise run test` was stopped near its end for disk space, and the five checks left were then run on their own. All pass but three: - `test_i18n_complete` fails, as it does on `main`. - `test_lifter`: its rustfmt and Clippy pass, and so does all of `cargo test --release --workspace --no-fail-fast` (modtool's 230 among them) but `every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split` (`sites`, `tests/repository.rs`), which fails the same way on `main` @ b4d56f526. - `test_stack_commit` failed once with the PC low on space, and passes alone here and on `main`. **Still to test:** - Any PC, the launcher's Mods page: a profile doubled like that, Remove on the row without a switch, expecting the row to go and the folder to stay (by hand) ## Measurements **Verdict:** fixed: the folder is kept, the test failing on `main` passes here. Setup: Windows 11, no game; `cargo test -p modtool --lib removing_an_entry` | | Before: main @ b4d56f526 | After: this PR @ 67a669a85 | |---|---|---| | `removing_an_entry_keeps_a_folder_that_is_another_mod_to_the_game` | fails: `deleted` names the folder | passes: `deleted` is empty | ## Risks Removing an entry like that leaves its folder in `mods/`; the folder's own row still removes it. The launcher's question still says the folder is deleted. A revert is enough. Saves, settings and caches: nothing. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [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.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(mods): removing a mod's old entry no longer deletes its only copy
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
d7ad5f9d4d
An older launcher's entry names a folder whose mod.json nothing reads any more, so the game lists the folder under
another id and the entry as missing. Removing the missing one deleted the folder.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Member

Tested in game: Windows 11, RTX 5080, driver 621.47, headless from kokiri-start. This branch's builder removed the missing row of a doubled throwaway profile ("deleted": []), then the game ran on that profile: in play, 600 frames, the Insert menu opened, mods: local/Grass: 1 RomFS files, no error lines. The game was built from main @ b4d56f526 plus one menu fix (b1b433ee9), not from this branch: it changes only the builder's mod remove, and a build of it did not fit on the disk.

Tested in game: Windows 11, RTX 5080, driver 621.47, headless from kokiri-start. This branch's builder removed the missing row of a doubled throwaway profile ("deleted": []), then the game ran on that profile: in play, 600 frames, the Insert menu opened, mods: local/Grass: 1 RomFS files, no error lines. The game was built from main @ b4d56f526 plus one menu fix (b1b433ee9), not from this branch: it changes only the builder's mod remove, and a build of it did not fit on the disk.
Author
Member

The checks left out earlier for disk space have run now. test_lifter's only failure, every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split, fails the same way on main @ b4d56f526. test_reshade_fx passes.

The checks left out earlier for disk space have run now. `test_lifter`'s only failure, `every_site_has_one_owner_and_the_sites_are_the_ones_before_the_split`, fails the same way on `main` @ b4d56f526. `test_reshade_fx` passes.
llun changed title from WIP: fix(mods): removing a mod's old entry no longer deletes its only copy to fix(mods): removing a mod's old entry no longer deletes its only copy 2026-12-03 13:23:26 +00:00
Author
Member
@review
BeanBot requested changes 2026-12-03 13:25:46 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The guard can still delete a folder containing a mod the game lists under another ID, and it reads unvalidated profile paths before the existing deletion guard can refuse them. The launcher removal flow also still needs its stated manual test.

The change preserves a directly contained emulator-layout mod when removing an older mismatched profile entry, and its new test covers that case. Its separate layout check does not cover all folders the game discovers.

Blocking (2): must change before merging.

  1. L1 game/crates/modtool/src/service.rs:1223: The import detector does not find every mod that the game's discovery walk finds, so this guard can still delete another listed mod's only copy. (more on the line) Do: Use the game's discovery rules to detect any separately listed mod within the folder before deleting it, and add a regression test for a nested mod.
  2. L2 game/crates/modtool/src/service.rs:1222: The new filesystem probe uses the profile's manual path before validating that it is a direct child of mods. (more on the line) Do: Validate the manual path as a single local mods child before any filesystem access, and test an absolute network path in a profile entry.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3: The launcher flow that players use for the reported bug remains untested. When: The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. Do: On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains.

@fix can do L1 and L2.

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the tested case: the author reports the new test fails on main and passes on this head, and a Windows builder run kept the folder and removed the entry. The launcher's Mods page flow has not yet been tested.

Other systems: The game and builder share the mod discovery walk, which also finds nested mods and patch sets; the new removal guard uses a narrower import detector. The path probe also runs on Windows and Linux for profile-supplied manual paths.

Switches: None.

Reviewed: d7ad5f9d4d against b4d56f5264: Read the repository instructions, CONTRIBUTING.md, the pull request template, the diff and commit messages, and the changed removal and test sections with their discovery, path-validation and profile-locking code. Skimmed the rest of the changed files and standards; the full changed files were not all read in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The new test uses synthetic files and exercises the key guard against the base behavior.
  • No switches, generated files, third-party files or renderer API changes are in the diff.

Testing: No commands from the pull request were run. The author reports a passing targeted test and Windows builder and game checks; CI is still running.

Overlaps and merge order: LongshotLauncher#410 addresses the doubling itself; this change is intended to protect users before that launcher fix reaches them.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The guard can still delete a folder containing a mod the game lists under another ID, and it reads unvalidated profile paths before the existing deletion guard can refuse them. The launcher removal flow also still needs its stated manual test. The change preserves a directly contained emulator-layout mod when removing an older mismatched profile entry, and its new test covers that case. Its separate layout check does not cover all folders the game discovers. **Blocking (2)**: must change before merging. 1. **L1** `game/crates/modtool/src/service.rs:1223`: The import detector does not find every mod that the game's discovery walk finds, so this guard can still delete another listed mod's only copy. (more on the line) **Do:** Use the game's discovery rules to detect any separately listed mod within the folder before deleting it, and add a regression test for a nested mod. 2. **L2** `game/crates/modtool/src/service.rs:1222`: The new filesystem probe uses the profile's manual path before validating that it is a direct child of mods. (more on the line) **Do:** Validate the manual path as a single local mods child before any filesystem access, and test an absolute network path in a profile entry. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3**: The launcher flow that players use for the reported bug remains untested. *When:* The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. **Do:** On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains. `@fix` can do L1 and L2. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the tested case: the author reports the new test fails on main and passes on this head, and a Windows builder run kept the folder and removed the entry. The launcher's Mods page flow has not yet been tested. **Other systems:** The game and builder share the mod discovery walk, which also finds nested mods and patch sets; the new removal guard uses a narrower import detector. The path probe also runs on Windows and Linux for profile-supplied manual paths. **Switches:** None. **Reviewed:** d7ad5f9d4de1 against b4d56f526449: Read the repository instructions, CONTRIBUTING.md, the pull request template, the diff and commit messages, and the changed removal and test sections with their discovery, path-validation and profile-locking code. Skimmed the rest of the changed files and standards; the full changed files were not all read in full. docs/review-checklist.md and the adjacent Tooling checkout were absent.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The new test uses synthetic files and exercises the key guard against the base behavior. - No switches, generated files, third-party files or renderer API changes are in the diff. **Testing:** No commands from the pull request were run. The author reports a passing targeted test and Windows builder and game checks; CI is still running. **Overlaps and merge order:** LongshotLauncher#410 addresses the doubling itself; this change is intended to protect users before that launcher fix reaches them. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as llun took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -1216,0 +1219,4 @@
fn another_mod(dir: &Path, id: &str, rel: &str) -> bool {
let name = rel.strip_prefix("mods/").unwrap_or(rel).trim_end_matches('/');
let at = dir.join("mods").join(name);
std::fs::symlink_metadata(&at).is_ok_and(|m| m.is_dir())
Member

L2 (blocking): The new filesystem probe uses the profile's manual path before validating that it is a direct child of mods.

When: A profile entry containing an absolute Windows network path causes join to replace the mods path and symlink_metadata to access that network location when the entry is removed. Previously delete_own refused that path before accessing it.

Do: Validate the manual path as a single local mods child before any filesystem access, and test an absolute network path in a profile entry.

**L2** (blocking): The new filesystem probe uses the profile's manual path before validating that it is a direct child of mods. *When:* A profile entry containing an absolute Windows network path causes join to replace the mods path and symlink_metadata to access that network location when the entry is removed. Previously delete_own refused that path before accessing it. **Do:** Validate the manual path as a single local mods child before any filesystem access, and test an absolute network path in a profile entry.
@ -1216,0 +1220,4 @@
let name = rel.strip_prefix("mods/").unwrap_or(rel).trim_end_matches('/');
let at = dir.join("mods").join(name);
std::fs::symlink_metadata(&at).is_ok_and(|m| m.is_dir())
&& crate::import::is_emulator_mod(&at)
Member

L1 (blocking): The import detector does not find every mod that the game's discovery walk finds, so this guard can still delete another listed mod's only copy.

When: If an old entry points to mods/Pack and its mod is at mods/Pack/Grass/romfs, the game lists local/Pack/Grass. is_emulator_mod checks only Pack's immediate children, returns false, and removing the old entry deletes Pack and Grass.

Do: Use the game's discovery rules to detect any separately listed mod within the folder before deleting it, and add a regression test for a nested mod.

**L1** (blocking): The import detector does not find every mod that the game's discovery walk finds, so this guard can still delete another listed mod's only copy. *When:* If an old entry points to mods/Pack and its mod is at mods/Pack/Grass/romfs, the game lists local/Pack/Grass. is_emulator_mod checks only Pack's immediate children, returns false, and removing the old entry deletes Pack and Grass. **Do:** Use the game's discovery rules to detect any separately listed mod within the folder before deleting it, and add a regression test for a nested mod.
llun force-pushed fix/mod-remove-keeps-unlabelled-folder from d7ad5f9d4d
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 92df94f7e9
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
2026-12-03 13:33:07 +00:00
Compare
Author
Member

Both are fixed in 92df94f7e, each with a test that failed on the first version. The branch still reads test, then fix.

  • L1: the folder is looked through with the game's own walk (code_mods::walk). It is kept when that finds a mod the game lists under another id: one deeper in the folder, a patch set, a package, or a mod.toml mod below it. An entry of the folder's own mod, and a folder with no mod in it, are deleted as before. Test: removing_an_entry_keeps_a_folder_that_holds_another_mod.
  • L2: the path is checked as a manual mod's (check_manual_path) before any file access, and delete_own refuses the rest as it did. Test: removing_an_entry_never_looks_at_a_path_outside_mods, with absolute, mods/ + absolute, .. and network paths.
  • L3: the launcher's Remove has not been clicked through yet. It stays under Still to test.

Not run again on this head: the game and the whole suite. cargo test -p modtool for the parts this touches, cargo fmt --check and Clippy pass on Windows.

Both are fixed in 92df94f7e, each with a test that failed on the first version. The branch still reads test, then fix. - **L1:** the folder is looked through with the game's own walk (`code_mods::walk`). It is kept when that finds a mod the game lists under another id: one deeper in the folder, a patch set, a package, or a `mod.toml` mod below it. An entry of the folder's own mod, and a folder with no mod in it, are deleted as before. Test: `removing_an_entry_keeps_a_folder_that_holds_another_mod`. - **L2:** the path is checked as a manual mod's (`check_manual_path`) before any file access, and `delete_own` refuses the rest as it did. Test: `removing_an_entry_never_looks_at_a_path_outside_mods`, with absolute, `mods/` + absolute, `..` and network paths. - **L3:** the launcher's Remove has not been clicked through yet. It stays under Still to test. Not run again on this head: the game and the whole suite. `cargo test -p modtool` for the parts this touches, `cargo fmt --check` and Clippy pass on Windows.
Author
Member
@review
BeanBot requested changes 2026-12-03 13:34:27 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The guard still deletes a folder when its root manifest identifies a different mod from the removed entry. The launcher flow also remains untested.

The change protects legacy launcher entries and nested mods from deletion by using the game's discovery walk. It adds a small filesystem scan on removal, but misses a different mod identified by a manifest at the folder root.

Blocking (1): must change before merging.

  1. L1 game/crates/modtool/src/service.rs:1223: A root manifest mod is assumed to belong to the entry being removed, even when its manifest names a different mod. When: If an entry for local/old points to mods/Whole and Whole/mod.toml identifies me/whole, the game lists me/whole, but the root spot has s.rel == name. The guard returns false and delete_own deletes its only folder. Do: Resolve the root manifest's game-visible id and keep the folder when it differs from the removed entry; cover that case with a regression test.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3: The launcher flow that players use for the reported bug remains untested. When: The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. Do: On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains.

@fix can do L1.

Since the last review (on d7ad5f9d4d)
Resolved: L2 (The new filesystem probe uses the profile's manual path before validating that it is a dir…)
Still open: L1 (A root manifest mod is assumed to belong to the entry being removed, even when its manifes…); L3 (The launcher flow that players use for the reported bug remains untested.)

Checks: Still running: PR description / Title and description (pull_request_target).

More: does it help, other systems, switches, what was read

Does it help: Yes: the reported Windows test kept the legacy folder and removed the duplicate entry; the new regression test is reported to fail on main and pass on this head. The launcher interaction has not yet been tested.

Other systems: The builder's remove operation runs on Windows and Linux; the guard uses the shared game discovery walk and checks the manual path before probing it. The game itself does not run the changed removal code.

Switches: None.

Reviewed: 92df94f7e9 against b4d56f5264: Read the diff, the changed removal logic and tests, the manual-path validator, the shared discovery walk and the game's discovery caller. Read AGENTS.md and CONTRIBUTING.md, though the combined output was truncated; the full changed files and pull request template were not read. The sibling Tooling rules and review checklist were unavailable.; nothing run (a code review).

Checked and fine:

  • Nested discovery uses the same walk and depth as the game.
  • Invalid manual paths are checked before the new filesystem probe.

Testing: No commands that build or run the project were executed. The author reports focused tests, formatting and Clippy passing on Windows; the launcher flow remains outstanding.

Overlaps and merge order: LongshotLauncher#410 addresses the duplicate rows themselves; this change also protects users of older launchers.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The guard still deletes a folder when its root manifest identifies a different mod from the removed entry. The launcher flow also remains untested. The change protects legacy launcher entries and nested mods from deletion by using the game's discovery walk. It adds a small filesystem scan on removal, but misses a different mod identified by a manifest at the folder root. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/modtool/src/service.rs:1223`: A root manifest mod is assumed to belong to the entry being removed, even when its manifest names a different mod. *When:* If an entry for local/old points to mods/Whole and Whole/mod.toml identifies me/whole, the game lists me/whole, but the root spot has s.rel == name. The guard returns false and delete_own deletes its only folder. **Do:** Resolve the root manifest's game-visible id and keep the folder when it differs from the removed entry; cover that case with a regression test. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3**: The launcher flow that players use for the reported bug remains untested. *When:* The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. **Do:** On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains. `@fix` can do L1. **Since the last review** (on d7ad5f9d4de1) Resolved: L2 (The new filesystem probe uses the profile's manual path before validating that it is a dir…) Still open: L1 (A root manifest mod is assumed to belong to the entry being removed, even when its manifes…); L3 (The launcher flow that players use for the reported bug remains untested.) **Checks:** Still running: `PR description / Title and description (pull_request_target)`. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the reported Windows test kept the legacy folder and removed the duplicate entry; the new regression test is reported to fail on main and pass on this head. The launcher interaction has not yet been tested. **Other systems:** The builder's remove operation runs on Windows and Linux; the guard uses the shared game discovery walk and checks the manual path before probing it. The game itself does not run the changed removal code. **Switches:** None. **Reviewed:** 92df94f7e96b against b4d56f526449: Read the diff, the changed removal logic and tests, the manual-path validator, the shared discovery walk and the game's discovery caller. Read AGENTS.md and CONTRIBUTING.md, though the combined output was truncated; the full changed files and pull request template were not read. The sibling Tooling rules and review checklist were unavailable.; nothing run (a code review). **Checked and fine:** - Nested discovery uses the same walk and depth as the game. - Invalid manual paths are checked before the new filesystem probe. **Testing:** No commands that build or run the project were executed. The author reports focused tests, formatting and Clippy passing on Windows; the launcher flow remains outstanding. **Overlaps and merge order:** LongshotLauncher#410 addresses the duplicate rows themselves; this change also protects users of older launchers. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
llun force-pushed fix/mod-remove-keeps-unlabelled-folder from 92df94f7e9
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to fecd2b9c1c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
2026-12-03 13:45:32 +00:00
Compare
Author
Member

L1's last case is fixed in fecd2b9c1: for each mod found, the guard works out the id the game lists it under. That is the id in its mod.toml when that reads and the folder may be it, else local/<its folder>. The folder is kept when that id is not the removed entry's.

removing_an_entry_keeps_a_folder_that_holds_another_mod now also covers a folder whose mod.toml names another mod (kept), one whose mod.toml cannot be read under another id (kept) and under its own (deleted). It failed on 92df94f7e, on the first of these. Taking out either new part of the guard makes it fail.

On Windows, modtool's service, cmd::state, import, profile, emulators and handle tests, cargo fmt --check and Clippy with -D warnings pass. L3 stays under Still to test.

L1's last case is fixed in fecd2b9c1: for each mod found, the guard works out the id the game lists it under. That is the id in its `mod.toml` when that reads and the folder may be it, else `local/<its folder>`. The folder is kept when that id is not the removed entry's. `removing_an_entry_keeps_a_folder_that_holds_another_mod` now also covers a folder whose `mod.toml` names another mod (kept), one whose `mod.toml` cannot be read under another id (kept) and under its own (deleted). It failed on 92df94f7e, on the first of these. Taking out either new part of the guard makes it fail. On Windows, modtool's `service`, `cmd::state`, `import`, `profile`, `emulators` and `handle` tests, `cargo fmt --check` and Clippy with `-D warnings` pass. L3 stays under Still to test.
Author
Member
@review
BeanBot requested changes 2026-12-03 13:46:31 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The guard still deletes a root manifest mod belonging to a different ID when its manifest is exactly the game’s maximum accepted size. The launcher’s Remove flow also remains untested.

Removing an outdated profile entry normally keeps a folder that the game lists as another mod, preventing loss of the mod’s only copy. The new manifest check improves coverage but has a one-byte limit mismatch with the game.

Blocking (1): must change before merging.

  1. L1 game/crates/modtool/src/service.rs:1223: The manifest read limit is one byte smaller than the game’s limit. When: For a valid 1,048,576-byte root mod.toml naming a different mod, removing an entry named local/ makes the guard fall back to that local ID and delete the folder, although the game lists the manifest’s ID. Do: Read up to the same manifest limit as the game and cover the boundary with a regression test.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3: The launcher flow that players use for the reported bug remains untested. When: The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. Do: On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains.

@fix can do L1.

Since the last review (on 92df94f7e9)
Still open: L1 (The manifest read limit is one byte smaller than the game’s limit.); L3 (The launcher flow that players use for the reported bug remains untested.)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported case: the author reports that the regression test fails on main and passes on this head, and that the builder kept the folder in a Windows run. The maximum-size manifest case remains broken.

Other systems: The guard uses the shared mod walk and affects builder removal on Windows and Linux; it does not change the game loader. The author tested the builder on Windows and the resulting profile in a game built from main.

Switches: None.

Reviewed: fecd2b9c1c against b4d56f5264: Read the pull request diff, commits, repository rules and template, removal and manifest-discovery paths, and the relevant tests. The changed source files were not read in full; other tests and documentation were skimmed. Tooling’s AGENTS.md was unavailable locally.; nothing run (a code review).

Checked and fine:

  • Ordinary root manifests are parsed and compared by ID, with the same folder matching rule as the game.
  • Invalid manual paths are checked before the new walk.
  • The author reports tests for nested mods, malformed manifests and the original duplicate-entry case.

Testing: No commands from the project were run. The author reports targeted tests, formatting and Clippy passing on Windows; CI is still running. The launcher Remove flow remains to be tested by hand.

Overlaps and merge order: The description identifies LongshotLauncher#410 as stopping the duplicate display; this change protects players without that launcher fix.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The guard still deletes a root manifest mod belonging to a different ID when its manifest is exactly the game’s maximum accepted size. The launcher’s Remove flow also remains untested. Removing an outdated profile entry normally keeps a folder that the game lists as another mod, preventing loss of the mod’s only copy. The new manifest check improves coverage but has a one-byte limit mismatch with the game. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/modtool/src/service.rs:1223`: The manifest read limit is one byte smaller than the game’s limit. *When:* For a valid 1,048,576-byte root mod.toml naming a different mod, removing an entry named local/<folder> makes the guard fall back to that local ID and delete the folder, although the game lists the manifest’s ID. **Do:** Read up to the same manifest limit as the game and cover the boundary with a regression test. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3**: The launcher flow that players use for the reported bug remains untested. *When:* The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. **Do:** On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains. `@fix` can do L1. **Since the last review** (on 92df94f7e96b) Still open: L1 (The manifest read limit is one byte smaller than the game’s limit.); L3 (The launcher flow that players use for the reported bug remains untested.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported case: the author reports that the regression test fails on main and passes on this head, and that the builder kept the folder in a Windows run. The maximum-size manifest case remains broken. **Other systems:** The guard uses the shared mod walk and affects builder removal on Windows and Linux; it does not change the game loader. The author tested the builder on Windows and the resulting profile in a game built from main. **Switches:** None. **Reviewed:** fecd2b9c1c66 against b4d56f526449: Read the pull request diff, commits, repository rules and template, removal and manifest-discovery paths, and the relevant tests. The changed source files were not read in full; other tests and documentation were skimmed. Tooling’s AGENTS.md was unavailable locally.; nothing run (a code review). **Checked and fine:** - Ordinary root manifests are parsed and compared by ID, with the same folder matching rule as the game. - Invalid manual paths are checked before the new walk. - The author reports tests for nested mods, malformed manifests and the original duplicate-entry case. **Testing:** No commands from the project were run. The author reports targeted tests, formatting and Clippy passing on Windows; CI is still running. The launcher Remove flow remains to be tested by hand. **Overlaps and merge order:** The description identifies LongshotLauncher#410 as stopping the duplicate display; this change protects players without that launcher fix. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
Author
Member
@review
BeanBot left a comment

Recommendation: Request changes. The guard can still delete the only copy of a mod when its valid manifest is exactly 1,048,576 bytes. The launcher Remove flow also remains untested.

Removing an obsolete profile entry usually keeps a folder that the game recognizes as another mod, avoiding loss of its only copy. The added walk and manifest read leave an outstanding limit mismatch.

Blocking (1): must change before merging.

  1. L1 game/crates/modtool/src/service.rs:1223: The manifest read limit is one byte smaller than the game’s limit. When: For a valid 1,048,576-byte root mod.toml naming a different mod, removing an entry named local/ makes the guard fall back to that local ID and delete the folder, although the game lists the manifest’s ID. Do: Read up to the same manifest limit as the game and cover the boundary with a regression test.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3: The launcher flow that players use for the reported bug remains untested. When: The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. Do: On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains.

@fix can do L1.

Since the last review (on fecd2b9c1c)
Still open: L1 (The manifest read limit is one byte smaller than the game’s limit.); L3 (The launcher flow that players use for the reported bug remains untested.)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes for the reported case: the author reports that the new test fails on main because the folder is deleted and passes on this head with an empty deleted list. The launcher flow has not yet been exercised.

Other systems: The builder removal path affects Windows and Linux profiles; the recorded builder and game run was on Windows. The game uses a different manifest read limit, leaving the boundary case open.

Switches: None.

Reviewed: fecd2b9c1c against b4d56f5264: Read the ledger, pull request description and comments, repository guidance and template, the diff and commits, and the relevant manifest limit and removal code. The changed code files and their callers were not read in full; recorded runs were reviewed from the description and comments.; nothing run (a code review).

Checked and fine:

  • The recorded test covers keeping the reported old-launcher folder while removing its profile entry.
  • The guard validates the manual path before walking it.

Testing: No commands that run project code were executed. The author reports passing targeted Windows tests, formatting and Clippy; CI is still running.

Overlaps and merge order: LongshotLauncher#410 addresses the duplicate listing itself; this change protects profiles used with launchers that lack that fix. No merge order is stated.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The guard can still delete the only copy of a mod when its valid manifest is exactly 1,048,576 bytes. The launcher Remove flow also remains untested. Removing an obsolete profile entry usually keeps a folder that the game recognizes as another mod, avoiding loss of its only copy. The added walk and manifest read leave an outstanding limit mismatch. **Blocking (1)**: must change before merging. 1. **L1** `game/crates/modtool/src/service.rs:1223`: The manifest read limit is one byte smaller than the game’s limit. *When:* For a valid 1,048,576-byte root mod.toml naming a different mod, removing an entry named local/<folder> makes the guard fall back to that local ID and delete the folder, although the game lists the manifest’s ID. **Do:** Read up to the same manifest limit as the game and cover the boundary with a regression test. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3**: The launcher flow that players use for the reported bug remains untested. *When:* The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. **Do:** On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains. `@fix` can do L1. **Since the last review** (on fecd2b9c1c66) Still open: L1 (The manifest read limit is one byte smaller than the game’s limit.); L3 (The launcher flow that players use for the reported bug remains untested.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the reported case: the author reports that the new test fails on main because the folder is deleted and passes on this head with an empty deleted list. The launcher flow has not yet been exercised. **Other systems:** The builder removal path affects Windows and Linux profiles; the recorded builder and game run was on Windows. The game uses a different manifest read limit, leaving the boundary case open. **Switches:** None. **Reviewed:** fecd2b9c1c66 against b4d56f526449: Read the ledger, pull request description and comments, repository guidance and template, the diff and commits, and the relevant manifest limit and removal code. The changed code files and their callers were not read in full; recorded runs were reviewed from the description and comments.; nothing run (a code review). **Checked and fine:** - The recorded test covers keeping the reported old-launcher folder while removing its profile entry. - The guard validates the manual path before walking it. **Testing:** No commands that run project code were executed. The author reports passing targeted Windows tests, formatting and Clippy; CI is still running. **Overlaps and merge order:** LongshotLauncher#410 addresses the duplicate listing itself; this change protects profiles used with launchers that lack that fix. No merge order is stated. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
llun force-pushed fix/mod-remove-keeps-unlabelled-folder from fecd2b9c1c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 67a669a85b
Some checks failed
CI / What the change needs (pull_request) Successful in 10s
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
PR description / Title and description (pull_request_target) Successful in 7s
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 15m42s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m46s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m20s
CI / Website build and checks (pull_request) Failing after 37s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 51m52s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
2026-12-03 14:15:41 +00:00
Compare
Author
Member

L1's limit is fixed in 67a669a85: the guard reads the mod.toml with the game's own reader (api::disk::OsDisk) and limit (api::loader::MANIFEST_MAX), so the two cannot differ.

removing_an_entry_keeps_a_folder_that_holds_another_mod now has a mod.toml of exactly that many bytes. It failed on fecd2b9c1, and it fails with the limit one byte lower. On Windows (gnullvm), modtool's service tests, cargo fmt --check and Clippy with -D warnings pass. L3 stays under Still to test.

L1's limit is fixed in 67a669a85: the guard reads the `mod.toml` with the game's own reader (`api::disk::OsDisk`) and limit (`api::loader::MANIFEST_MAX`), so the two cannot differ. `removing_an_entry_keeps_a_folder_that_holds_another_mod` now has a `mod.toml` of exactly that many bytes. It failed on fecd2b9c1, and it fails with the limit one byte lower. On Windows (gnullvm), modtool's `service` tests, `cargo fmt --check` and Clippy with `-D warnings` pass. L3 stays under Still to test.
Author
Member
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The manifest limit now matches the game's reader, and the reported builder test shows the original deletion bug fixed. The launcher’s Remove flow still needs a manual run, and CI is still running. Recommend approval; not approved on the forge.

Removing an obsolete mod entry keeps a folder that the game recognizes as another mod, preventing loss of its only copy. The guard adds a filesystem walk and manifest read when removing a manual entry.

Testing before merging (1) (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation)

  • L3: The launcher flow that players use for the reported bug remains untested. When: The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. Do: On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains.

Since the last review (on fecd2b9c1c)
Resolved: L1 (The manifest read limit is one byte smaller than the game’s limit.)
Still open: L3 (The launcher flow that players use for the reported bug remains untested.)

Checks: Still running: 11 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes: the author reports that the regression test fails on main because the folder appears in deleted, and passes on this head with deleted empty. The builder flow was also exercised on Windows; the launcher UI flow remains untested.

Other systems: The guard uses the game’s manifest reader and limit on the builder path. The author reports Windows tests; the launcher integration remains to be exercised. GPU-specific behavior is unaffected.

Switches: None.

Reviewed: 67a669a85b against b4d56f5264: Read the repository rules, PR template, full diff, commit list, disk reader and relevant loader and guard code. Large changed files, documentation and walk implementation were only skimmed because the combined output was truncated; docs/review-checklist.md was absent.; nothing run (a code review).

Checked and fine:

  • The boundary test creates a manifest exactly MANIFEST_MAX bytes long and checks that its folder is kept.
  • The reported builder run kept the folder and removed the obsolete entry.

Testing: No commands from the project or tests were run. The author reports passing focused Windows tests, formatting and Clippy; CI remains in progress.

Overlaps and merge order: LongshotLauncher#410 addresses the duplicate listing itself; this change protects profiles used with older launchers and does not require it to merge first.


Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left (a run of the change itself). The manifest limit now matches the game's reader, and the reported builder test shows the original deletion bug fixed. The launcher’s Remove flow still needs a manual run, and CI is still running. Recommend approval; not approved on the forge. Removing an obsolete mod entry keeps a folder that the game recognizes as another mod, preventing loss of its only copy. The guard adds a filesystem walk and manifest read when removing a manual entry. **Testing before merging (1)** (the change behaves the same on every system: one run of the change itself is enough; it doesn't hold the recommendation) - **L3**: The launcher flow that players use for the reported bug remains untested. *When:* The builder command was tested directly, but the reported doubled Mods page and its Remove action have not been exercised together. **Do:** On one PC, remove the missing row from a doubled profile in the launcher and confirm that the row disappears and the folder remains. **Since the last review** (on fecd2b9c1c66) Resolved: L1 (The manifest read limit is one byte smaller than the game’s limit.) Still open: L3 (The launcher flow that players use for the reported bug remains untested.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes: the author reports that the regression test fails on main because the folder appears in deleted, and passes on this head with deleted empty. The builder flow was also exercised on Windows; the launcher UI flow remains untested. **Other systems:** The guard uses the game’s manifest reader and limit on the builder path. The author reports Windows tests; the launcher integration remains to be exercised. GPU-specific behavior is unaffected. **Switches:** None. **Reviewed:** 67a669a85beb against b4d56f526449: Read the repository rules, PR template, full diff, commit list, disk reader and relevant loader and guard code. Large changed files, documentation and walk implementation were only skimmed because the combined output was truncated; docs/review-checklist.md was absent.; nothing run (a code review). **Checked and fine:** - The boundary test creates a manifest exactly MANIFEST_MAX bytes long and checks that its folder is kept. - The reported builder run kept the folder and removed the obsolete entry. **Testing:** No commands from the project or tests were run. The author reports passing focused Windows tests, formatting and Clippy; CI remains in progress. **Overlaps and merge order:** LongshotLauncher#410 addresses the duplicate listing itself; this change protects profiles used with older launchers and does not require it to merge first. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by llun. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch fix/mod-remove-keeps-unlabelled-folder 2026-12-03 14:40:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!3078
No description provided.