Skip to content

feat(cli): add minimum release age flag to lock and ls-remote#9269

Merged
jdx merged 13 commits into
jdx:mainfrom
risu729:codex/add-before-ls-remote-lock
May 10, 2026
Merged

feat(cli): add minimum release age flag to lock and ls-remote#9269
jdx merged 13 commits into
jdx:mainfrom
risu729:codex/add-before-ls-remote-lock

Conversation

@risu729

@risu729 risu729 commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --before support to two more commands that need date-aware version discovery:

  • mise ls-remote --before <date> filters remote version listings by release timestamp.
  • mise lock --before <date> resolves fuzzy/latest tool requests against versions released before the cutoff before writing or previewing lockfile entries.
  • Both commands honor all three cutoff sources: the CLI flag, per-tool install_before, and global [settings] install_before, with the CLI flag taking precedence.

This is intended to support potential mise integration work in Renovate, where tooling may need to list and lock versions using a release-date cutoff.

Implementation Notes

ls-remote still fetches the normal cached full remote version metadata and applies the effective date filter after reading it. That keeps the cache independent of the requested cutoff and avoids caching a filtered result for one cutoff that could incorrectly affect a later query with a different cutoff.

lock builds the toolset with a ResolveOptions.before_date override when the flag is present, while preserving the existing per-tool and global install_before fallback behavior when it is not.

Tests

  • mise run test:e2e e2e/cli/test_ls_remote e2e/cli/test_lock
  • cargo fmt --check

@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 introduces a --before flag to the mise lock and mise ls-remote commands, allowing users to filter tool versions based on their release date. The changes include updates to the CLI argument parsing, logic for resolving toolsets with date constraints, and new E2E tests to verify the functionality. Feedback suggests making the before field public in the Lock struct for consistency and optimizing the lock command to use the cached toolset when no date filter is applied to avoid unnecessary overhead.

Comment thread src/cli/lock.rs Outdated
Comment thread src/cli/lock.rs Outdated
@greptile-apps

greptile-apps Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends the existing --minimum-release-age / install_before date-cutoff mechanism to two more commands: mise ls-remote and mise lock. Both commands respect the same three-tier precedence (CLI flag → per-tool install_before → global [settings] install_before), and the lock path correctly bypasses installed-version fast paths when a cutoff is active so that date-aware resolution reaches the remote version metadata.

  • ls-remote applies the resolved per-backend cutoff after fetching the full cached version list, keeping the cache cutoff-independent.
  • lock rebuilds the toolset with the CLI cutoff when provided and resolves overridden latest requests through the async resolution path; tool_version.rs gains should_filter_installed_versions guards to prevent offline-only fallbacks from bypassing the cutoff.

Confidence Score: 5/5

Safe to merge; the changes are well-tested end-to-end and additive, with no impact on existing behaviour when the new flag is absent.

The core logic is consistent with the existing resolve_before_date first-wins precedence already in use elsewhere, and the new code paths are guarded by before_date.is_some() so they are entirely inert when the flag is not supplied. The offline/prefer-offline guard in tool_version.rs correctly restricts the installed-version bypass to online resolution only, and a dedicated regression test covers that path.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/lock.rs Adds --minimum-release-age to lock; builds a fresh toolset with before_date when CLI flag is present, and applies per-tool date merging in get_tools_to_lock via ToolRequest::resolve_options; async refactor of get_tools_to_lock is non-trivial
src/cli/ls_remote.rs Adds --minimum-release-age (alias --before) to ls-remote; resolves the effective date per-backend via resolve_before_date_for_backend and filters output through VersionInfo::filter_by_date; --before alias is hidden (not visible in --help)
src/install_before.rs Adds resolve_before_date_for_backend helper that resolves effective date cutoff for a specific backend, short-circuiting to CLI date when set; consistent with the existing first-wins precedence of resolve_before_date
src/toolset/tool_version.rs Adds should_filter_installed_versions guard to skip installed-version fast paths when a before_date cutoff is active and not in offline/prefer-offline mode; also adds the same guard for the npm-semver range path
src/toolset/tool_request.rs Adds resolve_options method that merges per-tool minimum_release_age with the base ResolveOptions using the existing first-wins precedence logic
e2e/cli/test_lock Comprehensive new e2e tests covering global settings, per-tool overrides, CLI flag precedence, installed-version bypassing, lockfile-scope scoping, and relative durations
e2e/cli/test_ls_remote New e2e tests for --minimum-release-age on ls-remote covering global, per-tool, and CLI-override cutoff sources; also verifies that cached full version list is not affected by filtered queries
e2e/cli/test_install_prefer_offline_no_refresh Adds regression test confirming that a configured date cutoff does not break installed-version fallback in prefer-offline/offline mode
src/backend/mod.rs Minor comment updates replacing --before flag references with generic "release-date filter/cutoff" wording

Reviews (24): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile

