fix(mods): restart switching builds in a mod whose versions call no function, and follows jump tables in data #3216

Merged
HumanBean merged 2 commits from snaildev99/Longshot:mods/switch-parity into main 2026-12-05 17:31:06 +00:00
Member

Summary

main builds a code mod's ExeFS patches behind a switch, so the player can turn the mod off and on at a restart
without a build (the re-implementation of #1036). Comparing it with #1036 found cases where a switched build could run
code that doesn't exist, and a few loose ends:

  • A call or branch that only one switch state makes, and that discovery still hasn't found a function for after
    its last round, was lifted anyway; so was a version that calls into data. Now the mods involved are built in
    (fixed in their profile state) and the build goes again; if the profile's own state goes where no code is (and the
    game's own code doesn't), building it in would keep that, so the build stops first and names the mods and the
    target (unsafe_patch_switch).
  • A jump table written in data by a mod: the code that reads it wasn't versioned per switch state. Discovery now
    records the bytes it reads to recover a table, and a switch that writes them versions the reader.
  • An address taken with ADR only while a switch is off wasn't an entry. Entry discovery now runs on the all-off
    image too.
  • A missing or unreadable switch table left dispatch off while the image kept its all-on bytes; now every switched
    patch is active at that start, and a table cut between two complete writes is refused (new tables carry their row
    counts; older complete ones still read).
  • The Mods tab said a switched patch of a mod that is off stays in the game until a build; it now says that only of
    files built in without a switch.

How to see it on main: the test commit (206fef104) has ten tests for the cases above (two of them whole builds through
the driver of a switched mod whose patch calls into data, the mod on and off); each fails on main.

Read first: builder/crates/lift/src/whole/switches.rs (discover_switched, fix_switches),
builder/crates/build-driver/src/build.rs (the retry and its stop), builder/crates/cfg/src/table.rs, then
game/crates/longshot-game/src/switches.rs and game/crates/api/src/loader/switch.rs.

Testing

Tested: Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, built by longshot-builder play --profile with
this PR and the other mod compatibility ports merged (and #3213, which a restart without a build needs), adult Link in
Kakariko. The profile's only mods are four patch-only test mods (IPS32, one instruction each in the HUD's per-frame
update: its entry returned at once, or one of three calls in it skipped). The build put all four in behind a switch:

exefs: 4 mod(s) built in behind a switch, 4 of them with code (the game sets them at its start)
lift: the mods' switches change 1 functions: 15 more versions of them lifted (one a state of their switches)

Each start set them as the profile said (local/patch-hud-call-a-off: its ExeFS patches are off at this start (built in behind a switch)); call A turned off and then on again, each a restart through the builder, needed no build
(fast check: up to date) and was set as asked; the save loads and plays each time. main's builder gives the same
build and start lines for the same profile. These mods hit none of the cases this PR fixes (the game-free tests below
build each one): the run checks that switching that worked still does.
After the rebase onto main @ 3a0f7d8f7 and the review's fixes, the same profile again, built with this PR @
efdae26b4 and the other ports merged (929bf025a): the same two build lines, each mod set at the start as the profile
says, call A off and on again through two restarts (fast check: up to date, 15.8 and 4.1 ms, set as asked each
time), and the save loads and plays.
The Mods tab note this changes shows only on the page of an emulator-layout mod whose patches are built in, and this
base never builds those (it reads ExeFS from manifest mods alone), so there is no screenshot: the api test checks it.

