Skip to content

fix: report failed !Desired() sync uninstalls as deletions and lock exectest Deleted - #2853

Merged
yxxhero merged 1 commit into
helmfile:mainfrom
yxxhero:issue-2849-delete-reporting
Oct 27, 2026
Merged

yxxhero merged 1 commit into
helmfile:mainfrom
yxxhero:issue-2849-delete-reporting

Conversation

@yxxhero

@yxxhero yxxhero commented Oct 24, 2026

Copy link
Copy Markdown
Member

Closes #2849

Problem

Two leftovers from the #2843 review round:

  1. SyncReleases' defensive !Desired() uninstall branch accumulated failures in AffectedReleases.Failed, rendering them under the Failed Releases table instead of Failed to Delete Releases — inconsistent with DeleteReleases and DeleteReleasesForSync.
  2. exectest.Helm.Deleted was appended without a mutex (unlike DiffMutex/ReleasesMutex), making concurrent successful-deletion tests unsafe under -race.

Solution

  • Switch the three failure appends in the !Desired() branch to affectedReleases.DeleteFailed.
  • Add exectest.Helm.DeletedMutex and guard the DeleteRelease append via the existing helm.sync helper.
  • New tests: TestHelmState_SyncReleasesUndesiredDeleteFailureReportsDeleteFailed (1 and 2 failing installed: false releases) and TestHelmState_DeleteReleasesConcurrently (5 releases, concurrency 3, successful-deletion counterpart of the existing failed-deletion test).

Verification

  • Both new tests pass with -race
  • go test ./pkg/state/ -run 'SyncReleases' -race and go test ./pkg/app/ -run 'Sync|Apply|Destroy' — green
  • gofmt clean

…xectest Deleted

SyncReleases' defensive !Desired() uninstall branch accumulated failures
in AffectedReleases.Failed, rendering them under the Failed Releases
table instead of Failed to Delete Releases, unlike DeleteReleases and
DeleteReleasesForSync. Accumulate them in DeleteFailed for consistency.

Also add exectest.Helm.DeletedMutex guarding the Deleted append in
DeleteRelease (mirroring DiffMutex/ReleasesMutex), so concurrent
successful-deletion tests can run under -race; add
TestHelmState_DeleteReleasesConcurrently as the successful-deletion
counterpart of TestHelmState_DeleteFailedReleasesConcurrently.

Closes helmfile#2849 (part 1 and part 2)

Signed-off-by: yxxhero <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The focused fixes match the acceptance criteria and existing patterns, with regression coverage and no identified blocking issues.

No open issues 🎉

What changed in this PR

Addresses the follow-ups from #2843 tracked in #2849 by aligning failed-uninstall reporting and supporting concurrency-safe deletion recording in the Helm test double.

Changes:

  • Report all three failure paths in SyncReleases’ undesired-release uninstall branch through DeleteFailed.
  • Add DeletedMutex and use the existing synchronization helper for deletion recording.
  • Add regression tests for failed undesired-release uninstalls and successful concurrent deletions.
File Description
pkg/​state/​state.go Classifies undesired-release uninstall failures as failed deletions.
pkg/​state/​state_test.go Tests deletion failure reporting and successful concurrent deletion recording.
pkg/​exectest/​helm.go Adds mutex-backed synchronization for the Deleted append.

Review effort: Balanced

@yxxhero
yxxhero merged commit 54f255e into helmfile:main Oct 27, 2026
17 checks passed
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.

SyncReleases !Desired() failures report under Failed instead of DeleteFailed; exectest.Helm.Deleted is unsynchronized

3 participants