Skip to content

fix(issue): conditionally collapse lifetime to preserve count/userCount/firstSeen/lastSeen#985

Merged
BYK merged 1 commit into
mainfrom
byk/fix-issue-list-lifetime-collapse
May 20, 2026
Merged

fix(issue): conditionally collapse lifetime to preserve count/userCount/firstSeen/lastSeen#985
BYK merged 1 commit into
mainfrom
byk/fix-issue-list-lifetime-collapse

Conversation

@BYK
Copy link
Copy Markdown
Member

@BYK BYK commented May 20, 2026

Summary

Fixes #969sentry issue list --json --fields count,firstSeen,lastSeen,userCount was silently omitting those fields because collapse=lifetime was always sent to the Sentry API.

Root Cause

buildIssueListCollapse() always included "lifetime" in the collapse array. Despite the JSDoc claiming top-level count/userCount/firstSeen/lastSeen are unaffected by collapsing, collapse=lifetime actually strips these fields from the list endpoint response. This caused:

  • EVENTS: ? in human output (count undefined)
  • SEEN: — / AGE: — (lastSeen/firstSeen undefined)
  • USERS: 0 (userCount undefined)
  • Empty values in --json --fields output

Fix

Makes the lifetime collapse conditional via a new shouldCollapseLifetime parameter on buildIssueListCollapse() (defaults to false).

Lifetime is NOT collapsed (fields available) when:

  • Human output — always needs these for EVENTS, USERS, SEEN, AGE columns
  • JSON mode without --fields — all fields returned
  • JSON mode with --fields that include any of: count, userCount, firstSeen, lastSeen

Lifetime IS collapsed (perf optimization) when:

  • JSON mode with explicit --fields that don't include any lifetime-dependent field

Changes

  • src/lib/api/issues.ts — Added shouldCollapseLifetime option to buildIssueListCollapse(), fixed misleading JSDoc comments
  • src/commands/issue/list.ts — Added LIFETIME_FIELDS set, updated buildListApiOptions() to compute lifetime collapse condition from flags.fields
  • test/lib/issue-collapse.property.test.ts — Updated property tests for new parameter (11 tests, 407 expect calls)
  • test/commands/issue/list.test.ts — Added 4 integration tests covering all lifetime collapse scenarios

@BYK BYK self-assigned this May 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-985/

Built to branch gh-pages at 2026-05-20 14:52 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 20, 2026

Codecov Results 📊

7018 passed | Total: 7018 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests 📈 +6
Passed Tests 📈 +6
Failed Tests
Skipped Tests

All tests are passing successfully.

✅ Patch coverage is 82.14%. Project has 14185 uncovered lines.
✅ Project coverage is 77.12%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/commands/issue/list.ts 82.61% ⚠️ 4 Missing
src/lib/api/issues.ts 80.00% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    77.11%    77.12%    +0.01%
==========================================
  Files          321       321         —
  Lines        61993     62010       +17
  Branches         0         0         —
==========================================
+ Hits         47808     47825       +17
- Misses       14185     14185         —
- Partials         0         0         —

Generated by Codecov Action

…nt/firstSeen/lastSeen (#969)

`collapse=lifetime` on the issues list endpoint strips top-level
`count`, `userCount`, `firstSeen`, and `lastSeen` fields from the
response. The CLI was always sending this collapse parameter, causing
`--json --fields count,firstSeen,...` to return empty values and the
human table to show `EVENTS: ?`, `SEEN: —`, `USERS: 0`.

Now `lifetime` is only collapsed in JSON mode when explicit `--fields`
are provided and none of them are lifetime-dependent. Human output and
JSON without `--fields` always get the full data.

Closes #969
@BYK BYK force-pushed the byk/fix-issue-list-lifetime-collapse branch from a87f1e0 to 1e4b1ce Compare May 20, 2026 14:51
@BYK BYK merged commit 6096cba into main May 20, 2026
30 checks passed
@BYK BYK deleted the byk/fix-issue-list-lifetime-collapse branch May 20, 2026 15:06
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.

sentry issue list --json --fields omits count, firstSeen, lastSeen, userCount (missing expand=stats)

1 participant