fix(concurrent): avoid extra initial remainder request - #581
SuperCoolPencil merged 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughConcurrent downloads now limit initial tasks to the configured connection count. The final retained task absorbs the remaining file range. Sequential mode preserves all chunks. Tests cover task sizing, setup wiring, and signed range requests. ChangesConcurrent task budgeting
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Downloader
participant setupTasks
participant createInitialTasks
participant HTTPServer
Downloader->>setupTasks: provide connection count
setupTasks->>createInitialTasks: create parallel initial tasks
createInitialTasks-->>Downloader: return worker-limited tasks
Downloader->>HTTPServer: send signed byte-range requests
HTTPServer-->>Downloader: return partial-content responses
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/strategy/concurrent/signed_range_test.go (1)
35-43: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the exact request ranges.
The handler accepts every in-bounds range. A partition with an overlap or a gap can still return
206and pass this test. Compare each parsed range with the expected three ranges, including the finalfileSize-1boundary.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/strategy/concurrent/signed_range_test.go` around lines 35 - 43, Update the test handler around parseTestByteRange to validate each request’s parsed start and end against the expected three partition ranges, rejecting overlaps and gaps instead of accepting any in-bounds range. Ensure the expected ranges include the final fileSize-1 endpoint before returning a successful partial response.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@internal/strategy/concurrent/signed_range_test.go`:
- Around line 35-43: Update the test handler around parseTestByteRange to
validate each request’s parsed start and end against the expected three
partition ranges, rejecting overlaps and gaps instead of accepting any in-bounds
range. Ensure the expected ranges include the final fileSize-1 endpoint before
returning a successful partial response.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 5e7985d6-8f9e-4340-8902-c7830cc495bf
📒 Files selected for processing (4)
internal/strategy/concurrent/chunk_test.gointernal/strategy/concurrent/downloader.gointernal/strategy/concurrent/downloader_helpers_test.gointernal/strategy/concurrent/signed_range_test.go
15213f3 to
ab47fb9
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/strategy/concurrent/signed_range_test.go`:
- Around line 29-43: Update the test handler around downloadTask to record every
validated (start, end) range, then after downloadTask completes compare the
recorded pairs against the corresponding tasks entries. Add assertions for exact
range coverage, including that the final range ends at fileSize-1, while
retaining the existing request-count validation.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c658b17b-cfe2-4d1d-9330-8f2934f58632
📒 Files selected for processing (4)
internal/strategy/concurrent/chunk_test.gointernal/strategy/concurrent/downloader.gointernal/strategy/concurrent/downloader_helpers_test.gointernal/strategy/concurrent/signed_range_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
- internal/strategy/concurrent/downloader.go
- internal/strategy/concurrent/downloader_helpers_test.go
|
Thanks so much @snowyukitty 🚀 |
Summary
Why
The aligned chunk size can leave a small (N+1)th remainder task after N primary ranges. Request-sensitive signed URLs can reject that extra HTTP range request even though the primary ranges are valid.
Testing
go test ./internal/strategy/concurrent -run '^(TestInitialRangesStayWithinWorkerRequestBudget|TestTaskRangeAssignment)$' -count=1go test ./internal/strategy/concurrent -count=1go vet ./...go test ./internal/lint/... -count=1go build ./...cmdandinternal/probe(the two reproduced Windows baseline failures)go test ./... -count=1 -timeout 90spassed every other package. On this Windows host,cmdstill fails its dummy batch-editor test andinternal/probestill reports a DNS resolver goroutine; both failures reproduce on the audited base. The race detector was unavailable because the host has no CGO toolchain, WSL, or running Docker daemon.Coordination
This patch touches
internal/strategy/concurrent/downloader.goalongside open #550 and #580. Both current merge trees are clean, and the concurrent package passes on each combined tree.Addresses the initial partitioning case in #579. Runtime hedging, permanent HTTP retry handling, and connection prewarming remain out of scope.
Assistance disclosure: This contribution was developed with AI assistance (OpenAI Codex).
Summary by CodeRabbit
Performance
Bug Fixes