-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(http): store tool opts as native TOML to fix platform switching #8448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fd2bc60
fix(http): use TOML parsing for tool options to fix platform switching
jdx 1ebe9d5
fix(http): store tool opts as native TOML in .mise-installs.toml
jdx 6becea8
refactor: extract split_bracketed_opts/strip_opts helpers
jdx 049a3b0
refactor: extract EPHEMERAL_OPT_KEYS constant for filtered option keys
jdx 61bee69
[autofix.ci] apply automated fixes
autofix-ci[bot] e2cc9bc
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 60c1ef3
fix(http): persist only user-specified opts, not registry defaults
jdx 0872419
refactor: extract str_to_toml_value helper, fix darwin platform key i…
jdx 5532006
fix(http): preserve native TOML opts without string round-trip
jdx d3cd3a5
fix(http): strip brackets from full when writing backend meta
jdx c07b2fb
fix(http): unify opts write precedence and filter ephemeral keys
jdx d9e41a1
fix(http): give manifest opts precedence over registry defaults
jdx 2adacbc
fix(http): fix opts precedence so user opts override manifest cache
jdx 2dc7ecd
refactor: store tool opts as native toml::Value instead of strings
jdx 781a962
[autofix.ci] apply automated fixes
autofix-ci[bot] cdf0736
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 3189980
fix: convert scalar TOML opts to strings to fix strip_components
jdx 2e59229
fix: store native toml::Value in tool stub opts for platform URL lookup
jdx dd62f65
[autofix.ci] apply automated fixes
autofix-ci[bot] 8ccab41
[autofix.ci] apply automated fixes (attempt 2/3)
autofix-ci[bot] 6c8ff28
fix(http): address PR feedback for native TOML opts
jdx eabd6e9
refactor: extract opts_as_strings() helper to deduplicate toml::Value…
jdx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| # Test switching from single url to platform-specific urls | ||
| # Regression test for https://github.com/jdx/mise/discussions/7034 | ||
| # | ||
| # When a tool is first installed with a single `url`, the install state stores | ||
| # the options (including url) in the manifest. If the user then changes the | ||
| # config to use platform-specific urls via [tools."http:X".platforms], the | ||
| # stale cached options could shadow the new config, causing | ||
| # "Http backend requires 'url' option" error. | ||
|
|
||
| # Step 1: Install with a single url | ||
| cat <<EOF >mise.toml | ||
| [tools] | ||
| "http:hello-plat-switch" = { version = "1.0.0", url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz", bin_path = "hello-world-1.0.0/bin", postinstall = "chmod +x \$MISE_TOOL_INSTALL_PATH/hello-world-1.0.0/bin/hello-world" } | ||
| EOF | ||
|
|
||
| mise install | ||
| assert_contains "mise x -- hello-world" "hello world" | ||
|
|
||
| # Step 2: Switch to platform-specific urls (same tool name, same version) | ||
| # This previously failed with "Http backend requires 'url' option" because | ||
| # the stale cached platforms data from parse_tool_options was mangled and | ||
| # shadowed the correct config values during merge. | ||
| cat <<EOF >mise.toml | ||
| [tools."http:hello-plat-switch"] | ||
| version = "1.0.0" | ||
| bin_path = "hello-world-1.0.0/bin" | ||
| postinstall = "chmod +x \$MISE_TOOL_INSTALL_PATH/hello-world-1.0.0/bin/hello-world" | ||
|
|
||
| [tools."http:hello-plat-switch".platforms] | ||
| linux-x64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" } | ||
| linux-arm64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" } | ||
| darwin-arm64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" } | ||
| darwin-x64 = { url = "https://mise.jdx.dev/test-fixtures/hello-world-1.0.0.tar.gz" } | ||
| EOF | ||
|
|
||
| # This should succeed, not fail with "Http backend requires 'url' option" | ||
| mise install | ||
| assert_contains "mise x -- hello-world" "hello world" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.