Skip to content

Fall back to streaming after range request failures - #917

Draft
zaniebot wants to merge 2 commits into
mainfrom
zb/range-reader-request-fallback
Draft

zaniebot wants to merge 2 commits into
mainfrom
zb/range-reader-request-fallback

Conversation

@zaniebot

@zaniebot zaniebot commented Aug 28, 2026 •

Copy link
Copy Markdown
Collaborator

When HEAD advertises range support but a ranged GET fails, wheel metadata extraction can error even when an ordinary GET succeeds. The range reader's HTTP and transport errors, including those wrapped by the ZIP reader, do not currently trigger streaming fallback. Retry the original wheel URL without Range for these failures, unless metadata range requests are required.

Handle these failures separately from the existing classification for unsupported ranges, which also disables range requests for subsequent wheels from the index. A request can fail because of an individual artifact, signed URL, or transient connection problem; it does not establish that other wheels cannot serve ranges. Fall back for the affected wheel without changing the index capability. Errors indicating unsupported ranges or malformed range responses continue to use the existing classification.

This is stacked below #909 to preserve fallback if redirected storage rejects a ranged GET with 403 while accepting an ordinary GET. The motivating scenario uses a simulated server; a production instance of that specific rejection has not been identified.

@astral-automations-bot astral-automations-bot Bot added the bug Something isn't working label Aug 28, 2026
@zaniebot
zaniebot force-pushed the zb/range-reader-request-fallback branch from c3c093b to 503148f Compare August 28, 2026 22:15
@zaniebot
zaniebot force-pushed the zb/range-reader-redirect-tests branch from 197a5b6 to 043e682 Compare August 28, 2026 22:15
@zaniebot
zaniebot changed the base branch from zb/range-reader-redirect-tests to zb/range-reader-redirect-edge-tests August 28, 2026 22:15
@zaniebot
zaniebot force-pushed the zb/range-reader-redirect-edge-tests branch from 1109285 to 61a10de Compare August 29, 2026 14:07
@zaniebot
zaniebot force-pushed the zb/range-reader-request-fallback branch from 503148f to 0185839 Compare August 29, 2026 14:36
@zaniebot
zaniebot changed the base branch from zb/range-reader-redirect-edge-tests to main August 29, 2026 14:36
@zaniebot
zaniebot force-pushed the zb/range-reader-request-fallback branch from 0185839 to f04fc45 Compare August 29, 2026 14:39
Comment thread crates/uv-client/src/error.rs Outdated
ErrorKind::Zip(_, ZipError::UpstreamReadError(err)) => err
.get_ref()
.and_then(|err| err.downcast_ref::<AsyncHttpRangeReaderError>()),
_ => None,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make this exhaustive?

Comment thread crates/uv-client/src/error.rs Outdated
Comment on lines +379 to +386
matches!(
range_error,
Some(
AsyncHttpRangeReaderError::HttpError(_)
| AsyncHttpRangeReaderError::TransportError(_)
| AsyncHttpRangeReaderError::IoError(_)
)
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be exhaustive too?

@zaniebot zaniebot added priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect. risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. labels Sep 9, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working priority:2 Important: bounded correctness, release reliability, committed work, or proven performance gains. risk:2 Low, contained risk of minor incorrect behavior with straightforward recovery. size:2 Moderate: one subsystem with meaningful invariants, edge cases, or operational evidence to inspect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants