feat(mods): a mod can ask to load last with order = "last" #3192

Merged
HumanBean merged 3 commits from HumanBean/Longshot:feat/mod-order-last into main 2026-12-04 22:46:28 +00:00
Owner

Summary

A mod that has to come after mods it cannot name, such as the one the randomizer generates for each seed, had no way to say so: players had to move it to the bottom of the list themselves, and dependencies cannot help (and do not decide which mod wins a file).

A mod can now put order = "last" in its mod.toml:

  • The mod list keeps it below every mod that does not ask, so it wins files they also have and its ExeFS patches are written after theirs. It also loads after them, unless something depends on it.
  • The player can still reorder each group among itself; no move crosses the line between them.
  • It never turns a mod off, and a dependency still loads first.
  • The Mods tab tags it Loads last and says under the list that the player's mods load after the built-in ones, which of two wins, and that marked mods stay at the bottom. A drag across the line still previews the move and then goes back; stopping it there needs a new UI property, not added here.

An older Longshot ignores the field. An add-on that replaces files of such a mod has to ask to load last too and sit below it, since which mod wins a file is the list's order alone.

Read first: game/crates/api/src/loader/mod.rs (put_last, move_to), loader/arrive.rs (a mod added while the game runs), loader/resolve.rs (step 6), modtool/src/service.rs (order), builder/crates/game-files/src/code_mods.rs (put_last). The docs' note that the launcher has its own resolver was out of date and is replaced. The launcher's tag and note are a separate pull request in LongshotLauncher.

Testing

