Skip to content

Log partial payload + headers when a download is interrupted#228

Draft
yarikoptic wants to merge 1 commit into
masterfrom
enh-fail-debug
Draft

Log partial payload + headers when a download is interrupted#228
yarikoptic wants to merge 1 commit into
masterfrom
enh-fail-debug

Conversation

@yarikoptic
Copy link
Copy Markdown
Member

When a streaming download fails mid-flight (ChunkedEncodingError / ConnectionError) or yields a corrupt zip, we now log the bytes written so far, the response headers, and a UTF-8/repr preview of the first 512 bytes of what arrived. This makes it possible to tell apart genuine truncation from a tiny error-stub response that the server returned with status 200.

Motivated by intermittent IncompleteRead failures fetching GitHub Actions logs where the advertised Content-Length was suspiciously small (~4 KiB), but the discarded body could have revealed whether it was a JSON/HTML stub or real binary data.

When a streaming download fails mid-flight (ChunkedEncodingError /
ConnectionError) or yields a corrupt zip, we now log the bytes
written so far, the response headers, and a UTF-8/repr preview of
the first 512 bytes of what arrived. This makes it possible to tell
apart genuine truncation from a tiny error-stub response that the
server returned with status 200.

Motivated by intermittent IncompleteRead failures fetching
GitHub Actions logs where the advertised Content-Length was suspiciously
small (~4 KiB), but the discarded body could have revealed whether it
was a JSON/HTML stub or real binary data.

Co-Authored-By: Claude Code 2.1.119 / Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yarikoptic yarikoptic added the patch Increment the patch version when merged label Apr 25, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 25, 2026

Codecov Report

❌ Patch coverage is 26.08696% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.73%. Comparing base (d2c5f59) to head (fb2e28c).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
src/tinuous/base.py 26.08% 17 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #228      +/-   ##
==========================================
+ Coverage   55.45%   59.73%   +4.28%     
==========================================
  Files          10       10              
  Lines        1421     1443      +22     
  Branches      222      223       +1     
==========================================
+ Hits          788      862      +74     
+ Misses        581      515      -66     
- Partials       52       66      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant