feat(ecr): Batch 2 — image + layer ops, content-addressed blob storage#718
Merged
vieiralucas merged 2 commits intomainfrom Apr 23, 2026
Merged
feat(ecr): Batch 2 — image + layer ops, content-addressed blob storage#718vieiralucas merged 2 commits intomainfrom
vieiralucas merged 2 commits intomainfrom
Conversation
Batch 2 of 4. Adds the 10 ops that make real image pushes work via the JSON control plane, and gives us the content-addressed layer storage that Batch 3's OCI v2 Distribution protocol will expose over HTTP. Operations: - PutImage, BatchGetImage, BatchDeleteImage - BatchCheckLayerAvailability - DescribeImages, ListImages - GetDownloadUrlForLayer - InitiateLayerUpload, UploadLayerPart, CompleteLayerUpload Implementation: - sha256-addressed layer blobs stored per repo (snapshot as base64). - Layer upload state machine keyed by uploadId; UploadLayerPart validates contiguous byte ranges and part-size consistency. - CompleteLayerUpload recomputes the sha256 of received bytes and rejects mismatched digests with LayerDigestMismatchException. - PutImage computes the manifest digest, supports tag reassignment on MUTABLE repos, and returns ImageAlreadyExistsException on IMMUTABLE repos. - BatchDeleteImage removes tag-only when other tags still point at the digest; removes the image when the last tag/digest is gone. - DescribeImages / ListImages paginate with the AWS default page size of 100, validate maxResults 1..=1000, and reject invalid continuation tokens with InvalidContinuationTokenException. - Snapshot schema bumped to v2; state grows `images`, `image_tags`, `layers`, and `layer_uploads` fields, all serde(default) so an existing v1 snapshot loads cleanly. Tests: - 6 E2E round-trips (layer upload, digest mismatch, put/describe, batch-get, tag-only delete, immutable-tag guard). - 10 new conformance tests (one per new op) — total 21/58 ops implemented, all at 100% variant coverage. Baseline bumped: 60621 / 61743 variants pass (98.2%).
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
2 issues found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="crates/fakecloud-ecr/src/service.rs">
<violation number="1" location="crates/fakecloud-ecr/src/service.rs:791">
P1: Validate `imageDigest` against the uploaded manifest bytes before accepting the push.</violation>
<violation number="2" location="crates/fakecloud-ecr/src/service.rs:1305">
P1: A digest mismatch currently deletes the in-progress upload state, preventing retry of the same upload.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
- CompleteLayerUpload now validates the received-bytes digest BEFORE removing upload state, so a mismatched digest no longer forces the caller to re-upload the whole blob; retrying with the correct digest reuses the in-flight upload. - PutImage now validates the optional supplied imageDigest against the sha256 of the actual manifest bytes and rejects mismatches with ImageDigestDoesNotMatchException instead of silently storing the user-supplied digest.
This was referenced Apr 23, 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
PutImage,BatchGetImage,BatchDeleteImage,BatchCheckLayerAvailability,DescribeImages,ListImages,GetDownloadUrlForLayer,InitiateLayerUpload,UploadLayerPart,CompleteLayerUpload.docker push/docker pullwork) will expose over HTTP.Key behaviours
InitiateLayerUploadreturns a UUID + 10 MiB partSize (matching AWS).UploadLayerPartrequires contiguous byte ranges and part-size consistency, bumpinglast_byte_received.CompleteLayerUploadrecomputes the sha256 of the received bytes and rejects mismatched digests withLayerDigestMismatchException.PutImageon anIMMUTABLErepo returnsImageAlreadyExistsExceptionwhen a tag already points at a different digest;MUTABLErepos allow tag reassignment.DescribeImages/ListImagesuse AWS's documented default page size of 100, enforcemaxResults1..=1000, and returnInvalidContinuationTokenExceptionon garbagenextTokeninput.serde(default)so v1 snapshots load cleanly. All mutating ops trigger a snapshot save.Test plan
cargo build --workspacecargo fmt --checkcargo clippy --workspace --all-targets -- -D warningscargo test -p fakecloud-e2e --test ecr --test ecr_persistence --test ecr_images— 13 passingcargo test -p fakecloud-conformance --test ecr— 21 passingcargo run -p fakecloud-conformance --release -- run --services ecr— 21/58 ops implemented, all 100%cargo run -p fakecloud-conformance --release -- check— no regressions on other servicesFollow-up
/v2/...) +GetAuthorizationToken+ Basic-Auth — the differentiator that makesdocker pushwork againstlocalhost:4566.Summary by cubic
Adds ECR image and layer operations with content‑addressed sha256 blob storage. Enables full image management via the JSON control plane and sets up OCI v2 push/pull next.
/v2/<repo>/blobs/<digest>URL.Written for commit cc6b6b1. Summary will update on new commits.