Report only what doctor's checks actually establish - #7
Open
Dione-b wants to merge 1 commit into
Open
Conversation
Motivation: Copilot's review of stellar#2670 found three `doctor` diagnostics claiming more than the data behind them supports, each able to send a user after a cause that was never observed. Behavior: - A check whose fetch failed still stamps the cache, but leaves the recorded versions untouched, so "last refreshed by" credited an install with version data it never fetched. Say "checked" instead, in the messages and the field docs: the writer paces the next check rather than vouching for the versions stored beside it. Recording it only after a successful fetch was the alternative, and it hides the install worth finding -- a stale one whose fetch fails still suppresses everyone else's check for a day. - The single-install branch printed a count without the listing, so the one case a listing would settle was the one case that omitted path and version. List every discovered install. - Absent agreement was reported as disagreement: two executables that cannot be run are both unknown, yet the message blamed differing versions. `InstalledVersions` now keeps Agreed, Disagree and Unanswered apart. An observed disagreement still wins over a failed probe alongside it, because that one is a fact. Tests: four unit cases for `summarize_versions`, and two integration cases driving real subprocesses through a fake `PATH` -- two unrunnable CLIs, and a disagreement sitting next to an unreadable binary. The lone-install listing and the reworded cache-writer lines are asserted too. Release impact: no breaking change and no migration. The `upgrade_check.json` shape is untouched and older files still load. Only `doctor`'s stderr wording changes -- no command, flag or help text does, so `FULL_HELP_DOCS.md` stands as is. Co-authored-by: Nearx-Labs <nearxlabs@nearx.com.br>
Dione-b
force-pushed
the
fix/2464-upgrade-check-stale-version
branch
from
August 6, 2026 00:20
b783bcf to
b7df621
Compare
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.
Motivation
Copilot's review of the upstream PR (stellar#2670) flagged three places where the new diagnostics claim more than the data behind them supports. All three are real, and each one can send a user chasing a cause that was never observed:
upgrade_check.rsrecordslast_checked_byeven when the fetch to crates.io failed — the attempt still paces the next check — butdoctorreported the file as "last refreshed by" that install. That credits an install with version data it never fetched.check_installsprinted a count without callinglist_installs, so the one case where a listing would settle "which executable is this?" was the one case that omitted path and version. The separateRunning executableline is not necessarily the entryPATHresolves by name, and carries no version.common_version == Nonemeant either "known versions disagree" or "at least one executable could not be asked". Both landed on a message blaming differing versions, so two unrunnable binaries — both listed asunknown version— were reported as a version conflict.Groundwork for stellar#2464.
Behavior
doctorsays "checked", not "refreshed". The cache writer is the last writer/pacer, not the source of the versions stored beside it. Kept that semantics — it is the one that answers "which install is holding the next check back?" — and made the wording match the field name (last_checked_by), in the fourdoctormessages and in the field/struct docs.Alternative discarded: recording the writer only after a successful refresh. That would make "refreshed by" literally true, but it loses the diagnostic that matters. When a stale install fails its fetch and stamps the file, it still suppresses everyone else's check for 24h; dropping its identity would leave the file crediting whichever install last succeeded, hiding exactly the install a user needs to find.
Every discovered install is listed.
list_installsnow runs for any non-zero count, including one.Undetermined agreement is no longer reported as disagreement. Introduced
InstalledVersions { Agreed(String), Disagree, Unanswered(usize) }:N Stellar CLI executables on PATH, all reporting X:...reporting different versions; an outdated one can report a version that disagrees with 'stellar --version':Found N Stellar CLI executables on PATH, M of which did not report a version, so whether they agree could not be determined:An observed disagreement still wins when it sits alongside a failed probe — a contradiction between two known versions is a fact, and a third unrunnable binary does not soften it.
Tests
Unit (
cmd/soroban-cli/src/commands/doctor.rs) — four cases forsummarize_versions: agreement, distinct known versions, probes that returned nothing (both all-unknown and one-unknown), and disagreement coexisting with a failed probe.Integration (
cmd/crates/soroban-test/tests/it/doctor.rs) — two new end-to-end cases driving real subprocesses through a fakePATH:does_not_blame_differing_versions_when_a_version_could_not_be_read— two unrunnable CLIs; asserts the undetermined message and thatdifferent versionsis absent.reports_a_disagreement_even_when_another_executable_is_unreadable—27.1.0+22.8.0+ one unrunnable across twoPATHentries; asserts the disagreement still surfaces.Also extended
reports_the_running_executable_and_a_lone_installto assert the lone install is listed with its version, and updated the four cache-writer assertions to the new wording. New helperwrite_unrunnable_cliwrites a script that fails both version queries.Full run, all green:
cargo fmt --all -- --checkcargo clippy --all-targets(and--features additional-libs)cargo test -p soroban-cli --lib(and--features additional-libs)cargo test -p soroban-test --test it -- doctor:: version:: plugin:: help:: message::cargo test -p soroban-test -- --skip integration::cargo test --workspace --exclude soroban-testNot run:
make rpc-test(--features it -- integration), which needs a local RPC — nothing here touches RPC paths.Note for reviewers running these locally: the integration tests execute
target/debug/stellarand do not rebuild it, socargo build --bin stellaris needed first or the assertions run against a stale binary.Release Impact
No breaking changes. No data migration: this commit does not change the
upgrade_check.jsonshape —last_checked_byand its optional fields are unchanged, and files written before it existed still load.User-visible surface is
stellar doctor's stderr diagnostics only: four cache-writer lines reworded from "refreshed" to "checked", one new message for undetermined versions, and the single-install case now followed by a listing. No command, flag, or help text changed, soFULL_HELP_DOCS.mdis untouched. Anything matching ondoctor's exact stderr text would need updating — no such consumer is known in this repo beyond the tests updated here.Checklist
CheckWriter,UpgradeCheck::last_checked_by,show_version_cache_writerandcheck_installsnow state that the writer paces the next check rather than vouching for the recorded versions. No user-facing docs changed: no CLI surface change, soFULL_HELP_DOCS.mdis unaffected.doctorremains diagnostic-only.PATHfrom a per-test temp dir and the cache viaSTELLAR_DATA_HOME; nothing touches the real config/data dirs, the network, or any key material.Cargo.lockor workflow change; the new tests live in the existingsoroban-testittarget already run by CI.