@risu729 risu729 force-pushed the codex/add-before-ls-remote-lock branch 4 times, most recently from e032d2c to f2d83b4 Compare April 20, 2026 23:45
@risu729 risu729 marked this pull request as ready for review April 21, 2026 04:33
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@risu729 risu729 marked this pull request as draft April 21, 2026 04:33
@risu729 risu729 force-pushed the codex/add-before-ls-remote-lock branch 5 times, most recently from e4a5f4e to 1135f6d Compare April 23, 2026 05:36
@risu729

risu729 commented Apr 24, 2026

Copy link
Copy Markdown
Contributor Author

Blocking: I need to make the scope of mise lock clear.

@risu729 risu729 force-pushed the codex/add-before-ls-remote-lock branch 2 times, most recently from d3204af to 26852af Compare May 6, 2026 12:52
@risu729

This comment was marked as outdated.

@risu729

This comment was marked as outdated.

@risu729 risu729 marked this pull request as ready for review May 8, 2026 13:50
Comment thread docs/cli/ls-remote.md Outdated
@risu729 risu729 force-pushed the codex/add-before-ls-remote-lock branch from b5a684b to 2c6bfaf Compare May 10, 2026 16:26
@risu729 risu729 changed the title feat(cli): add before flag to lock and ls-remote feat(cli): add minimum release age flag to lock and ls-remote May 10, 2026
@jdx jdx merged commit 0cf7615 into jdx:main May 10, 2026
34 checks passed
@risu729 risu729 deleted the codex/add-before-ls-remote-lock branch May 10, 2026 21:14
mise-en-dev added a commit that referenced this pull request May 11, 2026
### 🚀 Features

- **(cli)** add minimum release age flag to lock and ls-remote by
@risu729 in [#9269](#9269)
- **(config)** add run field for hooks by @risu729 in
[#9718](#9718)
- **(github)** add native oauth token source by @jdx in
[#9654](#9654)
- **(oci)** scope build to project config by default by @jdx in
[#9766](#9766)
- add support for prefixed latest version queries in outdated checks by
@roele in [#9767](#9767)

### 🐛 Bug Fixes

- **(activate)** guard bash chpwd hook under nounset by @risu729 in
[#9716](#9716)
- **(backend)** date-check latest stable fast path by @risu729 in
[#9650](#9650)
- **(config)** parse core tool options consistently by @risu729 in
[#9742](#9742)
- **(exec)** propagate __MISE_DIFF so nested mise recovers pristine PATH
by @jdx in [#9765](#9765)
- **(forgejo)** include prereleases when opted in by @risu729 in
[#9717](#9717)
- **(github)** avoid caching empty release assets by @risu729 in
[#9616](#9616)
- **(java)** resolve lockfile URLs from metadata by @risu729 in
[#9719](#9719)
- **(lock)** cache unavailable github attestations by @risu729 in
[#9741](#9741)
- **(pipx)** preserve options when reinstalling tools by @risu729 in
[#9663](#9663)
- **(python)** skip redundant lockfile provenance verification by
@risu729 in [#9739](#9739)
- **(vfox)** run pre_uninstall hook by @risu729 in
[#9662](#9662)

### 🚜 Refactor

- **(schema)** extract tool options definition by @risu729 in
[#9649](#9649)

### ⚡ Performance

- **(aqua)** bake rkyv aqua package blobs by @risu729 in
[#9535](#9535)

### 📦️ Dependency Updates

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

### 📦 Registry

- add vector
([github:vectordotdev/vector](https://github.com/vectordotdev/vector))
by @kquinsland in [#9761](#9761)
- add oc and openshift-install (http backend) by @konono in
[#9669](#9669)

### New Contributors

- @konono made their first contribution in
[#9669](#9669)
- @kquinsland made their first contribution in
[#9761](#9761)
jdx pushed a commit that referenced this pull request Jun 11, 2026
…version resolution

The built-in 24h minimum_release_age default (#10279) set a before_date on
every resolution, which disabled the installed-version fast paths for all
non-prefer-offline commands (mise which, mise use, ...). Every invocation
then fetched remote version lists for the entire toolset, turning ~75ms
shell-startup calls into ~2.5s each (reported as ~65s shell startups in
discussion #10308).

The built-in default now only gates which versions remote resolution may
pick — its actual purpose of delaying new installs. Explicit cutoffs (the
--minimum-release-age flag, a per-tool minimum_release_age option, or the
minimum_release_age setting) keep their date-aware resolution semantics
from #9269, since opting in was a deliberate choice there.

- install_before: cutoff resolution reports a BeforeDateSource
  (Provided/Explicit/Default) alongside the timestamp
- ResolveOptions: new before_date_from_default flag, set via a shared
  apply_before_date_for_tool helper; the should_filter_installed_versions
  gates in resolve_version/resolve_prefix require an explicit cutoff
- e2e: test_which_no_remote_fetch pins the regression (fails on unfixed
  code); test_hook_env_no_remote_fetch guards the prefer-offline paths so
  hook-env can never start fetching remote versions

Fixes #10308

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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