refactor(api): wire listIssuesPaginated through @sentry/api SDK for type safety#310
Merged
refactor(api): wire listIssuesPaginated through @sentry/api SDK for type safety#310
Conversation
…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
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Api
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 2110 passed | Total: 2110 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 3574 uncovered lines. Files with missing lines (1)
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 |
There was a problem hiding this comment.
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).
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.
Summary
listIssuesPaginatedpreviously used a hand-rolledorgScopedRequestPaginatedcall, which meant query parameter names and types were invisible to TypeScript. Thelimitvsper_pagemismatch (fixed in #309) is exactly the class of bug this creates.This PR migrates the function to use
listAnOrganization_sIssuesfrom@sentry/api, following the same pattern already used by logs and transactions.Changes
unwrapPaginatedResult<T>— new helper that wrapsunwrapResultwhile preserving theResponseto extract the Link header for cursor pagination; needed because the SDK result carriesresponseat runtime but not in its TypeScript typeIssueSort— exported type derived directly fromListAnOrganizationSissuesData["query"]["sort"]; now covers all 6 sorts (date,new,freq,user,inbox,trends) and stays in sync with the SDK automaticallylistIssuesPaginated— body replaced withgetOrgSdkConfig+listAnOrganization_sIssues+unwrapPaginatedResult; public signature unchangedlistIssuesAllPagessort param updated toIssueSortNo callers changed. All 2203 tests pass.