Repository navigation
Fix: kube.#List reads the resource its schema declares - #266
Merged
Merged
Conversation
#List declares $params.resource, but List decoded into ResourceVars, whose resource is tagged "value". A call written to the schema reached List with a nil resource and panicked on GetKind; so did one that left out the optional filter. List now decodes its own ListVars, reading resource, errors when it is missing, and treats an absent filter as none. kubevela#263 fixed the same bug in the legacy vela/op provider; this is the vela/kube one. The existing tests called List with Go structs directly, past the schema; the new ones call #List through its CUE, as a template does. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XN3yiHyAFaPJXDTk1SK3ko Signed-off-by: Brian Kane <briankane1@gmail.com>
briankane
requested review from
FogDong,
Somefive,
anoop2811,
jguionnet,
leejanee and
wonderflow
as code owners
October 9, 2026 10:05
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #266 +/- ##
===========================================
+ Coverage 62.49% 75.42% +12.92%
===========================================
Files 62 73 +11
Lines 4415 5163 +748
===========================================
+ Hits 2759 3894 +1135
+ Misses 1324 1269 -55
+ Partials 332 0 -332
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The schema only asks for strings, so an empty apiVersion reached List and failed later as a client error. List now returns its own error for an empty apiVersion or kind. The unfiltered test also checks that the fixture ConfigMaps come back, not just that a list exists. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XN3yiHyAFaPJXDTk1SK3ko Signed-off-by: Brian Kane <briankane1@gmail.com>
|
Backport failed for Please cherry-pick the changes locally and resolve any conflicts. git fetch origin release-0.6
git worktree add -d .worktree/backport-266-to-release-0.6 origin/release-0.6
cd .worktree/backport-266-to-release-0.6
git switch --create backport-266-to-release-0.6
git cherry-pick -x 3c2e7156426540fa8b006403c403c27d33dd8da7 |
3 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
kube.#Listdeclares$params.resource, but the provider decoded its parameters intoResourceVars, where the resource is read fromvalue. A call written to the schema reachedListwith a nil resource and panicked onGetKind, and so did a call that left out theoptional
filter.Listnow decodes its ownListVars, readingresource, returns an error when it is missing,and treats a missing
filteras no filter. #263 fixed the same bug in the legacyvela/opprovider; this is the
vela/kubeone, which it left as it was.Fixes #
I have:
make reviewableto ensure this PR is ready for review. Ran gofmt, golangci-lint v2.14.0 and staticcheck v0.8.1 on the changed packages; not the full target.backport release-x.ylabels to auto-backport this PR if necessary.How has this code been tested
New
pkg/providers/kube/list_cue_test.gocalls#Listthrough its CUE, the way a templatedoes, with and without a filter. The existing tests called
Listwith Go structs directly, so they never went through the schema. They are updated tothe new parameter type.
Special notes for your reviewer
Unlike #263's legacy fix, there is no fallback to
valuehere:vela/kube's#Listschema isclosed under
$params, so no caller can have passed the resource there.Summary by cubic
Fixes
kube.#Listso it decodes its ownListVarsand readsresourcefrom$params.resource, matching its schema. Previously calls written to the schema reachedListwith a nil resource and panicked, and so did calls that omitted the optionalfilter.Listnow returns an error whenresourceis missing or has an empty apiVersion or kind, and treats an absentfilteras no filter.#Listthe way a template does, with and without a filter, and for an empty apiVersion.Written for commit 720225a. Summary will update on new commits.