Repository navigation
fix(cli): Silence dropped connections and bad sourcemap directories - #1606
Merged
Merged
Conversation
Two kinds of user-environment failures still reached Sentry as issues: - undici aborts a response body with `TypeError: terminated` when the connection drops mid-stream (CLI-2AD). GET bodies are already retried, so one that still escapes is the same offline/proxy noise as `fetch failed` and is now treated as a network error. - A missing, non-directory, or unreadable sourcemap directory throws a ValidationError with field "directory" (CLI-1FN). It is now silenced like the missing --input file case. Other ValidationErrors stay captured. Ported from getsentry/cli#1653 and getsentry/cli#1616. Co-Authored-By: BYK <burak.kaya@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This was referenced Oct 22, 2026
BYK
approved these changes
Oct 23, 2026
7 tasks done
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
…etsentry#1606) ## Summary `sentry project list --limit 200` was sending `per_page=200`. The org projects endpoint returns **400** for that (it does not silently cap at 100 like some other list APIs), so agents that want a slug map of a large org just retry 300/500 and fail the same way. `--limit` is now a total. Each request is capped at `API_MAX_PER_PAGE` (100) and `autoPaginate` fills the rest — same helper issue/trace list already use. `listProjectsPaginated` also clamps so a raw oversized `per_page` cannot leak through. Shared `handleOrgAll` (team/repo list) gets the same auto-pagination, so `--limit 250` actually returns 250 items instead of one capped page of 100. ## Test plan - [ ] `sentry project list <org>/ --limit 200 --json --fields slug,name` returns up to 200 projects (or fewer if the org is smaller), no 400 - [ ] `sentry project list <org>/ --limit 25` still does a single request - [ ] `sentry project list <org>/ -c next` still walks one page at the requested limit - [ ] unit tests: `pnpm exec vitest run test/lib/api-client.coverage.test.ts test/commands/project/list.test.ts test/lib/org-list.test.ts` from `packages/cli` Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
…etsentry#1606) ## Summary `sentry project list --limit 200` was sending `per_page=200`. The org projects endpoint returns **400** for that (it does not silently cap at 100 like some other list APIs), so agents that want a slug map of a large org just retry 300/500 and fail the same way. `--limit` is now a total. Each request is capped at `API_MAX_PER_PAGE` (100) and `autoPaginate` fills the rest — same helper issue/trace list already use. `listProjectsPaginated` also clamps so a raw oversized `per_page` cannot leak through. Shared `handleOrgAll` (team/repo list) gets the same auto-pagination, so `--limit 250` actually returns 250 items instead of one capped page of 100. ## Test plan - [ ] `sentry project list <org>/ --limit 200 --json --fields slug,name` returns up to 200 projects (or fewer if the org is smaller), no 400 - [ ] `sentry project list <org>/ --limit 25` still does a single request - [ ] `sentry project list <org>/ -c next` still walks one page at the requested limit - [ ] unit tests: `pnpm exec vitest run test/lib/api-client.coverage.test.ts test/commands/project/list.test.ts test/lib/org-list.test.ts` from `packages/cli` Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
## Summary `paginate()` currently uses the same `per_page` for every request. A limit of 150 therefore fetches 100 + 100 rows, trims the last 50, and correctly drops the server cursor because using it would skip those trimmed rows. Track the remaining budget inside `paginate()` so that request becomes 100 + 50 and the final cursor points at the first unreturned row. `autoPaginate()` remains unchanged: same signature, same cursor loop, and the same defensive trim-and-drop behavior when an endpoint ignores `per_page`. Split out of getsentry#1606 so the shared helper behavior can be reviewed independently. ## Test plan - `pnpm exec vitest run test/lib/api/infrastructure.test.ts test/lib/auto-paginate.property.test.ts test/lib/api/traces.test.ts test/lib/api/replays.test.ts test/lib/api/logs.test.ts test/lib/api/conversations.test.ts` - `pnpm run lint` - generate schema/docs/SDK, then `pnpm exec tsc --noEmit` Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
joshuawayzwright
pushed a commit
to joshuawayzwright/sentry-mcp
that referenced
this pull request
Nov 16, 2026
## Summary `paginate()` currently uses the same `per_page` for every request. A limit of 150 therefore fetches 100 + 100 rows, trims the last 50, and correctly drops the server cursor because using it would skip those trimmed rows. Track the remaining budget inside `paginate()` so that request becomes 100 + 50 and the final cursor points at the first unreturned row. `autoPaginate()` remains unchanged: same signature, same cursor loop, and the same defensive trim-and-drop behavior when an endpoint ignores `per_page`. Split out of getsentry#1606 so the shared helper behavior can be reviewed independently. ## Test plan - `pnpm exec vitest run test/lib/api/infrastructure.test.ts test/lib/auto-paginate.property.test.ts test/lib/api/traces.test.ts test/lib/api/replays.test.ts test/lib/api/logs.test.ts test/lib/api/conversations.test.ts` - `pnpm run lint` - generate schema/docs/SDK, then `pnpm exec tsc --noEmit` Made with [Cursor](https://cursor.com) Co-authored-by: Cursor <cursoragent@cursor.com>
This branch was previously deployed
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.
Two kinds of user-environment failures still show up in Sentry as CLI issues:
TypeError: terminated(CLI-2AD): undici throws this when the connection drops while the response body is streaming. fix(cli): retry interrupted GET responses across commands #1548 already retries finite GET bodies, so one that still gets through is the same offline/proxy noise asfetch failed.isNetworkError()now matches it too.assertDirectoryReadablethrows aValidationErrorwith field"directory"when the directory doesn't exist, isn't a directory, or can't be read. This is now silenced the same way as the missing--inputfile case (CLI-1JY).The original getsentry/cli#1616 silenced every
ValidationErrorand changedpaginate()back to fixed page sizes. That conflicts with the targeted silencing policy here and with getsentry/cli#1615, so this port only covers the sourcemap directory case.Ported from getsentry/cli#1653 and getsentry/cli#1616, which are being closed with the repo archive.
via BYK.
--
View Junior Session in Sentry