Repository navigation
Fix re-pull upload tests under aws-cli 2.42 - #2410
Merged
Merged
Conversation
aws-cli 2.41.2+ sends aws s3 uploads through the CRT client even with AWS_MAX_ATTEMPTS=1, so bodies arrive aws-chunked with a trailing checksum and part ETags unquoted. The stand-in stored the framing as the object. It now decodes and checks them as S3 does. Stand-in tests pass with aws-cli 2.41.0 and 2.42.1.
Upload and annex failures throw UploadFailed with a fixed-word detail that describeError appends, so upload-failed no longer reads 'Error.'. Paths and stderr stay out. Tested by an injected S3 fault in repull-execute-prepare.
Contributor
Author
|
The aws-cli 2.41.0 run has finished: the same 10 files pass, 284/284 (aws-cli/2.41.0 source/arm64, 585 s). Both versions now pass the affected files locally. |
Review round 1 on #2410: refuse a chunk size with non-hex junk and bytes after the trailer, and say which checksums the stand-in does not verify. Stand-in tests pass (10).
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2410Version: 🤖 Updated on each push. |
This was referenced Nov 26, 2026
This branch was previously deployed
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.
Unblocks release PR #2408: the re-pull CLI suites failed in CI with
upload-failed("2 git-held data file(s) could not be annexed or uploaded: Error.") on runner image ubuntu-26.04 20261122.9.1 (aws-cli 2.42.1).Root cause
The S3 stand-in was wrong. The re-pull's invocation and real S3 are not affected.
AWS_MAX_ATTEMPTS=1. Underpreferred_transfer_client = auto,aws s3already selects the CRT transfer client, but before aws-cli 2.41.2 it fell back to the classic client whenmax_attempts = 1. The 2.41.2 changelog reads "Supportmax_attempts = 1in the CRT transfer client".x-amz-content-sha256: STREAMING-UNSIGNED-PAYLOAD-TRAILERandContent-Encoding: aws-chunked, with a trailingx-amz-checksum-crc64nvme. Captured from 2.42.1:5\r\nhello\r\n0\r\nx-amz-checksum-crc64nvme:M3eFcAZSQlc=\r\n\r\n(54 bytes for a 5-byte file). 2.41.0 with the same environment sent the plain 5 bytes with anx-amz-checksum-crc64nvmeheader.awsCliUpload's size check (isKeyPresentAtDeclaredSize) then found 54 bytes where 5 were declared and threw.describeErrorwithholds every plainError's message, so the refusal said only "Error."<ChecksumCRC64NVME>element.Production
Production re-pulls are not at risk from this change.
preferred_transfer_client,awsCliUploadpasses nomax_attempts, and the two scripts that setAWS_MAX_ATTEMPTSset it to 10. So productionaws s3 syncruns with the installed CLI's default selection, which for 2.41.2 and later is CRT; which client a given host picks depends on its aws-cli version, which the repository cannot show.aws-chunkedwith a trailing checksum is S3's standard streaming upload encoding, and real S3 decodes it.Changes
test/scrub/helpers/s3-standin.ts: PutObject and UploadPart decodeaws-chunkedbodies, as S3 does. The decoded length must equalx-amz-decoded-content-length(IncompleteBodyotherwise). The trailing checksum is verified (crc32, crc32c, crc64nvme, sha1 or sha256;BadDigeston a mismatch) and counts as the request's checksum. CompleteMultipartUpload reads each<Part>by element and accepts ETags with or without quotes. The log recordschunked.src/lib/import-normalize.ts,src/lib/normalize-dataset.ts,src/lib/import-scrub.ts: annex and upload failures throwUploadFailed, which carries adetailbuilt only from fixed words and counts.describeErrorappends that detail; paths and stderr remain withheld. Against the old stand-in, the refusal now reads "UploadFailed: 2 of 2 object(s) absent from the bucket or the wrong size (first: 24 byte(s) declared, 74 byte(s) held)".Tests
test/scrub/s3/standin.test.tsadds three tests:awsCLI with the CRT client pinned uploads a small file and a 17 MiB multipart file. The test asserts the bytes, the ETag, and that the request was chunked, so it exercises the case on any installed aws-cli.test/repull-execute-prepare.test.tsadds one test: an injected S3 write fault refuses withupload-failed, and both the refusal and the row'slast_errorsay "UploadFailed: aws s3 sync exited 1" without naming any path or the S3 error text.describeErrordetail branch disabled, the prepare test fails.What I ran
bun run typecheck,bun run linttest/repull-gates-cli.test.tsfailed with aws-cli 2.42.1, which reproduced the CI failure locally on macOS. The 2.42.1 binary came from the official pkg, expanded withpkgutil --expand-full.test/scrub/s3/standin.test.tspasses 10/10.test/scrub/s3/standin.test.tspasses 10/10.bun test. CI covers it.Review
Round 1 (one full review): no Critical or Important findings. The three suggestions are fixed in 0db7f7d: a chunk size must be hex digits only ("5zz" no longer parses as 5), bytes after the trailer are refused, and the header comment says which checksums the stand-in does not verify (plain
x-amz-checksum-*headers on unchunked bodies, part checksums at completion). Two new assertions cover the refusals; the stand-in suite passes (10). The production paragraph above is reworded per the review.