# Sentry

> Tell reviewers when a pull request changes code behind your top unresolved Sentry issues: how the integration works, what it reads and stores, and setup.

When a pull request changes files that appear in the stack traces of your top unresolved Sentry issues, MergeHarbor gives those issues to the reviewer and notes it in the summary, for example: "This change touches code behind Sentry issue API-4F."

## How it works

- In the background, MergeHarbor reads your top unresolved issues from the last 14 days, ordered by frequency (20 by default), with the in-app frames of each issue's latest event. It refreshes them at most once an hour, and only when reviews need them.
- A review uses only the issues whose in-app stack frames are in files the pull request changes. Reviews never wait for Sentry.
- No extra model call is made.

## Connect

1. In Sentry, create a token with the scopes `org:read`, `project:read` and `event:read`. An internal integration token (**Settings → Custom Integrations**) is best; a user auth token also works.
2. In the console, open **Integrations** and choose **Connect** on **Sentry**. You need the `settings.manage` permission.
3. Enter the base URL (`https://sentry.io`, `https://de.sentry.io`, or your self-hosted Sentry), your organization slug and the token.
4. Optionally, open **Settings** to choose which **Sentry projects** to read (empty means all).

## What is read and stored

Issue short ID, title, culprit, event and user counts, last seen time, link, and the file, function and line of in-app stack frames. MergeHarbor does not read event payloads beyond the stack frames. The snapshot is kept until the next refresh and never written to logs. The token is encrypted at rest and never shown again.

## Disconnect

Open the integration in **Integrations** and choose **Disconnect**. MergeHarbor deletes the token and the snapshot. Then delete the token in Sentry, since MergeHarbor cannot revoke it.
