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 "llun/Longshot: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.eaf4a48bd48c1ba7hot 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.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.