Fix copy endpoint for files >5 GB (PTFE-3441) - #221
Merged
Conversation
Scaleway enforces a 5GB hard limit on CopyObject (identical to AWS S3). Builds containing files >5GB (e.g. artesca promote jobs) fail with EntityTooLarge when copy_build.lua tries to copy them in a single CopyObject call. Production path: attempt CopyObject as before; on 400 EntityTooLarge fall back to multipart copy (UploadPartCopy), using up to 1,000 parts (Scaleway limit) with a minimum 5 MB part size. Test path: COPY_OBJECT_SIZE_LIMIT=0 in tests/.env forces all non-empty files through the multipart path so the UploadPartCopy code is exercised in CI without needing actual >5 GB files. Four new internal-only nginx locations handle the multipart lifecycle (initiate/part/complete/abort), and four matching signature modes are added to compute_aws_s3_signature.lua. Fixes: PTFE-3441 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
All 4 multipart copy subrequests (initiate, part, complete, abort)
were calling their nginx locations directly, causing the
`if ($remote_addr != 127.0.0.1) { return 400; }` guard to fire
because ngx.location.capture inherits the parent request's remote_addr
(the external client IP), not 127.0.0.1.
Prefix all calls with /force_real_request/ so they proxy through
nginx to localhost, making $remote_addr == 127.0.0.1 as required.
This mirrors the existing pattern used by /force_real_request/copy/.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review by Claude Code |
Two fixes from code review: - Add /force_real_request/ prefix on the abort call inside the complete-failure handler (different indentation was missed by the previous replace_all pass) - Check for <Error> in the CompleteMultipartUpload response body: S3 can return HTTP 200 with an error payload (documented behavior) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM |
In test mode (COPY_OBJECT_SIZE_LIMIT set), the server said 'DONE' for both CopyObject and multipart paths — making it impossible to tell from the log which was used. Add '(multipart copy)' suffix so logCopyOutput in action-artifacts can detect and report it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
LGTM |
jauresamani-06
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
copy_build.luauses S3 CopyObject (x-amz-copy-source) for every file with no size check. Scaleway enforces a 5 GB hard limit (identical to AWS S3). Builds with files >5 GB (e.g. artesca promote jobs) fail withEntityTooLarge.EntityTooLarge(HTTP 400), fall back to multipart copy using S3UploadPartCopy. Parts are sized atmax(5 MB, ⌈size/1000⌉)to stay within Scaleway's 1,000-part limit. Parts within a single file are copied in parallel batches of 16.COPY_OBJECT_SIZE_LIMIT=0added totests/.envforces all non-empty files through the multipart code path in CI, so the full initiate→part→complete cycle is exercised without actual >5 GB files.Changes
conf/nginx.conf.templateenv COPY_OBJECT_SIZE_LIMIT;+ 4 internal-only locations:copy-multipart-{initiate,part,complete,abort}lua/compute_aws_s3_signature.luaCOPY_MULTIPART_{INITIATE,PART,COMPLETE,ABORT}lua/copy_build.luamultipart_copy()function; production path falls back on EntityTooLarge; test path uses size thresholdtests/.envCOPY_OBJECT_SIZE_LIMIT=0to force multipart in CItests/end2end/test_copy.pytest_copy_via_multipart_copyverifies content integrity through the multipart pathTest plan
test_copy.pytests now run through the multipart path (due toCOPY_OBJECT_SIZE_LIMIT=0) and verify the implementation is correct end-to-endtest_copy_via_multipart_copyspecifically documents and asserts the multipart behaviorFixes: PTFE-3441
🤖 Generated with Claude Code