-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat: add --before flag for date-based version filtering #7298
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 all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
40827c9
feat(core): add created_at timestamps to ls-remote --json for core pl…
jdx d49c2d2
fix(versions_host): use TOML endpoint for created_at timestamps
jdx 94522fa
feat(cli): add --before flag for date-based version filtering
jdx 9f6eaee
docs: remove non-existent install_before_mode setting references (#7299)
Copilot c5c03ef
[WIP] Add --before flag for date-based version filtering (#7300)
Copilot 1d732d4
fix(toolset): pass before_date to resolve_sub for "latest" versions
jdx ce805ad
Merge branch 'main' into install-before-feature
jdx e066785
fix: address PR review comments for install_before feature
jdx 5698c26
fix: handle empty version list in resolve_sub and restore mise.toml
jdx 4e15030
[autofix.ci] apply automated fixes
autofix-ci[bot] 1e177cf
fix: validate negative durations and preserve exact version matching
jdx 7f2ea63
fix(upgrade): compute before_date once to ensure consistency
jdx c1f3020
[autofix.ci] apply automated fixes
autofix-ci[bot] 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
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
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
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,43 @@ | ||
| #!/usr/bin/env bash | ||
| # Test --before flag for date-based version filtering | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Clean up any existing installations | ||
| mise uninstall tiny --all 2>/dev/null || true | ||
| rm -f mise.toml .tool-versions | ||
|
|
||
| # Test: install --before with dry-run should show the tool | ||
| output=$(mise install tiny@latest --before 2020-01-01 --dry-run 2>&1) | ||
| assert_contains "echo '$output'" "tiny" | ||
|
|
||
| # Test: install --before should install a version | ||
| mise install tiny@latest --before 2025-01-01 | ||
| assert_contains "mise ls --installed tiny" "3.1.0" | ||
|
|
||
| # Test: use --before with dry-run | ||
| mise uninstall tiny --all 2>/dev/null || true | ||
| output=$(mise use tiny@latest --before 2025-01-01 --dry-run 2>&1) | ||
| assert_contains "echo '$output'" "tiny" | ||
| rm -f mise.toml | ||
|
|
||
| # Test: MISE_INSTALL_BEFORE environment variable works | ||
| mise uninstall tiny --all 2>/dev/null || true | ||
| export MISE_INSTALL_BEFORE="2025-01-01" | ||
| mise install tiny@latest | ||
| assert_contains "mise ls --installed tiny" "3.1.0" | ||
| unset MISE_INSTALL_BEFORE | ||
|
|
||
| # Test: upgrade --before with dry-run | ||
| cat <<EOF >mise.toml | ||
| [tools] | ||
| tiny = "1" | ||
| EOF | ||
| mise uninstall tiny --all 2>/dev/null || true | ||
| mise install tiny@1.0.0 | ||
| output=$(mise upgrade --before 2025-01-01 --dry-run 2>&1) | ||
| assert_contains "echo '$output'" "tiny" | ||
|
|
||
| # Clean up | ||
| mise uninstall tiny --all 2>/dev/null || true | ||
| rm -f mise.toml .tool-versions |
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Date-only timestamps fail to parse in version filtering
The
VersionInfo::filter_by_datemethod only tries parsing timestamps withts.parse::<Timestamp>(), which requires RFC3339 format. However, when falling back from versions host to native APIs, Node and Zig backends provide date-only strings like "2024-01-09" which cannot be parsed byTimestamp. These versions silently bypass the filter (returningtrueon parse failure). This is inconsistent withparse_into_timestampinduration.rswhich correctly handles date-only strings by parsing asjiff::civil::Datefirst. The--beforefilter will not work for Node and Zig when the versions host is unavailable.Additional Locations (2)
src/plugins/core/node.rs#L433-L434src/plugins/core/zig.rs#L272-L273