Skip to content

fix(install): rebuild symlinks after partial installs#10470

Merged
jdx merged 2 commits into
jdx:mainfrom
risu729:risu/fix-reshim-runtime-symlinks
Jun 17, 2026
Merged

fix(install): rebuild symlinks after partial installs#10470
jdx merged 2 commits into
jdx:mainfrom
risu729:risu/fix-reshim-runtime-symlinks

Conversation

@risu729

@risu729 risu729 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes the follow-up reported in #9848 where successful tools from a partially failed mise install could be left without runtime version symlinks such as installs/bun/latest.

What was wrong

Toolset::install_all_versions() already preserves partial success in Error::InstallFailed { successful_installations, failed_installations }. However, mise install used ? on that result, so any failed tool skipped the later rebuild_shims_and_runtime_symlinks() call entirely. That meant tools that had already installed successfully during the same command could miss their runtime symlinks and shims until another successful install/rebuild path ran.

This is an install partial-failure problem, not a mise reshim problem. Runtime version symlinks remain owned by the install/runtime-symlink rebuild flow.

How this fixes it

  • Mirrors the existing mise upgrade pattern: extract successful_installations from InstallFailed, continue post-install rebuild work for those versions, then return the original install error.
  • Applies that behavior to both explicit mise install <tools> and bare mise install from config.
  • Extends e2e/cli/test_install_parallel_failure to assert that the successfully installed tool gets its latest runtime symlink even though another tool failed.

Testing

  • /home/risu/.cargo/bin/cargo fmt --all --check
  • git diff --check
  • env -u MISE_PROJECT_ROOT -u MISE_ORIGINAL_CWD mise run test:e2e e2e/cli/test_install_parallel_failure

Not run: full local test suite.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling during parallel installations to ensure shims and symlinks are properly rebuilt even when some tool installations fail.
  • Tests

    • Enhanced end-to-end tests to verify correct installation symlinks after parallel install scenarios.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c8ce973-338b-44a4-b7ae-3ff1c3159a75

📥 Commits

Reviewing files that changed from the base of the PR and between e7234cd and bf1778e.

📒 Files selected for processing (4)
  • e2e/cli/test_install_parallel_failure
  • src/cli/install.rs
  • src/cli/upgrade.rs
  • src/errors.rs
✅ Files skipped from review due to trivial changes (1)
  • e2e/cli/test_install_parallel_failure

📝 Walkthrough

Walkthrough

Adds a split_install_result helper in errors.rs that extracts successfully installed versions from a partial InstallFailed error. install.rs and upgrade.rs use this helper to defer error propagation until after shim/symlink rebuild completes for the successful installs. Two e2e assertions confirm the tiny/latest symlink resolves correctly after parallel failures.

Changes

Deferred install error propagation with split_install_result

Layer / File(s) Summary
split_install_result helper
src/errors.rs
Adds pub fn split_install_result(Result<Vec<ToolVersion>, Report>) -> (Vec<ToolVersion>, Result<(), Report>) that downcasts InstallFailed errors to extract successfully installed versions while preserving the original error.
Deferred error propagation in install commands
src/cli/install.rs
Replaces direct await? on install_all_versions with split_install_result in both install_runtimes and install_missing_runtimes. Shim/symlink rebuild is conditioned on install_error.is_ok() || !versions.is_empty(), and install_error? propagates failure after the rebuild.
Upgrade command simplified
src/cli/upgrade.rs
Removes the inline match on install results and replaces it with a single split_install_result(...) call, consolidating the extraction logic in the shared helper.
e2e verification
e2e/cli/test_install_parallel_failure
Adds readlink assertions confirming .../installs/tiny/latest resolves to ./3.1.0 in both the parallel dummy-failure and mixed jq-failure test cases.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 When installs run in parallel with flair,
Some tools may fail, but tiny gets there!
We split the result, save what we can,
Rebuild the shims — that's the plan.
Then propagate errors, tidy and fair! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(install): rebuild symlinks after partial installs' accurately and specifically describes the main change in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a partial-install regression where tools that succeeded in a parallel mise install run could be left without their installs/<tool>/latest runtime symlinks if any sibling tool failed. The root cause was an early ? return on the install_all_versions result that skipped the rebuild_shims_and_runtime_symlinks call entirely.

  • Extracts a split_install_result helper in src/errors.rs that separates successful ToolVersions from the error on a partial InstallFailed, and refactors upgrade.rs to use it (no behavior change there).
  • Applies the same pattern to both run_explicit and run_from_config in install.rs: rebuild is now called whenever at least one tool installed successfully, and the original install error is propagated afterward.
  • Extends the e2e test with readlink assertions that directly verify the latest symlink is created for the successful tool even when another tool in the same invocation fails.

Confidence Score: 5/5

Safe to merge — the change is narrowly scoped to the post-install rebuild gate, logic is correct, and the fix is covered by an extended e2e test.

The new split_install_result helper faithfully mirrors the pre-existing upgrade.rs pattern, the guard condition install_error.is_ok() || !versions.is_empty() correctly covers all three cases (full success, partial success, total failure), and the install error is always propagated at the end of each path rather than swallowed.

No files require special attention.

Important Files Changed

Filename Overview
src/errors.rs Adds split_install_result helper that extracts the (Vec<ToolVersion>, Result<(), Report>) pair from an install result, correctly preserving successful installations from InstallFailed errors and returning empty vec for all other error types.
src/cli/upgrade.rs Pure refactor: replaces inline match logic with the new split_install_result helper. Semantics are identical to the original code.
src/cli/install.rs Both run_explicit and run_from_config now use split_install_result so that rebuild_shims_and_runtime_symlinks is called for any partial success, and the install error is propagated after the rebuild completes.
e2e/cli/test_install_parallel_failure Adds readlink assertions for the latest symlink in both partial-failure scenarios, directly covering the regression that this PR fixes.

Reviews (3): Last reviewed commit: "refactor(install): share split_install_r..." | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@risu729 risu729 force-pushed the risu/fix-reshim-runtime-symlinks branch from e7234cd to 1ac4791 Compare June 17, 2026 00:19
@risu729 risu729 changed the title fix(shim): rebuild runtime symlinks during reshim fix(install): rebuild symlinks after partial installs Jun 17, 2026
Comment thread src/cli/install.rs Outdated
risu729 added 2 commits June 18, 2026 06:50
Extract partial-install success handling into errors::split_install_result
so install and upgrade use the same logic.
@risu729 risu729 force-pushed the risu/fix-reshim-runtime-symlinks branch from 1ac4791 to bf1778e Compare June 17, 2026 20:58
@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review June 17, 2026 20:58
@risu729 risu729 marked this pull request as draft June 17, 2026 21:09
@risu729 risu729 marked this pull request as ready for review June 17, 2026 21:09
@risu729 risu729 marked this pull request as draft June 17, 2026 21:11
@risu729 risu729 marked this pull request as ready for review June 17, 2026 21:18
@jdx jdx merged commit 7b174b9 into jdx:main Jun 17, 2026
33 checks passed
@risu729 risu729 deleted the risu/fix-reshim-runtime-symlinks branch June 17, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants