Skip to content
This repository was archived by the owner on Oct 3, 2026. It is now read-only.

feat(differ): emit native EROFS layers from Compare - #43

Merged
aledbf merged 1 commit into
aledbf/review-batch3from
aledbf/native-erofs-compare
Jun 12, 2026
Merged

aledbf merged 1 commit into
aledbf/review-batch3from
aledbf/native-erofs-compare

Conversation

@aledbf

@aledbf aledbf commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Compare now honors diff.WithMediaType(images.MediaTypeErofsLayer) (application/vnd.erofs.layer.v1). Stacked on #42.

  • The tar diff is streamed through mkfs.erofs with the same options as the Apply/pull path (uncompressed, 4KiB blocks, --aufs whiteouts), so the emitted layer is fsmeta-merge compatible — committed images mount through the merged fsmeta/VMDK like pulled ones.
  • The staged image is committed to the content store as-is; the diff ID for native EROFS layers is the blob digest itself, recorded in the containerd.io/uncompressed label so commit flows read the diff ID uniformly across media types.
  • Effect: images committed with this media type skip the tar→EROFS reconversion on every subsequent pull/unpack within the stack (Apply already consumed the official media type natively). tar+gzip remains the default for OCI portability — this is opt-in per Compare call.
  • Implementation detail: mkfs.erofs needs a seekable output file, so the conversion stages through a temp file wired with an io.Pipe; the pipe is closed from the converter side to unblock the tar producer when mkfs stops reading at the end-of-archive marker. Blobs are not byte-reproducible across runs (random mkfs UUID — the pull path keys it on the layer digest, unknown here until conversion ends).

Validation

  • New unit test TestWriteAndCommitDiffNativeErofs (Linux + mkfs.erofs): asserts the committed blob parses as EROFS with 4KiB blocks and that the uncompressed label equals the blob digest. TestCompressionTypeFromMediaTypeErofs covers media type acceptance incl. +suffix rejection.
  • integration-commit gains -native-erofs; test_image_commit now runs the full commit flow twice (tar+gzip and native EROFS), ending in image verification (layer count, top diff ID, unpacked).
  • task fmt && task lint && task test green (lint clean on golangci 2.11/2.12).

🤖 Generated with Claude Code

Compare now honors diff.WithMediaType(images.MediaTypeErofsLayer): the tar
diff is streamed through mkfs.erofs with the same options as the Apply/pull
path (uncompressed, 4KiB blocks, --aufs whiteouts - fsmeta-merge
compatible) and the staged image is committed to the content store as-is.
The diff ID for native EROFS layers is the blob digest itself, recorded in
the containerd.io/uncompressed label like the other media types, so commit
flows read it uniformly.

Images committed with this media type skip the tar->EROFS reconversion on
every subsequent pull/unpack within the stack (Apply already consumed the
official media type natively). tar+gzip remains the default for OCI
portability.

integration-commit gains -native-erofs and test_image_commit exercises both
flows end-to-end: Compare -> manifest/config -> Prepare+Apply+Commit ->
image verification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 60.00000% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/differ/compare_linux.go 60.00% 7 Missing and 7 partials ⚠️

📢 Thoughts on this report? Let us know!

@aledbf
aledbf merged commit 6c50763 into aledbf/review-batch3 Jun 12, 2026
6 checks passed
@aledbf
aledbf deleted the aledbf/native-erofs-compare branch June 15, 2026 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant