Skip to content

refactor(api): wire listIssuesPaginated through @sentry/api SDK for type safety#310

Merged
BYK merged 3 commits intomainfrom
refactor/issues-sdk-type-safety
Feb 28, 2026
Merged

refactor(api): wire listIssuesPaginated through @sentry/api SDK for type safety#310
BYK merged 3 commits intomainfrom
refactor/issues-sdk-type-safety

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 28, 2026

Summary

listIssuesPaginated previously used a hand-rolled orgScopedRequestPaginated call, which meant query parameter names and types were invisible to TypeScript. The limit vs per_page mismatch (fixed in #309) is exactly the class of bug this creates.

This PR migrates the function to use listAnOrganization_sIssues from @sentry/api, following the same pattern already used by logs and transactions.

Changes

  • unwrapPaginatedResult<T> — new helper that wraps unwrapResult while preserving the Response to extract the Link header for cursor pagination; needed because the SDK result carries response at runtime but not in its TypeScript type
  • IssueSort — exported type derived directly from ListAnOrganizationSissuesData["query"]["sort"]; now covers all 6 sorts (date, new, freq, user, inbox, trends) and stays in sync with the SDK automatically
  • listIssuesPaginated — body replaced with getOrgSdkConfig + listAnOrganization_sIssues + unwrapPaginatedResult; public signature unchanged
  • listIssuesAllPages sort param updated to IssueSort

No callers changed. All 2203 tests pass.

…ype safety

- Add `unwrapPaginatedResult` helper that unwraps SDK result data while
  also extracting the Link header for cursor pagination
- Export `IssueSort` type derived from `ListAnOrganizationSissuesData`
  so sort options stay in sync with the SDK automatically
- Replace hand-rolled `orgScopedRequestPaginated` call in
  `listIssuesPaginated` with `listAnOrganization_sIssues` + `getOrgSdkConfig`
- Update `listIssuesAllPages` sort parameter to use the exported `IssueSort`
- Remove the now-redundant hand-maintained sort union literal
@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (issue-list) Global limit with fair distribution, compound cursor, and richer progress by BYK in #306

Bug Fixes 🐛

Api

  • Use limit param for issues endpoint page size by BYK in #309
  • Auto-correct ':' to '=' in --field values with a warning by BYK in #302

Other

  • (ci) Generate JUnit XML to silence codecov-action warnings by BYK in #300
  • (nightly) Push to GHCR from artifacts dir so layer titles are bare filenames by BYK in #301
  • (test) Handle 0/-0 in getComparator anti-symmetry property test by BYK in #308

Internal Changes 🔧

  • (api) Wire listIssuesPaginated through @sentry/api SDK for type safety by BYK in #310

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2026

Codecov Results 📊

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

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 3574 uncovered lines.
✅ Project coverage is 77.05%. Comparing base (base) to head (head).

Files with missing lines (1)
File Patch % Lines
api-client.ts 72.70% ⚠️ 243 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    77.04%    77.05%    +0.01%
==========================================
  Files          117       117         —
  Lines        15564     15576       +12
  Branches         0         0         —
==========================================
+ Hits         11990     12002       +12
- Misses        3574      3574         —
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK marked this pull request as ready for review February 28, 2026 11:31
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Lore appended 12 duplicate copies of the Long-term Knowledge section
(~1044 extra lines) below the canonical auto-maintained section. Keep
only the single authoritative copy (lines 626-711).
@BYK BYK merged commit 3fb33b1 into main Feb 28, 2026
20 checks passed
@BYK BYK deleted the refactor/issues-sdk-type-safety branch February 28, 2026 13:46
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