Skip to content

fix(cli): Stop reporting unknown set-commits --commit repositories as CLI errors - #1903

Closed
sentry-junior[bot] wants to merge 1 commit into
mainfrom
cli/set-commits-silence-repo
Closed

sentry-junior[bot] wants to merge 1 commit into
mainfrom
cli/set-commits-silence-repo

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Part 7 of the set-commits stack, on #1902.

A --commit repository that the org hasn't added to Sentry is a user configuration error, and after #1902 the error says how to fix it. It still opened Sentry issues (CLI-2SK).

classifySilenced now returns a new user_config reason for a ValidationError with field commit.repository. These errors are counted in the cli.error.silenced metric instead of being reported as CLI bugs. Other --commit errors are still reported.

via bete.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 4, 2026 5:35pm UTC

Request Review

@sentry-junior
sentry-junior Bot added this pull request to stack #1867 November 3, 2026 20:02
@github-actions github-actions Bot added the risk: low PR risk score: low label Nov 3, 2026
@betegon
betegon force-pushed the cli/set-commits-silence-repo branch from 1688063 to 6a2c031 Compare November 3, 2026 20:58
@betegon
betegon self-requested a review November 3, 2026 20:59
@betegon
betegon force-pushed the cli/set-commits-silence-repo branch from 6a2c031 to dc54c71 Compare November 3, 2026 21:21
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: low PR risk score: low labels Nov 3, 2026
betegon pushed a commit that referenced this pull request Nov 4, 2026
…inds no repos (#1900)

Part 5 of the set-commits stack. #1866 has merged, so this is now on
`main`. Splits CLI-2SK into one PR per fix.

When the org has no repositories in Sentry, `release set-commits --auto`
only said "No repository integrations configured for this organization."
That's about 27% of CLI-2SK. Nothing on the command line can fix it, so
the error now says where to go next:

- It links the org's source code integrations page
(`/settings/integrations/?category=source%20code%20management`).
- It suggests `sentry integration list <org>/`.
- It suggests `--local` when run inside a git checkout.

The CLI can't install integrations (`sentry integration` only has `list`
and `delete`, and GitHub needs a browser install), so the error sends
people to the Sentry UI.

It stays an `ApiError` with the same message and 404 status, so default
mode still falls back to local history and error reporting still
silences it.

The rest of CLI-2SK is in #1902 (`--commit` with a repository Sentry
doesn't have) and #1903 (stop reporting that one as a CLI error).

## Before / after

The real CLI, run from source, against a local mock of the Sentry API
for an org `acme` with no repositories. Before is `8eba364a` (the old
base, before this change). After is `207c4e8d`, the current head on
`main`.

**Git checkout, `origin` = `github.com/acme/web`**

Before:
```console
$ sentry release set-commits acme/1.0.0 --auto
Error: No repository integrations configured for this organization.
  Endpoint: organizations/acme/releases/1.0.0/
```

After:
```console
$ sentry release set-commits acme/1.0.0 --auto
Error: No repository integrations configured for this organization.
  Endpoint: organizations/acme/repos/
  Connect GitHub, GitLab, Bitbucket, or Azure DevOps to Sentry and add the repository: https://acme.sentry.io/settings/integrations/?category=source%20code%20management

Try:
  sentry integration list acme/
  sentry release set-commits acme/1.0.0 --local
```

**No `.git`, repository from CI variables (`GITHUB_REPOSITORY`,
`GITHUB_SHA`)**

Before:
```console
$ sentry release set-commits acme/1.0.0 --auto
[info] [api.releases] No 'origin' git remote found. Using acme/web@4f2c9e1b7a3d from GITHUB_REPOSITORY/GITHUB_SHA.
Error: No repository integrations configured for this organization.
  Endpoint: organizations/acme/releases/1.0.0/
```

