Repository navigation
refactor(backend): add request-aware version selection - #11551
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughBackend 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. ChangesRequest-specific version selection
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
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/backend/mod.rs (1)
1821-1827: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winTwo delegating entry points force every cache-bypassing backend to duplicate its override.
list_remote_versions_with_info_with_refreshandlist_remote_versions_with_info_with_selection_optionsboth delegate tolist_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: documentlist_remote_versions_with_info_and_optionsas 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 oflist_remote_versions_with_info_and_optionsthat derives prerelease filtering fromselection_opts.src/plugins/core/java.rs#L478-L485: replace both java overrides with one override oflist_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
📒 Files selected for processing (6)
src/backend/conda.rssrc/backend/mod.rssrc/cli/upgrade.rssrc/plugins/core/java.rssrc/toolset/outdated_info.rssrc/toolset/tool_version.rs
|
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 AI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable. |
0e2cb89 to
55ab155
Compare
|
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. |
55ab155 to
d71f455
Compare
|
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. |
dc9f3d9 to
03e7703
Compare
|
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. |
Greptile SummaryThis PR introduces request-aware backend APIs that separate candidate-source options from request-specific version selection while preserving existing config-based entry points.
Confidence Score: 5/5The 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
Reviews (1): Last reviewed commit: "test(backend): cover request-aware versi..." | Re-trigger Greptile |
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:
prereleaseandminimum_release_ageare supplied by the active request.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_pathmise run test:unit -- java_options_reads_release_typemise run lint-fixAI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.
Summary by CodeRabbit