Skip to content

controller: fix requeueReconcileErr handling if it ever contains a reason - #100

Merged
pfl merged 1 commit into
intel:mainfrom
tkatila:improve_cp_error_handling
Aug 31, 2026
Merged

controller: fix requeueReconcileErr handling if it ever contains a reason#100
pfl merged 1 commit into
intel:mainfrom
tkatila:improve_cp_error_handling

Conversation

@tkatila

@tkatila tkatila commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Clusterpolicy controller's error handling had a potential bug that if the subcontrollers' code ever changed, the requeue handling would have reported an error.

The changes have currently no functional change.

…ason

Clusterpolicy controller's error handling had a potential bug that if the
subcontrollers' code ever changed, the requeue handling would have reported
an error.

The changes have currently no functional change.

Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the ClusterPolicy controller’s “requeue requested by sub-controller” error handling so that errors.Is(err, requeueReconcileErr{}) reliably detects requeue sentinel errors even when they wrap a real cause, and ensures any wrapped cause can be logged without turning the reconcile into a failure.

Changes:

  • Add Is, Error, and Unwrap methods to requeueReconcileErr to support proper sentinel matching and safe stringification when the embedded error is nil.
  • Introduce logRequeue to optionally log a wrapped cause while still returning nil from the reconcile path.
  • Add unit tests covering sentinel matching, Error, Unwrap, and logRequeue behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/controller/clusterpolicy_controller.go Implements robust sentinel behavior for requeueReconcileErr and logs any wrapped cause during requeue paths.
internal/controller/clusterpolicy_controller_test.go Adds tests validating errors.Is matching, nil-safe Error(), Unwrap(), and logRequeue() behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@pfl
pfl merged commit ced105b into intel:main Aug 31, 2026
11 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.

3 participants