Repository navigation
fix(grpcapi): skip the status and kind filters when all given values are empty - #7497
Open
harshalsp07 wants to merge 2 commits into
Open
harshalsp07 wants to merge 2 commits into
harshalsp07 wants to merge 2 commits into
Conversation
harshalsp07
requested review from
ffjlabo,
khanhtc1202 and
t-kikuc
and
a balanced review from Copilot
October 19, 2026 07:33
✅ Deploy Preview for pipecd-site canceled.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Both panic paths are safely guarded while preserving existing filtering behavior, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Fixes #7098 by preventing control-plane panics when ListDeployments receives only empty status or kind values.
Changes:
- Adds filters only when non-empty values remain, preserving existing validation.
- Adds regression tests for empty, valid, invalid, and mixed status inputs.
| File | Description |
|---|---|
| pkg/app/server/grpcapi/api.go | Guards status and kind indexing against empty slices. |
| pkg/app/server/grpcapi/api_test.go | Tests filter construction and invalid-input handling. |
Review effort: Balanced
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7497 +/- ##
==========================================
+ Coverage 30.94% 31.04% +0.10%
==========================================
Files 602 602
Lines 52856 52856
==========================================
+ Hits 16357 16410 +53
+ Misses 34956 34899 -57
- Partials 1543 1547 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…alues Fixes pipe-cd#7098. The Status/Kind filters were built by skipping empty strings and then reading statuses[0]/kinds[0], so a request like --status=, (all values empty) indexed an empty slice and panicked the control plane process, which runs without a recovery interceptor. Build the filters only when a non-empty value survived the skip, and add regression tests covering all-empty, mixed, valid, and invalid inputs for both fields. Signed-off-by: Harshal <[email protected]>
Adds a case where both a status and a kind are given so the test checks that the two filters are added independently, and makes the error assertion safe when no error is returned. Signed-off-by: Harshal <[email protected]>
harshalsp07
force-pushed
the
fix/7098-list-deployments-empty-status
branch
from
October 27, 2026 17:56
3935324 to
07d8933
Compare
mohammedfirdouss
approved these changes
Oct 27, 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.
What this PR does:
ListDeploymentsskipped empty values while collecting the status and kind filters, then readstatuses[0]/kinds[0]from the result. A request whose values were all empty, for examplepipectl deployment list --status=,, indexed an empty slice and panicked.The filters are now added only when a non-empty value survived the skip, so an all-empty input behaves the same as no filter at all.
Why we need it:
The API server has no recovery interceptor, so the panic stopped the whole control plane process instead of failing one request. The status and kind fields are free text rather than typed enums, so any client with an API key can reach this with a single bad flag value.
Which issue(s) this PR fixes:
Fixes #7098
Does this PR introduce a user-facing change?:
pipectl deployment list --status=,no longer takes the control plane down. The request is treated as "no filter".How to test:
go test ./pkg/app/server/grpcapi/...covers all-empty, mixed, valid and invalid values for both fields, plus the case where a status and a kind are given together.Without the fix the new test panics at the old line:
Note: #7099 is an earlier attempt at the same fix. It is based on an older master and currently conflicts, so this PR supersedes it.