Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@gfyrag
Copy link
Contributor

@gfyrag gfyrag commented Oct 27, 2025

No description provided.

@gfyrag gfyrag requested a review from a team as a code owner October 27, 2025 10:50
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Three targeted updates: upgrading the controller-gen tool version from v0.14.0 to v0.17.0 in the build configuration, and refactoring error message construction in two error handling files to use explicit format strings via WithMessage("%s", ...) for consistency.

Changes

Cohort / File(s) Change Summary
Build Configuration
Earthfile
Updated controller-gen tool version from v0.14.0 to v0.17.0
Error Message Formatting
internal/core/controllers.go, internal/core/errors.go
Refactored error message construction to use explicit format strings with WithMessage("%s", ...) pattern for safer handling of string formatting

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • All changes are straightforward and homogeneous: a single version bump and consistent error formatting refactor applied across two files
  • No logic changes, control flow modifications, or public API alterations
  • Pattern is consistent and repetitive across error handling files

Poem

🐰 With cleaner strings and tools so bright,
Error messages formatted right,
From v0.14 to v0.17 we hop,
Control-gen springs to the top,
A tidy update, neat and tight! ✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning No pull request description was provided by the author. An empty description fails to meet the basic requirement of providing content that relates to the changeset. While the level of detail is not important for this check, some description is necessary to satisfy the criterion that the description should be "related in some way to the changeset." Add a description to the pull request that explains the purpose of the changes. Even a brief description would help—for example, explain why the controller-gen version was updated, or clarify how the error formatting changes fix the development environment issues. This will help reviewers understand the context and motivation for the changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The pull request title "fix: devenvs" is vague and generic. The term "devenvs" is non-descriptive and doesn't clearly convey the primary changes in the pull request. While the changes include updates to the Earthfile (controller-gen version), error formatting in controllers.go, and error formatting in errors.go, the title "devenvs" doesn't specifically communicate what the main issue being fixed is, making it difficult to determine if the title meaningfully relates to the changeset. Consider updating the title to be more specific about the main changes. For example, if the primary fix is error formatting, the title could be "fix: use formatted error messages in error constructors". If the primary fix is the controller-gen version update, that could be highlighted instead. A more descriptive title will help reviewers and future maintainers quickly understand the purpose of the changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/devenv

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
internal/core/errors.go (1)

40-40: Defensive format string handling applied.

The explicit format string "%s" prevents accidental interpretation of format specifiers if msg contains % characters. This is good defensive programming, though the risk is minimal since msg is typically a controlled string literal.

For consistency, consider auditing other direct WithMessage(string) calls in the codebase:

#!/bin/bash
# Find other potential WithMessage calls that might benefit from explicit formatting
rg -nP '\.WithMessage\([^"]*\)' --type=go -g '!*_test.go'
internal/core/controllers.go (1)

50-50: Optimize string formatting to avoid unnecessary concatenation.

The explicit format string is good for consistency, but the string concatenation before formatting creates an unnecessary allocation.

Apply this diff to use format arguments directly:

-					setStatus(NewPendingError().WithMessage("%s", "pending condition: "+str))
+					setStatus(NewPendingError().WithMessage("pending condition: %s", str))

This is more efficient and idiomatic as it performs concatenation directly through fmt.Sprintf rather than creating an intermediate string.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2e8da7b and f554abf.

⛔ Files ignored due to path filters (4)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
  • tools/kubectl-stacks/go.mod is excluded by !**/*.mod
  • tools/kubectl-stacks/go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (3)
  • Earthfile (1 hunks)
  • internal/core/controllers.go (1 hunks)
  • internal/core/errors.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
internal/core/controllers.go (1)
internal/core/errors.go (1)
  • NewPendingError (35-37)
🔇 Additional comments (1)
Earthfile (1)

18-18: Verify generated code after controller-gen upgrade to v0.17.0.

The upgrade spans three minor versions with documented changes affecting code generation:

  • v0.16.0 strips comments from CRD descriptions (marked as breaking)
  • v0.17.0 adds support for encoding.TextMarshaler (marked as warning)
  • Multiple fixes for Go 1.23 type alias handling in deepcopy and CRD generation

Regenerate CRDs (line 117) and deepcopy code (line 27) using the new version and verify the outputs for differences, particularly in generated manifests and type alias handling.

}

setStatus(NewPendingError().WithMessage("pending condition: " + str))
setStatus(NewPendingError().WithMessage("%s", "pending condition: "+str))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
setStatus(NewPendingError().WithMessage("%s", "pending condition: "+str))
setStatus(NewPendingError().WithMessage( "pending condition: %s", str))

Copy link
Contributor

Choose a reason for hiding this comment

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

(I might be missing somethign?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated by the pre-commit

controller-gen:
FROM core+builder-image
DO --pass-args core+GO_INSTALL --package=sigs.k8s.io/controller-tools/cmd/controller-gen@v0.14.0
DO --pass-args core+GO_INSTALL --package=sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fguery This is the culprit. In conjunction with the go version from what I have understood.

@gfyrag gfyrag requested a review from sylr October 28, 2025 10:43
@gfyrag gfyrag merged commit e610fb2 into main Oct 28, 2025
6 checks passed
@gfyrag gfyrag deleted the fix/devenv branch October 28, 2025 10:48
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.

5 participants