Skip to content

GEP-33 addition : fix image metadata read #33

Closed
anton-paulovich wants to merge 2 commits into
masterfrom
fix/gep-33
Closed

GEP-33 addition : fix image metadata read #33
anton-paulovich wants to merge 2 commits into
masterfrom
fix/gep-33

Conversation

@anton-paulovich

@anton-paulovich anton-paulovich commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Read metadata not only from annotations, but from labels too

example image manifest : https://github.com/gardenlinux/gardenlinux-sci/pkgs/container/gardenlinux-ccloud/453780162?tag=1921.0.0-metal-sci-usi-amd64-1921.0-4cde331e-amd64

Summary by CodeRabbit

  • Bug Fixes
    • Improved OCI image metadata reading to support both annotation and label sources, with preference for annotations when available. This enhances compatibility with different OCI image formats.

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@anton-paulovich, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 11 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0d651f76-1d61-4235-b1fc-c2bdb689bb53

📥 Commits

Reviewing files that changed from the base of the PR and between 072774f and c804930.

📒 Files selected for processing (1)
  • cloudprofilesync/source.go
📝 Walkthrough

Walkthrough

In cloudprofilesync/source.go, the OCI manifest decoding struct is extended with a Labels field alongside Annotations. A selection step then picks Annotations when non-empty, otherwise falls back to Labels, and all subsequent metadata extraction (architecture, feature_set, version) uses this selected map.

Changes

OCI Manifest Metadata Fallback

Layer / File(s) Summary
Manifest struct and metadata selection logic
cloudprofilesync/source.go
Decoded manifest struct gains a Labels field. After decoding, a local metadata map is set to manifest.Annotations when non-empty, otherwise manifest.Labels. Extraction of architecture, feature_set, and version is then performed against this selected map.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

A rabbit sniffed the manifest with care,
"Annotations first," it said, "but labels are there!"
When one map is empty, the other shall do,
architecture found whichever path it ran through.
🐇 No version left behind — hooray for fallback too!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'GEP-33 addition : fix image metadata read' clearly relates to the main change in the PR, which modifies image metadata reading in OCI manifest decoding to handle both annotations and labels.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gep-33

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cloudprofilesync/source.go`:
- Around line 157-160: The error message in the fmt.Errorf call for the
architecture lookup is outdated and misleading. Since the meta lookup now
includes both annotations and labels (not just annotations), update the error
message in the line where architecture is checked to accurately reflect that the
architecture annotation or label was not found, rather than claiming only the
annotation is missing. This will provide accurate context during debugging and
triage.
- Around line 153-165: The metadata lookup is using per-map fallback where
either manifest.Annotations or manifest.Labels is selected upfront and reused
for all subsequent key lookups. This fails when metadata keys are split across
both maps (e.g., architecture in labels but feature_set in annotations), causing
valid images to be incorrectly rejected. Change the approach to per-key lookup:
instead of assigning a single meta map and reusing it, check both
manifest.Annotations and manifest.Labels independently for each key access
("architecture", "feature_set", "version") so that keys can be found regardless
of which map they reside in.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 401280d3-f99f-4098-9224-a01238257414

📥 Commits

Reviewing files that changed from the base of the PR and between 01b6df2 and 072774f.

📒 Files selected for processing (1)
  • cloudprofilesync/source.go

Comment thread cloudprofilesync/source.go Outdated
Comment thread cloudprofilesync/source.go Outdated
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/cobaltcore-dev/cloud-profile-sync/cloudprofilesync 88.89% (+0.35%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/cobaltcore-dev/cloud-profile-sync/cloudprofilesync/source.go 88.61% (+0.77%) 79 (+5) 70 (+5) 9 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

@anton-paulovich

Copy link
Copy Markdown
Collaborator Author

wrong idea

@anton-paulovich anton-paulovich deleted the fix/gep-33 branch June 15, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant