WIP: fix(mods): Windows: a changed folder mod's content module runs again while the game runs: its folder matches its mod #2832
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2832
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mod-api-win-content-reload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
For #2822 (into
mod-api). On Windows, a folder mod's files changed while the game runs are never matched to that mod. So its content module is not run again, and the hot reload's log names "a mod". The watch hands the loader the folders whose served files changed with/between their names (game/crates/api/src/watch.rs,slashes).same_path(game/crates/api/src/loader/mod.rs) compared those with the mods' rows, whose paths keep Windows' backslash, as text (ignoring case). On Windows no changed folder matched, andhot_layersrebuilt the layers for no mod.same_pathnow treats either separator as the same on Windows, still ignoring case. Linux is unchanged.To see it on
mod-api: Windows, a profile with a content mod (theseven-rupeeexample), the game running. Change itssrc/content.ts: the log saysmods: hot reload: a mod: rebuilt while the game runs, …, and the module doesn't run again.Read first:
same_pathingame/crates/api/src/loader/mod.rs, and its callerhot_layersingame/crates/api/src/loader/hot.rs.Testing
Tested: Windows 11, RTX 5080, NVIDIA 621.40, confined through
longshot-builder game, a profile withlocal/seven-rupee(itscontent.add,content.readanditems.grantgranted). Itssrc/content.tswas changed 40 s in.mods: hot reload: a mod: rebuilt while the game runs, 0 paths served anew …, with no content line after it.mod runtime: local/seven-rupee: content: Obj_M37444242_Rupee7, …(the module ran again), thenmods: hot reload: local/seven-rupee: rebuilt while the game runs, … 64 ms.Both runs are on
mod-apiwith #2726's save-folder fix and its broker change applied locally, beneath this PR. On plainmod-apia confined Windows start with a profile stops at the save folder. In both runs the content's outputs could not be written to the game folder'smodcache("its plan cannot be kept"), so 0 paths were served. That's a separate Windows problem, not this one.Checks: the new
loader::tests::a_folder_is_the_same_path_with_either_separator_on_windows(Windows only) fails onmod-api@eaf4a48b("the watch's form") and passes here. The existinga_content_mods_changed_module_runs_again_and_its_outputs_are_servedfailed on Windows for the same reason and passes now.cargo test -p api --target x86_64-pc-windows-gnullvm: all 443 pass (onmod-api, 442 with that one failing). On Linux all 443 passed onmod-api, and the change is behindcfg!(windows).cargo fmt -p api --check,cargo clippy -p api --all-targets --no-deps -- -D warnings(Windows target) andmise run lintpass.Still to test:
Measurements
Verdict: fixed. On Windows, a changed content mod's module runs again while the game runs.
Baseline:
mod-api(#2822's head), the branch this PR goes into: the bug is there, not onmain. The in-game runs are both onmod-apiwith #2726's save-folder fix and broker change applied locally, beneath this PR.Setup: Windows 11, RTX 5080, NVIDIA 621.40, the game confined, the same profile.
seven-rupee'ssrc/content.tschanged 40 s in. The log's hot reload line, and the checks.eaf4a48bf5aa1dea6hot reload: a mod: …, the module not run againcontent: …again, thenhot reload: local/seven-rupee: …a_folder_is_the_same_path_with_either_separator_on_windowsa_content_mods_changed_module_runs_again_and_its_outputs_are_served, WindowsRisks
The sandbox: not touched.
same_pathonly picks which changed mod's content module runs again. Its files are still read through the builder's grants for the profile's mods folder, as at the start.Only Windows' path comparison changes, and it has one caller (
hot_layers): the two separators now count as the same, as Windows itself treats them. A revert is enough. Players on Windows see a content or files mod's change applied while the game runs, as the docs say it does.Checklist
Ready for review
mod-api(#2822's head); the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (The checks this change reaches pass:cargo test -p api, as above.mod-api's whole suite has failures on Windows that this PR doesn't change.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
mainand passes here. (It fails onmod-api, where the bug is.)Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
The watch hands the loader the folders whose served files changed with `/` between their names (watch.rs's slashes); a row's path is the profile's, joined with `\`. A Windows-only test of loader::same_path with both forms, another letter case, and another folder. It fails on mod-api ("the watch's form"): same_path compares the two as text, so on Windows a changed folder matches no mod, and tests::a_content_mods_changed_module_runs_again_and_its_outputs_are_served fails there for the same reason (it passes on Linux). Assisted-by: Claude Code Co-Authored-By: Claude Opus 5.5 <[email protected]>Tested in the game: Windows 11, RTX 5080, NVIDIA 621.40, confined through
longshot-builder gamewith the seven-rupee example as a profile mod, its src/content.ts changed 40 s in (on mod-api with #2726's save-folder fix and its broker change applied locally, beneath this PR). Before:mods: hot reload: a mod: rebuilt while the game runs, 0 paths served anew ..., the module not run again. After:mod runtime: local/seven-rupee: content: Obj_M37444242_Rupee7, ...again, thenmods: hot reload: local/seven-rupee: rebuilt while the game runs, ... 64 ms.Description fixed: a shell quoting mistake when opening it cut its middle out (Testing, Measurements, Risks); this is the whole description.
Risks now says how this change stands with the sandbox (what it touches, and why the confined game reaches nothing more).
1b0897afed8e2c8494bcRebased onto mod-api's newest (
4cc50ca1: main's newest merged in), with no conflict; this PR's own checks were run again on the rebased head and pass as before. The merge touched none of this PR's files (#2827: only a comment in host/hos_main.c, far from its change), so the measurements and runs above hold; the After commit is the rebased head.8e2c8494bcf1368c4c2bRebased onto
mod-api@816d2354(#2837, headless shots of the mods' UI), nowf1368c4c. No conflict, and the diff is the same as before (samegit patch-id). #2837 touches none of this PR's files.f1368c4c2b8cb95a2f518cb95a2f51d48c1ba7abRebased onto
mod-api@c5e5b676: it was re-squashed onto main @46291934(#2833) twice today (cdbb8551, thenc5e5b676), which made this PR show main's and the whole mod API's diff. Nowd48c1ba7, the same diff as before (samegit patch-id), no conflict. The changes underneath touch none of this PR's files, so its checks still hold.d48c1ba7abcad8bc5973Rebased onto
mod-api@537c2816(#2848, game-free checks' fixtures only), nowcad8bc59: the same diff (samegit patch-id), no conflict. #2848 touches none of this PR's files, so its checks still hold.cad8bc59738b13be8595Rebased onto mod-api
aea64d3a(#2745 nav.closest, one new commit):cad8bc59->8b13be85, the same diff (git patch-id unchanged), so the checks and runs above still hold; none of this PR's files changed on mod-api. The description's head hash is updated.8b13be8595c3f6607400Rebased onto the new
mod-apicb37f5ab(#2851 native mouse camera, #2852 modding docs), which touch none of this PR's files: the same patch (same patch-id), headc3f66074.c3f66074001d10e8e944Rebased onto mod-api @
12f42db5(#2855 rustfmt of nav.closest, #2861 menu rows by place): headc3f660740->1d10e8e94, the same diff (patch-id unchanged); neither commit touches this PR's files.1d10e8e94486b37d5c3bRebased onto mod-api @
75bcd270(#2881 a mod adds a game language): head1d10e8e94->86b37d5c3, the same diff (patch-id unchanged); #2881 changes game/crates/api/src/loader/mod.rs, which this PR touches too: this PR's Rust checks are still to be rerun on this head, before it leaves WIP.Checked again on the head rebased onto
mod-api@75bcd270(#2881 touches this PR's files), on Windows with llvm-mingw (--target x86_64-pc-windows-gnullvm), againstmod-api@75bcd270itself:cargo test -p api: 458 pass, 0 fail (onmod-api: 456 pass, 1 fail, the content-reload test this PR fixes).cargo clippy -p api --all-targets --no-deps -- -D warningsandcargo fmt --checkpass.86b37d5c3ba484a74605Rebased onto mod-api
af3e4d40(5 new commits on75bcd270): heada484a7460, the same diff (patch-id unchanged). The new mod-api commits touch none of this PR's files.a484a7460509059dd818Rebased onto mod-api
716735d8(6 new commits on top ofaf3e4d40): heada484a7460->09059dd81, the same diff (git patch-id unchanged). The new mod-api touches files near this PR; its checks are to be rerun on this head.09059dd818885271515aRebased onto mod-api
5780eeda(one new commit on716735d8, the reverse-engineering tools for hook sites): head09059dd81->885271515, the same diff (git patch-id unchanged). The new mod-api commit touches files near this PR (the builder crates, Cargo, CI); its checks are to be rerun on this head before it leaves WIP.885271515a781a527a6fRebased onto mod-api
65148a78(one new commit, photo-mode and effects APIs), now at781a527a6: the same diff (git patch-id unchanged). Checks not rerun on this PC.781a527a6f8ef2c124efRebased onto the re-squashed
mod-api041890bb(it now carries main up to #2926 and #2884): only this PR's own commits moved withgit rebase --onto, the diff unchanged (samegit patch-id). Head8ef2c124e(was781a527a6). Checks not rerun here: CI on the new head.8ef2c124eff5aa1dea6eRebased onto mod-api
5740a5df(two new commits on041890bb: actors.pose/freeze, and #2902's pool-flag sites in the owners table): head8ef2c124e->f5aa1dea6, the same diff (git patch-id unchanged). Checks not rerun on this PC: CI on the new head.Closing in favour of #2938: one pull request into
mod-apiwith every fix a Windows test of it found, as asked. This PR's commits are there, rebased ontomod-api@5740a5dfand checked again there on Windows (in the game, confined, and every game-free check) and Linux; its description lists this one.Pull request closed