feat(game): the Game language row lists the languages the profile's mods add, as its builder says them #380
No reviewers
Labels
No labels
area/build
area/install
area/mods
area/saves
area/tooling
area/ui
area/updates
ci: approved
good first issue
gpu/amd
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
platform/linux
platform/steam-deck
platform/windows
priority
critical
priority
high
priority
low
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/LongshotLauncher!380
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/LongshotLauncher:feat/mod-game-languages"
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
Longshot's mod API lets a mod add a game language, a new choice of the game's Game language row
(MagicBeanDev/Longshot#2881, into
mod-api). Thelauncher's own Game language dropdown kept a fixed list of the game's 16, so it couldn't show or keep a mod's language.
Now it asks the profile's builder:
Longshot.exe --profile P --output json mod languages(added by that PR) gives thegame's 16, then each language a mod that is on adds,
{id, name, base, mod}.profile.jsonor itsmods/folderchanges. Meanwhile the dropdown shows the 16, so nothing waits on the builder.
mod languages(every Longshot before #2881), the launcher keeps the 16, as now.game_language=like any code, and shown by its name.Read first:
src/game/languages.rs, thensrc/players/language.rs(the code rule now asks it).Testing
Tested:
cargo test(a new test reads amod languagesdocument and checks the choices, the lookups and thenames), clippy and fmt, Linux.
Still to test:
mod-apibuild and a mod that adds a language, open Settings → Game: expecting the mod's language after the16, and choosing it writes
game_language=<its id>(by hand). Not run here: no released builder hasmod languagesyet.Risks
game_language=into the profile'ssettings.ini, which themod-apigame reads once intosettings/settings.toml. That's as before this change.🤖 Generated with Claude Code
https://claude.ai/code/session_016o1k1QvyUwMcv8kvCNXuco
Possibly related, for context:
WIP: feat(game): the Game language row lists the languages the profile's mods add, as its builder says themto feat(game): the Game language row lists the languages the profile's mods add, as its builder says them@review
Recommendation: Request changes. A saved mod language is not restored reliably, and rebuilding can replace it with English. Profile changes and overlapping queries can also leave another profile’s languages in the dropdown.
The change asks the selected builder for mod-provided game languages and adds them to the launcher’s language model. The shared cache and its integration with profile rows and the build wizard need correction before the feature can reliably preserve a player’s choice.
Blocking (7): must change before merging.
src/game/languages.rs:141: Publishing the language list does not refresh the profile rows that were read before the query completed. (more on the line) Do: After publishing the current profile’s result, refresh the profile rows as well as the choice models, and test reopening a profile with a saved mod language.src/game/languages.rs:140: Every query publishes unconditionally, including results for a profile or builder that is no longer current. (more on the line) Do: Track the latest requested key or generation, clear the old profile’s choices on a switch, and publish only if the completed query still matches the current request.src/game/wizard.rs:222: The wizard discards a saved mod language and later writes its fallback over that choice after a build. (more on the line) Do: Keep the profile’s mod language separate from the builder’s built-in build language, and do not replace the saved choice merely because the wizard needs a built-in language.src/game/actions.rs:88: The expanded model is also used by the build wizard, whose validation only accepts built-in languages. (more on the line) Do: Give the wizard a built-in-only model, or explicitly support mod languages throughout its build and validation path.src/game/languages.rs:122: The cache key and refresh triggers do not observe changes inside the mods tree. (more on the line) Do: Invalidate the language query when the observed mod tree changes, including nested manifests, and invoke it after mod operations and external edits.CI / Release packages and stable upgrades (pull_request)fails on this head and passes on the base branch: Failing after 28m4s.PR title / Conventional Commit title (pull_request)fails on this head and passes on the base branch: Failing after 36s.Should fix (1): not blocking, but worth doing before merging.
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)
src/game/languages.rs:132: The player-facing builder integration has not yet been exercised. (more on the line) Do: Run the described mod-enabled and older-builder checks, including switching profiles and reopening the launcher, and record the results.@fixcan do L1, L2, L3, L4, L5, L6, L8 and L9.More: does it help, other systems, switches, what was read
Does it help: Unproven: the new unit test exercises parsing and lookups, but the described manual runs with a mod-enabled builder and an older builder have not been done.
Other systems: The language model is shared by Settings and the build wizard, and language lookup is also used for every profile row and for build completion. The same asynchronous cache and invalidation issues affect Windows and Linux. No player-facing run with the new builder is recorded.
Switches: None.
Reviewed:
7fd61f24e4against29c6603aa4: Read AGENTS.md, CONTRIBUTING.md, the commit and diff, the new language module, player language and row code, and the relevant refresh, builder-command, live-watch, UI and wizard paths. Skimmed the remaining changed files and surrounding code; no review checklist or pull request template was present. The other changed code files were not read in full.; nothing run (a code review).Checked and fine:
Testing: No commands from the project or tests were run, as requested. The pull request reports Linux cargo test, clippy and formatting checks; its manual integration checks remain outstanding. CI reports two checks failing only on this head.
Overlaps and merge order: None found in the supplied pull request information; network access was unavailable.
Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.
@ -99,2 +87,2 @@.as_slice(),));// (the game's 16 at once; the languages the profile's mods add once its builder says them)super::languages::set_models(ui);L4 (blocking): The expanded model is also used by the build wizard, whose validation only accepts built-in languages.
When: After a mod language loads, the player can select it in the wizard’s Game language dropdown. Starting the build then fails with “Choose a supported game language.”
Do: Give the wizard a built-in-only model, or explicitly support mod languages throughout its build and validation path.
@ -0,0 +119,4 @@.unwrap_or_default();let changed = |p: PathBuf| std::fs::metadata(p).and_then(|m| m.modified()).ok();let key = (program,L5 (blocking): The cache key and refresh triggers do not observe changes inside the mods tree.
When: Editing an existing nested mod.json changes neither the top-level mods directory timestamp nor profile.json. The live watcher detects nested manifests only while the installed Mods page is visible, and even then does not call this refresh, so the language choices remain stale.
Do: Invalidate the language query when the observed mod tree changes, including nested manifests, and invoke it after mod operations and external edits.
@ -0,0 +129,4 @@}let weak = ui.as_weak();std::thread::spawn(move || {let found =L7 (should fix): The player-facing builder integration has not yet been exercised.
When: The recorded test uses a synthetic document; no run confirms that the builder’s response reaches the dropdown and that selecting and reopening a mod language preserves it.
Do: Run the described mod-enabled and older-builder checks, including switching profiles and reopening the launcher, and record the results.
@ -0,0 +137,4 @@});*ADDED.write().unwrap_or_else(|e| e.into_inner()) = (Some(key), added);let _ = weak.upgrade_in_event_loop(|ui| set_models(&ui));});L2 (blocking): Every query publishes unconditionally, including results for a profile or builder that is no longer current.
When: A slow query for profile A starts, the player switches to B, and B’s query completes first. When A finishes it overwrites B’s cache and dropdown, allowing A’s languages to be selected for B and hiding B’s choices.
Do: Track the latest requested key or generation, clear the old profile’s choices on a switch, and publish only if the completed query still matches the current request.
@ -0,0 +138,4 @@*ADDED.write().unwrap_or_else(|e| e.into_inner()) = (Some(key), added);let _ = weak.upgrade_in_event_loop(|ui| set_models(&ui));});}L1 (blocking): Publishing the language list does not refresh the profile rows that were read before the query completed.
When: On launcher startup, a profile already has a mod language in settings.ini. While ADDED is empty, chosen() rejects it and profile_row falls back to a built-in language; when the query finishes, set_models updates only the choices, so the row continues to show the fallback instead of the saved language.
Do: After publishing the current profile’s result, refresh the profile rows as well as the choice models, and test reopening a profile with a saved mod language.
@ -226,3 +222,1 @@.instance().and_then(|version| super::builder_cli::built_language(&version.folder))});let built_language = players::game_language(&ctx.profile).or_else(|| {L3 (blocking): The wizard discards a saved mod language and later writes its fallback over that choice after a build.
When: With a recognized mod language in settings.ini, wizard open reads it but the LANGS filter selects en-US. Completing a rebuild of the profile’s version calls language_follows_build, which recognizes the old mod language and writes en-US to settings.ini.
Do: Keep the profile’s mod language separate from the builder’s built-in build language, and do not replace the saved choice merely because the wizard needs a built-in language.
7fd61f24e419792c4d27Review fixes, folded into the commit (now
19792c4d):basefrom the builder. The wizard starts at that base, and a build in that base keeps the saved mod language. It's replaced only when the player picks another language in the wizard. Tested.stock-languages, the dropdown'sstock-only). The Settings row still lists the mods' languages.profile.json,mods.json, and every folder and nestedmod.jsonundermods/. A refresh follows every mod action and the live watcher's mods-changed event; the builder is asked again only when the key changed. Tested.Checks: fmt and clippy
-D warningspass.cargo testgives 280 passed and 1 failed. The failure isreleases::tests::adding_the_same_release_twice_creates_distinct_instances, which refuses to run while a Longshot process is open on this PC; it isn't related to this change.