Repository navigation
Conversation
The concurrent download limit was checked against every episode in a series batch, so with the default limit of 3 any series longer than 3 episodes was rejected with 429 every time, even with nothing downloading. A batch now needs one free concurrent slot. Its episodes are downloaded one after another and still count as active once queued, so they hold back further downloads until they finish. The period quota still counts the whole batch. Closes Silo-Server#1703 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughThe concurrent download limit now counts at most one slot for each batch, regardless of batch size. The period quota continues to count every download in the batch. Tests cover concurrent-limit cases and batch period quotas. ChangesBatch download limits
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: 🔵 Low · up to A caller that requests multiple files from a batch at once can exceed the configured concurrent-transfer limit. The change is mergeable with awareness that the server does not enforce one-at-a-time delivery. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to Series downloads can now exceed the configured active-download limit without server-enforced sequential transfers. Download permissions, ownership checks and whole-batch period quotas remain intact, but client-side scheduling is not a reliable resource-control boundary. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
The batch behavior should be included when C1 is run; single-download and period-quota behavior remain unchanged. Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
…o fix/series-download-concurrent-limit-1703 # Conflicts: # internal/downloads/limiter.go
|
The updated line also needs Web admin case #1218 C1. Its steps set global/per-user limits and verify their effect with the Server task; the Downloads settings page exposes
Both C1 results are currently Not run, so this adds planned coverage rather than invalidating or unblocking a recorded result. Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed. Posted via Macroscope — v1 validation impact |
|
Silo's pull request guidance changed today (#2016). A PR that changes what a user sees now needs before-and-after evidence in its Evidence section, and a PR with no visible change says Missing here: A before-and-after recording of Download series on a long series, or before-and-after excerpts of the download-create response (429 versus success) for the same request. The rules are in Show visible changes, and the PR template shows the Evidence section layout. I've converted this PR to draft for now. Mark it ready for review once the Evidence section is filled in. Generated by Claude Code |
|
Closing: #1713 already fixed this on The only request this PR still changes is a series download without a device ID, such as the legacy v1 🤖 Posted by Claude Code |
Problem
Closes #1703
Related issue: Silo-Server/silo-android#424 (the Android client doesn't report this failure)
Related PR: Silo-Server/silo-android#429 shows the server's reason when a download is rejected. The two are independent and can merge in either order.
Validation tasks: changes #1217 C1; changes #1218 C1 (both not run yet; their next runs should cover the series batch limit)
Download series failed every time for any series with more episodes than the per-user concurrent download limit, which defaults to 3. It did so even with nothing downloading. The server checked the limit against every episode in the batch and answered
429 rate_limited, and the Android app showed nothing. On a real deployment, every Download series attempt got a 429 while the user's download list was empty.Approach
QuantityLimiter.Checknow requires one free concurrent slot for a request, whatever its batch size (active + min(batchSize, 1) > maxConcurrent). A series batch's episodes are downloaded one after another, so needing a slot per episode only blocked series longer than the limit. Single downloads (batch size 1) behave as before. A batch's queued records still count as active once created, so they keep further downloads blocked until they finish, and the period quota still counts every record in the batch.The limit only applies when downloads are created; serving the file doesn't check it. The more thorough fix would enforce concurrency when a transfer starts and queue the rest server-side. Every client would then need to handle a "not yet" response, so that's left as a separate decision.
Validation
Run in WSL2 against Postgres 18 (full schema):
internal/downloadspasses, apart fromTestConcurrentArtifactCreatesCannotBypassQuotaDB, which times out onmainin the same environment too. The download tests ininternal/apiv2andinternal/api/handlerspass.make lint-changed: 0 issues.Evidence
The same Download series request for a five-episode series, from a user with no downloads and the default limit of 3 concurrent downloads, first on
main, then on this branch.Before (
main):After (this branch):
On
main, a series request that sendsX-Silo-Device-Id(managed downloads) already succeeds since #1713, which registers original-quality episodes as ready rather than active. The request above, without a device ID, still reaches the per-episode check this PR changes.Surface and build: downloads API, local builds of
mainatc7621772dand this branch at8529074b9against one database, with downloads enabled and generated test media.Risks
A user can now queue a whole series even when it's longer than the limit, so the number of unfinished downloads can exceed the limit until they finish. The period quota (
download.max_per_period) still caps the total. If maintainers readmax_concurrent_per_useras a hard cap on unfinished downloads, this needs the transfer-time enforcement described above instead.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Fix series downloads to require only one concurrent slot per batch
QuantityLimiter.Checkin limiter.go now checks concurrent count asmin(batchSize, 1)instead of the full batch size. A batch still counts every created episode toward the period quota, and queued batch entries still occupy concurrent slots.CheckCountscallers that assumed batch size equals slot usageMacroscope summarized 8529074.