After (no `--local`, since there's no git history to read):
```console
$ sentry release set-commits acme/1.0.0 --auto
[info] [api.releases] No 'origin' git remote found. Using acme/web@4f2c9e1b7a3d from GITHUB_REPOSITORY/GITHUB_SHA.
Error: No repository integrations configured for this organization.
  Endpoint: organizations/acme/repos/
  Connect GitHub, GitLab, Bitbucket, or Azure DevOps to Sentry and add the repository: https://acme.sentry.io/settings/integrations/?category=source%20code%20management

Try:
  sentry integration list acme/
```

Both exit with code 30, before and after.

**Unchanged: default mode still falls back to local history** (same
output before and after):
```console
$ sentry release set-commits acme/1.0.0
[warn] [release.set-commits] Could not auto-discover commits (no repository integration). Falling back to local git history.
Commits Set: 1.0.0
```

**The suggested command runs:**
```console
$ sentry integration list acme/
No integrations found in organization 'acme'.
```

## The integrations link

- **Sentry's UI uses the same link.** The onboarding "link a repository"
task (`static/app/components/onboardingWizard/taskConfig.tsx`) and the
stack trace "add integration" banner (`addIntegrationBanner.tsx`) both
link `/settings/${org}/integrations/` with `query: {category: 'source
code management'}`.
- **The filter shows the right integrations.** The directory reads
`location.query.category` (`integrationListDirectory.tsx`).
`getCategories` in `integrationUtil.tsx` maps the `commits` feature to
`source code management`. The integrations with
`IntegrationFeatures.COMMITS` are GitHub, GitHub Enterprise, GitLab,
Bitbucket, Bitbucket Server, Azure DevOps (`vsts`), and Perforce.
- **The page exists.**
`https://sentry.sentry.io/settings/integrations/?category=source%20code%20management`
returns a 302 to the org login (`/auth/login/sentry/`). A settings path
that doesn't exist redirects to `/settings/sentry/` instead.
- **Self-hosted** uses `/settings/<org>/integrations/`, which is covered
by `sentry-urls.property.test.ts`.

<!-- junior-request-attribution:start -->
via **bete**.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C615WFS9G%3A1793734411.837769 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C615WFS9G%3A1793734411.837769)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C615WFS9G%3A1793734411.837769/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
@betegon
betegon force-pushed the cli/set-commits-silence-repo branch from dc54c71 to 3eb46a4 Compare November 4, 2026 09:27
@sentry-junior
sentry-junior Bot force-pushed the cli/set-commits-silence-repo branch from 3eb46a4 to c97e345 Compare November 4, 2026 09:29
@sentry-junior
sentry-junior Bot force-pushed the cli/set-commits-commit-repo branch from 339c2ed to 9253290 Compare November 4, 2026 09:29
@sentry-junior
sentry-junior Bot force-pushed the cli/set-commits-silence-repo branch from c97e345 to 2276fb1 Compare November 4, 2026 09:59
@sentry-junior
sentry-junior Bot force-pushed the cli/set-commits-commit-repo branch from 9253290 to 49bc712 Compare November 4, 2026 09:59
Base automatically changed from cli/set-commits-commit-repo to main November 4, 2026 17:34
… CLI errors

A `--commit` repository that the org hasn't added to Sentry is a user
configuration error, and the error now says how to fix it. Error
reporting classifies the "commit.repository" ValidationError as the new
`user_config` silence reason, so it is counted in the
`cli.error.silenced` metric instead of opening a Sentry issue
(CLI-2SK).

Co-Authored-By: Miguel Betegon <miguel.betegon@sentry.io>
@betegon
betegon force-pushed the cli/set-commits-silence-repo branch from 2276fb1 to 41fe042 Compare November 4, 2026 17:34
@sentry-junior sentry-junior Bot closed this Nov 4, 2026
@sentry-junior
sentry-junior Bot removed this pull request from stack #1867 November 4, 2026 17:49
betegon added a commit that referenced this pull request Nov 4, 2026
… differs in form (#1948)

Part of the CLI-2SK work. The branch is based on `main` after #1902.
#1903 was closed and is not part of this change.

Sentry matches `--commit` repository names exactly (`Release.set_refs`,
`name__in`). A name that refers to the same repository but is written
differently, for example in a different case, fails with `Invalid
repository names`. On Vercel production builds,
`@sentry/bundler-plugins` passes
`VERCEL_GIT_REPO_OWNER/VERCEL_GIT_REPO_SLUG` as-is, which is one way to
end up with such a name.

**Change.** When the server rejects `--commit` refs as invalid
repository names, the CLI now looks up each rejected name with the same
matching `--auto` uses (`findSentryRepository`: case-insensitive name,
URL path, GitLab display names). If every rejected name matches a Sentry
repository, the CLI retries once with Sentry's names and prints a
warning for each name it replaced. If any rejected name has no match, or
the lookup fails, the command fails with #1902's error and next steps,
unchanged. The commit range (`PREV..SHA`) the caller passed is kept.

## Before / after

The CLI was run from source against a local stand-in for the Sentry API
that rejects names the way `Release.set_refs` does. "Before" is `main`
at `08fac06c` (#1902), "after" is this branch.

### Same repository, different case (org `acme` has `acme/web`)

**Before**

```console
$ sentry release set-commits acme/1.0.0 --commit 'Acme/Web@abc1234..def5678'
Error: Sentry organization 'acme' has no repository named 'Acme/Web'. It has 'acme/web'. --commit needs the repository name exactly as Sentry shows it.

Try:
  sentry release set-commits acme/1.0.0 --commit 'acme/web@abc1234..def5678'
# exit 21
```

**After**

```console
$ sentry release set-commits acme/1.0.0 --commit 'Acme/Web@abc1234..def5678'
[warn] [api.releases] Sentry organization 'acme' has no repository named 'Acme/Web'. Using 'acme/web', the same repository in Sentry.
Commits Set: 1.0.0
━━━━━━━━━━━━━━━━━━

╭─────────┬───────╮
│ Version │ 1.0.0 │
│ Commits │ 3     │
╰─────────┴───────╯
# exit 0
```

The retry sends `acme/web` with the same `abc1234..def5678` range.

### One name matches, another has no match (org `acme` has only
`acme/web`)

Before and after are the same. No retry runs, and no "Using ..." warning
is printed:

```console
$ sentry release set-commits acme/1.0.0 --commit 'Acme/Web@abc1234..def5678,Acme/Api@def5678'
Error: Sentry organization 'acme' has no repository named 'Acme/Web'. It has 'acme/web'. --commit needs the repository name exactly as Sentry shows it.

Try:
  sentry release set-commits acme/1.0.0 --commit 'acme/web@abc1234..def5678'
# exit 21
```

### Org has no repositories

Before and after are the same:

```console
$ sentry release set-commits acme/1.0.0 --commit 'Acme/Web@abc1234..def5678'
Error: Sentry organization 'acme' has no repository named 'Acme/Web'. It has no repositories yet, so it cannot associate commits.

Try:
  sentry integration list acme/

Note: Connect GitHub, GitLab, Bitbucket, or Azure DevOps to Sentry and add the repository: https://acme.sentry.io/settings/integrations/?category=source%20code%20management
# exit 21
```

### Repository not in Sentry, similar names exist (org `acme` has
`acme/website`, `acme/web-app`, `acme/api`)

Before and after are the same:

```console
$ sentry release set-commits acme/1.0.0 --commit 'Acme/Web@abc1234..def5678'
Error: Sentry organization 'acme' has no repository named 'Acme/Web'. It has similarly named repositories: acme/website, acme/web-app.

Try:
  sentry release set-commits acme/1.0.0 --commit 'acme/website@abc1234..def5678'
  sentry release set-commits acme/1.0.0 --commit 'acme/web-app@abc1234..def5678'
  sentry repo list acme/

Note: Add the repository to Sentry through your source code integration: https://acme.sentry.io/settings/repos/
# exit 21
```

## Why the CLI and not only the plugin

The fix applies to every `--commit` caller: the bundler plugin, CI
scripts and people. The plugin keeps passing Vercel's previous
deployment SHA, so the range doesn't change.

## Tests

- `correctRefRepositories`: case-only correction (with its warning), no
match, a later name with no match (no warning, no retry), other errors
(no lookup), lookup failure.
- `set-commits --commit` retries with the corrected refs.
- The release, error-reporting and URL suites pass (284 tests), and
`pnpm run lint` passes. I did not run the full suite.

<!-- junior-request-attribution:start -->
via @betegon.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AC0C615WFS9G%3A1793734411.837769 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/slack%3AC0C615WFS9G%3A1793734411.837769)
[[Sentry]](https://sentry.sentry.io/explore/conversations/slack%3AC0C615WFS9G%3A1793734411.837769/?project=4510944073809921)

<!-- junior-session-footer:end -->

---------

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Miguel Betegon <28983162+betegon@users.noreply.github.com>
Co-authored-by: bete <miguel.betegon@sentry.io>

This branch was successfully deployed

1 active deployment
Preview — 41fe0428 Deployed Nov 4, 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.

0 participants