ci: ensure codegen check fails if file(s) changes detected#238
ci: ensure codegen check fails if file(s) changes detected#238
Conversation
Signed-off-by: Artur Troian <troian.ap@gmail.com>
WalkthroughAdds a GitHub Actions Changes
Sequence Diagram(s)mermaid Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@pkg/client/clientset/versioned/fake/clientset_generated.go`:
- Around line 107-113: Fix the misspelled variable name used when asserting the
watch action: replace the incorrect identifier watchActcion with watchAction in
the NewClientset generated code (the block that does if watchActcion, ok :=
action.(testing.WatchActionImpl); ok { opts = watchActcion.ListOptions }),
ensuring metav1.ListOptions is populated from the correct variable and passed to
o.Watch(gvr, ns, opts); update any other identical occurrences coming from the
generator template so the assertion and subsequent use consistently reference
watchAction.
- Around line 54-60: There is a typo in the variable name used for the type
assertion: change the identifier watchActcion to watchAction wherever it appears
(the short variable in the type assertion action.(testing.WatchActionImpl) and
its subsequent use watchAction.ListOptions) so the code compiles and reads
correctly; if this file is generated, fix the generator template that emits the
variable name instead of editing only this generated file.
| var opts metav1.ListOptions | ||
| if watchActcion, ok := action.(testing.WatchActionImpl); ok { | ||
| opts = watchActcion.ListOptions | ||
| } | ||
| gvr := action.GetResource() | ||
| ns := action.GetNamespace() | ||
| watch, err := o.Watch(gvr, ns) | ||
| watch, err := o.Watch(gvr, ns, opts) |
There was a problem hiding this comment.
Typo in variable name: watchActcion should be watchAction.
There's a typo on line 55: watchActcion instead of watchAction. Since this file is marked as generated code (line 17), this suggests either the code generator has a bug or this file was manually edited.
If manually edited, please fix the typo. If this is generated output, the fix should be applied to the generator template.
🐛 Proposed fix
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
var opts metav1.ListOptions
- if watchActcion, ok := action.(testing.WatchActionImpl); ok {
- opts = watchActcion.ListOptions
+ if watchAction, ok := action.(testing.WatchActionImpl); ok {
+ opts = watchAction.ListOptions
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var opts metav1.ListOptions | |
| if watchActcion, ok := action.(testing.WatchActionImpl); ok { | |
| opts = watchActcion.ListOptions | |
| } | |
| gvr := action.GetResource() | |
| ns := action.GetNamespace() | |
| watch, err := o.Watch(gvr, ns) | |
| watch, err := o.Watch(gvr, ns, opts) | |
| var opts metav1.ListOptions | |
| if watchAction, ok := action.(testing.WatchActionImpl); ok { | |
| opts = watchAction.ListOptions | |
| } | |
| gvr := action.GetResource() | |
| ns := action.GetNamespace() | |
| watch, err := o.Watch(gvr, ns, opts) |
🤖 Prompt for AI Agents
In `@pkg/client/clientset/versioned/fake/clientset_generated.go` around lines 54 -
60, There is a typo in the variable name used for the type assertion: change the
identifier watchActcion to watchAction wherever it appears (the short variable
in the type assertion action.(testing.WatchActionImpl) and its subsequent use
watchAction.ListOptions) so the code compiles and reads correctly; if this file
is generated, fix the generator template that emits the variable name instead of
editing only this generated file.
| var opts metav1.ListOptions | ||
| if watchActcion, ok := action.(testing.WatchActionImpl); ok { | ||
| opts = watchActcion.ListOptions | ||
| } | ||
| gvr := action.GetResource() | ||
| ns := action.GetNamespace() | ||
| watch, err := o.Watch(gvr, ns) | ||
| watch, err := o.Watch(gvr, ns, opts) |
There was a problem hiding this comment.
Same typo: watchActcion should be watchAction.
The same typo appears here in NewClientset. This reinforces that the issue likely originates from the code generator template.
🐛 Proposed fix
cs.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) {
var opts metav1.ListOptions
- if watchActcion, ok := action.(testing.WatchActionImpl); ok {
- opts = watchActcion.ListOptions
+ if watchAction, ok := action.(testing.WatchActionImpl); ok {
+ opts = watchAction.ListOptions
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| var opts metav1.ListOptions | |
| if watchActcion, ok := action.(testing.WatchActionImpl); ok { | |
| opts = watchActcion.ListOptions | |
| } | |
| gvr := action.GetResource() | |
| ns := action.GetNamespace() | |
| watch, err := o.Watch(gvr, ns) | |
| watch, err := o.Watch(gvr, ns, opts) | |
| var opts metav1.ListOptions | |
| if watchAction, ok := action.(testing.WatchActionImpl); ok { | |
| opts = watchAction.ListOptions | |
| } | |
| gvr := action.GetResource() | |
| ns := action.GetNamespace() | |
| watch, err := o.Watch(gvr, ns, opts) |
🤖 Prompt for AI Agents
In `@pkg/client/clientset/versioned/fake/clientset_generated.go` around lines 107
- 113, Fix the misspelled variable name used when asserting the watch action:
replace the incorrect identifier watchActcion with watchAction in the
NewClientset generated code (the block that does if watchActcion, ok :=
action.(testing.WatchActionImpl); ok { opts = watchActcion.ListOptions }),
ensuring metav1.ListOptions is populated from the correct variable and passed to
o.Watch(gvr, ns, opts); update any other identical occurrences coming from the
generator template so the assertion and subsequent use consistently reference
watchAction.
No description provided.