Skip to content

fix(install): install a lazy tool's missing dependencies on first use - #12997

Merged
jdx merged 3 commits into
jdx:mainfrom
balintant:fix/lazy-tool-depends
Sep 9, 2026
Merged

jdx merged 3 commits into
jdx:mainfrom
balintant:fix/lazy-tool-depends

Conversation

@balintant

@balintant balintant commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Issue

A lazy tool's depends target is commonly lazy itself, and in that case nothing ever installs it. mise install skips lazy tools by design, and first-use dispatch installs only the provider, so the dependency preflight fails. The hint it prints suggests mise install, which skips lazy tools, so there is no way out except to stop marking the dependency lazy.

We hit this with hk. Both python and ruff were marked lazy, and hk invokes ruff itself during a check run, so it failed mid-workflow while mise install kept reporting that everything was already installed.

Fix

With this change, upon the first-use dispatch through a shim, mise x, or a task, mise now installs the provider together with its still-missing configured dependencies.

Reproduction

# mise.toml
[tools.python]
lazy = true
lazy_bins = ["python", "python3"]
version = "3"

[tools.ruff]
depends = ["python"]
lazy = true
version = "latest"
$ mise install
#> mise all tools are installed          # lazy tools are skipped by design

$ ruff --version
#> mise ERROR failed to install lazy tool ruff@0.16.6
#> mise ERROR Failed to install aqua:astral-sh/ruff@latest: tool 'ruff@latest' requires
#>   configured install dependency 'python@3', but its selected version is not installed
#> hint: Run `mise install python@3` before installing 'ruff@latest'. Remove the
#> dependency from configuration to allow the install hook to rely on system PATH instead.

AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5[1m]; version: 2.1.220.

Summary by CodeRabbit

  • New Features

    • Lazy tool execution now installs configured tools along with missing direct and transitive dependencies.
    • Dependency installation works consistently during direct execution and through mise x.
    • Already-installed dependencies are reused without duplicate installation.
    • Each dependency is installed in the scope associated with its configuration, including support for multiple configured versions.
  • Documentation

    • Updated developer documentation to reflect lazy tool dependency installation.
  • Tests

    • Added end-to-end coverage for dependency installation, reuse, multiple versions, and configuration scopes.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: cd6c8efc-b364-4111-8735-1164bac2c79c

📥 Commits

Reviewing files that changed from the base of the PR and between cbc3aca and 482ebe6.

📒 Files selected for processing (4)
  • e2e/cli/test_lazy_tools_depends
  • e2e/cli/test_lazy_tools_system
  • src/toolset/install_options.rs
  • src/toolset/toolset_install.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Lazy tool installation now resolves missing transitive dependencies before execution. Each tool uses the install directory for its declaring configuration scope. Tests cover direct use, mise x, multiple versions, dependency reuse, and system/user scopes.

Changes

Lazy tool dependency installation

Layer / File(s) Summary
Expand lazy installation requests
src/toolset/toolset_install.rs
The installer collects the lazy tool and all matching missing dependency versions, then passes the expanded requests to install_all_versions.
Resolve scoped install directories
src/toolset/install_options.rs, src/toolset/toolset_install.rs
InstallOptions supports scoped directory resolution. Each tool uses the scope of its declaring configuration, while system-scoped tools use the system installs directory.
Document and validate dependency installation
e2e/cli/test_lazy_tools_depends, e2e/cli/test_lazy_tools_system, docs/dev-tools/shims.md
Tests and documentation cover direct execution, mise x, dependency reuse, multiple configured versions, and mixed system/user scopes.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 482eb

Lazy tool first use now installs configured missing dependencies in their declaring scopes, with end-to-end coverage for the affected invocation and scope scenarios. No concrete current-head merge-blocking risk remains.

Suggested reviewers: jdx, risu729

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant LazyShim
  participant ToolsetInstaller
  participant ConfigDeclarations
  User->>LazyShim: Run lazy tool
  LazyShim->>ToolsetInstaller: Install missing lazy tool requests
  ToolsetInstaller->>ConfigDeclarations: Resolve dependency declarations
  ConfigDeclarations-->>ToolsetInstaller: Return dependency requests
  ToolsetInstaller->>ToolsetInstaller: Resolve each tool's scoped install directory
  ToolsetInstaller-->>LazyShim: Install provider and dependencies
  LazyShim-->>User: Execute tool
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (2 skipped: 2… 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 clearly and concisely describes the primary change: installing missing dependencies for lazy tools during first use.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI

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.

@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; the previous multi-version and cross-scope failures are fully addressed and no new actionable issue remains.

Summary

  • Collects missing direct and transitive dependency requests, including every configured version.
  • Resolves installation destinations per request for mixed-scope batches.
  • Adds end-to-end coverage for shim dispatch, mise x, dependency reuse, multiple versions, and mixed system/user scope.
  • Updates shim documentation to describe the new behavior.

Comment thread src/toolset/toolset_install.rs Resolved
Comment thread src/toolset/toolset_install.rs Resolved
@balintant

Copy link
Copy Markdown
Contributor Author

Regarding @coderabbitai's Docstring Coverage requirement:

  • Both new functions are documented.
  • The pre-existing helpers were already missing docstrings.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@balintant Thanks for the clarification. Both new functions are documented. The existing undocumented helpers are outside this PR's change scope. I am withdrawing the Docstring Coverage comment.

You are interacting with an AI system.

@jdx
jdx merged commit 673a132 into jdx:main Sep 9, 2026
45 checks passed
This was referenced Sep 9, 2026
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