Skip to content

refactor(backend): add request-aware version selection - #11551

Merged
jdx merged 6 commits into
jdx:mainfrom
risu729:agent/fix-request-option-resolution
Aug 13, 2026
Merged

jdx merged 6 commits into
jdx:mainfrom
risu729:agent/fix-request-option-resolution

Conversation

@risu729

@risu729 risu729 commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

What

Add request-aware backend APIs for remote version listing, matching, and latest-version selection.

The API keeps the backend's candidate-list source separate from request-specific selection policy:

  • prerelease and minimum_release_age are supplied by the active request.
  • Backend source options continue to control how candidates are fetched and cached.
  • Backends that bypass the shared cache can use the active request when it changes the source. Java now selects the GA or EA feed from that request's release_type; Conda preserves its backend-specific listing behavior.

The unused selection wrapper is removed instead of being retained with dead-code suppression.

Why

Version resolution needs to apply request-specific candidate policy without cloning backend arguments or letting one request's filters contaminate a shared candidate cache. This API is the prerequisite for the resolution changes in the stacked follow-up PR #11720.

Test

  • mise run test:unit -- test_prerelease_selection_skips_latest_stable_fast_path
  • mise run test:unit -- java_options_reads_release_type
  • mise run lint-fix

AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.

Summary by CodeRabbit

  • Bug Fixes
    • Improved version selection to consistently respect prerelease and release-date filters.
    • Prerelease selections now use complete remote version listings instead of stable-only shortcuts.
    • Conda version results now correctly honor the selected prerelease setting.
    • Java version listings now exclude prereleases for more predictable stable-version selection.
    • Improved latest-version resolution when filtering by release age or other selection criteria.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Backend version resolution now carries explicit selection options through remote listing, matching, and latest-version lookup. Stable selections retain the fast path, while prerelease selections use remote versions. Conda and Java overrides use the options-aware listing API.

Changes

Request-specific version selection

Layer / File(s) Summary
Backend listing option separation
src/backend/mod.rs, src/backend/conda.rs, src/plugins/core/java.rs
Backend listing separates listing options from selection options. Prerelease filtering uses selection options. Conda and Java implement the options-aware listing method. Java excludes prereleases.
Selection-aware matching and cutoff resolution
src/backend/mod.rs
Matching APIs pass explicit selection options through remote listing and release-date cutoff calculation.
Selection-aware latest resolution
src/backend/mod.rs
Latest-version resolution limits stable fast paths to stable selections and uses remote fallback resolution for prerelease selections. Regression tests cover both paths.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ToolVersion
  participant Backend
  participant RemoteVersionSource
  ToolVersion->>Backend: resolve latest with ToolVersionOptions
  Backend->>Backend: check stable fast-path eligibility
  Backend->>RemoteVersionSource: request remote versions for prerelease selection
  RemoteVersionSource-->>Backend: return version metadata
  Backend-->>ToolVersion: return filtered latest version
Loading

Possibly related PRs

  • jdx/mise#11720: Both changes update the options-aware backend resolution refactor and tool-specific listing implementations.
  • jdx/mise#11457: Both changes update version-resolution option propagation in Backend and related APIs.
  • jdx/mise#11391: Both changes modify the backend remote-version listing flow in src/backend/mod.rs.

Poem

I hop through versions, stable and bright,
Selection options guide the right.
Conda lists what requests say,
Java keeps previews away.
Remote paths handle prereleases clear.
— A rabbit reviewing with cheer 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.82% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding request-aware version selection in the backend.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
src/backend/mod.rs (1)

1821-1827: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Two delegating entry points force every cache-bypassing backend to duplicate its override. list_remote_versions_with_info_with_refresh and list_remote_versions_with_info_with_selection_options both delegate to list_remote_versions_with_info_and_options, so a backend that must bypass the shared cache has to override both wrappers. A backend that overrides only the refresh variant is silently skipped on the selection-options path.

  • src/backend/mod.rs#L1821-L1827: document list_remote_versions_with_info_and_options as the single override point for backends that bypass the shared remote-versions cache.
  • src/backend/conda.rs#L725-L739: replace both conda overrides with one override of list_remote_versions_with_info_and_options that derives prerelease filtering from selection_opts.
  • src/plugins/core/java.rs#L478-L485: replace both java overrides with one override of list_remote_versions_with_info_and_options.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/backend/mod.rs` around lines 1821 - 1827, The remote-version listing API
