feat(utils): add robust SplitList utility with unit tests (Fixes #555)#785
Merged
ispeakc0de merged 3 commits intolitmuschaos:masterfrom Jan 21, 2026
Merged
feat(utils): add robust SplitList utility with unit tests (Fixes #555)#785ispeakc0de merged 3 commits intolitmuschaos:masterfrom
ispeakc0de merged 3 commits intolitmuschaos:masterfrom
Conversation
6925b56 to
b671b1b
Compare
b671b1b to
80af7a1
Compare
ispeakc0de
approved these changes
Jan 14, 2026
…uschaos#555) Signed-off-by: Naveen <107784608+xnaveenx@users.noreply.github.com>
d1defe1 to
e5fa482
Compare
Signed-off-by: Naveen <107784608+xnaveenx@users.noreply.github.com>
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 / why we need it:
This PR introduces a centralized helper function SplitList in pkg/utils/stringutils to safely handle comma-separated strings. It addresses the logic bug described in #555 where empty strings incorrectly resulted in a slice of length 1.
Improvements over previous attempts: This PR supersedes stale PRs #564 and #686 by:
Centralizing Logic: Instead of fixing individual experiment files inline, this provides a reusable, tested function.
Edge Case Handling: Automatically trims spaces ("a, b" -> ["a","b"]) and filters empty elements ("a,,b" -> ["a","b"]).
Robust Testing: Includes unit tests covering edge cases like inputs containing only commas (,,,), satisfying the feedback left on PR #686.
Which issue this PR fixes:
fixes #555
Special notes for your reviewer:
Strategy: I have purposefully limited this PR to the utility implementation and unit tests to keep the review atomic and clean. Once this is merged, I will open a follow-up "refactor" PR to update the experiment files (e.g., pod_delete.go) to use this new SplitList function.
Checklist:
[x] Fixes #555
[ ] PR messages has document related information
[ ] Labelled this PR & related issue with breaking-changes tag
[ ] PR messages has breaking changes related information
[ ] Labelled this PR & related issue with requires-upgrade tag
[ ] PR messages has upgrade related information
[x] Commit has unit tests
[ ] Commit has integration tests
[ ] E2E run Required for the changes