Skip to content

Commit 445bd12

Browse files
committed
test(cli): assert toon default projection against stdout only; alert 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.
1 parent 9b1bebf commit 445bd12

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

internal/cli/fieldproject_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,21 @@ func TestIncidentListStructuredDefaultUsesCompactProjection(t *testing.T) {
134134
stub := newGFStub(t)
135135
stub.data = map[string]any{"items": []any{incidentRow()}, "total": 1}
136136

137-
out, err := execCommand("incident", "list", "--output-format", "toon")
137+
out, stderrText, err := execCommandSplit("incident", "list", "--output-format", "toon")
138138
if err != nil {
139-
t.Fatalf("execCommand: %v", err)
139+
t.Fatalf("execCommandSplit: %v", err)
140140
}
141141

142+
// Positive keys must come from stdout alone: the stderr note embeds the
143+
// same field names, so a merged capture would satisfy this vacuously.
142144
for _, key := range []string{"incident_id", "title", "incident_severity", "progress", "start_time", "channel_id"} {
143145
if !strings.Contains(out, key) {
144146
t.Errorf("default toon output missing compact key %q, got:\n%s", key, out)
145147
}
146148
}
149+
if !strings.Contains(stderrText, "note: rows projected to default compact fields") {
150+
t.Errorf("default projection should announce itself on stderr, got:\n%s", stderrText)
151+
}
147152
for _, key := range []string{"responders", "labels", "description"} {
148153
if strings.Contains(out, key) {
149154
t.Errorf("default toon output should not contain full-record key %q, got:\n%s", key, out)

skills/flashduty/reference/alert.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fduty alert feed <alert-id> --output-format toon
3838
fduty alert-event list --channel <channel-id> --since 1h --limit 30 --output-format toon
3939
```
4040

41-
Structured `alert-event list` output stays below 16 KiB. A trailing `...` means a long retained string was shortened.
41+
Structured `alert-event list` output stays below 16 KiB. A trailing `...` means a long retained string was shortened. In json/toon mode rows default to the compact projection `event_id,alert_id,event_severity,event_status,event_time,title` (a stderr note says so when it applies); any other response field is one `--fields` away — a key missing from the output means it wasn't selected, not that the server omits it.
4242

4343
## Hot flow — merge noisy alerts into an existing incident
4444

0 commit comments

Comments
 (0)