currently requires duplicate backend overrides for cache-bypassing behavior. In
src/backend/mod.rs lines 1821-1827, document
list_remote_versions_with_info_and_options as the single override point; in
src/backend/conda.rs lines 725-739, replace both existing overrides with this
method and derive prerelease filtering from selection_opts; in
src/plugins/core/java.rs lines 478-485, replace both existing overrides with one
list_remote_versions_with_info_and_options override.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/backend/mod.rs`:
- Around line 1821-1827: The remote-version listing API currently requires
duplicate backend overrides for cache-bypassing behavior. In src/backend/mod.rs
lines 1821-1827, document list_remote_versions_with_info_and_options as the
single override point; in src/backend/conda.rs lines 725-739, replace both
existing overrides with this method and derive prerelease filtering from
selection_opts; in src/plugins/core/java.rs lines 478-485, replace both existing
overrides with one list_remote_versions_with_info_and_options override.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: b68ceaaf-e89c-4642-a8fa-2602c9d0836e

📥 Commits

Reviewing files that changed from the base of the PR and between 8dc28e2 and 47cc471.

📒 Files selected for processing (6)
  • src/backend/conda.rs
  • src/backend/mod.rs
  • src/cli/upgrade.rs
  • src/plugins/core/java.rs
  • src/toolset/outdated_info.rs
  • src/toolset/tool_version.rs

risu729 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit’s maintainability note in 0e2cb89: both config-aware and request-aware listing entry points now share one documented cache-bypass override hook. Conda and Java each implement that hook once, preserving their existing source/cache behavior. Both focused regressions and mise run lint-fix pass, and an independent follow-up review found no behavioral or cache regressions.

AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@risu729
risu729 force-pushed the agent/fix-request-option-resolution branch from 55ab155 to d71f455 Compare August 5, 2026 00:40
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@risu729 risu729 changed the title fix(backend): resolve with per-request tool options refactor(backend): add request-aware version selection Aug 5, 2026
@risu729
risu729 force-pushed the agent/fix-request-option-resolution branch from dc9f3d9 to 03e7703 Compare August 12, 2026 18:43
@github-actions

Copy link
Copy Markdown
Contributor

This PR currently has failing checks. If this continues for 7 days, it will be closed automatically.

This is warning day 1 of 7.

Please update the PR when you have a chance. Feel free to reopen or create a new PR if it is closed and you'd like to continue working on it.

This comment was generated by an automated workflow.

@risu729
risu729 marked this pull request as ready for review August 13, 2026 08:53
@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces request-aware backend APIs that separate candidate-source options from request-specific version selection while preserving existing config-based entry points.

  • Adds request-aware remote listing, matching, and latest-version methods to the shared Backend trait.
  • Migrates Conda and Java cache-bypassing listing overrides to the new common hook.
  • Makes Java choose its GA or EA metadata feed from the active selection options.
  • Adds coverage for prerelease-aware latest selection and request-provided version ordering.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code failure identified.

The new APIs preserve existing config-based behavior for current callers, cleanly separate listing provenance from selection policy, and migrate both cache-bypassing backend overrides consistently.

Important Files Changed

Filename Overview
src/backend/mod.rs Adds the request-aware listing and latest-selection API layers while retaining config-derived source and cache provenance; no actionable defect was established.
src/backend/conda.rs Migrates Conda's direct-listing override and applies prerelease filtering from active selection options while preserving config-based channel lookup.
src/plugins/core/java.rs Extracts option-driven Java metadata listing and routes request release_type values to the corresponding GA or EA feed.

Reviews (1): Last reviewed commit: "test(backend): cover request-aware versi..." | Re-trigger Greptile

@jdx
jdx merged commit d7f7197 into jdx:main Aug 13, 2026
30 checks passed
@risu729
risu729 deleted the agent/fix-request-option-resolution branch August 21, 2026 16:17
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