Skip to content

fix: don't warn about upgrades from stale cached versions when crates.io fetch fails - #2693

Open
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:fix/2464-stale-upgrade-warning
Open

fix: don't warn about upgrades from stale cached versions when crates.io fetch fails#2693
Galmanus wants to merge 1 commit into
stellar:mainfrom
Galmanus:fix/2464-stale-upgrade-warning

Conversation

@Galmanus

Copy link
Copy Markdown

What

When the crates.io fetch fails, has_available_upgrade no longer reports the cached versions as the latest release. The fetch failure is propagated, so no upgrade warning is printed from stale data. The cached check time still advances, keeping the retry throttled to once per check interval.

Why

Fixes #2464. The cached versions can be arbitrarily old (the cache is only refreshed on a successful fetch), so printing an upgrade warning from them tells the user to upgrade to a version that is itself outdated.

Testing

  • test_apply_fetch_result_failure_is_propagated_not_swallowed — regression test for the stale-warning path: failure surfaces, cached versions untouched, check time advances.
  • test_apply_fetch_result_success_replaces_cached_versions — success path replaces versions wholesale.
  • cargo test -p soroban-cli --lib upgrade_check: 7 passed. cargo clippy and cargo fmt --check clean.

….io fetch fails

When the crates.io fetch failed, the cached (possibly weeks-old) versions
were still reported as the latest release, telling users to upgrade to a
version that is itself outdated. Propagate the fetch failure so no warning
is printed from stale data, while still advancing the check time so the
retry stays throttled to once per interval.

Fixes stellar#2464
Copilot AI balanced review requested due to automatic review settings August 22, 2026 02:12
@github-project-automation github-project-automation Bot moved this to Backlog (Not Ready) in DevX Aug 22, 2026

Copilot AI 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.

Pull request overview

Prevents stale cached crate versions from immediately producing upgrade warnings after a crates.io fetch failure.

Changes:

  • Propagates fetch failures while updating the check timestamp.
  • Adds helper-level success and failure tests.
  • Refactors cache updates into apply_fetch_result.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Ok(())
}
Err(e) => {
stats.latest_check_time = now;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog (Not Ready)

Development

Successfully merging this pull request may close these issues.

Upgrade check warning shows wrong latest version

2 participants