Skip to content

Conversation

@bobh66
Copy link
Contributor

@bobh66 bobh66 commented Jan 20, 2026

Description of your changes

Modified the condition Equial() method to check for unset ObservedGeneration fields
when comparing two conditions. If at least one of the ObservedGenerations is 0 then the comparison
will ignore the field since it will always be False.

This can happen when a provider does not set the observedGeneration in a Synced condition during Observe(), which causes it to appear to be different than the Synced condition that is set by the managed reconciler.

Fixes #902

I have:

Need help with this checklist? See the cheat sheet.

Signed-off-by: Bob Haddleton <bob.haddleton@nokia.com>
@bobh66 bobh66 requested a review from a team as a code owner January 20, 2026 01:18
@bobh66 bobh66 requested a review from jbw976 January 20, 2026 01:18
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

The Condition.Equal() method is updated with a guard clause to treat ObservedGeneration as optional during equality comparison. When either condition has ObservedGeneration unset (0), comparison focuses on Type, Status, Reason, and Message, preventing spurious inequality.

Changes

Cohort / File(s) Summary
Condition Equality Logic
apis/common/condition.go
Added guard clause in Equal() method: when either condition has ObservedGeneration == 0, equality ignores the ObservedGeneration field and compares only Type, Status, Reason, and Message. Otherwise, all five fields are compared.
Condition Tests
apis/common/condition_test.go
Added new test case IdenticalWithMissingObservedGeneration verifying that conditions with matching Type/Status/Reason/Message are equal even when ObservedGeneration differs (one set, one unset). Adjusted existing DifferentObservedGeneration case context.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: handling null/unset observedGeneration in the condition Equal() method, matching the core objective of the PR.
Description check ✅ Passed The description is well-related to the changeset, explaining the rationale for modifying Condition.Equal() to ignore unset ObservedGeneration fields and referencing the linked issue.
Linked Issues check ✅ Passed The code changes precisely implement the requirement from issue #902: when either ObservedGeneration is 0, the comparison ignores ObservedGeneration and only compares Type, Status, Reason, and Message [#902].
Out of Scope Changes check ✅ Passed All changes are in-scope: the Equal() method modification and corresponding test case directly address the issue #902 objective with no extraneous modifications.
Breaking Changes ✅ Passed Behavioral change to Condition.Equal() ignores unset ObservedGeneration values, making equality checks more lenient rather than more restrictive, fixing spurious watch events.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Managed Resources are generating watch events on every poll interval due to missing observedGeneration in the Synced condition

1 participant