Skip to content

refactor(core): parse plugin tool options locally#9963

Merged
jdx merged 6 commits into
jdx:mainfrom
risu729:refactor/core-plugin-typed-options
May 18, 2026
Merged

refactor(core): parse plugin tool options locally#9963
jdx merged 6 commits into
jdx:mainfrom
risu729:refactor/core-plugin-typed-options

Conversation

@risu729

@risu729 risu729 commented May 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add local typed option readers for core .NET runtime, Java release_type, Rust profile/components/targets, and Python patch_sysconfig/virtualenv options
  • route install, listing, activation, and lockfile option reads through those local readers
  • parse boolean tool options consistently via the shared backend option helper
  • add focused parser tests for each touched core plugin and shared boolean parsing

Verification

  • cargo fmt --check
  • git diff --check
  • cargo test backend::options::tests
  • cargo test python_options_reads_patch_sysconfig
  • cargo test test_include_prereleases_accepts_bool_and_string_values

Notes:

  • Node, Erlang, Ruby, and core Go do not currently read raw per-tool option keys in this PR C parser phase; their remaining work is setting-derived identity classification for PR D.

Project: https://github.com/users/risu729/projects/3/views/1?pane=issue&itemId=185472417

@greptile-apps

greptile-apps Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refactors how plugin-specific tool options are parsed by introducing typed wrapper structs (DotnetOptions, JavaOptions, PythonOptions, RustOptions) and centralising boolean parsing in backend/options.rs with case-insensitive handling and warnings for invalid values.

  • Boolean parsing hardened: is_truthy is now case-insensitive; new is_falsey, bool_value, bool_with_default, and warn_invalid_bool_value helpers unify all bool option reads across core plugins and the shared include_prereleases path.
  • Correctness fix in Python: The old patch_sysconfig check compared the raw string against "false", silently ignoring a native TOML false boolean; the new bool_with_default("patch_sysconfig", true) handles both representations correctly.
  • Rust comma_list now trims whitespace: elements from "clippy, rustfmt" are trimmed before being passed to rustup, preventing rejections of component names with leading spaces.

Confidence Score: 5/5

Safe to merge — all changes are refactors or bug fixes with no removed behaviour, backed by new unit tests for every touched code path.

Every changed code path has an explicit before/after test. The only observable behaviour changes are intentional improvements: case-insensitive bool parsing, a warning on invalid values, fixing the Python patch_sysconfig TOML-bool silent no-op, and whitespace trimming in Rust's comma_list. No external contracts are broken.

No files require special attention.

Important Files Changed

Filename Overview
src/backend/options.rs Centralises boolean parsing: adds bool_value, bool_value_or_default, bool_with_default, is_falsey, warn_invalid_bool_value, and makes is_truthy case-insensitive. Existing bool() and platform_bool_for_target() are rewired to the new helpers.
src/backend/mod.rs Delegates tool_option_bool to the shared bool_value_or_default helper and extends test_include_prereleases_accepts_bool_and_string_values to cover "1"/"0"/"00" and the case-folded "FALSE" path.
src/plugins/core/dotnet.rs Introduces DotnetOptions typed wrapper; routes runtime reads through it in test_dotnet, install, and uninstall paths; adds a focused unit test.
src/plugins/core/java.rs Introduces JavaOptions typed wrapper; routes release_type reads and lockfile option construction through it; adds a focused unit test.
src/plugins/core/python.rs Introduces PythonOptions; replaces string-comparison-based patch_sysconfig check with bool_with_default(..., true), fixing the silent no-op for TOML-boolean false; adds unit tests for both options.
src/plugins/core/rust.rs Introduces RustOptions; extracts profile/components/targets parsing into comma_list (now trims whitespace per-element); install_args encapsulates the idiomatic-file vs tool-option merge logic; adds unit tests.

Reviews (8): Last reviewed commit: "refactor(core): expose optional boolean ..." | Re-trigger Greptile

Comment thread src/plugins/core/python.rs
Comment thread src/plugins/core/rust.rs

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the dotnet, java, python, and rust core plugins to utilize structured option types—DotnetOptions, JavaOptions, PythonOptions, and RustOptions—for handling tool-specific configuration. This replaces manual retrieval from raw tool options with a more unified and testable approach. Unit tests were also introduced for each new options struct to verify correct behavior. I have no feedback to provide.

@risu729

risu729 commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

CI note: the benchmark job failed before running the benchmark because mise x hyperfine could not install aqua:sharkdp/hyperfine@latest; GitHub returned 403 Forbidden for the hyperfine release API request. This appears to be a GitHub API/rate-limit issue unrelated to the core plugin option parser changes in this PR.

This comment was generated by an AI coding assistant.

@risu729

risu729 commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

CI note: windows-e2e also appears unrelated to this PR. It failed in 7z.executes 7za 25.00 because the Windows runner hit GitHub API rate limits while installing github:ip7z/7zip@25.00 (403 Forbidden on the release API request). The core plugin option parser changes are not involved in that path.

This comment was generated by an AI coding assistant.

@risu729 risu729 marked this pull request as ready for review May 18, 2026 17:27
@risu729 risu729 marked this pull request as draft May 18, 2026 17:27
@risu729 risu729 force-pushed the refactor/core-plugin-typed-options branch from 3bb98db to c6fb99a Compare May 18, 2026 19:19
@risu729 risu729 marked this pull request as ready for review May 18, 2026 19:56
@jdx jdx merged commit a3a3cf1 into jdx:main May 18, 2026
32 checks passed
@risu729 risu729 deleted the refactor/core-plugin-typed-options branch May 19, 2026 00:19
mise-en-dev added a commit that referenced this pull request May 19, 2026
### 🚀 Features

- **(cli)** rename before flag to minimum release age by @risu729 in
[#9768](#9768)
- **(core)** deprecate default package files by @jdx in
[#9970](#9970)
- **(edit)** add --global flag for editing the global config file by
@fru1tworld in [#9953](#9953)

### 🐛 Bug Fixes

- **(aqua)** support cosign public-key bundles by @jdx in
[#9972](#9972)
- **(backend)** pass install_env to postinstall by @risu729 in
[#9930](#9930)
- **(backend)** apply install_env to install commands by @risu729 in
[#9929](#9929)
- **(cargo)** skip binstall for cargo install options by @risu729 in
[#9928](#9928)
- **(config)** restore MISE_ENV_FILE setting by @risu729 in
[#9903](#9903)

### 🚜 Refactor

- **(cli)** use tool wording in version env help by @risu729 in
[#9906](#9906)
- **(conda)** parse tool options locally by @risu729 in
[#9960](#9960)
- **(core)** parse plugin tool options locally by @risu729 in
[#9963](#9963)
- **(go)** parse tool options locally by @risu729 in
[#9961](#9961)
- **(http)** parse tool options locally by @risu729 in
[#9870](#9870)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#9954](#9954)
- lock file maintenance by @renovate[bot] in
[#9957](#9957)

### 📦 Registry

- use aqua backend for qsv by @risu729 in
[#9910](#9910)

### Ci

- build/publish snap package for arm64 by @jnsgruk in
[#9948](#9948)

### New Contributors

- @jnsgruk made their first contribution in
[#9948](#9948)

## 📦 Aqua Registry Updates

### New Packages (2)

- [`AOMediaCodec/libavif`](https://github.com/AOMediaCodec/libavif)
- [`julian7/redact`](https://github.com/julian7/redact)

### Updated Packages (1)

- [`apache/jena`](https://github.com/apache/jena)
jdx pushed a commit that referenced this pull request May 20, 2026
## Summary
- add a direct .NET backend typed option reader for prerelease
- route prerelease filtering through the shared boolean option parser
while preserving the legacy package flag fallback
- add unit coverage for prerelease option parsing

## Verification
- cargo fmt --check
- git diff --check
- cargo test dotnet_options_reads_prerelease

Stacked on #9963. Target branch remains the default branch.

Project:
https://github.com/users/risu729/projects/3/views/1?pane=issue&itemId=185472417
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