feat(cli): announce the default compact projection on stderr - #139
Merged
Conversation
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.
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.
In json/toon mode,
incident list,incident similarandalert-event listsilently reduce rows to a compact default field set. A reader piping stdout to jq sees an unselected key (labels,description, …) asnullon every row and can reasonably conclude the server never returns it — when it is one--fieldsaway. The incident card documents the projection, but nothing at invocation time points back to it.Change
noteDefaultProjectionhelper: whenever the default projection applies (no--fields), print one stderr line naming the projected fields and the--fieldsescape hatch. stdout stays byte-identical, so jq/toon pipelines are unaffected.alert listuntouched — it has no default projection (bare--jsondumps full records).--fields, and wide fields over many rows hit the 16 KiB structured-output bound → smaller--limit/paging, orinsightaggregates for distributions.execCommandSplitcaptures 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-cardsOK.