mise run test, run locally while CI's run waits for approval (Windows 11, tests/run_all.py --strict, 12 checks at
once), here @ efdae26b4 and on main @ 3a0f7d8f7: 838 passed, 21 failed, 52 skipped here; 845 passed, 14 failed, 52
skipped on main. 14 of the 21 also fail on main: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title,
test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image,
test_present_image_free, test_program_cache_store_record, test_rt_pin, test_sync_watch_event, test_turf_budget,
test_ui_renderer. The other seven hit their timeouts while other work ran on the PC: test_audio_voice_biquad,
test_audio_wave_buffer_release, test_check_third_party, test_quit_not_crash and test_settings_atomic pass here run
alone (--exact); test_dev_update and test_native_zstd timed out again alone beside another suite, and time out the
same way on main @ 3a0f7d8f7 beside the same load. This PR touches none of the sources these seven read (scripts/,
the host's zstd, the audio code).

Still to test:

  • Windows: the build time of a profile with patch mods behind switches, against main (measurement, the review's
    L2)

Measurements

Verdict: It works: each of the ten tests fails on main and passes here, and in the game four switched patch
mods build and switch at each start as on main. Nothing per frame to measure: the change is in the build and in the
start's read of the switch table.

Setup: cargo test of game-files, lift, api, longshot-game and build-driver on Windows 11; the before side
is the test commit (206fef104), which is main's code with the tests.

Before: main @ 3a0f7d8f7 After: this PR @ efdae26b4
cargo test -p lift whole::tests:: (missing call, call into data, ADR entry, table in data) 4 failed 4 passed
cargo test -p game-files fixing_a_switch_keeps_the_profile_bytes_and_updates_both_lists 1 failed 1 passed
cargo test -p api (cut table, off mod's switched patch) 2 failed 2 passed
cargo test -p longshot-game an_unreadable_table_keeps_the_all_on_image_and_dispatch 1 failed (dispatch 0) 1 passed
cargo test -p build-driver --test driver switched (the mod on: stops; off: built in) 2 failed (built; still a switch) 2 passed

Risks

  • Fixing an unsafe switch can take another image build and discovery round in that build.
  • A switched mod whose patch, as the profile has it, calls or branches where no code is now stops the build
    (unsafe_patch_switch, naming it) where main built it. Built in without a switch (past the eight, or with a code
    module), the same patch still builds as on main.
  • A data write that versions a jump table's reader counts toward the eight switches a function may have.
  • Older switch tables carry no row counts, so a cut between two complete rows of one goes unseen (as on main).
  • Players: a mod whose switching was unsafe is built in, with its note saying so (or, when their own setting of it
    is the unsafe one, the build stops and names it); one whose switching worked as before keeps it. No save or setting changes. 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). (run locally, Testing names them; CI's run waits for approval)
  • 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.
  • A check under tests/ that reads changed source is updated, not weakened. (tests/test_dlss_nr_forwarder.py reads build-driver's build.rs (finished_files, unchanged here): it passes unchanged)
  • 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 `main` builds a code mod's ExeFS patches behind a switch, so the player can turn the mod off and on at a restart without a build (the re-implementation of #1036). Comparing it with #1036 found cases where a switched build could run code that doesn't exist, and a few loose ends: - **A call or branch that only one switch state makes**, and that discovery still hasn't found a function for after its last round, was lifted anyway; so was a version that calls into data. Now the mods involved are built in (fixed in their profile state) and the build goes again; if the profile's own state goes where no code is (and the game's own code doesn't), building it in would keep that, so the build stops first and names the mods and the target (`unsafe_patch_switch`). - **A jump table written in data** by a mod: the code that reads it wasn't versioned per switch state. Discovery now records the bytes it reads to recover a table, and a switch that writes them versions the reader. - **An address taken with ADR only while a switch is off** wasn't an entry. Entry discovery now runs on the all-off image too. - **A missing or unreadable switch table** left dispatch off while the image kept its all-on bytes; now every switched patch is active at that start, and a table cut between two complete writes is refused (new tables carry their row counts; older complete ones still read). - **The Mods tab** said a switched patch of a mod that is off stays in the game until a build; it now says that only of files built in without a switch. How to see it on `main`: the test commit (206fef104) has ten tests for the cases above (two of them whole builds through the driver of a switched mod whose patch calls into data, the mod on and off); each fails on `main`. Read first: `builder/crates/lift/src/whole/switches.rs` (`discover_switched`, `fix_switches`), `builder/crates/build-driver/src/build.rs` (the retry and its stop), `builder/crates/cfg/src/table.rs`, then `game/crates/longshot-game/src/switches.rs` and `game/crates/api/src/loader/switch.rs`. ## Testing **Tested:** Windows 11 Pro, RTX 3090, NVIDIA 610.88, in the game, built by `longshot-builder play --profile` with this PR and the other mod compatibility ports merged (and #3213, which a restart without a build needs), adult Link in Kakariko. The profile's only mods are four patch-only test mods (IPS32, one instruction each in the HUD's per-frame update: its entry returned at once, or one of three calls in it skipped). The build put all four in behind a switch: ``` exefs: 4 mod(s) built in behind a switch, 4 of them with code (the game sets them at its start) lift: the mods' switches change 1 functions: 15 more versions of them lifted (one a state of their switches) ``` Each start set them as the profile said (`local/patch-hud-call-a-off: its ExeFS patches are off at this start (built in behind a switch)`); call A turned off and then on again, each a restart through the builder, needed no build (`fast check: up to date`) and was set as asked; the save loads and plays each time. `main`'s builder gives the same build and start lines for the same profile. These mods hit none of the cases this PR fixes (the game-free tests below build each one): the run checks that switching that worked still does. After the rebase onto `main` @ 3a0f7d8f7 and the review's fixes, the same profile again, built with this PR @ efdae26b4 and the other ports merged (929bf025a): the same two build lines, each mod set at the start as the profile says, call A off and on again through two restarts (`fast check: up to date`, 15.8 and 4.1 ms, set as asked each time), and the save loads and plays. The Mods tab note this changes shows only on the page of an emulator-layout mod whose patches are built in, and this base never builds those (it reads ExeFS from manifest mods alone), so there is no screenshot: the `api` test checks it. `mise run test`, run locally while CI's run waits for approval (Windows 11, `tests/run_all.py --strict`, 12 checks at once), here @ efdae26b4 and on `main` @ 3a0f7d8f7: 838 passed, 21 failed, 52 skipped here; 845 passed, 14 failed, 52 skipped on `main`. 14 of the 21 also fail on `main`: test_dlssg, test_fsr4_tune, test_lifter, test_no_game_title, test_no_map_reload, test_present_acquire_ahead, test_present_geometry_trace, test_present_held_image, test_present_image_free, test_program_cache_store_record, test_rt_pin, test_sync_watch_event, test_turf_budget, test_ui_renderer. The other seven hit their timeouts while other work ran on the PC: test_audio_voice_biquad, test_audio_wave_buffer_release, test_check_third_party, test_quit_not_crash and test_settings_atomic pass here run alone (`--exact`); test_dev_update and test_native_zstd timed out again alone beside another suite, and time out the same way on `main` @ 3a0f7d8f7 beside the same load. This PR touches none of the sources these seven read (`scripts/`, the host's zstd, the audio code). **Still to test:** - Windows: the build time of a profile with patch mods behind switches, against `main` (measurement, the review's L2) ## Measurements **Verdict:** It works: each of the ten tests fails on `main` and passes here, and in the game four switched patch mods build and switch at each start as on `main`. Nothing per frame to measure: the change is in the build and in the start's read of the switch table. Setup: `cargo test` of `game-files`, `lift`, `api`, `longshot-game` and `build-driver` on Windows 11; the before side is the test commit (206fef104), which is `main`'s code with the tests. | | Before: main @ 3a0f7d8f7 | After: this PR @ efdae26b4 | |---|---|---| | `cargo test -p lift whole::tests::` (missing call, call into data, ADR entry, table in data) | 4 failed | 4 passed | | `cargo test -p game-files fixing_a_switch_keeps_the_profile_bytes_and_updates_both_lists` | 1 failed | 1 passed | | `cargo test -p api` (cut table, off mod's switched patch) | 2 failed | 2 passed | | `cargo test -p longshot-game an_unreadable_table_keeps_the_all_on_image_and_dispatch` | 1 failed (dispatch 0) | 1 passed | | `cargo test -p build-driver --test driver switched` (the mod on: stops; off: built in) | 2 failed (built; still a switch) | 2 passed | ## Risks - Fixing an unsafe switch can take another image build and discovery round in that build. - A switched mod whose patch, as the profile has it, calls or branches where no code is now stops the build (`unsafe_patch_switch`, naming it) where `main` built it. Built in without a switch (past the eight, or with a code module), the same patch still builds as on `main`. - A data write that versions a jump table's reader counts toward the eight switches a function may have. - Older switch tables carry no row counts, so a cut between two complete rows of one goes unseen (as on `main`). - Players: a mod whose switching was unsafe is built in, with its note saying so (or, when their own setting of it is the unsafe one, the build stops and names it); one whose switching worked as before keeps it. No save or setting changes. 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). (run locally, Testing names them; CI's run waits for approval) - [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] A check under `tests/` that reads changed source is updated, not weakened. (`tests/test_dlss_nr_forwarder.py` reads build-driver's `build.rs` (`finished_files`, unchanged here): it passes unchanged) - [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)
The checks of the fix that follows, on main's code. Each fails there for the bug's reason:

- a call that only one switch state makes is still missing after the last discovery round, and the lift accepts it;
- a switch version calls into .rodata, and the lift accepts it in either state;
- an ADR target that exists only with a switch off is not an entry;
- two switches that write a jump table in data do not version the code that reads it;
- fixing one mod's switch does not fix the whole mod in its profile state;
- a switch table cut between two complete writes parses;
- an unreadable switch table leaves dispatch off while the image keeps its all-on bytes;
- the Mods tab says a switched patch of a mod that is off stays in the game until a build.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(mods): restart switching builds in a mod whose versions call no function, and follows jump tables in data
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
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
a7198bbbcb
The rest of #1036 on the Rust builder (main already switches a mod's ExeFS patches at the next start).

- A version that calls or branches where no function is: after the discovery rounds, main logged "a trap there" and
  lifted it anyway. The lift now names the mods whose versions still have such a transfer, and the build fixes them
  as the profile has them (built in, no switch), makes the image and both lists again, and lifts again. Each round
  fixes at least one switched mod, so it ends.
- A jump table written in data: the discovery records the bytes it reads for each table, and a switch that writes
  them changes the function that reads them, so each state gets its own targets. A switch that only writes data now
  counts toward the eight switches one function may have.
- An address taken with ADR or ADRP+ADD where a switch writes: the game's own (all off) code is scanned too, so its
  target stays an entry.
- The game's start: the dispatch flags start all on, and the whole table is checked before any byte is set, so a
  missing, cut or unreadable table leaves the image and its dispatch as built (all on). The table's header now gives
  its switch and write counts (version 2), so a table cut between complete rows is refused; a complete version 1 table
  is still read.
- The Mods tab: only a mod's built-in files (no switch) are said to stay in the game until the next build.

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

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88, adult Link in Kakariko: four patch-only test mods built in behind switches (15 more versions lifted); each start set them as the profile said, a restart with one turned off and on again needed no build (with #3213), and the save loads and plays each time; main's builder gives the same build and start lines.

Tested in game: Windows 11 Pro, RTX 3090, NVIDIA 610.88, adult Link in Kakariko: four patch-only test mods built in behind switches (15 more versions lifted); each start set them as the profile said, a restart with one turned off and on again needed no build (with #3213), and the save loads and plays each time; main's builder gives the same build and start lines.
Author
Member

mise run test, run locally while CI's run waits for approval: 824 passed, 21 failed, 51 skipped here @ a7198bbbc; 20 of the 21 also fail on main @ f577a1aea (named in Testing), the other (test_mesh_args_cleanup) hit a fixture case's 10 s timeout under load and passes here run alone (--exact). test_dlss_nr_forwarder, which reads build-driver's build.rs, passes unchanged. Boxes ticked.

mise run test, run locally while CI's run waits for approval: 824 passed, 21 failed, 51 skipped here @ a7198bbbc; 20 of the 21 also fail on main @ f577a1aea (named in Testing), the other (test_mesh_args_cleanup) hit a fixture case's 10 s timeout under load and passes here run alone (--exact). test_dlss_nr_forwarder, which reads build-driver's build.rs, passes unchanged. Boxes ticked.
snaildev99 changed title from WIP: fix(mods): restart switching builds in a mod whose versions call no function, and follows jump tables in data to fix(mods): restart switching builds in a mod whose versions call no function, and follows jump tables in data 2026-12-05 03:02:56 +00:00
BeanBot left a comment

Recommendation: Request changes. The retry can still produce a build whose selected mod state transfers control to a missing function. The added tests show several discovery fixes, but they stop before checking the full retry and resulting build.

The change detects unsafe switched versions, versions readers of patched jump tables, and keeps dispatch consistent when the switch table is unreadable. It can require another image build and discovery round, and its build-time cost has not been measured.

Blocking (2): must change before merging.

  1. L1 builder/crates/build-driver/src/build.rs:626: The retry loses the unresolved-transfer check when fixing the last switch, so an invalid transfer in the profile's selected state can still be built. (more on the line) Do: After fixing switches, validate the selected image's implicated transfers before accepting the lift, and return a player-facing error naming the mods and target if the selected state is still invalid. Add a full retry test for both selected states.
  2. L3: It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first). (for the author)

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 builder/crates/lift/src/whole/mod.rs:403: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. (more on the line) Do: Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. (@fix does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)

@fix can do L1 and L2.

Checks: Still running: 11 checks.

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

Does it help: Partly shown: the PR reports eight game-free cases failing on the base and passing here, plus a Windows game run showing existing switching still works. The selected-state failure after a retry is not covered, and build-time cost is unmeasured.

Other systems: The builder and startup switch-table reader run on Windows and Linux. The reported game run is on Windows; the changed discovery can also affect builds with data-only mods and functions shared by several switches. The reported run does not exercise the newly fixed cases in game.

Switches: No environment variables or developer switches added, changed, or removed. Existing per-mod switches can become fixed at the profile state when discovery finds an unsafe version.

Reviewed: a7198bbbcb against f577a1aeab: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, commits and the complete diff. Read the switch planning, CFG entry and walk, patch classification, switch-table parser and startup switch files in full; inspected relevant retry, discovery, lift and stamp callers. The remaining changed code files and documentation were reviewed through their diffs and surrounding code, not read in full. No review checklist or adjacent Tooling checkout was present.; nothing run (a code review).

Checked and fine:

  • Both commits record AI assistance.
  • The changed files do not include generated output, third-party files, or apparent game-derived assets.
  • The version 2 table counts complete write rows, and the parser checks the counts before startup applies switches.
  • The reported Windows run exercises an existing four-switch profile across restarts.

Testing: Read-only review; no tests or project code were run. The supplied CI checks are still running.

Overlaps and merge order: Not established; network access is closed. The reported restart test depends on #3213.


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

**Recommendation: Request changes.** The retry can still produce a build whose selected mod state transfers control to a missing function. The added tests show several discovery fixes, but they stop before checking the full retry and resulting build. The change detects unsafe switched versions, versions readers of patched jump tables, and keeps dispatch consistent when the switch table is unreadable. It can require another image build and discovery round, and its build-time cost has not been measured. **Blocking (2)**: must change before merging. 1. **L1** `builder/crates/build-driver/src/build.rs:626`: The retry loses the unresolved-transfer check when fixing the last switch, so an invalid transfer in the profile's selected state can still be built. (more on the line) **Do:** After fixing switches, validate the selected image's implicated transfers before accepting the lift, and return a player-facing error naming the mods and target if the selected state is still invalid. Add a full retry test for both selected states. 2. **L3**: It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first). *(for the author)* **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `builder/crates/lift/src/whole/mod.rs:403`: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. (more on the line) **Do:** Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. *(`@fix` does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)* `@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:** Partly shown: the PR reports eight game-free cases failing on the base and passing here, plus a Windows game run showing existing switching still works. The selected-state failure after a retry is not covered, and build-time cost is unmeasured. **Other systems:** The builder and startup switch-table reader run on Windows and Linux. The reported game run is on Windows; the changed discovery can also affect builds with data-only mods and functions shared by several switches. The reported run does not exercise the newly fixed cases in game. **Switches:** No environment variables or developer switches added, changed, or removed. Existing per-mod switches can become fixed at the profile state when discovery finds an unsafe version. **Reviewed:** a7198bbbcbf9 against f577a1aeabdb: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, commits and the complete diff. Read the switch planning, CFG entry and walk, patch classification, switch-table parser and startup switch files in full; inspected relevant retry, discovery, lift and stamp callers. The remaining changed code files and documentation were reviewed through their diffs and surrounding code, not read in full. No review checklist or adjacent Tooling checkout was present.; nothing run (a code review). **Checked and fine:** - Both commits record AI assistance. - The changed files do not include generated output, third-party files, or apparent game-derived assets. - The version 2 table counts complete write rows, and the parser checks the counts before startup applies switches. - The reported Windows run exercises an existing four-switch profile across restarts. **Testing:** Read-only review; no tests or project code were run. The supplied CI checks are still running. **Overlaps and merge order:** Not established; network access is closed. The reported restart test depends on #3213. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, as snaildev99 took it out of WIP. Nothing was run; a maintainer decides.</sub>
@ -623,0 +623,4 @@
{
r.log(format!("exefs: {detail}. Fixing those mods as selected for this build."));
game_files::switches::fix(&mut patches.files, &mods);
patches.update_lists(&game_files::nso::Nso::load(&p.work.exefs.join("main"))?);
Member

L1 (blocking): The retry loses the unresolved-transfer check when fixing the last switch, so an invalid transfer in the profile's selected state can still be built.

When: If the only switched mod is on and its patch calls into data, discovery returns PatchSwitch and this branch fixes the mod on. The next lift has an empty switch table, so discover_switched uses ordinary discovery without checking the transfer and the build proceeds with a missing destination instead of stopping and naming the mod and target.

Do: After fixing switches, validate the selected image's implicated transfers before accepting the lift, and return a player-facing error naming the mods and target if the selected state is still invalid. Add a full retry test for both selected states.

**L1** (blocking): The retry loses the unresolved-transfer check when fixing the last switch, so an invalid transfer in the profile's selected state can still be built. *When:* If the only switched mod is on and its patch calls into data, discovery returns PatchSwitch and this branch fixes the mod on. The next lift has an empty switch table, so discover_switched uses ordinary discovery without checking the transfer and the build proceeds with a missing destination instead of stopping and naming the mod and target. **Do:** After fixing switches, validate the selected image's implicated transfers before accepting the lift, and return a player-facing error naming the mods and target if the selected state is still invalid. Add a full retry test for both selected states.
@ -401,3 +401,3 @@
return Ok((discover(o, image)?, BTreeMap::new()));
}
let mut more = switches::entries(image, &o.switches);
let mut more = switches::entries(image, &o.switches)
Member

L2 (should fix): The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement.

When: A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles.

Do: Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry.

**L2** (should fix): The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. *When:* A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. **Do:** Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry.
snaildev99 force-pushed mods/switch-parity from a7198bbbcb
Some checks failed
PR description / Title and description (pull_request_target) Successful in 6s
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 efdae26b4c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
2026-12-05 10:20:21 +00:00
Compare
Author
Member

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ efdae26b4. Tested (the game again on this head), mise run test (against main @ 3a0f7d8f7: the failures main doesn't have are timeouts under load, each passing alone or timing out on main beside the same load) and Measurements are updated. Answers to the review below.

Rebased onto main @ 3a0f7d8f7 for the base conflict; here @ efdae26b4. Tested (the game again on this head), `mise run test` (against main @ 3a0f7d8f7: the failures main doesn't have are timeouts under load, each passing alone or timing out on main beside the same load) and Measurements are updated. Answers to the review below.
Author
Member

L1 (the retry loses the unresolved-transfer check): fixed in efdae26b4. The check is the profile's own state, done
before the fix rather than after it: the lift already walked every state of each function it names, and all of a
function's switches are fixed together, so built in, the function is exactly the version of the profile's state. The
lift now reports, with the mods it names, each version's call or branch to a place with no code that the game's own
code (the function's switches all off) doesn't make, with which of the function's mods are on in that version
(build_core::NoCode). When one of those versions is the profile's, the build stops with unsafe_patch_switch,
naming the mods that are on and the target, before it makes the image again; otherwise it fixes the mods and goes on
as before. A version's call into code is no stop: built in, that call is a BL target and so an entry. Tests, whole
builds through build::build with the real lift (build-driver/tests/driver.rs):
a_switched_mod_on_whose_patch_calls_where_no_code_is_stops_the_build (the mod on: the build stops, naming
local/stray and 0x80000200; on the previous head it built) and
a_switched_mod_off_whose_patch_calls_where_no_code_is_built_in_off (the mod off: fixed off, the image made again
with the game's own word, no switch table). Both fail on main. builder.md, using-mods.md and the code's row in
build-events.md say so.

L2 (build-time measurement): the measurement is still to run. Of the code part: with
L1's fix, a build whose selected state can't be built in stops before the image and the lift are made again. The
all-off address scan runs once per lift, not per discovery round, and is linear in the code; a retry's image and
discovery are made again because the bytes they read change. Nothing else here could be reused safely without
duplicating the scanner's window logic, so no further change.

L3 (conflicts with main): rebased onto main @ 3a0f7d8f7. The one conflict was the warnings row of the codes
table in build-events.md, which main changed (#3137 dropped mod_needs_import) next to the row this PR adds: main's
row kept, this PR's unsafe_patch_switch row before it. The rest merged cleanly (#3137's ExeFS mods in read.rs,
#3081's float middle path in stages.rs and the lift's tests, #3192's load order).

**L1** (the retry loses the unresolved-transfer check): fixed in efdae26b4. The check is the profile's own state, done before the fix rather than after it: the lift already walked every state of each function it names, and all of a function's switches are fixed together, so built in, the function is exactly the version of the profile's state. The lift now reports, with the mods it names, each version's call or branch to a place with no code that the game's own code (the function's switches all off) doesn't make, with which of the function's mods are on in that version (`build_core::NoCode`). When one of those versions is the profile's, the build stops with `unsafe_patch_switch`, naming the mods that are on and the target, before it makes the image again; otherwise it fixes the mods and goes on as before. A version's call into code is no stop: built in, that call is a BL target and so an entry. Tests, whole builds through `build::build` with the real lift (`build-driver/tests/driver.rs`): `a_switched_mod_on_whose_patch_calls_where_no_code_is_stops_the_build` (the mod on: the build stops, naming `local/stray` and `0x80000200`; on the previous head it built) and `a_switched_mod_off_whose_patch_calls_where_no_code_is_built_in_off` (the mod off: fixed off, the image made again with the game's own word, no switch table). Both fail on `main`. `builder.md`, `using-mods.md` and the code's row in `build-events.md` say so. **L2** (build-time measurement): the measurement is still to run. Of the code part: with L1's fix, a build whose selected state can't be built in stops before the image and the lift are made again. The all-off address scan runs once per lift, not per discovery round, and is linear in the code; a retry's image and discovery are made again because the bytes they read change. Nothing else here could be reused safely without duplicating the scanner's window logic, so no further change. **L3** (conflicts with main): rebased onto `main` @ 3a0f7d8f7. The one conflict was the warnings row of the codes table in `build-events.md`, which main changed (#3137 dropped `mod_needs_import`) next to the row this PR adds: main's row kept, this PR's `unsafe_patch_switch` row before it. The rest merged cleanly (#3137's ExeFS mods in `read.rs`, #3081's float middle path in `stages.rs` and the lift's tests, #3192's load order).
Author
Member

Still to test now lists the measurement the review asked for, which the answers above say is still to run.

Still to test now lists the measurement the review asked for, which the answers above say is still to run.
Author
Member

Merge note for #3166 and #3216: each passes alone on main, but whichever merges second needs a two-line test fix. #3216 gives write_image in builder/crates/build-driver/tests/driver.rs a second argument (the writes), and #3166's two return tests call it with one: write_image(&d, &[]). With all the mod compatibility ports merged together, that is the only change it needed there.

Merge note for #3166 and #3216: each passes alone on `main`, but whichever merges second needs a two-line test fix. #3216 gives `write_image` in `builder/crates/build-driver/tests/driver.rs` a second argument (the writes), and #3166's two return tests call it with one: `write_image(&d, &[])`. With all the mod compatibility ports merged together, that is the only change it needed there.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The selected-state check now stops the build before retrying when a switched version introduces a transfer outside code. The build-time cost of the additional scan and retries remains unmeasured. Recommend approval; not approved on the forge.

The change fixes unsafe mod switching, versions readers of patched jump tables, and makes switch-table failures start consistently. It adds discovery work and can repeat image construction during a build.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 builder/crates/lift/src/whole/mod.rs:403: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. When: A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. Do: Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. (@fix does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)

@fix can do L2.

Since the last review (on a7198bbbcb)
Resolved: L1 (The retry loses the unresolved-transfer check when fixing the last switch, so an invalid t…); L3 (It conflicts with its base branch: bring it up to date (@​fix or @​rebase try first).)
Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…)

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 for the covered fixes: the author reports ten game-free tests failing on main and passing here. An in-game Windows run confirms existing switching still works, but does not exercise the newly fixed cases.

Other systems: The builder changes affect Windows and Linux; the reported build and game runs are on Windows. Switch-table handling also runs at game startup. GPU-specific behavior is not implicated by the changed logic.

Switches: No player or developer switches added, changed, or removed. Mod patch switches retain their existing behavior, except unsafe ones are fixed to the profile state.

Reviewed: efdae26b4c against 3a0f7d8f7f: Read the repository's AGENTS.md, CONTRIBUTING.md and pull request template; the specified review checklist is absent. Examined the lift and build-driver diffs, the switch planning and retry paths, and game-files switch handling. Other changed files and their full contents were not read.; nothing run (a code review).

Checked and fine:

  • The retry fixes all named mods before regenerating the switch table and image.
  • The reported whole-build tests cover the selected mod on and off.

Testing: No commands that build or run tests were executed. The author reports passing targeted tests and an in-game Windows switching run; the build-time comparison remains outstanding.

Overlaps and merge order: #3166 changes the same test helper; the author reports that whichever merges second needs its two calls updated.


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. The selected-state check now stops the build before retrying when a switched version introduces a transfer outside code. The build-time cost of the additional scan and retries remains unmeasured. Recommend approval; not approved on the forge. The change fixes unsafe mod switching, versions readers of patched jump tables, and makes switch-table failures start consistently. It adds discovery work and can repeat image construction during a build. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `builder/crates/lift/src/whole/mod.rs:403`: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. *When:* A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. **Do:** Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. *(`@fix` does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)* `@fix` can do L2. **Since the last review** (on a7198bbbcbf9) Resolved: L1 (The retry loses the unresolved-transfer check when fixing the last switch, so an invalid t…); L3 (It conflicts with its base branch: bring it up to date (`@​fix` or `@​rebase` try first).) Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…) **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 for the covered fixes: the author reports ten game-free tests failing on main and passing here. An in-game Windows run confirms existing switching still works, but does not exercise the newly fixed cases. **Other systems:** The builder changes affect Windows and Linux; the reported build and game runs are on Windows. Switch-table handling also runs at game startup. GPU-specific behavior is not implicated by the changed logic. **Switches:** No player or developer switches added, changed, or removed. Mod patch switches retain their existing behavior, except unsafe ones are fixed to the profile state. **Reviewed:** efdae26b4c77 against 3a0f7d8f7f34: Read the repository's AGENTS.md, CONTRIBUTING.md and pull request template; the specified review checklist is absent. Examined the lift and build-driver diffs, the switch planning and retry paths, and game-files switch handling. Other changed files and their full contents were not read.; nothing run (a code review). **Checked and fine:** - The retry fixes all named mods before regenerating the switch table and image. - The reported whole-build tests cover the selected mod on and off. **Testing:** No commands that build or run tests were executed. The author reports passing targeted tests and an in-game Windows switching run; the build-time comparison remains outstanding. **Overlaps and merge order:** #3166 changes the same test helper; the author reports that whichever merges second needs its two calls updated. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
Owner
@rebase
Member

I rebased this pull request onto main (6b1694a787): the new head is 4b5bb09eae.

Conflicts resolved

  • builder/crates/game-files/src/switches.rs: Passed an empty overlapping set to the test’s plan call.

Nothing was built or run: read the resolution before merging.


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

I rebased this pull request onto `main` (6b1694a78707): the new head is 4b5bb09eaea3. **Conflicts resolved** - builder/crates/game-files/src/switches.rs: Passed an empty overlapping set to the test’s plan call. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed mods/switch-parity from efdae26b4c
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
to 4b5bb09eae
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-05 17:27:13 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The fix has game-free tests for the reported cases and an in-game check of existing switching, but its build-time cost remains unmeasured. Wait for the comparison against main. Recommend approval; not approved on the forge.

The change handles unsafe switched code, data-backed jump tables and incomplete switch tables, and corrects the Mods tab note. It can require another image build and discovery pass, adding build-time work whose cost is not yet known.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 builder/crates/lift/src/whole/mod.rs:403: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. When: A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. Do: Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. (@fix does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)

@fix can do L2.

Since the last review (on efdae26b4c)
Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…)

Checks: Still running: 11 checks.

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

Does it help: Unproven for build-time cost. The description reports ten game-free tests failing on main and passing with the change, plus a Windows in-game switching run; it reports no build-time comparison.

Other systems: The builder and switch-table reader affect Windows and Linux. The recorded in-game run is on Windows; the game-free tests cover the reported failure cases, but no Linux run is reported.

Switches: No player-facing switches or environment variables added or changed. The patch switch table gains row counts, with support retained for complete version 1 tables.

Reviewed: 4b5bb09eae against 6b1694a787: Read AGENTS.md, CONTRIBUTING.md and builder/crates/game-files/src/switches.rs in full; inspected the changed diff for that file and docs/user/using-mods.md, the commit list, and references to discovery and retry. The remaining changed files and project standards were not read in full.; nothing run (a code review).

Checked and fine:

  • The rebased switch planner preserves profile order and excludes overlapping mods from switch candidates.
  • The changed test passes the new overlapping argument to the planner.

Testing: No commands from the project were run. The author reports ten targeted tests passing and an in-game Windows switching check; CI is still running.

Overlaps and merge order: The author reports that whichever of #3166 and #3216 merges second needs two test call sites updated for write_image's new argument.


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

**Recommendation: Approve.** The code is ready: only testing is left. The fix has game-free tests for the reported cases and an in-game check of existing switching, but its build-time cost remains unmeasured. Wait for the comparison against main. Recommend approval; not approved on the forge. The change handles unsafe switched code, data-backed jump tables and incomplete switch tables, and corrects the Mods tab note. It can require another image build and discovery pass, adding build-time work whose cost is not yet known. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `builder/crates/lift/src/whole/mod.rs:403`: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. *When:* A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. **Do:** Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. *(`@fix` does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)* `@fix` can do L2. **Since the last review** (on efdae26b4c77) Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…) **Checks:** Still running: 11 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven for build-time cost. The description reports ten game-free tests failing on main and passing with the change, plus a Windows in-game switching run; it reports no build-time comparison. **Other systems:** The builder and switch-table reader affect Windows and Linux. The recorded in-game run is on Windows; the game-free tests cover the reported failure cases, but no Linux run is reported. **Switches:** No player-facing switches or environment variables added or changed. The patch switch table gains row counts, with support retained for complete version 1 tables. **Reviewed:** 4b5bb09eaea3 against 6b1694a78707: Read AGENTS.md, CONTRIBUTING.md and builder/crates/game-files/src/switches.rs in full; inspected the changed diff for that file and docs/user/using-mods.md, the commit list, and references to discovery and retry. The remaining changed files and project standards were not read in full.; nothing run (a code review). **Checked and fine:** - The rebased switch planner preserves profile order and excludes overlapping mods from switch candidates. - The changed test passes the new overlapping argument to the planner. **Testing:** No commands from the project were run. The author reports ten targeted tests passing and an in-game Windows switching check; CI is still running. **Overlaps and merge order:** The author reports that whichever of #3166 and #3216 merges second needs two test call sites updated for write_image's new argument. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
Owner
@rebase
Member

I rebased this pull request onto main (e813a37f63): the new head is 2e2a53d389.

Conflicts resolved

  • docs/dev/reference/mods.md: Kept the base branch’s build timing clarification and the pull request’s switched-file and jump-table behavior.

Nothing was built or run: read the resolution before merging.


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

I rebased this pull request onto `main` (e813a37f6366): the new head is 2e2a53d389f8. **Conflicts resolved** - docs/dev/reference/mods.md: Kept the base branch’s build timing clarification and the pull request’s switched-file and jump-table behavior. Nothing was built or run: read the resolution before merging. --- <sub>Automated rebase by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
BeanBot force-pushed mods/switch-parity from 4b5bb09eae
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 2e2a53d389
Some checks failed
PR description / Title and description (pull_request_target) Failing after 7s
CI / What the change needs (pull_request) Successful in 10s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Waiting to run
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Waiting to run
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Waiting to run
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Waiting to run
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Waiting to run
CI / Website build and checks (pull_request) Waiting to run
CI / Third-party parts and guide screenshots (pull_request) Successful in 14s
2026-12-05 17:29:52 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The fix has game-free test results and a Windows game run, but its added build-time cost has not been measured against main. Recommend approval; not approved on the forge.

The change builds unsafe switched patches into their selected state or stops an unsafe build, tracks jump-table data and off-state entries, and makes switch-table startup safer. It adds an address scan and can repeat image construction and discovery.

Testing before merging (1) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 builder/crates/lift/src/whole/mod.rs:403: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. When: A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. Do: Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. (@fix does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)

@fix can do L2.

Since the last review (on 4b5bb09eae)
Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…)

Checks: they run again on this head; a failure shows on the pull request.

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

Does it help: Yes for the covered correctness cases: the author reports ten tests failing on main and passing with the change, plus a Windows game run confirming existing switching still works. Build-time cost remains unmeasured.

Other systems: The builder and switch-table reader affect Windows and Linux; the reported game run is on Windows with NVIDIA hardware. The change also affects mod patch discovery and startup dispatch.

Switches: No player or developer switches added, changed, or removed; existing mod switches gain safer fallback behavior.

Reviewed: 2e2a53d389 against e813a37f63: Read AGENTS.md, CONTRIBUTING.md, the pull request template, docs/dev/reference/mods.md, and the relevant discovery and build-retry sections; skimmed the relevant diff and supplied test reports. The remaining changed files and supporting code were not read in full.; nothing run (a code review).

Checked and fine:

  • The changed documentation line says the Mods tab and log identify files waiting for a build.
  • The author reports the all-off scan runs once per lift rather than once per discovery round.

Testing: Await a comparable build-time measurement on a profile with switched patch mods, including a retry case. CI has not run on this head.

Overlaps and merge order: #3166 overlaps the driver test helper; whichever merges second needs the two reported call-site updates.


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

**Recommendation: Approve.** The code is ready: only testing is left. The fix has game-free test results and a Windows game run, but its added build-time cost has not been measured against main. Recommend approval; not approved on the forge. The change builds unsafe switched patches into their selected state or stops an unsafe build, tracks jump-table data and off-state entries, and makes switch-table startup safer. It adds an address scan and can repeat image construction and discovery. **Testing before merging (1)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `builder/crates/lift/src/whole/mod.rs:403`: The added all-off scan and possible repeated image builds and discovery rounds have no build-time measurement. *When:* A build with switched code now scans address references on another image, and an unsafe switch can cause the image and lift discovery to run again. The reported tests and game run do not quantify the cost to players building such profiles. **Do:** Compare clean and one-function-change build times and output sizes against the base, including a representative switched profile and a profile that triggers a retry. *(`@fix` does its part first: Avoid repeating the full address scan or image work where its results can safely be reused.)* `@fix` can do L2. **Since the last review** (on 4b5bb09eaea3) Still open: L2 (The added all-off scan and possible repeated image builds and discovery rounds have no bui…) **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes for the covered correctness cases: the author reports ten tests failing on main and passing with the change, plus a Windows game run confirming existing switching still works. Build-time cost remains unmeasured. **Other systems:** The builder and switch-table reader affect Windows and Linux; the reported game run is on Windows with NVIDIA hardware. The change also affects mod patch discovery and startup dispatch. **Switches:** No player or developer switches added, changed, or removed; existing mod switches gain safer fallback behavior. **Reviewed:** 2e2a53d389f8 against e813a37f6366: Read AGENTS.md, CONTRIBUTING.md, the pull request template, docs/dev/reference/mods.md, and the relevant discovery and build-retry sections; skimmed the relevant diff and supplied test reports. The remaining changed files and supporting code were not read in full.; nothing run (a code review). **Checked and fine:** - The changed documentation line says the Mods tab and log identify files waiting for a build. - The author reports the all-off scan runs once per lift rather than once per discovery round. **Testing:** Await a comparable build-time measurement on a profile with switched patch mods, including a retry case. CI has not run on this head. **Overlaps and merge order:** #3166 overlaps the driver test helper; whichever merges second needs the two reported call-site updates. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its rebase. Nothing was run; a maintainer decides.</sub>
HumanBean deleted branch mods/switch-parity 2026-12-05 17:31:07 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!3216
No description provided.