Skip to content

fix: switch rust self-update to CDN bundles#182

Merged
F16shen merged 1 commit into
AI-Shell-Team:rustfrom
F16shen:fix/rust-update-cdn-self-update
May 13, 2026
Merged

fix: switch rust self-update to CDN bundles#182
F16shen merged 1 commit into
AI-Shell-Team:rustfrom
F16shen:fix/rust-update-cdn-self-update

Conversation

@F16shen
Copy link
Copy Markdown
Collaborator

@F16shen F16shen commented May 13, 2026

Background

Rust self-update was still checking GitHub release metadata and downloading GitHub release assets first, while the release workflow already publishes stable and beta bundles to the CDN paths used by the installer. This left the Rust line inconsistent with the published release layout.

Changes

  • switch update checks to read latest version metadata from the CDN stable or beta channel
  • normalize CDN latest metadata into release tags, then fetch the matching GitHub release by tag for notes and release links
  • download release archives from CDN versioned paths first, with GitHub release assets kept as fallback
  • add focused unit coverage for beta-to-stable upgrade detection and CDN URL resolution

Validation

  • run cargo test -p aish-cli update:: -- --nocapture

Risk

  • update checks now depend on CDN latest metadata being present and correct for both stable and beta channels
  • GitHub release metadata is still required for release notes and release page links

Summary by CodeRabbit

  • New Features

    • Update downloads now utilize optimized delivery infrastructure for faster downloads
    • Improved version management with enhanced support for stable and prerelease releases
  • Bug Fixes

    • Enhanced error handling and recovery mechanisms during update checks
    • More robust version detection and validation processes

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e1f2364b-dfa9-4343-9af8-41bac1bab51d

📥 Commits

Reviewing files that changed from the base of the PR and between f5b2d57 and 5d30da3.

📒 Files selected for processing (1)
  • crates/aish-cli/src/update.rs

📝 Walkthrough

Walkthrough

This PR refactors the self-update mechanism in crates/aish-cli/src/update.rs to adopt a CDN-first approach. It adds environment-configurable URL helpers for stable/beta CDN endpoints, detects prerelease versions, fetches the latest version from CDN, validates through GitHub tag-based release metadata, downloads from CDN with GitHub release asset fallback, and expands test coverage for the new logic.

Changes

CDN-based update flow

Layer / File(s) Summary
Module documentation and URL constants
crates/aish-cli/src/update.rs (1–19)
Module docs now describe CDN-based self-update behavior; replaces old GitHub/mirror URL constants with CDN stable/beta bases, GitHub tag API endpoint, and releases page base.
URL resolution and environment configuration
crates/aish-cli/src/update.rs (112–234)
New helpers for environment override reading, prerelease detection, stable vs beta CDN URL resolution, latest-version endpoint construction, and release download URL building; refactors check_for_updates start to use new URL helpers.
check_for_updates refactoring with HTTP and tag validation
crates/aish-cli/src/update.rs (243–256)
Fetches CDN-derived latest endpoint, handles non-success HTTP responses with formatted errors, normalizes version tag from payload, and validates by fetching GitHub release metadata using the normalized tag instead of direct API list queries.
download_release with CDN-first and GitHub asset fallback
crates/aish-cli/src/update.rs (415–451)
Adds CDN download attempt using resolved CDN release URL; falls back to GitHub release asset download if CDN fails, replacing prior GitHub-then-mirror fallback. Updates section header comment to reflect new ordering.
extract_update_info html_url fallback update
crates/aish-cli/src/update.rs (280)
Changes default html_url fallback to construct GitHub tag page URL via GITHUB_RELEASES_PAGE_BASE.
Test coverage for URL resolution and download selection
crates/aish-cli/src/update.rs (648, 714–789)
Adds serde_json import; introduces unit tests for beta/stable URL resolution, tag normalization from metadata, latest-version URL endpoint selection (default and override), and stable vs beta CDN release download URL selection based on prerelease status.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Update Checker
  participant CDN as CDN Latest<br/>Endpoint
  participant GitHubAPI as GitHub API<br/>releases/tags/{tag}
  participant CDNDL as CDN Release<br/>Archive
  participant GitHubDL as GitHub Release<br/>Assets
  
  Client->>CDN: Fetch latest version
  alt HTTP success
    CDN-->>Client: Version tag in response
    Client->>Client: normalize_tag_from_metadata
    Client->>GitHubAPI: Fetch release metadata<br/>by normalized tag
    GitHubAPI-->>Client: Release info
    Client->>CDNDL: Download archive
    alt CDN available
      CDNDL-->>Client: Archive (success)
    else CDN unavailable
      Client->>GitHubDL: Fallback to GitHub<br/>release assets
      GitHubDL-->>Client: Archive (fallback)
    end
  else HTTP error
    CDN-->>Client: Error
    Client->>Client: Return formatted error
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • AI-Shell-Team/aish#133: Switches stable self-update logic in crates/aish-cli/src/update.rs to use CDN download/latest + download/releases/<version> paths, directly overlapping with this PR's CDN-based refactoring.
  • AI-Shell-Team/aish#161: Introduces separate beta/stable CDN publish paths and versioned download/beta/... URLs, which aligns with this PR's stable/beta URL resolution and selection logic.
  • AI-Shell-Team/aish#123: Refactors self-update to resolve latest via CDN endpoint, normalize version tags, and construct CDN-based bundle URLs instead of GitHub releases API.

Suggested labels

size: M, tests, experienced-contributor

Poem

🐰 A rabbit's ode to CDN-bound fate:
From GitHub's gates to the edge we translate,
With fallbacks in place when the fast path delays,
Now updates hop swifter through CDN's ways! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 39.13% 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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: switch rust self-update to CDN bundles' directly and clearly describes the main change: switching the self-update mechanism to use CDN bundles instead of GitHub release assets.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for the pull request. A maintainer will review it when available.

Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review.

Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md

@github-actions
Copy link
Copy Markdown
Contributor

This pull request description looks incomplete. Please update the missing sections below before review.

Missing items:

  • Summary
  • User-visible Changes
  • Compatibility
  • Testing
  • Change Type
  • Scope

@F16shen F16shen merged commit 2c0a9c4 into AI-Shell-Team:rust May 13, 2026
14 checks passed
@F16shen F16shen deleted the fix/rust-update-cdn-self-update branch May 14, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant