◐ Shell
clean mode source ↗

fix: register event sources when dependents are marked for deletion by SamBarker · Pull Request #3250 · operator-framework/java-operator-sdk

AI review requested due to automatic review settings

March 24, 2026 01:08
…teExecutor

When a BulkDependentResource has an activationCondition and its parent
dependent has a failing reconcilePrecondition, JOSDK's
markDependentsForDelete() cascades to the bulk dependent and fires
NodeDeleteExecutor for it. However, NodeDeleteExecutor does not call
registerOrDeregisterEventSourceBasedOnActivation() before invoking
delete(), so if NodeReconcileExecutor has never run for that node (e.g.
on first reconciliation) the event source is never registered.

The delete() path calls getSecondaryResources() → eventSourceRetriever
.getEventSourceFor() → NoEventSourceForClassException.

This IT demonstrates the bug with a minimal workflow:
  ConfigMapDependentResource  (reconcilePrecondition = ALWAYS_FALSE)
    └── SecretBulkDependentResource  (activationCondition = ALWAYS_TRUE)

The fix is to call registerOrDeregisterEventSourceBasedOnActivation()
in NodeDeleteExecutor.doRun() before calling dependent.delete(),
mirroring what NodeReconcileExecutor already does.

Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Sam Barker <sam@quadrocket.co.uk>
- Make lastError and callCount instance fields on the reconciler; hold
  the reconciler instance as a static field in the IT so tests can
  access state without static leakage between tests
- Add callCount so the test can wait for any reconciliation activity
  (reconcile() or updateErrorStatus()) then assert cleanly, rather than
  timing out if the bug is fixed
- Add @disabled linking to issue operator-framework#3249 so this reproducer-only test
  does not break CI
- Add @sample annotation to match the pattern of other workflow ITs

Assisted-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Sam Barker <sam@quadrocket.co.uk>

SamBarker

@metacosm metacosm changed the title test: add failing IT reproducing NoEventSourceForClassException in NodeDeleteExecutor for activation-conditioned BulkDependentResource fix: register event sources when dependents are marked for deletion

Mar 25, 2026

dongjoon-hyun pushed a commit to apache/spark-kubernetes-operator that referenced this pull request

Mar 26, 2026