Skip to content

perf(cli): Filter repositories by name in set-commits --auto - #1538

Open
scttcper wants to merge 2 commits into
mainfrom
scttcper/set-commits-filter-repos
Open

scttcper wants to merge 2 commits into
mainfrom
scttcper/set-commits-filter-repos

Conversation

@scttcper

@scttcper scttcper commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

set-commits --auto walks every page of the org's repositories to find the one matching the git remote. The repos endpoint sorts by name with offset pagination and counts hits, so each page reads and sorts every repository in the org. Orgs with tens of thousands of repositories make hundreds of requests per run at hundreds of milliseconds each.

/organizations/{org}/repos/ gets about 15M requests a week, nearly all from set-commits via the bundler plugins and the release GitHub Action: ~700 hours of request time a week (92ms p50, 450ms p95) and ~85 hours of database time for the repo list query. Today that traffic comes from the Rust sentry-cli, which walks every page the same way.

This passes the remote's name as query (the endpoint's case-insensitive name filter) and keeps the exact match on the client, so it's usually one request. If the filtered lookup is empty, a per_page=1 request checks whether the org has any repositories, so the "no repository integrations" fallback and cache still work. Servers that ignore query return every repository and the exact match still finds it.

Also fixes the setCommitsAuto JSDoc, which had NO_REPO_INTEGRATIONS_MESSAGE inserted in the middle of it.

setCommitsAuto walked every page of the org's repositories to find the one
matching the git remote, which is hundreds of requests for orgs with
thousands of repositories. Pass the remote name as the endpoint's `query`
filter and keep the exact match on the client. When the filtered lookup is
empty, check for any repository so the no-integration fallback still works.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
sentry-local Skipped Skipped Oct 17, 2026 11:53pm UTC

Request Review

Comment thread packages/cli/src/lib/api/releases.ts Outdated
const endpoint = `organizations/${orgSlug}/releases/${encodeURIComponent(version)}/`;
throw new ApiError(
NO_REPO_INTEGRATIONS_MESSAGE,
400,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be a 404, right? 400 usually indicates incorrect inputs etc.

@BYK
BYK marked this pull request as ready for review October 17, 2026 23:26
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 17, 2026
The client-side "no repository integrations" error used status 400, which
error reporting and isUserError treat as a CLI bug. Use 404 so it's
classified as a user error, and match it in the set-commits fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was previously deployed

1 inactive deployment
Preview — 1dbb6042 Deployed Oct 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants