Skip to content

Comments

fix: sanitize artifacthub version string for semver compliance#845

Open
parthivsaikia wants to merge 5 commits intomeshery:masterfrom
parthivsaikia:fix/artifact-semver
Open

fix: sanitize artifacthub version string for semver compliance#845
parthivsaikia wants to merge 5 commits intomeshery:masterfrom
parthivsaikia:fix/artifact-semver

Conversation

@parthivsaikia
Copy link
Member

Description

This PR updates the ArtifactHub generator to sanitize upstream version strings. Specifically, it uses strings.TrimPrefix to remove the leading v (e.g., converting v2022.06.14 to 2022.06.14) before assigning it to the model version. This ensures compliance with the strict Semantic Versioning checks enforced by the Masterminds/semver library and resolves validation errors for valid upstream charts.

This PR fixes #843

Notes for Reviewers

Verified locally that the fix properly strips the prefix.

The change is isolated to generators/artifacthub/package.go.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: PARTHIV PRATIM SAIKIA <parthivsaikia985@gmail.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @parthivsaikia, 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 resolves an issue where version strings from ArtifactHub, when prefixed with a 'v' (e.g., "v2022.06.14"), failed strict semantic versioning validation. By implementing a TrimPrefix operation, the generator now correctly processes these versions, preventing validation errors for otherwise valid upstream charts and improving data consistency.

Highlights

  • Semantic Versioning Compliance: Updated the ArtifactHub generator to sanitize upstream version strings by removing the leading 'v' prefix, ensuring compliance with strict semantic versioning checks enforced by the Masterminds/semver library.
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
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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
Contributor

@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 addresses an important issue with semver compliance for versions from ArtifactHub by removing the 'v' prefix. The change is straightforward and uses strings.TrimPrefix effectively. My main feedback is regarding testing. While the fix itself is correct, it's not covered by automated tests. I've added a comment suggesting the addition of unit tests to ensure this fix is robust and to prevent future regressions. This will improve the overall quality and maintainability of the code.

Signed-off-by: PARTHIV PRATIM SAIKIA <parthivsaikia985@gmail.com>
@ritesh-karankal
Copy link

Thank you for your contribution! @parthivsaikia 🎉

Let's discuss this PR during the Meshery Development Meeting today.
Please add it as an agenda item to the meeting minutes, including any related topics (issues, enhancements, or blockers) you'd like to cover.

Meshery Development Meeting | December 10th, 2025
Minutes 📝
Meeting ⏰ 10 AM CT | 8:30 PM IST

Copy link
Member

@leecalcote leecalcote left a comment

Choose a reason for hiding this comment

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

@parthivsaikia, thanks for this. Will you provide numbers showing the before and after here? I'm concerned that while this change will be helpful to some models that it will be detrimental to others...

@parthivsaikia
Copy link
Member Author

@leecalcote There are total 5 models affected by this change. Those are:

  1. opscenter-core
  2. opscenter-config
  3. bytebuilders-crds
  4. grafana-ui-server
  5. ui-presets

And this change doesn't introduce any detrimental effect to the other models.

@leecalcote leecalcote added the pr/on hold PR/Issue on hold label Jan 2, 2026
@leecalcote
Copy link
Member

leecalcote commented Jan 2, 2026

@parthivsaikia, why is this bug only affecting such a small number of models?

@leecalcote leecalcote requested a review from aabidsofi19 January 2, 2026 05:16
@parthivsaikia
Copy link
Member Author

@leecalcote only these models are failing because they don't follow the correct standard of versioning (e.g. 1.0.0). The maintainers have incorrectly added a prefix 'v' in the versions making it look like "v1.0.0".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/on hold PR/Issue on hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Artifact Hub generator fails validation on version strings with 'v' prefix

4 participants