Skip to content

Conversation

@chlins
Copy link
Member

@chlins chlins commented Sep 19, 2025

This pull request updates the codebase to use the github.com/dragonflyoss/model-spec/specs-go/v1 package instead of the deprecated github.com/modelpack/model-spec/specs-go/v1 for model specifications. Additionally, it introduces compatibility with legacy model spec types and annotations where appropriate. The changes ensure consistency and future compatibility with the new model spec source.

Migration to new model spec package:

  • All import statements referencing github.com/modelpack/model-spec/specs-go/v1 have been updated to use github.com/dragonflyoss/model-spec/specs-go/v1 across backend and test files, including attach.go, build.go, builder.go, processor files, and test mocks. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

Legacy model spec compatibility:

  • In pkg/backend/attach.go, references to model spec types and constants have been updated to use legacymodelspec instead of modelspec for media types and model config structures, ensuring backward compatibility. [1] [2] [3]
  • In pkg/backend/processor/base.go, sorting logic for descriptors now checks both the new and legacy annotation keys for file paths, improving compatibility with older model spec annotations. [1] [2]

Signed-off-by: chlins <chlins.zhang@gmail.com>
@chlins chlins added the enhancement New feature or request label Sep 19, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @chlins, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a revert to ensure compatibility with the legacy mediatype for version 0.1.0. It primarily involves switching the model specification package from "github.com/modelpack/model-spec/specs-go/v1" back to "github.com/dragonflyoss/model-spec/specs-go/v1". Additionally, it introduces explicit handling for these legacy types and annotations to maintain backward compatibility within the system.

Highlights

  • Revert Model Specification Package: The codebase has been updated to switch back to using "github.com/dragonflyoss/model-spec/specs-go/v1" for model specifications, replacing the "github.com/modelpack/model-spec/specs-go/v1" package across various backend and test files.
  • Legacy Mediatype Integration: In "pkg/backend/attach.go", references to model spec types and constants now explicitly use "legacymodelspec" (which points to "dragonflyoss") for media types and model configuration, ensuring proper handling of the older format.
  • Enhanced Annotation Compatibility: The sorting logic for descriptors in "pkg/backend/processor/base.go" has been improved to check for file paths using both the current ("modelpack") and legacy ("dragonflyoss") annotation keys, providing robust compatibility with different model spec versions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily updates the model specification dependency from github.com/modelpack/model-spec/specs-go/v1 to github.com/dragonflyoss/model-spec/specs-go/v1 and adds backward compatibility for legacy annotations. The changes are mostly straightforward dependency updates across several files. However, I've identified a critical bug in the sorting logic within pkg/backend/processor/base.go due to a copy-paste error, which would cause incorrect sorting of descriptors. I've provided a fix for this issue. It's also worth noting that the pull request title and description seem to be contradictory, which could cause confusion. The title suggests a revert, while the description and code changes indicate a migration to a new package.

@chlins chlins enabled auto-merge (squash) September 19, 2025 07:59
Copy link
Contributor

@aftersnow aftersnow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins chlins merged commit fc74e95 into main Sep 19, 2025
5 checks passed
@chlins chlins deleted the revert/switch-back-to-legacy-mediatype branch September 19, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants