Skip to content

Fix nondeterministic NonNamespaced annotations in register generator - #12

Merged
skevetter merged 1 commit into
mainfrom
fix/nonnamespaced-template
Apr 18, 2026
Merged

Fix nondeterministic NonNamespaced annotations in register generator#12
skevetter merged 1 commit into
mainfrom
fix/nonnamespaced-template

Conversation

@skevetter

@skevetter skevetter commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix NonNamespaced detection being gated behind next.Resource != nil, which caused types discovered first as subtypes to lose the annotation
  • Fix template emitting duplicate // +genclient line when NonNamespaced is false

Two bugs caused nondeterministic NonNamespaced annotations in generated
register files:

1. parse.go gated NonNamespaced detection behind next.Resource != nil,
   but types can be encountered first as subtypes (Resource=nil) via
   map iteration. Since processed types are skipped on re-encounter,
   the Resource version never runs, leaving NonNamespaced=false.

2. The template unconditionally emitted "// +genclient" on one line,
   then conditionally emitted "// +genclient:nonNamespaced" or a
   duplicate "// +genclient" on the next. Now the second line only
   emits when NonNamespaced is true.
@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@skevetter has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 10 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 10 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c7a09764-8ff5-4f2c-b5c1-efae95b08b1e

📥 Commits

Reviewing files that changed from the base of the PR and between 2b0bce6 and 6ab2d5b.

📒 Files selected for processing (2)
  • pkg/generate/parse.go
  • pkg/generate/unversioned_generator.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/nonnamespaced-template

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@skevetter
skevetter merged commit 0adfff4 into main Apr 18, 2026
9 checks passed
@skevetter
skevetter deleted the fix/nonnamespaced-template branch April 18, 2026 22:18
@devsy-app devsy-app Bot mentioned this pull request Apr 18, 2026
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