Skip to content

fix(cli): print a GVK as group/version/Kind - #422

Merged
rogirun merged 3 commits into
dsx-ai-factory:mainfrom
rogirun:fix/cli-gvk-format
Oct 5, 2026
Merged

rogirun merged 3 commits into
dsx-ai-factory:mainfrom
rogirun:fix/cli-gvk-format

Conversation

@rogirun

@rogirun rogirun commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do?

The CLI printed a GVK the way apimachinery renders it, kubeflow.org/v1, Kind=PyTorchJob, which reads as a Go struct dump. It now prints group/version/Kind, for example kubeflow.org/v1/PyTorchJob, and v1/Pod for the core group.

The new definitions.FormatGVK is used wherever the CLI names a type: resolver errors, the cluster collision warning, the no-definition error, and the kli definitions --group/--kind miss. The kli validate success line also labels it GVK: instead of maps:

Before: OK: my-karta.yaml is a valid Karta definition (maps kubeflow.org/v1, Kind=PyTorchJob)
After:  OK: my-karta.yaml is a valid Karta definition (GVK: kubeflow.org/v1/PyTorchJob)

Output change: the gvk field of the kli describe -o json no-definition payload uses the new format. The design doc marks the JSON shape unstable until v1, but a script that parses this field will see the change.

Related issue(s)

Replaces #415, which was opened from a branch in this repo before PRs moved to forks.

Part of #411 (item 4). The other items are in separate PRs.

Checklist

  • All commits are signed off with DCO (git commit -s)
  • New/modified files have SPDX license and copyright headers
  • Documentation updated (if applicable)
  • Tests pass (make check)
  • No proprietary or internal information included

Summary by CodeRabbit

  • Improvements
    • Standardized resource type names in CLI output and errors to use group/version/kind formatting, including for core-group resources.
    • Validation success messages now label the resource type as GVK.

apimachinery renders a GVK as "group/version, Kind=Kind", which reads as a
Go struct dump. The CLI now prints group/version/Kind, the apiVersion a
manifest carries followed by its kind, wherever it names a type: resolver
errors, the collision warning, the no-definition error and the
definitions --group/--kind miss. The kli validate success line labels it
"GVK:" instead of "maps".

The gvk field of the describe -o json no-definition payload changes format
with it.

Part of dsx-ai-factory#411

Signed-off-by: Roee Gil <roee.gil@run.ai>
The core group is the empty string, so a kind-only definitions filter in
it rendered as "/Pod" in the no-match message. It now renders the kind
alone.

Part of dsx-ai-factory#411

Signed-off-by: Roee Gil <roee.gil@run.ai>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: 36d4d069-ebd0-400b-8d6e-6efb832f7b91
📥 Commits

Reviewing files that changed from the base of the PR and between 161936c and ea9c9dd.

📒 Files selected for processing (9)
  • cli/cmd/definitions.go
  • cli/cmd/definitions_test.go
  • cli/cmd/describe.go
  • cli/cmd/validate.go
  • cli/cmd/validate_test.go
  • cli/pkg/definitions/load.go
  • cli/pkg/definitions/load_test.go
  • cli/pkg/definitions/resolver.go
  • cli/pkg/definitions/resolver_test.go

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


📝 Walkthrough

Walkthrough

The CLI now formats GVK values as slash-separated group, version, and kind strings in resolver errors, filter descriptions, validation output, missing-definition output, and collision warnings. Core-group formatting omits the group.

Changes

GVK formatting

Layer / File(s) Summary
Shared formatter and resolver errors
cli/pkg/definitions/resolver.go, cli/pkg/definitions/resolver_test.go
Added FormatGVK and used it in resolver errors. Tests cover named-group and core-group formatting.
CLI descriptions and command output
cli/cmd/definitions.go, cli/cmd/definitions_test.go, cli/cmd/describe.go, cli/cmd/validate.go, cli/cmd/validate_test.go
Filter descriptions, missing-definition output, and validation success output use slash-separated GVK strings. Related expectations were updated.
Collision warnings
cli/pkg/definitions/load.go, cli/pkg/definitions/load_test.go
Collision warnings use FormatGVK, and their expected GVK text was updated.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 14fd8

The CLI output changes follow the stated GVK-formatting intent, and no concrete merge-blocking regression is established. The JSON field’s format change is documented for script users.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: CLI GVK output now uses the group/version/Kind format.
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 unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@rogirun

rogirun commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Closed for now while this goes through review in the fork (rogirun#1). It will be reopened, or a new PR opened, when that review is done.

@rogirun rogirun closed this Oct 5, 2026
@rogirun

rogirun commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Reopened: reviewed and merged in the fork as rogirun#1. Same two commits, ready to land upstream.

@rogirun rogirun reopened this Oct 5, 2026
@rogirun
rogirun merged commit 0d7c8eb into dsx-ai-factory:main Oct 5, 2026
5 checks passed
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.

2 participants