fix(oci): render arm64 platform description without redundant v8#783
Open
Halvanhelv wants to merge 1 commit into
Open
fix(oci): render arm64 platform description without redundant v8#783Halvanhelv wants to merge 1 commit into
Halvanhelv wants to merge 1 commit into
Conversation
`Platform.description` rendered the same arm64 platform two different ways depending on how the value was constructed: `linux/arm64` when the variant was `nil`, and `linux/arm64/v8` when the variant was set to `"v8"`. These are the same platform — `==`, `hash`, and Set membership already treat an arm64 `nil` variant as equivalent to `"v8"` — so two equal values produced different descriptions and drifted between `arm64` and `arm64/v8` across stages of a single build (apple/container#1542). Omit the redundant `v8` variant for arm64 so equal platforms always describe as `linux/arm64`, matching how Docker and containerd display it. Only the rendered description changes; the stored variant and Codable encoding are untouched, so OCI content digests remain stable.
1e8f0c7 to
7eb0c7d
Compare
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
Platform.descriptionrenders the same arm64 platform two different waysdepending on how the value was constructed:
These are the same platform —
==,hash(into:), andSetmembershipalready treat an arm64
nilvariant as equivalent to"v8"— yet theyserialize differently, so a single platform drifts between
linux/arm64andlinux/arm64/v8across stages of one build (apple/container#1542).Relation to #764
#764 fixed the
Hashableside of this: it stoppedhash(into:)from usingdescriptionand canonicalized arm64nil→v8in the hash. That workedaround the inconsistent
descriptionbut did not fix it — its own summarynames
description(linux/arm64vslinux/arm64/v8) as the root cause.This PR fixes that remaining gap at the source.
Change
Omit the redundant
v8variant for arm64 when renderingdescription, soequal arm64 platforms always describe as
linux/arm64— matching how Dockerand containerd display the platform. Other variants (
arm/v7) andarchitectures (
amd64) are unaffected.Only the rendered
descriptionchanges. The storedvariantand theCodableencoding are untouched, so OCI content digests remain stable.Testing
Added
OCIPlatformTestscases for description consistency (equal arm64platforms describe identically;
arm64/v8renders aslinux/arm64;arm/v7andamd64preserved).swift test --filter ContainerizationOCITestspasses (55 tests);
swift format lint --strictclean.Closes apple/container#1542 (normalization-consistency aspect).