fix: don't warn about upgrades from stale cached versions when crates.io fetch fails - #2693
Open
Galmanus wants to merge 1 commit into
Open
fix: don't warn about upgrades from stale cached versions when crates.io fetch fails#2693Galmanus wants to merge 1 commit into
Galmanus wants to merge 1 commit into
Conversation
….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
Contributor
There was a problem hiding this comment.
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When the crates.io fetch fails,
has_available_upgradeno 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 clippyandcargo fmt --checkclean.