RegistryClient does not follow HTTP redirects (308), breaking resolution against redirecting registries #130
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
cleveragents/cleveractors-core#130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Metadata
feat(registry): follow HTTP redirects in RegistryClientfeature/m1-registry-client-follow-redirectsBackground and context
The Package Registry Standard does not forbid registry servers from answering with
HTTP redirects. In practice, gateways fronting a registry (e.g. Caddy) normalize URLs —
for example by appending a trailing slash and answering with
308 Permanent Redirect.RegistryClient(src/cleveractors/registry/client.py) builds its internalhttpx.AsyncClientwithoutfollow_redirects=True, and httpx returns a 3xx responseas-is when redirects are disabled.
raise_for_status()then raisesHTTPStatusErrorfor that 3xx, which
_requestconverts into an opaqueRegistryError("HTTP 308").The result: a perfectly reachable package on a redirecting registry cannot be resolved
at all.
Current behavior
Resolving a registry reference against a server that answers
308 Permanent Redirectfails:
Reproduced against
http://192.168.1.53(a Caddy-fronted registry):Root cause:
RegistryClient._get_client()(src/cleveractors/registry/client.py~line 82) createshttpx.AsyncClient(base_url=..., headers=..., timeout=...)withoutfollow_redirects=True. Because redirects are not followed, httpx 0.28.xraise_for_status()raisesHTTPStatusErrorfor the 3xx response, and_requestsurfaces it as a
RegistryErrorwhose message is the bare string"HTTP 308"— hidingthe real state of the target resource.
Expected behavior
RegistryClientfollows HTTP redirects transparently (3xx, including308 Permanent Redirect). Resolution against a redirecting registry succeeds. If the redirectedtarget does not exist, the client surfaces the appropriate typed error (e.g.
PackageNotFoundErroron a 404) instead of an opaque"HTTP 308".Acceptance criteria
RegistryClientconstructs itshttpx.AsyncClientwithfollow_redirects=True.resolve_package/get_package/browse/discoversucceed when the serveranswers a 3xx redirect whose target is valid.
PackageNotFoundErroron 404) rather than an opaqueRegistryError("HTTP 308").URLs with
308(e.g. Caddy).Supporting information
http://192.168.1.53(see Currentbehavior for the exact request/response).
src/cleveractors/registry/client.py(RegistryClient._get_client,_request)src/cleveractors/registry/reference_resolver.py(_resolve_registry_async)features/registry_http_client.feature/features/steps/registry_http_client_steps.py(existing BDD coverage for the client)
follow_redirects=Falsea 3xx is returned as-is andResponse.raise_for_status()raisesHTTPStatusErrorfor it.Subtasks
follow_redirects=Trueto thehttpx.AsyncClientconstruction inRegistryClient._get_client.redirect-to-404 yields
PackageNotFoundError.nox -s coverage_report.nox(all default sessions), fix any errors.Definition of Done
This issue is complete when:
Commit Message in Metadata exactly, followed by a blank line, then additional lines
providing relevant details about the implementation.
exactly.
master, reviewed, and mergedbefore this issue is marked done.