Skip to content

fix: fix upstream sync and adopt python-dxf#17

Merged
davidpoblador merged 3 commits intomainfrom
worktree-zesty-singing-music
Apr 2, 2026
Merged

fix: fix upstream sync and adopt python-dxf#17
davidpoblador merged 3 commits intomainfrom
worktree-zesty-singing-music

Conversation

@davidpoblador
Copy link
Copy Markdown
Member

Summary

  • Fix upstream blob push 404 by removing http2=True and restricting follow_redirects to GET/HEAD only (POST/PUT were subject to 301/302 method change)
  • Replace hand-rolled httpx registry client with python-dxf, a battle-tested Docker registry v2 library
  • Move httpx to dev deps, swap respx for responses in test mocks

Test plan

  • All 60 existing tests pass
  • Linter clean
  • Deploy updated image and verify sync completes for the stuck transcriptuner markers

🤖 Generated with Claude Code

davidpoblador and others added 3 commits April 2, 2026 12:13
The httpx client was configured with follow_redirects=True globally and
http2=True. On 301/302 redirects, HTTP spec allows clients to change
POST to GET, which means the upload session POST never actually creates
a session. The subsequent PUT then returns 404.

Fix: remove http2 (unnecessary, known issues with some registries),
remove global follow_redirects, and add it only to GET/HEAD operations
(pulls) where CDN redirects are expected. POST/PUT operations (pushes)
now use the default follow_redirects=False.

Also cleans up dead code: no-op URL conditional in push_blob and
unnecessary async generator wrapper in push_blob_streaming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adopt python-dxf for all upstream registry v2 operations. This replaces
the manual httpx POST/PUT blob upload flow (which was broken by redirect
handling) with a battle-tested library that correctly implements the
Docker registry protocol.

- UpstreamClient now creates per-repo DXF instances, cached for reuse
- All sync DXF calls wrapped with asyncio.to_thread (same pattern as storage)
- push_blob_streaming collects the async stream then delegates to DXF
- pull_blob yields chunks via to_thread(next, ...) for async streaming
- Moved httpx from main deps to dev-only (still needed for Starlette TestClient)
- Swapped respx for responses in test mocks

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Docker resolves localhost to ::1 (IPv6) on macOS and connects there
first. Binding to :: instead of 0.0.0.0 accepts both IPv4 and IPv6
connections.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davidpoblador davidpoblador merged commit 8b23ab7 into main Apr 2, 2026
1 check passed
@davidpoblador davidpoblador deleted the worktree-zesty-singing-music branch April 2, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant