Skip to content

fix(nvca): merge labels/annos in miniservice metadata cm - #609

Open
estroz wants to merge 1 commit into
mainfrom
estroczynski/fix/ms-metadata-cm-overrides
Open

fix(nvca): merge labels/annos in miniservice metadata cm#609
estroz wants to merge 1 commit into
mainfrom
estroczynski/fix/ms-metadata-cm-overrides

Conversation

@estroz

@estroz estroz commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

TL;DR

Fix labels/annos merging in miniservice metadata ConfigMap

Additional Details (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

For the Reviewer

For QA (optional for docs, build, test, refactor, ci, chore, style, and revert PRs)

Issues

Checklist

  • I am familiar with the Contributing Guidelines.
  • I have signed off my commits for Developer Certificate of Origin (DCO) compliance.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

Summary by CodeRabbit

  • Bug Fixes
    • Preserved existing labels and annotations when generating miniservice metadata.
    • Prevented previously configured metadata from being unintentionally overwritten.

Signed-off-by: Eric Stroczynski <estroczynski@nvidia.com>
@estroz
estroz requested a review from a team as a code owner July 31, 2026 21:21
@estroz
estroz requested a review from FamousDirector July 31, 2026 21:21
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The miniservice metadata builder now preserves existing labels and annotations. It initializes nil maps and merges generated metadata instead of replacing existing entries.

Changes

Metadata preservation

Layer / File(s) Summary
Merge generated metadata
src/compute-plane-services/nvca/internal/miniservice/metadata_configmap.go
The builder uses the maps package to merge generated labels and annotations into existing maps. Nil maps are initialized before merging.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: famousdirector

🚥 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 follows Conventional Commits and accurately describes the label and annotation merge fix in miniservice metadata.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch estroczynski/fix/ms-metadata-cm-overrides

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@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: 1

🤖 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 `@src/compute-plane-services/nvca/internal/miniservice/metadata_configmap.go`:
- Around line 92-105: Extend the regression coverage for the metadata merge
logic around newGeneralObjectLabelsAndAnnotations and the metadata_configmap
round-trip test: verify unrelated labels and annotations are preserved, nil
input maps are handled, and duplicate keys retain the generated values currently
established by maps.Copy. Add focused cases for both labels and annotations
without changing the merge implementation.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 48676d95-1444-4524-a63b-604078523936

📥 Commits

Reviewing files that changed from the base of the PR and between d6f0435 and f998df7.

📒 Files selected for processing (1)
  • src/compute-plane-services/nvca/internal/miniservice/metadata_configmap.go

Comment on lines +92 to +105
labels, annotations := newGeneralObjectLabelsAndAnnotations(
r.FeatureFlagFetcher, ms, icmsReq,
r.ClusterRegion, r.ClusterName, in.FunctionName, in.TaskName, false,
)
if meta.Labels == nil {
meta.Labels = labels
} else {
maps.Copy(meta.Labels, labels)
}
if meta.Annotations == nil {
meta.Annotations = annotations
} else {
maps.Copy(meta.Annotations, annotations)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add regression coverage for the merge contract.

The supplied metadata_configmap_test.go round-trip test does not verify that unrelated labels and annotations survive the merge. It also does not define duplicate-key precedence. Add cases for preserved entries, nil input maps, and the intended collision behavior. The current code gives generated values precedence for duplicate keys. (pkg.go.dev)

If tests are intentionally omitted, explain the omission in the Pull Request description.

As per coding guidelines, code changes must include tests; if tests are omitted, explain why in the Pull Request description.

🤖 Prompt for 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.

In `@src/compute-plane-services/nvca/internal/miniservice/metadata_configmap.go`
around lines 92 - 105, Extend the regression coverage for the metadata merge
logic around newGeneralObjectLabelsAndAnnotations and the metadata_configmap
round-trip test: verify unrelated labels and annotations are preserved, nil
input maps are handled, and duplicate keys retain the generated values currently
established by maps.Copy. Add focused cases for both labels and annotations
without changing the merge implementation.

Source: Coding guidelines

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