Skip to content

fix(cli): insight discovery + team get positional ID (audit fix/cli-insight-team-ids)#55

Merged
ysyneu merged 4 commits into
feat/ai-srefrom
fix/cli-insight-team-ids
Jun 17, 2026
Merged

fix(cli): insight discovery + team get positional ID (audit fix/cli-insight-team-ids)#55
ysyneu merged 4 commits into
feat/ai-srefrom
fix/cli-insight-team-ids

Conversation

@ysyneu

@ysyneu ysyneu commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • P2incident list --help now cross-references fduty insight team|responder|channel so agents see the analytics API without needing a user prompt. insight group Short updated to call it out as the preferred tool for metrics queries.
  • P3team get accepts an optional positional <id> arg, completing the PR#50 positional-ID rollout (incident/alert already had it). Agents using fduty team get 123 no longer get a syntax error.

Evidence

Both regressions confirmed in production session sess_5Cg5UV6WpTY8Yt4VSbHrLw:

  • 25-step detour using incident list for analytics (P2 prevents this)
  • 3 retries on fduty team get <id> before falling back to --id (P3 prevents this)

P1 (insight responder/team --team-ids) is fixed_pending_deploy — already landed in PR#48 on feat/ai-sre.

Test plan

  • go test ./internal/cli/... -run 'TestTeamGet' -v — 3 tests all PASS
  • go test ./internal/cli/... -timeout 60s — full suite PASS
  • go build ./... — clean
  • fduty incident list --help shows "See also: fduty insight team|responder|channel"
  • fduty insight --help shows updated Short
  • fduty team get 123 resolves without error

ysyneu added 4 commits June 17, 2026 12:32
… 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
@ysyneu ysyneu merged commit b42fcd0 into feat/ai-sre Jun 17, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant