fix(cli): Fix admin cli parsing multiple config values#7726
fix(cli): Fix admin cli parsing multiple config values#7726neil-xie merged 2 commits intocadence-workflow:masterfrom
Conversation
Signed-off-by: Neil Xie <neil.xie@uber.com>
Signed-off-by: Neil Xie <neil.xie@uber.com>
🔍 CI failure analysis for 3e41e2a: The CI failure in TestWatchLoopDisabled is 100% reproducible across four consecutive runs and unrelated to the PR changes, which only modify CLI config parsing code.IssueTest failure in Root CauseThe test This failure has now occurred in four consecutive CI runs (job IDs: 64212973854, 64224949030, 64226978603, 64231234032), confirming it's a highly reproducible issue affecting the master branch, not a flaky test. DetailsThe failure details:
This test failure is completely unrelated to the PR changes. The PR only modifies:
The failing test is in the Code Review ✅ Approved 1 resolved / 1 findingsClean fix with the previous finding resolved — the workaround now always validates reassembled JSON before accepting it, and correctly falls back to the raw array for legitimate multiple-value inputs. ✅ 1 resolved✅ Edge Case: Case 1 reassembles without JSON validation, unlike Case 2
Tip Comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
What changed?
Fixed the bug in the CLI's admin config update command, it can not parse multiple values with comma separated
Why?
The command cadence admin config update --name frontend.validSearchAttributes --value '{"Value":{"DomainID":1,"WorkflowID":1}}' was failing with the error "unexpected end of JSON input".
Root Cause: The urfave/cli v2 library's StringSliceFlag splits values on commas by default. When you passed JSON containing commas like {"Value":{"DomainID":1,"WorkflowID":1}}, it was being split into multiple pieces:
"{"Value":{"DomainID":1" and ""WorkflowID":1}}", which broke the JSON parsing.
How did you test it?
go test -v ./tools/cli -run TestAdminUpdateDynamicConfig
Potential risks
Only affects admin cli tool to update configs, no impact to file based configs
Release notes
Documentation Changes
Reviewer Validation
PR Description Quality (check these before reviewing code):
go testinvocation)