Skip to content

Use go-containerregistry for OCI tag validation#4017

Open
JAORMX wants to merge 3 commits intomainfrom
fix-oci-tag-validation-use-library
Open

Use go-containerregistry for OCI tag validation#4017
JAORMX wants to merge 3 commits intomainfrom
fix-oci-tag-validation-use-library

Conversation

@JAORMX
Copy link
Collaborator

@JAORMX JAORMX commented Mar 5, 2026

Summary

  • Replace hand-rolled regex (^[\w][\w.-]{0,127}$) in validateOCITag with go-containerregistry's nameref.NewTag using StrictValidation
  • Delegates tag validation to the same library already used for OCI reference parsing in parseOCIReference, avoiding drift from the distribution spec
  • Add table-driven unit tests for validateOCITag covering valid and invalid tags

Relates to #4015

Test plan

  • New TestValidateOCITag passes (16 cases: valid versions, hyphens, dots, underscores, boundary lengths; invalid special chars, empty, over-length)
  • Existing TestBuild passes (includes invalid_tag_returns_400 case)
  • Full skillsvc test suite passes
  • Lint clean

🤖 Generated with Claude Code

Replace the hand-rolled regex in validateOCITag with
go-containerregistry's nameref.NewTag using StrictValidation.
This delegates tag validation to the same library already used
for OCI reference parsing, avoiding drift from the distribution spec.

Add table-driven tests for validateOCITag covering valid tags
(versions, hyphens, dots, underscores, boundary lengths) and
invalid tags (special characters, empty, over-length).

Relates to #4015

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the size/XS Extra small PR: < 100 lines changed label Mar 5, 2026
@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 6, 2026
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.56%. Comparing base (e469d48) to head (48deaf2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4017      +/-   ##
==========================================
- Coverage   68.62%   68.56%   -0.06%     
==========================================
  Files         444      444              
  Lines       45222    45222              
==========================================
- Hits        31033    31006      -27     
- Misses      11790    11819      +29     
+ Partials     2399     2397       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Mar 6, 2026
@JAORMX JAORMX requested a review from aponcedeleonch March 6, 2026 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants