docs: fix assert artifact help text on flag mutual exclusivity#768
docs: fix assert artifact help text on flag mutual exclusivity#768dangrondahl merged 3 commits intomainfrom
Conversation
The help text incorrectly stated all four modes were mutually exclusive. In reality only --environment and --policy are mutually exclusive. --flow is an independent filter that can be combined with either.
|
Claude finished @dangrondahl's task in 1m 43s —— View job Review of PR #768
Static AnalysisAll checks pass — Code ReviewHelp text ( Client-side enforcement ( Test update ( What's done well
SummaryClean, well-scoped PR. No issues found. LGTM. |
Use Cobra's MarkFlagsMutuallyExclusive to give users a fast error message without a server round-trip.
|
Added |
|
|
||
| addFingerprintFlags(cmd, o.fingerprintOptions) | ||
| addDryRunFlag(cmd) | ||
| cmd.MarkFlagsMutuallyExclusive("environment", "policy") |
There was a problem hiding this comment.
Bug: This client-side enforcement changes the error message, but the existing test case "15 providing both --environment and --polices fails" in assertArtifact_test.go:184-189 still expects the old server-side error:
"Error: Cannot specify both 'environment_name' and 'policy_name' at the same time\n"
With MarkFlagsMutuallyExclusive, Cobra will now emit:
"Error: if any flags in the group [environment policy] are set none of the others can be; [environment policy] were all set"
The golden string in the test needs to be updated to match the new client-side message, otherwise this test will fail.
…133) ## Summary The assertion scopes table incorrectly listed four mutually exclusive modes. After investigating the server implementation (`src/fastapi_app/common/asserts.py`), only `--environment` and `--policy` are mutually exclusive (server returns 400 if both are provided). `--flow` is an independent filter that narrows the artifact lookup scope. Updated to describe three assertion modes with a note that `--flow` can be combined with any of them. Companion CLI PR: kosli-dev/cli#768
Summary
The help text for
kosli assert artifactincorrectly stated all four modes (environment, policy, flow, all-flows) were mutually exclusive.After investigating the server-side implementation (
src/fastapi_app/common/asserts.py), only--environmentand--policyare mutually exclusive (server returns 400 if both are provided).--flowis an independent filter that can be combined with either.Updated the help text to accurately describe the three assertion modes and clarify that
--flownarrows the artifact lookup scope rather than being a separate exclusive mode.