Repository navigation
refactor: extract sync uninstall and chart lock helpers - #2898
Merged
yxxhero merged 1 commit intoNov 15, 2026
Merged
Conversation
Signed-off-by: Виктор Быстров <[email protected]>
ViktorBystrov72
requested review from
aditmeno,
itscaro,
mumoshu,
xiaomudk,
yxxhero and
zhaque44
as code owners
November 14, 2026 08:13
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the state-management helper refactor.
No open issues 🎉
What changed in this PR
This PR reduces complexity in Helmfile’s state-management code by extracting two helpers, addressing #2850 while preserving uninstall behavior and chart-lock handling.
Changes:
- Extracts undesired-release uninstallation and chart-lock repository matching into named helpers.
- Extends uninstall-failure tests to cover pre/post-uninstall hook failures and verify whether Helm deletion occurred.
- Restores the cognitive-complexity limit from 120 to 110.
| File | Description |
|---|---|
pkg/state/state.go |
Extracts helpers while preserving hook order, locking, error bookkeeping, and dependency matching. |
pkg/state/state_test.go |
Adds uninstall-hook failure cases and deletion-count assertions. |
.golangci.yaml |
Restores the cognitive-complexity limit to 110. |
Review effort: Balanced
yxxhero
approved these changes
Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Extract the undesired-release uninstall lifecycle and the chart-lock repository matching loop into named helpers, restoring the
gocognitlimit to 110. Hook order, mutex boundaries, error bookkeeping, Name+Alias matching, normalization and digest handling retain their existing behavior.Fixes #2850.
Measured with golangci-lint 2.15.0:
SyncReleasesrewriteChartDependenciesThe extracted helpers score 7 and 9. The existing undesired-release failure test now also covers failing pre/post-uninstall hooks and verifies whether Helm deletion occurred.
Validation on Go 1.27.3:
pkg/staterace suite andpkg/appSync/Apply/Destroy race tests.make fmt,make check,make check-modernize,make build, and pinned golangci-lint 2.15.0.