Skip to content

Skip notifications for canceled reconciliations - #974

Open
shubhamcommits wants to merge 1 commit into
fluxcd:mainfrom
shubhamcommits:fix/shutdown-notifications
Open

shubhamcommits wants to merge 1 commit into
fluxcd:mainfrom
shubhamcommits:fix/shutdown-notifications

Conversation

@shubhamcommits

@shubhamcommits shubhamcommits commented Nov 17, 2026 •

Copy link
Copy Markdown

Fixes #491 using the notification suppression approach discussed in the issue.

Skip notification events and their paired event logs when the reconciliation context is canceled. Capture the original context for deferred ImageRepository notifications: the scan timeout context is canceled before that defer runs, so checking it would also suppress ordinary events. Registry errors and exceeded deadlines still produce notifications.

Add context tests, including cancellation with a custom cause, and a real HTTP registry regression covering successful scans, registry errors, scan timeouts, and cancellation during an in-flight request.

Validation:

  • make tidy fmt vet && make test passes, including envtest and the API module.
  • The full controller race suite and 20 repetitions of the new regressions pass.
  • Original-source and mutation controls fail when either the cancellation guard or the original-context capture is removed.
  • Separate agent review exercised ImageRepository and ImagePolicy notification branches, related references, logs, and status preservation.

One initial full-suite run hit the existing readiness test's six-second deadline; the subsequent full gate passed without changing that test or the patch. Live delivery through notification-controller was not exercised.

AI assistance

Codex/GPT-6 assisted with implementation, regression tests, validation harnesses, commit messages, and the PR description.

Avoid emitting failure notifications when the reconciliation context is
canceled during controller shutdown.

Capture the original reconciliation context for deferred notifications so
canceling a scan timeout context does not suppress normal events. Preserve
notifications for registry failures and exceeded deadlines, and cover the
context handling with notification and registry regression tests.

Signed-off-by: Shubham Singh <development.shubhamsingh@gmail.com>
Assisted-by: Codex/GPT-6
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.

Controller shutdown doesn't wait for reconciles to finish

1 participant