fix: parse inline CLI options for ls-remote, overrides mise.toml#8902
fix: parse inline CLI options for ls-remote, overrides mise.toml#8902
Conversation
There was a problem hiding this comment.
Code Review
This pull request refines tool option handling by prioritizing inline CLI options over configuration files in the vfox backend and ensuring the ls-remote command remains context-free by bypassing local configuration. Additionally, the regex for parsing bracketed options was updated to be more precise. I have no feedback to provide as there were no review comments to evaluate.
I don't think so |
Greptile SummaryThis PR fixes two related issues: a regex bug in Confidence Score: 5/5Safe to merge — no P0/P1 issues found; previous thread concerns about cached-backend opts have been addressed by threading opts as an explicit parameter The regex fix is correct and necessary. The opts-threading design is clean and avoids the cached-backend pitfall by never relying on self.ba.opts inside the backend implementation. The only finding is a P2 style inconsistency (missing warn! for invalid versions in the opts path). No files require special attention; all changes are consistent and well-structured Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant LsRemote
participant BackendArg
participant Backend as Backend (trait)
participant Cache as VersionCacheManager
participant VfoxBackend
participant Config
User->>LsRemote: mise ls-remote 'vfox-pixi:samtools[channels=["bioconda"]]'
LsRemote->>LsRemote: run() → run_single(config, plugin)
note over LsRemote: Extract inline opts from tool_arg.ba.opts
LsRemote->>BackendArg: ta.ba.opts.clone()
BackendArg-->>LsRemote: Some(opts) — channels=["bioconda"]
LsRemote->>Backend: list_remote_versions_with_info(config, Some(opts))
alt opts is Some — inline opts path
note over Backend: Cache bypass (results depend on opts)
Backend->>VfoxBackend: _list_remote_versions_with_opts(config, Some(opts))
VfoxBackend->>VfoxBackend: inline opts present → use opts.opts directly
note over VfoxBackend: config.get_tool_opts() NOT called
VfoxBackend->>VfoxBackend: vfox.backend_list_versions(pathname, tool_name, inline_opts)
VfoxBackend-->>Backend: Vec<VersionInfo>
Backend-->>LsRemote: filtered Vec<VersionInfo>
else opts is None — normal cached path
Backend->>Cache: get_or_try_init_async(...)
alt cache miss
Cache->>Backend: _list_remote_versions(config)
Backend->>VfoxBackend: _list_remote_versions(config)
VfoxBackend->>VfoxBackend: delegates to _list_remote_versions_with_opts(config, None)
VfoxBackend->>Config: get_tool_opts(&ba)
Config-->>VfoxBackend: ToolVersionOptions from mise.toml
VfoxBackend-->>Cache: Vec<VersionInfo>
end
Cache-->>Backend: cached Vec<VersionInfo>
Backend-->>LsRemote: Vec<VersionInfo>
end
LsRemote->>LsRemote: filter by prefix, print versions
LsRemote-->>User: version list output
Reviews (7): Last reviewed commit: "propagate opts param to backends, remove..." | Re-trigger Greptile |
So I got the impression it's more of a one-off command, since there's no mention of Should I consider both cases in this PR (with/without mise.toml)? Currently on |
403bbc4 to
ac7ab17
Compare
|
The regex fix in However, I have concerns about the other two changes:
I'd suggest keeping the regex fix and the vfox.rs precedence change, but dropping the This comment was generated by Claude Code. |
|
I dug into this more and my earlier feedback was wrong. The TOOLS cache looks up backends by So there's no precedence bug — inline bracket opts on That said, this cache bypass + vfox-specific opts check is still vfox-only. If we want inline opts on This comment was generated by Claude Code. |
849a182 to
440e638
Compare
|
@jdx |
@jdx I've re-added the cache bypass in
Probably, I don't know enough about the other backends, for now I'm only focusing on this so that I can complete my |
|
The vfox-only approach isn't going to work — we need inline opts to be handled generically so all backends (github, http, s3, etc.) benefit from the same fix. Rather than each backend independently checking The regex fix in This comment was generated by Claude Code. |
|
To expand on my previous comment — the The regex fix in This comment was generated by Claude Code. |
179efb9 to
e9ad707
Compare
|
@jdx I've removed the vfox-specific code and added a function called |
Signed-off-by: Esteve Fernandez <[email protected]>
Signed-off-by: Esteve Fernandez <[email protected]>
Signed-off-by: Esteve Fernandez <[email protected]>
e9ad707 to
8f78778
Compare
|
@jdx anything else that should be addressed? Would you prefer I add opts to |
|
going to pass for now, sorry |
## What - Add a shared backend option resolver that preserves where each effective option came from. - Resolve backend options in this order, with later layers overriding earlier ones: 1. Registry backend defaults. 2. Backend alias `[...]` options from `[tool_alias]` / `[alias]` backend entries. 3. Config options selected by the existing tool config lookup rules. 4. Inline backend options from the current tool spec, such as `tool[...]`. - Apply that resolved option path consistently in GitHub/GitLab/Forgejo, HTTP, S3, UBI, vfox backend plugins, Conda channel resolution, SPM provider/API URL resolution, Java release type listing, versions-host cache filtering, fuzzy version matching, `minimum_release_age` handling, runtime args, and install request initialization. - Preserve inline backend options across the short-name backend cache, so commands like `ls-remote 'github:owner/repo[api_url=...]'` do not accidentally use a cached installed backend without those inline options. - Preserve config options when runtime args include inline overrides, while still letting inline options win for the one command. - Switch Go install to use the resolved request options. - Fix shorthand parsing for URL-valued inline options such as `tool[api_url=https://example/api/v3]`. ## Follow-up The versions-host behavior for locally overridden backend options has been split into #9568. That PR is stacked on this one and should be rebased after this merges. ## Relationship to #9315 This PR does not change which config entry is eligible for a tool. That behavior comes from #9315: - Registry short names should not inherit config from their resolved full backend key. - Configured aliases can fall back to resolved full-backend config when there is no alias-specific entry. - Alias-specific `[tools.<alias>]` config is more specific than `[tools."<resolved-backend>"]` config. This PR builds on that lookup and changes what happens after config has been selected: registry defaults, backend alias options, config options, and inline options are merged through one resolver, with provenance retained for callers that need to distinguish where an option came from. ## Relationship to #8902 #8902 was a narrower `ls-remote` fix for inline backend options. This PR covers the same installed-tool cache failure mode generically: when a caller supplies inline backend options, mise builds a backend from that caller `BackendArg` instead of returning a short-name cache entry that was loaded from install state without the inline options. ## Example Given config selected through an alias fallback: ```toml [tool_alias] hw = "github:jdx/mise-test-fixtures[api_url=https://api.github.com]" [tools."github:jdx/mise-test-fixtures"] version = "1.0.0" asset_pattern = "definitely-not-a-real-hello-world-asset" ``` Inline options should still win for this invocation: ```sh mise install 'hw[asset_pattern=hello-world-1.0.0.tar.gz,bin_path=hello-world-1.0.0/bin]@1.0.0' ``` Before this PR, the resolved full-backend config could replace the inline `asset_pattern`, and alias `[...]` options were only visible as part of a resolved string. After this PR, alias options are their own layer and inline options are applied over the selected config options. ## Why Backend-level code had several config-or-inline branches. Depending on the path: - Inline options could be ignored when config existed for the same tool or resolved backend. - Inline options could be dropped at the installed-tool backend cache boundary. - Config options could be dropped when runtime args included inline options. - Backend alias `[...]` options were not represented as a distinct layer. - Backend-specific list/install paths could read raw backend args instead of the resolved tool options. - Registry defaults were not always part of the same overlay path as config and inline options. This PR centralizes that overlay so config-aware paths use the same precedence, while preserving source information separately from the effective option values. ## Validation - `cargo fmt --all` - `git diff --check` - `cargo test --all-features tool_opts` - `cargo test --all-features opts_with_config` - `cargo test --all-features test_git_provider_from_ba` - `mise run test:e2e e2e/backend/test_github_ls_remote_inline_opts` *This PR was updated by an AI coding assistant.* --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This PR enables
ls-remoteto parse options from the CLI (e.g.mise ls-remote "vfox-pixi:samtools[channels=bioconda]"), overriding options frommise.tomlif the latter exists, as introduced in #8875 . Also adds support for parsing TOML arrays (e.g.mise ls-remote 'vfox-pixi:samtools[channels=["conda-forge", "bioconda"]]')