Skip to content

Conversation

shawkins
Copy link
Collaborator

@shawkins shawkins commented Oct 9, 2025

closes: #2984

After seeing that comparable version support is coming in #2981 (comment) I reviewed the current logic and decided that it could be simplified.

We don't need to explicitly track known versions as a check of whether it's an unknown later version will work just as well.

A reason not to do this is if locking is not used, and you want to react to an older version that may have contained competing changes. However that doesn't seem like a valid thing to do from an eventual consistency perspective.

@Copilot Copilot AI review requested due to automatic review settings October 9, 2025 20:59
@openshift-ci openshift-ci bot requested review from csviri and xstefank October 9, 2025 20:59
Copy link

@Copilot Copilot AI left a comment

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 simplifies the TemporaryResourceCache class by removing the explicit tracking of known resource versions through the knownResourceVersions field and instead uses existing cache checks to determine if a resource version is known.

  • Removed knownResourceVersions field and related initialization logic
  • Simplified the isKnownResourceVersion method to use existing cached resources and tombstones for version checking
  • Eliminated the need to explicitly track known versions during resource updates

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return tombstones.contains(resource.getMetadata().getUid());
}

return !isLaterResourceVersion(resourceId, resource, cachedResource);
Copy link

Copilot AI Oct 9, 2025

Choose a reason for hiding this comment

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

The logic in isKnownResourceVersion has been inverted from checking if a version is in a known set to checking if it's NOT a later version. This semantic change could be confusing and may not be equivalent to the original behavior, especially for edge cases where versions are equal or incomparable.

Suggested change
return !isLaterResourceVersion(resourceId, resource, cachedResource);
return resource.getMetadata().getResourceVersion()
.equals(cachedResource.getMetadata().getResourceVersion());

Copilot uses AI. Check for mistakes.

@shawkins shawkins force-pushed the iss2984 branch 4 times, most recently from f56d852 to c04c09c Compare October 10, 2025 07:10
@csviri csviri linked an issue Oct 10, 2025 that may be closed by this pull request
@csviri
Copy link
Collaborator

csviri commented Oct 10, 2025

checking the KEP:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-api-machinery/5504-comparable-resource-version#conformance-tests

THey are actually not changing anything, just adding utility and tests, so we are fine with this IMHO, I will also do some related PRs.

@csviri
Copy link
Collaborator

csviri commented Oct 10, 2025

@shawkins could you pls rather target next branch for next minor release.

@csviri csviri changed the base branch from main to next October 10, 2025 11:02
@csviri csviri merged commit 4a02911 into operator-framework:next Oct 10, 2025
25 checks passed
@shawkins
Copy link
Collaborator Author

@shawkins could you pls rather target next branch for next minor release.

The changes here a valid in general - they do not depend on #2944

@csviri
Copy link
Collaborator

csviri commented Oct 10, 2025

@shawkins could you pls rather target next branch for next minor release.

The changes here a valid in general - they do not depend on #2944

ahh ok, soory will unlink

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.

Remove the usage of TemporaryResourceCache.knownResourceVersions

2 participants