Add OCI annotations to layer descriptors for GGUF and SafeTensors#66
Draft
Add OCI annotations to layer descriptors for GGUF and SafeTensors#66
Conversation
- Add annotation constants (filepath, metadata, mediatype.untested) to types package - Add FileMetadata struct following OCI spec - Update partial.NewLayer to populate layer annotations with file metadata - Update ManifestForLayers to preserve annotations from our Layer type - Add comprehensive tests for annotation presence and validity - All layer types (GGUF, SafeTensors, License, MMProj, ChatTemplate) now include annotations Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Run gofmt to align map values properly Co-authored-by: ericcurtin <1694275+ericcurtin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Extend OCI artifacts to include new annotations
Add OCI annotations to layer descriptors for GGUF and SafeTensors
Nov 12, 2025
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.
Implements OCI-compliant layer annotations per CNCF model specification to enable metadata discoverability in model artifacts.
Implementation
Constants and types (
pkg/distribution/types/config.go)org.cncf.model.filepath,org.cncf.model.file.metadata+json,org.cncf.model.file.mediatype.untestedFileMetadatastruct with Name, Mode, Uid, Gid, Size, ModTime, Typeflag fieldsLayer creation (
pkg/distribution/internal/partial/layer.go)NewLayernow extracts file metadata fromos.FileInfoand serializes to JSONManifest generation (
pkg/distribution/internal/partial/partial.go)ManifestForLayerspreserves annotations from custom Layer type instead of reconstructing descriptorsExample
Layers in manifests now include:
{ "mediaType": "application/vnd.docker.ai.gguf.v3", "digest": "sha256:...", "size": 1024, "annotations": { "org.cncf.model.filepath": "/path/to/model.gguf", "org.cncf.model.file.metadata+json": "{\"name\":\"model.gguf\",\"mode\":420,\"uid\":0,\"gid\":0,\"size\":1024,\"mtime\":\"2024-01-01T00:00:00Z\",\"typeflag\":0}", "org.cncf.model.file.mediatype.untested": "false" } }Testing
Added test cases validating annotation presence, format, and JSON deserialization for both single-file and sharded models.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.