Skip to content

[WIP] improve: various simplifications - #3542

Closed
csviri wants to merge 1 commit into
operator-framework:nextfrom
csviri:simplify
Closed

[WIP] improve: various simplifications#3542
csviri wants to merge 1 commit into
operator-framework:nextfrom
csviri:simplify

Conversation

@csviri

@csviri csviri commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Quality-only cleanup, no behavior changes.

Reuse:

  • PrimaryUpdateAndCacheUtils#compareResourceVersions duplicated the whole
    algorithm of ReconcilerUtilsInternal#validateAndCompareResourceVersions
    (including validateResourceVersion) with no production caller; delegate
    instead so the resource-version semantics live in one place.
  • addFinalizerWithSSA builds its bare SSA skeleton with
    HasMetadata#initNameAndNamespaceFrom, as ResourceOperations already does.
  • AbstractInformerPool formats informer identifiers via
    ReconcilerUtilsInternal#getResourceTypeNameWithVersion.
  • EventFilterWindow uses ExtendedResourceEvent#getResourceVersion.
  • Mappers#fromOwnerType uses ResourceID#fromOwnerReference, like its sibling
    fromOwnerReferences.
  • LocallyRunOperatorExtension instantiates reconcilers with Utils#instantiate.

Efficiency:

  • Mappers#fromMetadata hoists the invariant GroupVersionKind out of the
    per-event lambda and compares the encoded string before parsing.
  • SecondaryToPrimaryFromDefaultAnnotation holds one delegate mapper instead of
    building a new one on every event.
  • AbstractWorkflowExecutor sizes its result map from Workflow#size instead of
    building a throwaway map of all dependents per reconciliation.
  • GenericKubernetesResourceMatcher hoists the path-prefix lists to constants
    and drops the stream in nodeIsChildOf; both ran per JSON-diff node.
  • ExternalResourceCachingEventSource and PerResourcePollingEventSource drop a
    duplicate cache lookup and a duplicate ResourceID.fromResource.
  • InformerEventSource#start only walks the informer cache when the
    primary-to-secondary index is not the no-op implementation.

Altitude:

  • Move getKubernetesClient to Informable so InformerManager resolves the
    target client polymorphically instead of downcasting to
    InformerEventSourceConfiguration.
  • ResourceState keeps triggerOnAllEvents as a final field set once by
    ResourceStateManager, rather than receiving the same constant from every
    caller; the state machine's legal transitions are now readable on their own.
  • Drop the unused Options parameter threaded into desiredForJsonPatch.
  • Extract the volume-claim-template sanitization out of sanitizeState.

Quality-only cleanup, no behavior changes.

Reuse:
- PrimaryUpdateAndCacheUtils#compareResourceVersions duplicated the whole
  algorithm of ReconcilerUtilsInternal#validateAndCompareResourceVersions
  (including validateResourceVersion) with no production caller; delegate
  instead so the resource-version semantics live in one place.
- addFinalizerWithSSA builds its bare SSA skeleton with
  HasMetadata#initNameAndNamespaceFrom, as ResourceOperations already does.
- AbstractInformerPool formats informer identifiers via
  ReconcilerUtilsInternal#getResourceTypeNameWithVersion.
- EventFilterWindow uses ExtendedResourceEvent#getResourceVersion.
- Mappers#fromOwnerType uses ResourceID#fromOwnerReference, like its sibling
  fromOwnerReferences.
- LocallyRunOperatorExtension instantiates reconcilers with Utils#instantiate.

Efficiency:
- Mappers#fromMetadata hoists the invariant GroupVersionKind out of the
  per-event lambda and compares the encoded string before parsing.
- SecondaryToPrimaryFromDefaultAnnotation holds one delegate mapper instead of
  building a new one on every event.
- AbstractWorkflowExecutor sizes its result map from Workflow#size instead of
  building a throwaway map of all dependents per reconciliation.
- GenericKubernetesResourceMatcher hoists the path-prefix lists to constants
  and drops the stream in nodeIsChildOf; both ran per JSON-diff node.
- ExternalResourceCachingEventSource and PerResourcePollingEventSource drop a
  duplicate cache lookup and a duplicate ResourceID.fromResource.
- InformerEventSource#start only walks the informer cache when the
  primary-to-secondary index is not the no-op implementation.

Altitude:
- Move getKubernetesClient to Informable so InformerManager resolves the
  target client polymorphically instead of downcasting to
  InformerEventSourceConfiguration.
- ResourceState keeps triggerOnAllEvents as a final field set once by
  ResourceStateManager, rather than receiving the same constant from every
  caller; the state machine's legal transitions are now readable on their own.
- Drop the unused Options parameter threaded into desiredForJsonPatch.
- Extract the volume-claim-template sanitization out of sanitizeState.
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 68736d0b-1d15-4901-bd79-49923e9ba2a2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@csviri csviri changed the title improve: various simplifications [WIP] improve: various simplifications Aug 7, 2026
@csviri csviri closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant