Repository navigation
fix(install): restore runtime symlinks after failures - #11579
Conversation
📝 WalkthroughWalkthroughThe change adds backend-aware runtime symlink recovery for failed installations. It tracks attempted failures, restores affected aliases after resolution, aggregates rebuild errors, and adds end-to-end coverage for dry runs, dependency failures, restoration, and dangling aliases. ChangesRuntime symlink recovery
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Install as install_all_versions
participant Deps as install_with_deps
participant Symlinks as rebuild_for_backends
participant Backend as Backend
Install->>Deps: install tool requests
Deps-->>Install: successes, failures, attempted failures
Install->>Symlinks: affected backends
Symlinks->>Backend: rebuild runtime symlinks
Backend-->>Symlinks: rebuild results
Symlinks-->>Install: aggregated result
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
Greptile SummaryThe PR restores runtime aliases after failed installation tasks while preserving the original installation error.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the current code excludes dependency-blocked installs from repair and continues attempting later runtime-symlink repairs after an earlier repair error. Important Files Changed
Reviews (4): Last reviewed commit: "fix(install): restore runtime symlinks a..." | Re-trigger Greptile |
Head branch was pushed to by a user without write access
Summary
Problem and root cause
Runtime aliases can be updated while an installation is in progress. If the backend installation then fails, cleanup removes the incomplete version directory, but a single-failure install path does not run the later full shim and runtime-symlink rebuild. This can leave
latestand numeric or prefixed aliases pointing at the removed version.Implementation
The common install pipeline records the backends whose install tasks fail. After cleanup and config reload, it rebuilds runtime symlinks only for those backends and uses the existing per-directory logic for user, shared, and system installs. Existing valid versions therefore become alias targets again; when no valid version remains, dangling aliases are removed.
The repair is best-effort. A repair error is reported as a warning, while the command still returns the original install failure. Dry runs, plugin setup failures, and disabled-backend validation failures do not trigger repair. This intentionally does not update lockfiles or rebuild shims because the failed version was not installed successfully.
Verification
mise run test:e2e e2e/cli/test_install_failure_runtime_symlinks e2e/cli/test_install_parallel_failuremise exec -- cargo test --all-features runtime_symlinksmise exec -- cargo check --all-featuresmise exec -- cargo clippy --workspace --all-features --all-targets -- -D warningsmise exec -- cargo fmt --all -- --checkmise exec -- shfmt -d e2e/cli/test_install_failure_runtime_symlinksmise exec -- shellcheck e2e/cli/test_install_failure_runtime_symlinksmise run lintwas also attempted, but its hk wrapper cannot recognize this Sapling working copy as a Git repository. The relevant Rust, shell formatting, ShellCheck, and Clippy checks above pass individually.Addresses #6697
AI-assisted — Tool: Codex; model: OpenAI/GPT-5; version: unavailable.
Summary by CodeRabbit
Bug Fixes
Tests