Skip to content

feat(incident): add --title alias for incident list (fix doc-vs-code drift)#40

Closed
ysyneu wants to merge 1 commit into
mainfrom
audit-fix/audit-2026-06-11-incident-list-title-flag
Closed

feat(incident): add --title alias for incident list (fix doc-vs-code drift)#40
ysyneu wants to merge 1 commit into
mainfrom
audit-fix/audit-2026-06-11-incident-list-title-flag

Conversation

@ysyneu

@ysyneu ysyneu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

Adds a --title flag to fduty incident list. It is a convenience alias for the existing --query flag — both write to the same query (full-text search) field of ListIncidentsRequest. --query stays authoritative when both are passed, so this is fully non-breaking. The skill reference doc is reconciled to list both flags and explain the alias relationship.

Root cause

The skill reference skills/flashduty-incident/references/flashduty-incident-list.md documented (line 18) and exemplified (line 35: --title "database") a --title flag that did not exist on the incident list command — only --query did (internal/cli/incident.go). An agent that follows the skill types fduty incident list --title "...", cobra rejects it with unknown flag: --title, and the agent falls back to dumping the full incident list and grepping client-side.

Note the audit proposal's original premise ("no server-side filter, so it dumps-then-greps") was inaccurate: a server-side title/content filter already exists via --query. The real, contained bug is the doc-vs-code drift on the flag name — fixed here by making the documented --title real rather than removing it from the docs (so existing skill text and any muscle-memory keep working).

Evidence

  • Audit run: audit-2026-06-11
  • Sessions:
    • sess_JUm6ZDTmUmdUGE2bH4nFLzincident list --since 24h returned 61778 chars / 1918 lines for a one-incident-by-title lookup (the dump-then-grep fallback after the missing flag).
    • sess_a77jGy9XzY2GQLDnUcd3xf — the --tool-spec probing half of the proposal is already shipped on main (cli#34, commit 8cad69d: --tool-spec dropped, --data/stdin only, heredoc example in monit_agent.go Long help). That transcript is from a runner on an old CLI; no code change here addresses it.

Verification

$ env -u GOROOT go build ./...
=== BUILD OK ===

$ env -u GOROOT go test ./internal/cli/ -run 'TestIncidentList' -v
--- PASS: TestIncidentListNumsReachesWire (0.00s)
--- PASS: TestIncidentListTitleReachesWireAsQuery (0.00s)   # --title -> query body field
--- PASS: TestIncidentListQueryWinsOverTitle (0.00s)        # --query wins when both set
PASS
ok  	github.com/flashcatcloud/flashduty-cli/internal/cli	0.830s

$ env -u GOROOT go test ./...
ok  	github.com/flashcatcloud/flashduty-cli/cmd/flashduty
ok  	github.com/flashcatcloud/flashduty-cli/internal/cli
ok  	github.com/flashcatcloud/flashduty-cli/internal/config
ok  	github.com/flashcatcloud/flashduty-cli/internal/output
ok  	github.com/flashcatcloud/flashduty-cli/internal/timeutil
ok  	github.com/flashcatcloud/flashduty-cli/internal/update

$ env -u GOROOT go run ./cmd/flashduty incident list --help | grep -E -- '--title|--query'
      --query string      Free-text search across title/labels/content (...)
      --title string      Search by title/content keyword (alias of --query; --query wins if both set)

$ env -u GOROOT gofmt -l internal/cli/incident.go internal/cli/incident_short_id_test.go
(no output — no formatting diffs)

…de drift

The skill reference flashduty-incident-list.md documented and exemplified a
`--title` flag on `incident list` that did not exist on the command — only
`--query` did. An agent following the skill types `incident list --title "..."`,
cobra rejects it (`unknown flag: --title`), and falls back to dumping the full
incident list then grepping (a 61K / ~1900-line TOON dump for a one-incident
lookup).

Make the documented command real: add a `--title` flag that writes to the same
`query` backend field as `--query` (an alias). `--query` stays authoritative
when both are set, so existing behavior is unchanged. Reconcile the skill doc to
list both flags and note the alias relationship.
@ysyneu

ysyneu commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Superseded. Corrected approach per maintainer: the right fix is to remove the non-existent --title from the skill docs and expose the real --query flag, not to add a --title alias. Reopening as a docs-only change. (audit-2026-06-11)

@ysyneu ysyneu closed this Jun 11, 2026
@ysyneu ysyneu deleted the audit-fix/audit-2026-06-11-incident-list-title-flag branch June 11, 2026 06:35
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