Repository navigation
fix(modding): safe mod updates, local cache isolation and loader config - #306
Merged
Merged
Conversation
Loader packages tracked every file, so updating or uninstalling the loader overwrote or deleted BepInEx/config/BepInEx.cfg. Files under the loader config folder are now untracked like mod configuration, and an update no longer removes a file an older install tracked but the new plan treats as configuration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DGbCKVdcUfJfjZ93bYY9p3
An update deleted every file of the installed version before copying the new one, and a failed copy then uninstalled the mod. The old files are now moved into a temporary folder and deleted only once the new version is in place and recorded. On failure they are moved back and the old record and tracked files are restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DGbCKVdcUfJfjZ93bYY9p3
Installing over a disabled mod always recorded it as enabled and copied its files; update_profile_mods disabled it again afterwards, so a failure part way left it enabled. The installer now keeps the existing enabled state and, for a disabled mod, only updates its records. The update logic moves out of the Tauri command into update_from_catalog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DGbCKVdcUfJfjZ93bYY9p3
Mods imported from a local archive were cached under local-cache/<package>/<version>, shared by every game and profile, and an import replaced that folder in place. Importing another mod.zip elsewhere silently changed the files of the first import. Each import is now cached under local-cache/<sha256 of id and archive>, the key is stored on the mod record (schema v39) and cached entries are never replaced. Records from older imports keep the legacy path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DGbCKVdcUfJfjZ93bYY9p3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
Four modding install fixes from the review, one commit each:
BepInEx/config/are no longer tracked as loader files, so loader update/uninstall leave the user'sBepInEx.cfgalone. Older profiles that still track it stop tracking it on the next update without deleting it.install_cached_packagemoves the old version into a temporary backup, installs and records the new one, and deletes the backup only on success. On failure the new files are removed and the old files, record and tracked file list are restored; if restoring fails, the backup is kept and its path is in the error.update_profile_mods, and that logic moved out of the Tauri command intoupdate_from_catalog.local-cache/<sha256 of package id + archive>and entries are never replaced in place. The key is stored on the mod record so duplicated profiles keep pointing at the right files. Mods imported before this change keep using the oldlocal-cache/<package>/<version>path.Schema change: v38 -> v39 adds nullable
local_cache_keytomod_profile_mods(column existence checked first, same pattern as v37). Not sent to the frontend.Not addressed: pruning old local cache entries (pre-existing), and startup cleanup of a leftover
*-backupfolder after a crash mid-update (separate crash-recovery finding).Validation
cargo test --lib965 passed, 4 ignored; clippy-D warningsandcargo fmt --checkclean.loader_update_and_uninstall_keep_its_config,a_failed_update_keeps_the_old_version,a_blocked_removal_keeps_the_old_version_recorded,updating_a_disabled_mod_keeps_it_disabled,imports_with_the_same_name_keep_their_own_files.Generated by Claude Code