Tested: Linux, RTX 3090, driver 620.70.06, a headless run from kokiri-start of two file mods replacing the same path, the one asking to load last listed first. The log loaded it second (as the upper layer), the Mods tab showed it below the other with Loads last and the note under the list, and no FATAL or unhandled exception. The path is a made-up one the game never opens, so which copy is served is checked by the tests, not by that run. That run was made on an earlier head. On 896ebe00, a second headless run of the same two mods loaded the one that asks last second, and its Mods tab showed the tag, the order and the new note; the same run on main showed the listed order with neither (screenshots). The ordering fixes after that run (a mod added mid-game, the builder's patch order, order read from the copy that loads) have run in their tests, not in the game.

New tests: the loader (order, moves, a mod added while the game runs, with the served file), mod order, the builder's patch order, the Mods tab, and cases in the manifest and resolver vectors.

Checks: the Rust checks as mise run rust runs them, on the base one commit before the head's (that commit is a renderer change): rustfmt, schema-gen --check and ffi-gen --check pass; cargo test -p modtool 274 passed, 0 failed; the rest of the workspace 3486 passed, 4 failed. The 4 and Clippy's one error also fail on main (f8b54338): build-driver's the_repository_s_lock_and_the_table_agree, longshot-builder's one_copy installed_versions_reuse_their_own_builds_with_one_profile, net-broker's engine tests local::a_local_endpoint_carries_bytes_both_ways and local::local_endpoints_are_refused_by_the_grant_the_build_and_the_caps, and Clippy's "large array defined as const" in host-sys/src/settings_abi.rs. Clippy stops there, so it did not lint the crates after host-sys on this base.

mise run test, on an earlier base: 885 passed, 6 failed, each also failing on main: test_dlssg.py, test_lifter.py, test_no_game_title.py, test_sync_watch_event.py, test_turf_budget.py, test_vk_draw_overhead_lean.py.

Still to test:

  • Windows: put a mod with order = "last" and another replacing the same file in a profile, open the Mods tab, expecting the first at the bottom with its tag, and no drag or Ctrl+Space move taking another below it (by hand).
  • In the game: copy a file mod into mods/ while it runs, expecting it above the mod that loads last (by hand).

Measurements

Nothing to measure: it adds one sort of the mod list at a start and when a mod arrives or the builder reads the profile, and a line of text in the Mods tab.

Risks

  • A mod author can set the field without need; it only moves their mod down, and among such mods the player's order still decides.
  • The first change the player makes to the list writes it in the new order to profile.json.
  • No change for mods without the field. 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.
  • 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

  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • 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 A mod that has to come after mods it cannot name, such as the one the randomizer generates for each seed, had no way to say so: players had to move it to the bottom of the list themselves, and dependencies cannot help (and do not decide which mod wins a file). A mod can now put `order = "last"` in its `mod.toml`: - The mod list keeps it below every mod that does not ask, so it wins files they also have and its ExeFS patches are written after theirs. It also loads after them, unless something depends on it. - The player can still reorder each group among itself; no move crosses the line between them. - It never turns a mod off, and a dependency still loads first. - The Mods tab tags it **Loads last** and says under the list that the player's mods load after the built-in ones, which of two wins, and that marked mods stay at the bottom. A drag across the line still previews the move and then goes back; stopping it there needs a new UI property, not added here. An older Longshot ignores the field. An add-on that replaces files of such a mod has to ask to load last too and sit below it, since which mod wins a file is the list's order alone. Read first: `game/crates/api/src/loader/mod.rs` (`put_last`, `move_to`), `loader/arrive.rs` (a mod added while the game runs), `loader/resolve.rs` (step 6), `modtool/src/service.rs` (`order`), `builder/crates/game-files/src/code_mods.rs` (`put_last`). The docs' note that the launcher has its own resolver was out of date and is replaced. The launcher's tag and note are a separate pull request in LongshotLauncher. ## Testing **Tested:** Linux, RTX 3090, driver 620.70.06, a headless run from `kokiri-start` of two file mods replacing the same path, the one asking to load last listed first. The log loaded it second (as the upper layer), the Mods tab showed it below the other with **Loads last** and the note under the list, and no FATAL or unhandled exception. The path is a made-up one the game never opens, so which copy is served is checked by the tests, not by that run. That run was made on an earlier head. On 896ebe00, a second headless run of the same two mods loaded the one that asks last second, and its Mods tab showed the tag, the order and the new note; the same run on `main` showed the listed order with neither ([screenshots](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/3192#issuecomment-104108)). The ordering fixes after that run (a mod added mid-game, the builder's patch order, `order` read from the copy that loads) have run in their tests, not in the game. New tests: the loader (order, moves, a mod added while the game runs, with the served file), `mod order`, the builder's patch order, the Mods tab, and cases in the manifest and resolver vectors. Checks: the Rust checks as `mise run rust` runs them, on the base one commit before the head's (that commit is a renderer change): rustfmt, `schema-gen --check` and `ffi-gen --check` pass; `cargo test -p modtool` 274 passed, 0 failed; the rest of the workspace 3486 passed, 4 failed. The 4 and Clippy's one error also fail on `main` (f8b54338): `build-driver`'s `the_repository_s_lock_and_the_table_agree`, `longshot-builder`'s `one_copy` `installed_versions_reuse_their_own_builds_with_one_profile`, `net-broker`'s `engine` tests `local::a_local_endpoint_carries_bytes_both_ways` and `local::local_endpoints_are_refused_by_the_grant_the_build_and_the_caps`, and Clippy's "large array defined as const" in `host-sys/src/settings_abi.rs`. Clippy stops there, so it did not lint the crates after `host-sys` on this base. `mise run test`, on an earlier base: 885 passed, 6 failed, each also failing on `main`: `test_dlssg.py`, `test_lifter.py`, `test_no_game_title.py`, `test_sync_watch_event.py`, `test_turf_budget.py`, `test_vk_draw_overhead_lean.py`. **Still to test:** - Windows: put a mod with `order = "last"` and another replacing the same file in a profile, open the Mods tab, expecting the first at the bottom with its tag, and no drag or Ctrl+Space move taking another below it (by hand). - In the game: copy a file mod into `mods/` while it runs, expecting it above the mod that loads last (by hand). ## Measurements Nothing to measure: it adds one sort of the mod list at a start and when a mod arrives or the builder reads the profile, and a line of text in the Mods tab. ## Risks - A mod author can set the field without need; it only moves their mod down, and among such mods the player's order still decides. - The first change the player makes to the list writes it in the new order to `profile.json`. - No change for mods without the field. A revert is enough. ## 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] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [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)
feat(mods): a mod can ask to load last with order = "last"
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
a167b592bd
The mod list keeps such a mod below the others, so it wins files they also have without naming any of them, and loads
after them unless something depends on it. The Mods tab tags it "Loads last" and says the load order under the list.

Assisted-by: Claude Code
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner

Tested in game: Linux, RTX 3090, driver 620.70.06, headless from kokiri-start with two file mods replacing the same path: the one with order = "last", listed first, loaded as the upper layer and showed at the bottom of the Mods tab, tagged Loads last, with the load-order note under the list. No FATAL or unhandled exception. Run before the last two rebases and the fix for mods added while the game runs.

Tested in game: Linux, RTX 3090, driver 620.70.06, headless from kokiri-start with two file mods replacing the same path: the one with order = "last", listed first, loaded as the upper layer and showed at the bottom of the Mods tab, tagged Loads last, with the load-order note under the list. No FATAL or unhandled exception. Run before the last two rebases and the fix for mods added while the game runs.
Member

Possibly related, for context:

  • PR #3137 feat(mods): plain mods build their exefs code; mod ordering by drag and drop and a full menu search — Introduced mod list ordering that this feature extends
Possibly related, for context: - PR #3137 feat(mods): plain mods build their exefs code; mod ordering by drag and drop and a full menu search — Introduced mod list ordering that this feature extends
fix(mods): the load order note says it is about the player's mods, and explains a lone Loads last tag
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
c62ef3e272
Built-in mods are listed under the player's own but load first, so "bottom last" named the wrong winner between them.

Assisted-by: Claude Code
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Owner
@review
BeanBot requested changes 2026-12-04 21:26:25 +00:00
Dismissed
BeanBot left a comment

Recommendation: Request changes. The displayed order can disagree with the order used for ExeFS patches, and adding a normal mod during play can prevent live file updates. Some copies can also be classified using a manifest the loader will not select.

Adds a manifest field that groups mods at the bottom of the list, changes resolver priority, and labels them in the Mods tab. The feature has useful tests, but its ordering is not consistent across all loading paths.

Blocking (3): must change before merging.

  1. L1 game/crates/api/src/loader/arrive.rs:441: Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder. (more on the line) Do: Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits.
  2. L2 builder/crates/build-driver/src/read.rs:30: The stable last-group sort preserves the concatenation of manual and source mods, not their profile order. (more on the line) Do: Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types.
  3. L3 game/crates/api/src/loader/mod.rs:1826: The manifest used to classify a row is chosen without the resolver's copy-shadowing rules. (more on the line) Do: Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader 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)

  • L4: The final live-arrival behavior and the visible controls need an in-game check. When: The reported run predates the arrival fix and did not verify a file opened by the game. Do: Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows.

@fix can do L1, L2 and L3.

Checks: Still running: 11 checks.

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

Does it help: Unproven: the reported Linux run showed the list and label, but used a path the game never opened and predates the final live-arrival fix. Tests cover several ordering cases.

Other systems: The builder, source-installed and manual mods, live file layers, dependency resolution, the Mods tab and modtool all use the changed ordering. Windows and the final live-arrival path still need a run; no GPU-specific behavior is apparent.

Switches: None.

Reviewed: c62ef3e272 against a87eb85099: Read the repository rules and PR template, the diff, commit messages, and the relevant loader, builder and profile paths. Skimmed translations, vectors and generated schema changes; not every changed code file was read in full.; nothing run (a code review).

Checked and fine:

  • Both commits carry AI-assistance trailers.
  • Manifest vectors cover normal, last and an invalid order value.
  • No new environment switch is introduced.

Testing: Read-only review; no builds, tests or project scripts were run. CI is still running.

Overlaps and merge order: Not checked; network is closed.


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

**Recommendation: Request changes.** The displayed order can disagree with the order used for ExeFS patches, and adding a normal mod during play can prevent live file updates. Some copies can also be classified using a manifest the loader will not select. Adds a manifest field that groups mods at the bottom of the list, changes resolver priority, and labels them in the Mods tab. The feature has useful tests, but its ordering is not consistent across all loading paths. **Blocking (3)**: must change before merging. 1. **L1** `game/crates/api/src/loader/arrive.rs:441`: Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder. (more on the line) **Do:** Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits. 2. **L2** `builder/crates/build-driver/src/read.rs:30`: The stable last-group sort preserves the concatenation of manual and source mods, not their profile order. (more on the line) **Do:** Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types. 3. **L3** `game/crates/api/src/loader/mod.rs:1826`: The manifest used to classify a row is chosen without the resolver's copy-shadowing rules. (more on the line) **Do:** Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader 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) - **L4**: The final live-arrival behavior and the visible controls need an in-game check. *When:* The reported run predates the arrival fix and did not verify a file opened by the game. **Do:** Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows. `@fix` can do L1, L2 and L3. **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Linux run showed the list and label, but used a path the game never opened and predates the final live-arrival fix. Tests cover several ordering cases. **Other systems:** The builder, source-installed and manual mods, live file layers, dependency resolution, the Mods tab and modtool all use the changed ordering. Windows and the final live-arrival path still need a run; no GPU-specific behavior is apparent. **Switches:** None. **Reviewed:** c62ef3e2729b against a87eb850999b: Read the repository rules and PR template, the diff, commit messages, and the relevant loader, builder and profile paths. Skimmed translations, vectors and generated schema changes; not every changed code file was read in full.; nothing run (a code review). **Checked and fine:** - Both commits carry AI-assistance trailers. - Manifest vectors cover normal, last and an invalid order value. - No new environment switch is introduced. **Testing:** Read-only review; no builds, tests or project scripts were run. CI is still running. **Overlaps and merge order:** Not checked; network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -27,6 +27,7 @@ pub fn manifest_mods(profile: Option<&Path>, log: &mut dyn FnMut(String)) -> Res
source_mods_whole(&cache, p, log)?;
mods.extend(modtool::profile::store_code_mods(&cache, p, log));
}
game_files::code_mods::put_last(&mut mods);
Member

