Conversation
Reviewer's GuideFix stale install_profile.json handling by centralizing cleanup during loader changes/removal and limiting installation processors to Forge and NeoForge, preventing leftover profiles from affecting Fabric, Quilt, Cleanroom, and other loader scenarios. Sequence diagram for loader change and stale profile cleanupsequenceDiagram
participant Caller
participant InstanceCommands
participant LoaderCommon
participant VersionDirectory
Caller->>InstanceCommands: change_mod_loader()
InstanceCommands->>LoaderCommon: remove_install_profile(instance)
LoaderCommon->>VersionDirectory: remove_file(install_profile.json)
VersionDirectory-->>LoaderCommon: success or file absent
LoaderCommon-->>InstanceCommands: SJMCLResult
InstanceCommands->>InstanceCommands: schedule_progressive_task_group()
Sequence diagram for loader removal and profile cleanupsequenceDiagram
participant Caller
participant InstanceCommands
participant LoaderCommon
participant VersionDirectory
Caller->>InstanceCommands: remove_mod_loader()
InstanceCommands->>InstanceCommands: remove_mod_loader_from_client_info()
InstanceCommands->>LoaderCommon: remove_install_profile(instance)
LoaderCommon->>VersionDirectory: remove_file(install_profile.json)
VersionDirectory-->>LoaderCommon: success or file absent
LoaderCommon-->>InstanceCommands: SJMCLResult
InstanceCommands->>InstanceCommands: update mod_loader to Unknown
Flow diagram for loader-specific install profile processingflowchart TD
A["finish_mod_loader_install()"] --> B{Loader type is Forge or NeoForge?}
B -->|No| C["Skip execute_processors()"]
B -->|Yes| D{install_profile.json exists?}
D -->|No| E[Continue installation]
D -->|Yes| F["load_json_async()"]
F --> G["execute_processors()"]
G --> E
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src-tauri/src/instance/commands.rs" line_range="1522-1523" />
<code_context>
.await?;
}
+ remove_install_profile(&instance)?;
+
if !modloader_task_params.is_empty() {
schedule_progressive_task_group(
</code_context>
<issue_to_address>
**issue (bug_risk):** `remove_install_profile(&instance)` deletes the newly generated `install_profile.json` after `install_mod_loader` has prepared a Forge or NeoForge installation. `finish_mod_loader_install` then finds no profile and skips `execute_processors`, so processor-based installation steps are never run when switching to Forge or NeoForge.
**Triggers:** When changing an existing instance to Forge or NeoForge.
**Suggested fix:** Remove the stale profile before calling `install_mod_loader`, or only perform this post-install cleanup when the new loader does not require processors.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and the change deletes an existing install_profile.json when a loader is changed or removed, and also stops processing profiles for other loader types. If that cleanup is wrong, reverting will not restore a deleted profile, but the profile and associated installation state should be recreatable by reinstalling or rerunning the loader setup.
Blocking findings: src-tauri/src/instance/commands.rs:1523
| remove_install_profile(&instance)?; | ||
|
|
There was a problem hiding this comment.
issue (bug_risk): remove_install_profile(&instance) deletes the newly generated install_profile.json after install_mod_loader has prepared a Forge or NeoForge installation. finish_mod_loader_install then finds no profile and skips execute_processors, so processor-based installation steps are never run when switching to Forge or NeoForge.
Triggers: When changing an existing instance to Forge or NeoForge.
Suggested fix: Remove the stale profile before calling install_mod_loader, or only perform this post-install cleanup when the new loader does not require processors.
Checklist
This PR is a ..
Related Issues
作为 #2002 的后续改进,合入其分支。
Description
切换或移除加载器后,版本目录可能残留旧的
install_profile.json。本次通过公共 helper 在切换、移除加载器时统一清理该文件,覆盖切换到 Fabric、Quilt 等场景;文件不存在时正常继续,其他删除错误正常上报。安装完成阶段仅允许 Forge 和 NeoForge 执行 processors,替代原有的 Cleanroom 专用清理分支,避免历史残留 profile 影响 Cleanroom 安装。
Additional Context
已通过
cargo check --all-targets、格式检查和git diff --check。仍有 9 条既有编译警告,未进行实际游戏安装验证。Summary by Sourcery
Prevent stale loader installation profiles from interfering with mod loader changes and installations.
Bug Fixes:
Enhancements: