Repository navigation
feat(aqua): support private content and archives - #10915
Conversation
📝 WalkthroughWalkthroughGitHub archive and content packages now retain encoded API transport URLs. Download, provenance, and auxiliary asset resolution selects API or browser endpoints based on repository visibility and reachability, while GitHub content requests receive raw-content headers. ChangesPrivate GitHub downloads
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant AquaBackend
participant URLSelector
participant GitHubHTTP
participant GitHubAPI
AquaBackend->>URLSelector: package visibility and browser/API URLs
URLSelector->>GitHubHTTP: probe selected endpoint
GitHubHTTP-->>URLSelector: reachability result
URLSelector-->>AquaBackend: download transport URL
AquaBackend->>GitHubAPI: request archive, content, or asset
GitHubAPI-->>AquaBackend: package bytes
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/backend/aqua.rs (1)
502-568: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winUse the API URL for the v-prefix existence probe on private GitHub packages
The v-prefixed existence check still calls
HTTP.head(&url_prefixed)on the browser URL. For privateGithubContent/GithubArchivepackages, that URL 404s even when the tag exists, so the code can fall back to the wrong version variant. Route the probe through the API URL or skip it for private packages.🤖 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/aqua.rs` around lines 502 - 568, Update the v-prefixed existence probe in the get_url version-selection logic to avoid calling HTTP.head on the browser URL for private GithubContent/GithubArchive packages. Use the corresponding API URL for the HEAD request when available, or skip the probe for private packages, while preserving the existing fallback behavior for public packages.
🧹 Nitpick comments (1)
src/backend/aqua.rs (1)
3307-3327: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueSecond test's name/args don't match what's being asserted.
test_github_release_without_api_url_uses_browser_urlpassesprivate = trueandapi_url = None, so it's really testing "private package without an API URL falls back to the browser URL," not anything specific togithub_release. The name suggests a public/probe scenario that isn't actually exercised here.✏️ Suggested rename
- async fn test_github_release_without_api_url_uses_browser_url() { + async fn test_private_download_without_api_url_falls_back_to_browser_url() {🤖 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/aqua.rs` around lines 3307 - 3327, Rename test_github_release_without_api_url_uses_browser_url to accurately describe the private-package fallback scenario, such as test_private_github_download_without_api_url_uses_browser_url; keep its current arguments and assertion unchanged.
🤖 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.
Outside diff comments:
In `@src/backend/aqua.rs`:
- Around line 502-568: Update the v-prefixed existence probe in the get_url
version-selection logic to avoid calling HTTP.head on the browser URL for
private GithubContent/GithubArchive packages. Use the corresponding API URL for
the HEAD request when available, or skip the probe for private packages, while
preserving the existing fallback behavior for public packages.
---
Nitpick comments:
In `@src/backend/aqua.rs`:
- Around line 3307-3327: Rename
test_github_release_without_api_url_uses_browser_url to accurately describe the
private-package fallback scenario, such as
test_private_github_download_without_api_url_uses_browser_url; keep its current
arguments and assertion unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: d58971d7-5d61-41dd-a8ba-bf4a8f0560a8
📒 Files selected for processing (5)
crates/aqua-registry/src/cache.rscrates/aqua-registry/src/codec.rscrates/aqua-registry/src/types.rssrc/backend/aqua.rssrc/github.rs
719d908 to
598d84a
Compare
Greptile SummaryThis PR extends aqua's private-repo download support from
Confidence Score: 5/5Safe to merge — the change adds authenticated API fallback URLs for two previously unsupported package types without altering any existing download path for public packages. All three changed code paths (URL construction, header selection, v-prefix probing) are narrow and self-contained, each backed by a new unit test. The URL-encoding logic uses the url crate's path_segments_mut rather than string interpolation, so slashes and spaces in versions or paths are handled correctly. Public packages retain the existing browser-URL-first + HTML-detect fallback path unchanged. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "feat(aqua): support private content and ..." | Re-trigger Greptile |
598d84a to
0402a95
Compare
|
Addressed the AI review after rebasing onto current
The remaining Greptile note about an extra public-package HEAD request describes the intentional fallback behavior retained by this PR, so no code change is needed for that observation. This comment was generated by an AI coding assistant. |
0402a95 to
8585d10
Compare
Summary
github_contentpackagesgithub_archivepackagesWhy
Private
github_contentandgithub_archivepackages currently resolve versions through the authenticated GitHub API but fail when mise downloads fromraw.githubusercontent.comor the public archive URL. Those browser-facing URLs return 404 for private repositories and do not receive GitHub API credentials.Declared-private packages now go directly to an authenticated API endpoint. Packages without the marker retain reachability probing and fallback, which supports custom registries with missing or incorrect
privatemetadata.Validation
cargo fmt --all -- --checkcargo test test_pick_reachable_asset_urlcargo test test_github_archive_api_urlcargo test test_github_content_api_urlcargo test test_private_github_download_uses_api_url_without_probecargo test test_github_content_headers_request_raw_contentSummary by CodeRabbit
Bug Fixes
Documentation
Tests