pub fn fetch_latest(url: &str) -> Result<Option<Version>, Diagnostic>Expand description
Fetches url (a crates.io sparse-index endpoint) and returns the highest
published stable version found in the response body, if any.
Errors here are never user-visible; the caller logs at debug and drops
them. Every failure path (client construction, the request itself, or
reading the body) maps to Diagnostic::Internal — never any other
Diagnostic variant — so a future refactor doesn’t leak an Internal
diagnostic onto the main.rs Error: {diag} path. A non-2xx response
(404 for an unpublished crate name, 5xx for a server error) is not
treated as an error at all: it simply means “no info available”, so it
returns Ok(None).
url is an explicit parameter (rather than derived from SPARSE_INDEX_URL
internally) so tests can point this at a mock server.