You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3c7d085
Browse filesBrowse the repository at this point in the historyBrowse files
fix(issue): stop collapsing stats on piped output and JSON defaults (#1221)
## Summary
Fixes#1219. `sentry issue list` was sending `collapse=stats` whenever
stdout was piped or `--json` was used. On the Sentry API that flag skips
all seen-stats Snuba queries — not just sparklines — so piped tables
showed `—`/`?`/`0` for SEEN/AGE/EVENTS/USERS and JSON omitted basic
fields by default.
Now stats are only collapsed when `--json --fields` explicitly omits
count/timestamp/stats fields. Human output (including piped/agent usage)
always requests seen-stats data; the TREND column is still hidden on
narrow terminals as a display-only concern.
## Test plan
- [x] `pnpm exec vitest run test/commands/issue/list.test.ts -t
"collapse"`
- [ ] `sentry issue list <org>/<project> -q "is:unresolved" | head` —
SEEN/AGE/EVENTS/USERS populated
- [ ] `sentry issue list <org>/<project> --json` — includes `count`,
`userCount`, `firstSeen`, `lastSeen`, `stats`
Fixes#1219
Made with [Cursor](https://cursor.com)
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Copy file name to clipboardExpand all lines: .lore.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@
26
26
***check:stale-refs: generic toolchain consistency scanner derived from package.json**: \`script/check-stale-references.ts\`: reads \`packageManager\` from \`package.json\` (e.g., \`pnpm@10.11.0\`), derives stale PMs dynamically, and scans dev-facing docs/scripts for stale \`\<pm> run\`, \`\<pm> remove\`, \`\<pm> add -d\` commands and \`requires \<pm>\`/\`\<pm> installed\` prerequisite prose. Excludes: user-facing install instructions (fenced code blocks with \`install -g\`/\`add -g\`), the check script itself, and \`node\_modules/\`. Added to CI lint job. \*\*Generic\*\*: if project migrates from pnpm to yarn, changing \`packageManager\` in \`package.json\` auto-flags all \`pnpm run\` references in dev docs — no manual pattern updates needed. Trap: script must exclude itself from scanning or its own JSDoc examples trigger false positives.
* **collapse=lifetime in issue list: LIFETIME\_FIELDS, buildListApiOptions, and API gotcha**: \`src/commands/issue/list.ts\` \`LIFETIME\_FIELDS = new Set(\['count','userCount','firstSeen','lastSeen'])\` — fields stripped by \`collapse=lifetime\` on the list endpoint. \`buildListApiOptions(json, fields)\`: \`collapseLifetime\` only true when \`json && fields !== undefined && fields.length > 0 && !fields.some(f => LIFETIME\_FIELDS.has(f))\`. Human output NEVER collapses lifetime. \`buildIssueListCollapse()\` always starts with \`\['filtered','unhandled']\`, conditionally adds \`'lifetime'\` then \`'stats'\`. \`ISSUE\_DETAIL\_COLLAPSE\` safely includes \`'lifetime'\` — detail endpoint preserves top-level fields regardless. \`IssueViewOutputSchema\` in \`src/types/sentry.ts\` extends \`SentryIssueSchema\` with enrichment fields (\`event\`, \`org\`, \`replayIds\`, \`trace\`) added by \`jsonTransformIssueView\`. Wired via \`schema: IssueViewOutputSchema\` on output config in \`view.ts\`. NOTE: \`count\`/\`userCount\`/\`firstSeen\`/\`lastSeen\` always present on \`issue view\` (detail endpoint) — only potentially absent on \`issue list\` when collapse=lifetime is active.
29
+
* **issue list collapse=stats/lifetime API gotcha: SEEN\_STATS\_FIELDS, LIFETIME\_FIELDS, buildListApiOptions**: On the Sentry list endpoint, \`collapse=stats\` skips \`_get_seen_stats()\` entirely — stripping top-level \`count\`, \`userCount\`, \`firstSeen\`, \`lastSeen\` and the sparkline \`stats\` object (not just TREND). \`src/commands/issue/list.ts\`: \`SEEN_STATS_FIELDS = new Set(\[...LIFETIME_FIELDS, 'stats'])\`; \`shouldCollapseForFields(fields, dependentFields)\` shared by stats/lifetime decisions; \`shouldCollapseStats(json, fields)\` never collapses in human mode; JSON only when \`--fields\` omits all seen-stats fields. \`buildListApiOptions(json, fields)\`: \`collapseLifetime = json && shouldCollapseForFields(fields, LIFETIME_FIELDS)\`. \`buildIssueListCollapse()\` always starts with \`\['filtered','unhandled']\`, conditionally adds \`'lifetime'\` then \`'stats'\`. \`willShowTrend()\` is display-only (hides TREND column on narrow/piped stdout). See #1219. NOTE: \`count\`/\`userCount\`/\`firstSeen\`/\`lastSeen\` always present on \`issue view\` (detail endpoint) — only potentially absent on \`issue list\` when collapse is active.
* **Consola chosen as CLI logger with Sentry createConsolaReporter integration**: Consola is the CLI logger with Sentry \`createConsolaReporter\` integration. Two reporters: FancyReporter (stderr) + Sentry structured logs. Level via \`SENTRY\_LOG\_LEVEL\`. \`buildCommand\` injects hidden \`--log-level\`/\`--verbose\` flags. \`withTag()\` creates independent instances; \`setLogLevel()\` propagates via registry. All user-facing output must use consola, not raw stderr. \`HandlerContext\` intentionally omits stderr. Telemetry opt-out priority: (1) \`SENTRY\_CLI\_NO\_TELEMETRY=1\`, (2) \`DO\_NOT\_TRACK=1\`, (3) \`metadata.defaults.telemetry\`, (4) default on. Shell completions set \`SENTRY\_CLI\_NO\_TELEMETRY=1\` in \`bin.ts\` before imports. Timing queued to \`completion\_telemetry\_queue\` SQLite table; normal runs drain via \`DELETE ... RETURNING\`. \`ENV\_VAR\_REGISTRY\` in \`src/lib/env-registry.ts\` is single source for all honored env vars; \`topLevel: true\` + \`briefDescription\` surfaces in \`--help\`. Add install-script-only vars with \`installOnly: true\`.
0 commit comments