Skip to content

Migrate custom OCI types to ocispec in oci/skills#26

Merged
JAORMX merged 1 commit intomainfrom
oci-skills-migrate-ocispec-types
Feb 8, 2026
Merged

Migrate custom OCI types to ocispec in oci/skills#26
JAORMX merged 1 commit intomainfrom
oci-skills-migrate-ocispec-types

Conversation

@JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Feb 7, 2026

Summary

  • Replace 7 custom struct types (ImageConfig, ImageConfigData, RootFS, HistoryEntry, ImageIndex, IndexDescriptor, Platform) with their ocispec equivalents (ocispec.Image, ocispec.ImageConfig, ocispec.RootFS, ocispec.History, ocispec.Index, ocispec.Descriptor, ocispec.Platform)
  • Remove 5 redundant media type constants (MediaTypeImageIndex, MediaTypeImageManifest, MediaTypeImageConfig, MediaTypeImageLayer, AnnotationCreated) — callers now use ocispec.* directly
  • Update ParsePlatform to support os/arch/variant format (e.g., linux/arm/v7)
  • Replace Platform.String() method with PlatformString(ocispec.Platform) free function
  • Fix platform variant propagation in packager config and index construction
  • Add -copyright_file to mockgen directives so regenerated mocks include SPDX headers

Closes #24

Test plan

  • All existing tests updated and passing with new types
  • Added roundtrip test for PlatformString/ParsePlatform
  • Added variant parsing test cases (linux/arm/v7, empty variant)
  • task (lint + test) passes
  • task license-check passes
  • task gen produces mocks with proper SPDX headers

🤖 Generated with Claude Code

Replace the dual type system where the packager used ocispec types
internally but the store, registry, and helpers used custom types
(ImageConfig, ImageIndex, IndexDescriptor, Platform). This eliminates
friction like needing JSON re-serialization between the packager's
ocispec.Image and the store's ImageConfig.

Removed 7 custom struct types and 5 redundant media type constants in
favor of their ocispec equivalents. Updated ParsePlatform to support
os/arch/variant format, and replaced Platform.String() method with
PlatformString() free function. Also fixed platform variant propagation
in packager config and index construction, and added -copyright_file
to mockgen directives so generated mocks include SPDX headers.

Closes #24

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX JAORMX merged commit 0855b19 into main Feb 8, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate mediatypes.go custom OCI types to ocispec

2 participants