Skip to content

feat(cli): announce the default compact projection on stderr - #139

Merged
ysyneu merged 3 commits into
feat/ai-srefrom
fix/list-projection-notice
Aug 6, 2026
Merged

feat(cli): announce the default compact projection on stderr#139
ysyneu merged 3 commits into
feat/ai-srefrom
fix/list-projection-notice

Conversation

@ysyneu

@ysyneu ysyneu commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

In json/toon mode, incident list, incident similar and alert-event list silently reduce rows to a compact default field set. A reader piping stdout to jq sees an unselected key (labels, description, …) as null on every row and can reasonably conclude the server never returns it — when it is one --fields away. The incident card documents the projection, but nothing at invocation time points back to it.

Change

  • New noteDefaultProjection helper: whenever the default projection applies (no --fields), print one stderr line naming the projected fields and the --fields escape hatch. stdout stays byte-identical, so jq/toon pipelines are unaffected.
  • alert list untouched — it has no default projection (bare --json dumps full records).
  • incident card projection note extended with the two facts the projection hides: any list-response field (labels included) is selectable via --fields, and wide fields over many rows hit the 16 KiB structured-output bound → smaller --limit/paging, or insight aggregates for distributions.
  • Tests: new execCommandSplit captures stdout/stderr separately; projection tests now assert stdout stays pure JSON while the note lands on stderr.

Verification: make (fmt+lint+build) green, go test ./internal/... all pass, make check-cards OK.

ysyneu added 3 commits August 6, 2026 02:35
In json/toon mode, incident list, incident similar and alert-event list
silently reduce rows to a compact default field set. A reader piping
stdout to jq sees an unselected key (labels, description, ...) as null
on every row and can reasonably conclude the server never returns it,
when it is one --fields away — the incident list card even documents the
projection, but nothing at invocation time points back to it.

Print a one-line note on stderr whenever the default projection applies,
naming the projected fields and the --fields escape hatch. stdout stays
byte-identical, so existing jq/toon pipelines are unaffected. alert list
is untouched: it has no default projection (bare --json dumps the full
record).

Also extend the incident card's projection note with the two facts the
projection hides: any list-response field (labels included) is
selectable via --fields, and wide fields over many rows will hit the
16 KiB structured-output bound — page with a smaller --limit or use
insight aggregates for distributions.

Tests: new execCommandSplit captures stdout/stderr separately; the
projection tests now assert stdout stays pure JSON while the note lands
on stderr.
The alerts field appears in list/detail response shapes but no read
endpoint ever fills it; an incident's alerts come only from the
dedicated incident alerts command. Saying every response field is
selectable via --fields would invite --fields alerts and an
always-empty column.
…card parity

The stderr note embeds the default field names, so the merged-capture
toon subtest's positive assertions were satisfied by the note alone.
Switch it to the split capture and check the note on stderr, mirroring
the json subtest.

Also bring alert.md's alert-event list section to parity with the
incident card: name the default compact projection and the --fields
escape hatch.
@ysyneu
ysyneu merged commit 65a9731 into feat/ai-sre Aug 6, 2026
12 checks passed
@ysyneu
ysyneu deleted the fix/list-projection-notice branch August 6, 2026 09:45
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