Review — Correctness, Contracts & System-Level Consequences — PR #603
PR: https://github.com/NVIDIA/hyperflare-inference/pull/603 — "Report the repository and revision on Hub lookup errors"
Author: salignatmoandal · Head: a3ec4b6 · Files: flare/src/hub.rs only (+41 / −1)
Key findings
- The wrapper is correct and systemically inert.
RevisionLookupError(hub.rs:3398-3419) is private, applied only on the terminal 404 arm ofresolve_primary_target(hub.rs:3427-3441), after retry (with_transient_retry, hub.rs:5476-5493) and the-tp1fallback (hub.rs:3381-3392) have already decided. No locks, no shared state, no hot-path allocation, no panic path, no platform asymmetry, no contract change. - Major — the same failure is still reported two conflicting ways.
refresh_model_at(hub.rs:2276-2280) calls the sameresolve_revisionbut keeps flattening the bare 404 into its owncannot check REPO@REV for updates: …string. One404on one helper, two vocabularies in one binary; its test (hub.rs:6358-6390) asserts only--offline. - Minor — a 404 does not mean "that revision is wrong". The guard is status-only; the Hub also answers 404 for private/gated repos to unauthenticated requests, and the disambiguating token hint is
log::info!(hub.rs:3344-3348) while the error goes to stderr. - Minor — test placement/strength. The new assertion is bolted into
permanent_resolution_failures_are_not_retried(hub.rs:8619-8622); it pins only the substring404, never assertsError::source(), and leaves the sibling 404 sites unasserted. - Minor — the diagnostic has no record where the repo requires one. #489's reviewer asked for a
docs/TODO.txtentry; there is none, and no doc specifiescannot resolve REPO@REV. - Sound by inspection, stated plainly: no concurrency/contention/head-of-line, memory-amplification, cache-thrash, failure-propagation, or metric-span change; no cross-platform gap; no public/wire/captured-graph contract or owner sign-off requirement; no per-model branch, flag, or dependency change.
1. Correctness, Safety & Platform Parity
Sound. The change is confined to one error branch on the acquisition path (off the serving path).
Verified shape (hub.rs:3398-3441):
struct RevisionLookupError {
repository: String,
revision: String,
source: Box<dyn std::error::Error>,
}
...
let info = resolve_revision(api, repo, progress).map_err(|source| {
if matches!(
source.downcast_ref::<ApiError>(),
Some(ApiError::RequestError(error))
if matches!(error.as_ref(), ureq::Error::StatusCode(404))
) {
Box::new(RevisionLookupError { repository: repo.url(), revision: repo.revision().to_owned(), source })
} else { source }
})?;
- Ordering preserved:
resolve_revisionretries viawith_transient_retry(hub.rs:3381, 3390; implementation hub.rs:5476-5493) and tries the-tp1alias (hub.rs:3381-3392) before returning, so the wrap only decorates the terminal error.tp1_revision_alias(hub.rs:3363-3365) runs at :3384, so the message names the requested revision (…@gb10, not…@gb10-tp1) — consistent with the PR description. - No control-flow change:
ApiErroris downcast exactly once in the crate (this line, hub.rs:3429); the onlyApiErrorvariant that steers controller logic isPublisherKeyRequired(controller.rs:1302-1334, flare-cli/src/hub.rs:72-90), andRevisionLookupErroris not anApiError, so no downstreammatches!can change behaviour. The type aliasResult<T> = std::result::Result<T, Box<dyn std::error::Error>>(hub.rs:29) accepts the boxed struct unchanged; noSend/Syncbound applies because consumers stringify (flare-cli/src/orbit/agent.rs:135,flare/src/controller.rs:1308). - No panic, no unbounded work: one
Stringclone ofrepo.url()and onerepo.revision().to_owned(), only on a failing request.Error::source()(hub.rs:3415-3419) preserves the chain; nothing in the repo walks it (no.source()inflare-cli/src), which is harmless. - No platform parity gap: the Unix/Windows splits (hub.rs:844-870, 1755-1843) are untouched; the change is transport-agnostic post-hoc formatting.
2. System-level consequences (concurrent load, contention, blast radius)
Sound — no reportable issue. Specific checks performed:
- Contention / head-of-line: no mutex, channel, queue, or coalescing structure is created or held across the wrap; resolution is one-shot metadata lookup outside the token loop. The
AcquisitionProgresscounters (hub.rs:5446-5548) are untouched, so no metric/rate/admission-pricing sampling span shrank or widened — this PR changes no measurement, only terminal error text. - Failure propagation: the wrap cannot poison peers — the error is consumed by
?at the single call site and stringified at the controller boundary (flare/src/controller.rs:1308,flare-cli/src/orbit/agent.rs:135). No retry decision reads the new type, so a 404 cannot become retried or non-retried because of it. - Partial-failure edge case, worth naming (not a defect of this PR, but of its scope): see Finding 2 — the update-check path shares the helper and keeps the old wording, so an operator diagnosing a 404 from
flare runon an installed model still sees the rawRequestError(StatusCode(404)), i.e. the gap #489 tracks persists on one of the two user-visible paths.
3. Architecture, Contracts & Charter Compliance
FINDING 1 — Major — the fix is applied to one of two user-visible resolution failures, leaving two conflicting messages
Citation: flare/src/hub.rs:2276-2280 (unchanged by this PR; reached from acquire_update/refresh_model — hub.rs:13941, 13971):
let revision = requested.revision.as_deref().unwrap();
log::info!("Checking model origin: {}@{revision}", origin.repository);
let repo = Repo::with_revision(origin.repository.clone(), RepoType::Model, revision.into());
let info = resolve_revision(&api, &repo, None)
.map_err(|error| format!("cannot check {}@{revision} for updates: {error}; the local version is unchanged (use --offline to skip the check)", origin.repository))?;
Impact: resolve_revision (hub.rs:3374-3396) is the shared helper; after this PR a 404 from flare download/run of a new core reads cannot resolve ORG/NAME@gb10: … 404, while the recorded-origin update check on the same reference reads cannot check ORG/NAME@gb10 for updates: RequestError(StatusCode(404)); the local version is unchanged (use --offline to skip the check). Two different headlines, two different formats (one composed by the wrapper, one by format! around the Debug-ish Display of ApiError), for one failure mode. The PR body scopes this away implicitly ("the resolver completes its existing retry and -tp1 fallback decisions before the diagnostic adds context") but never says why the sibling call site is excluded. The PR's own disclosure that "the complete Orbit CLI workflow was not run" is precisely the path (acquire_update → refresh_model_at → resolve_revision) where the asymmetry shows.
Untested, so it will persist: model_refresh_failed_update_keeps_default (hub.rs:6358-6390) scripts 404 for both /revision/gb10 and /revision/gb10-tp1 and asserts only:
assert!(error.contains("--offline"), "{error}");
It never asserts the repository/revision, so the test would pass identically today and after any future attempt to unify the message.
Concrete fix (choose one):
- Move the wrap into
resolve_revision's terminal arm (wrap theresult => result?at hub.rs:3392 only, keeping the retry and alias branches inside), so all call sites share one message; or - Apply the identical
RevisionLookupErrorwrap at hub.rs:2279 and drop the now-duplicatedcannot check …@… for updates:prefix from theformat!.
Either way, extend the refresh test to assert the shared prefix.
Related, out of scope but should be stated in the PR: RevisionClient::revision (hub.rs:2130-2151) returns a bare ureq::Error::StatusCode(404) (result => result? at :2145) for the same class of lookup, with its own -tp1 retry at :2142-2144. This is a third site, so the PR is 1 of 3.
FINDING 2 — Minor — a 404 also means "private/gated", so the new message can point at a revision the user typed correctly
Citation: the status-only guard, flare/src/hub.rs:3428-3432:
if matches!(
source.downcast_ref::<ApiError>(),
Some(ApiError::RequestError(error))
if matches!(error.as_ref(), ureq::Error::StatusCode(404))
) {
The Hub serves 404, not 401, for a repository the current credential cannot see; this change therefore attributes a credentials problem to the reference. The repo already treats "unauthenticated" as a distinct, reportable condition — docs/cli-design.md:948 ("HF_TOKEN, … otherwise unauthenticated") and the same-run hint at flare/src/hub.rs:3344-3348:
None => {
log::info!(
"Connecting to Hugging Face without an access token; authenticate with `hf auth login`, `HF_TOKEN`, or `--token-file` for higher rate limits"
);
}
That hint is info-level, while the error itself is printed at flare-cli/src/main.rs:64 (eprintln!("Error: {error}")), so with any RUST_LOG filter the operator sees only the reference and no credentials clue.
Impact: the PR's benefit statement ("An operator can identify the reference involved in the failure") holds, but the message can be actively misleading in the gated-repo case, which is common for the models this repo targets.
Fix: keep the wrap status-only (correct — do not assign a cause to the status), and add a conditional clause where the token was resolved: cannot resolve ORG/NAME@rev: … 404 (reference not found, or not visible to the current credentials). The token state is already computed in the same run (hub.rs:3334-3350), so no new plumbing is needed.
Charter / contract compliance — no violation
- No wire/proto/captured-graph/cache-format/CLI-flag surface change: the type is private (hub.rs:3398), no public signature changed (
acquire_watched/refresh_model/download_watcheduntouched), no new flag, no dependency change (flare/Cargo.toml:27unchanged). - No per-model branch (Charter "no per-model special cases"): the guard keys on HTTP status only, which is the general mechanism the Charter wants.
- No owner sign-off requirement applies:
AGENTS.mdhas no "sign-off"/owner-approval rule for error-message work (searched; no matches), and this is not a captured-graph op contract. - Not a performance PR, so #210 A/B evidence is not required; the change cannot affect throughput (error path only, off the serving path).
- Process gap (Minor), Finding 4 below.
FINDING 4 — Minor — the operator-facing string becomes a de-facto contract with no record where the repo requires one
Citation: AGENTS.md:57-60:
Record unresolved defects, unrun checks, and pending measurements in docs/TODO.txt
docs/TODO.txt has no 404/revision entry (search_code for 404|Hub revision|resolve → only unrelated lines). docs/cli-design.md:920-932 stops at "tries the corresponding -tp1 revision if the initial revision lookup returns HTTP 404" and never specifies a message; docs/multi-host.md:536-553 has no failure row for it. The only prior reviewer direction on this exact defect is original-el8's CHANGES_REQUESTED on #489 (2026-11-28, item 3): the bare 404 is "an unresolved defect and belongs in docs/TODO.txt" and "should wrap like :1620". #603 satisfies the code half and cites neither the instruction nor #489's TODO ask.
Impact: a stable error string that operators and agents will parse is unspecified and has no close condition tracked; #489 will be closed against a defect that now has two half-fixes.
Fix: add the docs/TODO.txt line (or state in the PR that it lands separately and link the issue), and cite #489 in the PR body so the reviewer can see the instruction was addressed.
4. Tests & Claim Accuracy
FINDING 3 — Minor — the new assertion is bolted onto a retry test, pins only "404", and leaves the chain and siblings unasserted
Citation: flare/src/hub.rs:8603 and :8619-8622:
for (revision, status) in [("gb10", 401), ("gb10-tp1", 404), ("custom", 404)] {
...
assert!(error.contains(&status.to_string()), "{error}");
if status == 404 {
assert!(error.contains(&format!("owner/model@{revision}")), "{error}");
}
Assessment: coverage of the new path does exist — two 404 rows exercise it, including the post-alias gb10-tp1 row (proving the message reports the originally requested revision), and the 401 row proves the wrap is status-gated. But:
- the enclosing test's contract is retry behaviour (
permanent_resolution_failures_are_not_retried), so a future refactor of that test can drop the diagnostic coverage silently; contains("404")would also pass for any unrelated 404 text; the "retains HTTP 404" claim in the PR body is not pinned;Error::source()(hub.rs:3415-3419), the stated reason for keeping the original error, is never asserted;- the path is exercised only through the
#[cfg(test)]fetch_primary(hub.rs:3353-3361), not the real CLI entry.
Fix: add a dedicated revision_lookup_failure_names_the_reference test asserting the full prefix cannot resolve owner/model@gb10: and that source() yields the 404, and delete the conditional block from the retry test.
Claim-accuracy notes (disclosed, not inflated)
- "The message retains HTTP 404 without assigning a cause to that status." — The 404 text comes from
<ureq::Error as Display>, and ureq is a transitive dependency ofhf-hub(flare/Cargo.toml:27,ureqfeature); the rootCargo.lockis not readable here, so the rendered wording ("HTTP status 404" vs "http status: 404") could not be verified in-repo. Treat as unverified, not wrong — and note the test pins only the substring404. - "the strengthened HTTP fixture test failed on the baseline because the 404 lacked
owner/model@revision" — consistent with the diff (the assertion is new at :8620-8622). Author evidence only: no CI exists on a3ec4b6e. - "The full Flare crate suite passed in release mode on Linux ARM64 (242 passed, 4 ignored)" — same caveat, and the harness needed the Flare lockfile realigned to
deepseek-recipe; that lockfile work is outside the change, as disclosed. - "The complete Orbit CLI workflow was not run." — disclosed and material: that workflow is exactly the untested update-check path of Finding 1.
- No behavioral "before/after" claim in the PR is contradicted by
main; nothing in the diff reverts or conflicts with recently merged work. #598's widening ofhelios/src/core/naming.rs::PLATFORMS(hub.rs:3364 consumes it) increases the population of 404s this PR makes readable — complementary, not conflicting.
Areas checked and sound (stated plainly)
- No lock/mutex/queue contention, head-of-line blocking, or serialized bottleneck: error-path only, no shared structure touched.
- No memory amplification, unbounded buffering, extra copies beyond two short
Strings on a failing request, or cache/disk-I/O change. - No failure-propagation blast radius: the new type is never matched by retry/driver code (
ApiErrordowncast appears exactly once, hub.rs:3429). - No reversal of invariants from recent merges;
PLATFORMS-widened alias path (#598) still runs before the wrap. - No metric/rate/admission span change;
AcquisitionProgresscounters (hub.rs:5446-5548) untouched. - No public, wire, captured-graph, or on-disk-format contract change; no per-model branch; no new flag or dependency.
Open questions / not findable in the repo
- Was wrapping inside
resolve_revision(coveringresolve_primary_targetandrefresh_model_atat once) considered and rejected? The PR body does not say, and Finding 1 is the consequence. - Is
RevisionClient::revision's bare 404 (hub.rs:2130-2151), used by the update check, intentionally out of scope? The update check depends on it. - Does the rendered text actually contain "HTTP 404"? Not verifiable without
Cargo.lock/ureq version pinning; the test does not pin it either. - Is #489's reviewer instruction ("move it to
docs/TODO.txtwith a close condition") satisfied by merging #603 without that entry and without cross-linking? #489 (open docs PR) still does not reference #603. - No maintainer statement anywhere that this diagnostic is wanted at this layer: no issue for the gap, no
docs/TODO.txtentry, no label on #603 (siblings #601/#602 from the same author carrytriage:review), no human review and no CI on a3ec4b6e. Whether that is simple non-triage or deliberate skip is not answerable from the record. - No Discord/handles and no alternative contact were given in #603.