backend: helm repository error handling and regression test coverage#5149
Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:mainfrom Apr 16, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens backend Helm HTTP handler behavior by preventing success responses after error paths, mapping repository delete “not found” to HTTP 404, and adding regression tests to lock in the intended semantics.
Changes:
- Ensure chart listing returns immediately after an error (no success payload written after
http.Error). - Return 404 for attempts to delete a non-existent Helm repository, backed by an internal error sentinel.
- Set
Content-Type: application/jsonbefore writing status codes for JSON list endpoints and add regression tests for these cases.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| backend/pkg/helm/repository.go | Adds errRepositoryNotFound, improves lock error handling, fixes JSON header ordering, and maps repo delete not-found to 404. |
| backend/pkg/helm/charts.go | Returns early on chart list errors and fixes JSON header ordering. |
| backend/pkg/helm/repository_test.go | Adds handler-level regression tests for delete-not-found (404) and JSON content-type. |
| backend/pkg/helm/repository_internal_test.go | Adds internal test coverage for RemoveRepository returning the not-found sentinel error. |
| backend/pkg/helm/charts_test.go | Adds regression test ensuring error responses don’t include a success payload for chart listing. |
b9c1fbb to
19b1771
Compare
17dba60 to
09df7ab
Compare
Contributor
Author
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Athang69, yolossn The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Contributor
|
/lgtm |
Contributor
Author
|
Thanks for review @yolossn |
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.
Summary
This PR fixes Helm repository/chart handler error behavior by returning early on chart-list failures, mapping repository-not-found deletes to 404, improving repository lock error handling, and adding regression tests for these paths.
Related Issue
Fixes #ISSUE_NUMBER
Changes
Steps to Test
Notes for the Reviewer