L2 (blocking): The stable last-group sort preserves the concatenation of manual and source mods, not their profile order.

When: If a source-installed last mod is above a manual last mod in the profile and both patch the same byte, exefs_mods puts the manual mod first and store_code_mods appends the source mod. The source patch wins even though the displayed lower manual mod should win.

Do: Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types.

**L2** (blocking): The stable last-group sort preserves the concatenation of manual and source mods, not their profile order. *When:* If a source-installed last mod is above a manual last mod in the profile and both patch the same byte, exefs_mods puts the manual mod first and store_code_mods appends the source mod. The source patch wins even though the displayed lower manual mod should win. **Do:** Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types.
@ -434,2 +438,4 @@
self.start_rows.push((id, key));
}
// (a mod that joined goes above those that load last, as at a start: their files stay theirs)
self.rows.sort_by_key(|r| r.loads_last);
Member

L1 (blocking): Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder.

When: With a live last mod, a normal mod arrives and is sorted above it, while start_rows still has the new mod after it. layers_changed then remains true, causing hot_files and hot_layers to hold file changes until restart.

Do: Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits.

**L1** (blocking): Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder. *When:* With a live last mod, a normal mod arrives and is sorted above it, while start_rows still has the new mod after it. layers_changed then remains true, causing hot_files and hot_layers to hold file changes until restart. **Do:** Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits.
@ -1818,0 +1823,4 @@
/// Whether the copy of `id` the start would take (`pin`ned, else the newest) asks to load last.
fn asks_last(&self, id: &str, pin: Option<&str>) -> bool {
let copies = self.found.iter().filter(|f| f.id == id && !f.system).filter_map(|f| f.manifest.as_deref());
let pin = pin.and_then(|v| Version::parse(v, false));
Member

L3 (blocking): The manifest used to classify a row is chosen without the resolver's copy-shadowing rules.

When: When an ID has a copy at its canonical mods/owner/name location and a newer copy elsewhere, copy_left_out selects the canonical copy, but asks_last selects the newest. If their order fields differ, the row and file precedence use the other copy's setting.

Do: Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader test.

**L3** (blocking): The manifest used to classify a row is chosen without the resolver's copy-shadowing rules. *When:* When an ID has a copy at its canonical mods/owner/name location and a newer copy elsewhere, copy_left_out selects the canonical copy, but asks_last selects the newest. If their order fields differ, the row and file precedence use the other copy's setting. **Do:** Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader test.
HumanBean added this to the v4 milestone 2026-12-04 21:31:05 +00:00
HumanBean force-pushed feat/mod-order-last from c62ef3e272
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 896ebe0051
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-04 21:40:41 +00:00
Compare
Author
Owner

The Mods tab at the same spot, with two made-up file mods, "Rando test" (order = "last") listed first in the profile and "Other test". Linux, RTX 3090, driver 620.70.06, headless from kokiri-start.

main (46ae5b43), which ignores the field:

main

This branch (896ebe00):

branch

The Mods tab at the same spot, with two made-up file mods, "Rando test" (`order = "last"`) listed first in the profile and "Other test". Linux, RTX 3090, driver 620.70.06, headless from `kokiri-start`. `main` (46ae5b43), which ignores the field: ![main](https://git.magicbean.dev/attachments/308ad4d3-0ea7-4fd7-bf00-bb33d2d38eb9) This branch (896ebe00): ![branch](https://git.magicbean.dev/attachments/bffcc188-139d-4801-83db-8bcfa0a59e3f)
HumanBean changed title from WIP: feat(mods): a mod can ask to load last with order = "last" to feat(mods): a mod can ask to load last with order = "last" 2026-12-04 21:41:12 +00:00
BeanBot left a comment

Recommendation: Request changes. Live arrivals can be mistaken for a pending reorder, builder patch order can disagree with the profile, and row classification can use a shadowed manifest. These can change which mod’s files or patches win.

Mods can request a last-loading group while players retain order within each group. The feature addresses an ordering need, but the loader and builder still disagree in the cases covered by the open items.

Blocking (3): must change before merging.

  1. L1 game/crates/api/src/loader/arrive.rs:441: Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder. When: With a live last mod, a normal mod arrives and is sorted above it, while start_rows still has the new mod after it. layers_changed then remains true, causing hot_files and hot_layers to hold file changes until restart. Do: Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits.
  2. L2 builder/crates/build-driver/src/read.rs:30: The stable last-group sort preserves the concatenation of manual and source mods, not their profile order. When: If a source-installed last mod is above a manual last mod in the profile and both patch the same byte, exefs_mods puts the manual mod first and store_code_mods appends the source mod. The source patch wins even though the displayed lower manual mod should win. Do: Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types.
  3. L3 game/crates/api/src/loader/mod.rs:1826: The manifest used to classify a row is chosen without the resolver's copy-shadowing rules. When: When an ID has a copy at its canonical mods/owner/name location and a newer copy elsewhere, copy_left_out selects the canonical copy, but asks_last selects the newest. If their order fields differ, the row and file precedence use the other copy's setting. Do: Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader 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)

  • L4: The final live-arrival behavior and the visible controls need an in-game check. When: The reported run predates the arrival fix and did not verify a file opened by the game. Do: Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows.

@fix can do L1, L2 and L3.

Since the last review (on c62ef3e272)
Still open: L1 (Sorting the rows after appending the new entries leaves start_rows in the old order, so th…); L2 (The stable last-group sort preserves the concatenation of manual and source mods, not thei…); L3 (The manifest used to classify a row is chosen without the resolver's copy-shadowing rules.); L4 (The final live-arrival behavior and the visible controls need an in-game check.)

Checks: Still running: 11 checks.

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

Does it help: Unproven: the reported Linux run shows the tag and initial ordering on this head, but the live-arrival behavior and visible controls still need the in-game check.

Other systems: The change affects runtime file layers, dependency ordering, the builder’s ExeFS patch order, the Mods tab and modtool. Windows controls and live arrival remain untested in game.

Switches: Adds the optional manifest field order = "last"; omitted by default. It is a mod-author declaration, and the documentation describes its effect.

Reviewed: 896ebe0051 against 46ae5b43d3: Read AGENTS.md and CONTRIBUTING.md; inspected the loader ordering, arrival and resolver code, builder ordering paths, their diffs, and the reported runs. The remaining changed files, translations, vectors and generated schema were not read in full.; nothing run (a code review).

Checked and fine:

  • The resolver gives ready non-last mods priority while preserving dependency ordering.
  • The reported head run shows the last-loading mod below the other mod with its tag and note.

Testing: The author reports a Linux headless run on this head and passing targeted tests. Windows move controls and adding a mod during a running game remain to be checked; CI is still running. No tests were run in this review.

Overlaps and merge order: The description identifies a separate LongshotLauncher pull request for its tag and note; no merge order is stated.


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

**Recommendation: Request changes.** Live arrivals can be mistaken for a pending reorder, builder patch order can disagree with the profile, and row classification can use a shadowed manifest. These can change which mod’s files or patches win. Mods can request a last-loading group while players retain order within each group. The feature addresses an ordering need, but the loader and builder still disagree in the cases covered by the open items. **Blocking (3)**: must change before merging. 1. **L1** `game/crates/api/src/loader/arrive.rs:441`: Sorting the rows after appending the new entries leaves start_rows in the old order, so the loader treats the live order as a pending user reorder. *When:* With a live last mod, a normal mod arrives and is sorted above it, while start_rows still has the new mod after it. layers_changed then remains true, causing hot_files and hot_layers to hold file changes until restart. **Do:** Keep start_rows in the same effective order as the rows after a live arrival, and test the real hot-layer rebuild and subsequent edits. 2. **L2** `builder/crates/build-driver/src/read.rs:30`: The stable last-group sort preserves the concatenation of manual and source mods, not their profile order. *When:* If a source-installed last mod is above a manual last mod in the profile and both patch the same byte, exefs_mods puts the manual mod first and store_code_mods appends the source mod. The source patch wins even though the displayed lower manual mod should win. **Do:** Combine both sources in profile order before applying the last-group ordering, and test overlapping patches from both installation types. 3. **L3** `game/crates/api/src/loader/mod.rs:1826`: The manifest used to classify a row is chosen without the resolver's copy-shadowing rules. *When:* When an ID has a copy at its canonical mods/owner/name location and a newer copy elsewhere, copy_left_out selects the canonical copy, but asks_last selects the newest. If their order fields differ, the row and file precedence use the other copy's setting. **Do:** Classify the same eligible copy that resolution selects, including shadowing and version pins; cover conflicting copies in a loader 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) - **L4**: The final live-arrival behavior and the visible controls need an in-game check. *When:* The reported run predates the arrival fix and did not verify a file opened by the game. **Do:** Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows. `@fix` can do L1, L2 and L3. **Since the last review** (on c62ef3e2729b) Still open: L1 (Sorting the rows after appending the new entries leaves start_rows in the old order, so th…); L2 (The stable last-group sort preserves the concatenation of manual and source mods, not thei…); L3 (The manifest used to classify a row is chosen without the resolver's copy-shadowing rules.); L4 (The final live-arrival behavior and the visible controls need an in-game check.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the reported Linux run shows the tag and initial ordering on this head, but the live-arrival behavior and visible controls still need the in-game check. **Other systems:** The change affects runtime file layers, dependency ordering, the builder’s ExeFS patch order, the Mods tab and modtool. Windows controls and live arrival remain untested in game. **Switches:** Adds the optional manifest field order = "last"; omitted by default. It is a mod-author declaration, and the documentation describes its effect. **Reviewed:** 896ebe005174 against 46ae5b43d33e: Read AGENTS.md and CONTRIBUTING.md; inspected the loader ordering, arrival and resolver code, builder ordering paths, their diffs, and the reported runs. The remaining changed files, translations, vectors and generated schema were not read in full.; nothing run (a code review). **Checked and fine:** - The resolver gives ready non-last mods priority while preserving dependency ordering. - The reported head run shows the last-loading mod below the other mod with its tag and note. **Testing:** The author reports a Linux headless run on this head and passing targeted tests. Windows move controls and adding a mod during a running game remain to be checked; CI is still running. No tests were run in this review. **Overlaps and merge order:** The description identifies a separate LongshotLauncher pull request for its tag and note; no merge order is stated. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as HumanBean took it out of WIP. Nothing was run; a maintainer decides.</sub>
HumanBean force-pushed feat/mod-order-last from 896ebe0051
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 3dc8e1ee28
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-04 22:00:09 +00:00
Compare
HumanBean force-pushed feat/mod-order-last from 3dc8e1ee28
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 5db676713f
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Successful in 13s
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 1m22s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 13m34s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 10m52s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 12m37s
CI / Website build and checks (pull_request) Failing after 40s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 47m25s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 1h0m4s
2026-12-04 22:00:30 +00:00
Compare
Author
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left (a run of the change itself). The ordering fixes address the three code issues, and the initial load order and Mods tab were shown working on Linux. Live arrival and the move controls still need an in-game check. Recommend approval; not approved on the forge.

Mods can request a last-loading group while players retain ordering within each group. The follow-up keeps live-arrival baselines aligned, orders builder patches by the profile, and classifies the copy the resolver selects.

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)

  • L4: The final live-arrival behavior and the visible controls need an in-game check. When: The reported run predates the arrival fix and did not verify a file opened by the game. Do: Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows.

Since the last review (on 896ebe0051)
Resolved: L1 (Sorting the rows after appending the new entries leaves start_rows in the old order, so th…); L2 (The stable last-group sort preserves the concatenation of manual and source mods, not thei…); L3 (The manifest used to classify a row is chosen without the resolver's copy-shadowing rules.)
Still open: L4 (The final live-arrival behavior and the visible controls need an in-game check.)

Checks: Still running: 11 checks.

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

Does it help: Unproven for the full feature: the reported Linux run showed initial ordering, the tag and the note; live arrival and move controls have not been checked in game. This is not a performance change.

Other systems: The loader affects live file layers and the Mods tab; the builder also uses the ordering for ExeFS patches. The reported run covers initial behavior on Linux, while the remaining integrated behavior has not been run.

Switches: None.

Reviewed: 5db676713f against f8b543384d: Read the changed builder ordering code and the loader arrival, baseline and copy-selection paths; inspected the fix diff, related tests, repository rules, PR template, description and reported runs. The rest of the original PR diff, translations and generated files were not read in full.; nothing run (a code review).

Checked and fine:

  • The new shadowed-copy test covers a newer copy outside the ID's home folder.
  • The arrival test checks the restart baseline and a subsequent layer rebuild.
  • The builder test covers profile ordering across the concatenated install kinds.

Testing: No commands from the project were run. The author reports Linux in-game initial-order coverage and game-free tests; CI is still running. Check live arrival and the move controls in game before merge.

Overlaps and merge order: Not checked; network access is closed.


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

**Recommendation: Approve.** The code is ready: only testing is left (a run of the change itself). The ordering fixes address the three code issues, and the initial load order and Mods tab were shown working on Linux. Live arrival and the move controls still need an in-game check. Recommend approval; not approved on the forge. Mods can request a last-loading group while players retain ordering within each group. The follow-up keeps live-arrival baselines aligned, orders builder patches by the profile, and classifies the copy the resolver selects. **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) - **L4**: The final live-arrival behavior and the visible controls need an in-game check. *When:* The reported run predates the arrival fix and did not verify a file opened by the game. **Do:** Run the final head with conflicting file mods, including adding a normal mod during play and checking the served file and subsequent reload; check the Mods tab and moves on Windows. **Since the last review** (on 896ebe005174) Resolved: L1 (Sorting the rows after appending the new entries leaves start_rows in the old order, so th…); L2 (The stable last-group sort preserves the concatenation of manual and source mods, not thei…); L3 (The manifest used to classify a row is chosen without the resolver's copy-shadowing rules.) Still open: L4 (The final live-arrival behavior and the visible controls need an in-game check.) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for the full feature: the reported Linux run showed initial ordering, the tag and the note; live arrival and move controls have not been checked in game. This is not a performance change. **Other systems:** The loader affects live file layers and the Mods tab; the builder also uses the ordering for ExeFS patches. The reported run covers initial behavior on Linux, while the remaining integrated behavior has not been run. **Switches:** None. **Reviewed:** 5db676713ff4 against f8b543384dd0: Read the changed builder ordering code and the loader arrival, baseline and copy-selection paths; inspected the fix diff, related tests, repository rules, PR template, description and reported runs. The rest of the original PR diff, translations and generated files were not read in full.; nothing run (a code review). **Checked and fine:** - The new shadowed-copy test covers a newer copy outside the ID's home folder. - The arrival test checks the restart baseline and a subsequent layer rebuild. - The builder test covers profile ordering across the concatenated install kinds. **Testing:** No commands from the project were run. The author reports Linux in-game initial-order coverage and game-free tests; CI is still running. Check live arrival and the move controls in game before merge. **Overlaps and merge order:** Not checked; network access is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Author
Owner

L1 to L3 are fixed in 5db67671, each with a test (L1's and L3's failed before the fix). L4 is not done: the final head has not added a mod during play in the game, and nothing has run on Windows. Both are under Still to test.

L1 to L3 are fixed in 5db67671, each with a test (L1's and L3's failed before the fix). L4 is not done: the final head has not added a mod during play in the game, and nothing has run on Windows. Both are under Still to test.
HumanBean deleted branch feat/mod-order-last 2026-12-04 22:46:28 +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!3192
No description provided.