You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace the custom OCI struct types in oci/skills/mediatypes.go with canonical types from github.com/opencontainers/image-spec/specs-go/v1. The packager (PR #23) already uses ocispec types internally, creating a dual type system where the store and helper functions use custom types while the packager uses spec types.
Context
The OCI expert review of the packager flagged this as the primary concern (C1): configs produced by the packager using ocispec.Image cannot be directly consumed by SkillConfigFromImageConfig(*ImageConfig) without JSON re-serialization. The Go expert review also flagged the redundant media type constants as a maintenance hazard.
Remove custom ImageIndex, IndexDescriptor types — use ocispec.Index, ocispec.Descriptor
Remove custom Platform type — use ocispec.Platform (which includes Variant, OSVersion, OSFeatures)
Update ParsePlatform() to return ocispec.Platform
Add PlatformString(p ocispec.Platform) string free function (can't add methods to external types)
Update DefaultPlatforms to []ocispec.Platform
Update SkillConfigFromImageConfig to accept *ocispec.Image
Update Store.GetIndex to return *ocispec.Index
Update Store.IsIndex to use ocispec.MediaTypeImageIndex
Remove redundant media type constants (MediaTypeImageIndex, MediaTypeImageManifest, MediaTypeImageConfig, MediaTypeImageLayer) — consumers should use ocispec.* directly
Remove redundant AnnotationCreated — use ocispec.AnnotationCreated
Description
Replace the custom OCI struct types in
oci/skills/mediatypes.gowith canonical types fromgithub.com/opencontainers/image-spec/specs-go/v1. The packager (PR #23) already usesocispectypes internally, creating a dual type system where the store and helper functions use custom types while the packager uses spec types.Context
The OCI expert review of the packager flagged this as the primary concern (C1): configs produced by the packager using
ocispec.Imagecannot be directly consumed bySkillConfigFromImageConfig(*ImageConfig)without JSON re-serialization. The Go expert review also flagged the redundant media type constants as a maintenance hazard.Acceptance Criteria
ImageConfig,ImageConfigData,RootFS,HistoryEntrytypes — useocispec.Image,ocispec.ImageConfig,ocispec.RootFS,ocispec.HistoryImageIndex,IndexDescriptortypes — useocispec.Index,ocispec.DescriptorPlatformtype — useocispec.Platform(which includesVariant,OSVersion,OSFeatures)ParsePlatform()to returnocispec.PlatformPlatformString(p ocispec.Platform) stringfree function (can't add methods to external types)DefaultPlatformsto[]ocispec.PlatformSkillConfigFromImageConfigto accept*ocispec.ImageStore.GetIndexto return*ocispec.IndexStore.IsIndexto useocispec.MediaTypeImageIndexMediaTypeImageIndex,MediaTypeImageManifest,MediaTypeImageConfig,MediaTypeImageLayer) — consumers should useocispec.*directlyAnnotationCreated— useocispec.AnnotationCreatedArtifactTypeSkill,AnnotationSkill*,LabelSkill*SkillConfig(domain-specific, not an OCI type)PackageOptions.PlatformsandPackageResult.Platformsininterfaces.goto useocispec.Platformtask gen)Technical Notes
ocispec.PlatformhasVariant stringfield — enables proper arm64/v8 support in the futureocispec.Image.Createdis*time.Time(notstring) — stronger typingocispec.RootFS.DiffIDsis[]digest.Digest(not[]string) — type-safe digestsocispec.Descriptor.Digestisdigest.Digest(notstring)ocispec.History.Createdis*time.Timewith proper JSON marshalingimage-specdependency is already ingo.modEstimated Scope
~300 lines changed across
mediatypes.go,mediatypes_test.go,store.go,store_test.go,interfaces.go,mocks/mock_interfaces.go