Skip to content

fix: normalize criteria serialization keys to lowercase with omitempty - #2961

Merged
mchmarny merged 8 commits into
NVIDIA:mainfrom
mohityadav8:fix/criteria-serialization-keys
Sep 30, 2026
Merged

mchmarny merged 8 commits into
NVIDIA:mainfrom
mohityadav8:fix/criteria-serialization-keys

Conversation

@mohityadav8

Copy link
Copy Markdown
Contributor

Fixes #2897

Root cause: pkg/client/v1.Criteria had no json/yaml struct tags. encoding/json fell back to Go exported field names (Service, OS, Nodes); yaml.v3 auto-lowercased. Consumers switching formats, or piping recipe list --format json into jq '.[].criteria.service', got null.

Fix:

  • Added json:"field,omitempty" yaml:"field,omitempty" tags to all six fields on Criteria in pkg/client/v1/types.go
  • Updated the pinned ["Service"] assertion in pkg/cli/recipe_list_test.go to ["service"]

Tested: go test ./pkg/client/v1/... and go test ./pkg/cli/... pass.

@mohityadav8
mohityadav8 requested a review from a team as a code owner September 28, 2026 12:02
@copy-pr-bot

copy-pr-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙ïļ Run configuration

Configuration used: Repository: NVIDIA/aicr/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 571c783f-119f-4286-8ffe-ac7b28b79ff0

ðŸ“Ĩ Commits

Reviewing files that changed from the base of the PR and between aa25148 and e0ca518.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

â„đïļ Recent review info
⚙ïļ Run configuration

Configuration used: Repository: NVIDIA/aicr/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: da59dc00-2d29-49df-9ead-97638702ace6

ðŸ“Ĩ Commits

Reviewing files that changed from the base of the PR and between ee74821 and d96f8e0.

📒 Files selected for processing (1)
  • docs/user/cli-reference.md

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.


📝 Walkthrough

Walkthrough

The Criteria fields now use lowercase JSON and YAML keys with omitempty. The filtered JSON test and CLI reference example use lowercase criteria keys. The example omits unset dimensions.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: mchmarny

Merge Risk: ⚩ Minimal · up to d96f8

The CLI output change matches the documented example and inspected in-repository consumers. No confirmed issue blocks merging.

ðŸšĨ Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: normalizing criteria serialization keys to lowercase and omitting zero-value fields.
Description check ✅ Passed The description is directly related to the changes. It explains the root cause, the serialization fix, the test update, and the validation performed.
Linked Issues check ✅ Passed Issue #2897 requires lowercase JSON and YAML keys for all six criteria fields and omission of zero-value fields. pkg/client/v1/types.go adds lowercase json and yaml tags with omitempty for `seâ€Ķ
Out of Scope Changes check ✅ Passed The changes update Criteria serialization, the related CLI test assertion, and the corresponding CLI documentation example. These changes directly support Issue #2897. No unrelated change is identifâ€Ķ
âœĻ Finishing Touches
🧊 Generate unit tests (beta)
  • Create a new PR

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

@github-actions

Copy link
Copy Markdown
Contributor

Recipe evidence check

No leaf overlays affected by this PR.

This gate is warning-only and never blocks merge.

@mchmarny mchmarny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Request changes: 1 MAJOR against ee74821.

Comment thread pkg/client/v1/types.go Resolved
@github-actions

Copy link
Copy Markdown
Contributor

@mchmarny mchmarny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approve: no new findings against d96f8e0; 1 prior finding resolved.

@mchmarny
mchmarny enabled auto-merge (squash) September 30, 2026 14:56
@mchmarny
mchmarny merged commit 6380894 into NVIDIA:main Sep 30, 2026
75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

recipe list: JSON and YAML disagree on criteria key casing

2 participants