fix(cli): insight discovery + team get positional ID (audit fix/cli-insight-team-ids)#55
Merged
Merged
Conversation
… insight group purpose Add "See also: fduty insight team|responder|channel" to incident list Long description so agents discover the analytics API without a user prompt. Update insight group Short to call out it is preferred for metrics queries.
PR#50 added positional IDs to incident/alert curated commands but left team get requiring --id. Agents using the positional form got syntax errors (seen 3× in sess_5Cg5UV6WpTY8Yt4VSbHrLw steps 60-61). MaximumNArgs(1) + PreRunE bypass when arg present is consistent with the PR#50 pattern.
cobra.MaximumNArgs(1) was the only direct cobra-validator use in the cli package. The optionalArg helper is the project idiom for an optional positional that has a flag alternative (its doc comment describes exactly this case), and it yields the consistent "expects at most one id" error instead of cobra's default terse message.
- team get: error when positional <id> and any named flag are both provided (previously silently discarded the flag); add test for the conflict case - Restore member-resolution comment explaining the second round-trip - insight Short: trim to 63 chars (was 104, longest in codebase) - incident list Long: use <team|responder|channel> metavar instead of bare pipe to avoid shell-alternation confusion
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
incident list --helpnow cross-referencesfduty insight team|responder|channelso agents see the analytics API without needing a user prompt.insightgroup Short updated to call it out as the preferred tool for metrics queries.team getaccepts an optional positional<id>arg, completing the PR#50 positional-ID rollout (incident/alert already had it). Agents usingfduty team get 123no longer get a syntax error.Evidence
Both regressions confirmed in production session
sess_5Cg5UV6WpTY8Yt4VSbHrLw:incident listfor analytics (P2 prevents this)fduty team get <id>before falling back to--id(P3 prevents this)P1 (
insight responder/team --team-ids) isfixed_pending_deploy— already landed in PR#48 onfeat/ai-sre.Test plan
go test ./internal/cli/... -run 'TestTeamGet' -v— 3 tests all PASSgo test ./internal/cli/... -timeout 60s— full suite PASSgo build ./...— cleanfduty incident list --helpshows "See also: fduty insight team|responder|channel"fduty insight --helpshows updated Shortfduty team get 123resolves without error