UploadTracker - #13579
Conversation
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the current code fixes both previously reported issues. Reviews (4): Last reviewed commit: "Merge branch 'upload-tracker' of github...." | Re-trigger Greptile |
| max_field_size: int | None = None, | ||
| max_headers: int | None = None, | ||
| middlewares: Sequence[ClientMiddlewareType] | None = None, | ||
| upload_tracker: UploadTracker | None = None, |
There was a problem hiding this comment.
Threat model omits UploadTracker
This adds a public client request option without updating THREAT_MODEL.md, leaving the security model's public API inventory and required audit trail out of sync with the newly exposed upload-observation surface.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #13579 +/- ##
========================================
Coverage 99.02% 99.03%
========================================
Files 135 135
Lines 50500 51057 +557
Branches 2652 2678 +26
========================================
+ Hits 50007 50562 +555
- Misses 370 373 +3
+ Partials 123 122 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Merging this PR will not alter performance
Comparing Footnotes
|
| assert not fut.done() | ||
|
|
||
| body_unblocked.set() | ||
| await fut |
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
|
@aiolibsbot review |
PR Review — UploadTrackerSolid, well-thought-out API with unusually thorough state-machine testing — one real gap where Specific strengths: the generation-token design ( All 20 upload-tracker tests plus
🟡 Important
1. Argument-validation failures leave `upload_complete` pending forever
|
Verdict: no change — the swallow is load-bearing, and every dangerous reading of this finding is blocked by a verified guarantee. Sub-claim by sub-claim: "Neither inner handler re-raises" — deliberate routing, not an accident, and it's master's exact behavior (my restructure preserved the arms verbatim). The error is re-raised in the case that matters: when the "set_exception is a no-op if the protocol already holds an exception" — the delivery may be, but the hygiene isn't: ResponseHandler.set_exception sets _should_close = True (client_proto.py:209), and should_close "or the response was already fully read" — then the poisoned protocol delivers to no reader, but should_close still forces the connector to discard the connection on release. A truncated upload can never leak a "a truncated upload can surface as a clean 200" — the 200 is the server's genuine verdict, emitted before or while the write died; aiohttp fabricates nothing. Early-response-then-abandoned-body is a legitimate Making truncation unconditionally fatal on an otherwise-successful request (raise at release/ctx-exit when the writer failed) would be a breaking semantic change to long-standing client behavior and belongs to its |
| await asyncio.sleep(0) | ||
| task.cancel() | ||
| with pytest.raises(asyncio.CancelledError): | ||
| await task |
| await asyncio.sleep(0) | ||
| task.cancel() | ||
| with pytest.raises(RuntimeError, match="close boom"): | ||
| await task |
| await first_chunk_sent.wait() | ||
| task.cancel() | ||
| with pytest.raises(asyncio.CancelledError): | ||
| await task |
|
@aiolibsbot revewe |
|
❌ Unknown command Code & Development
Pull Requests
Usage: |
No description provided.