Skip to content

feat(seer): Look up a pull request's files by repo name and number - #129322

Merged
joseph-sentry merged 2 commits into
masterfrom
joey--pr-files-by-repo-and-number
Nov 3, 2026
Merged

joseph-sentry merged 2 commits into
masterfrom
joey--pr-files-by-repo-and-number

Conversation

@joseph-sentry

@joseph-sentry joseph-sentry commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds GET /organizations/{org}/repos/pull-request-files/?repo=<owner/name>&number=<n>, which returns a pull request's files from its provider, found by the repository's name and the PR's number.

The existing pull-requests/{id}/files/ endpoint needs our PullRequest row, and Seer runs open and push to PRs we may have no record of. Ask Seer's PR bar needs each of the run's PRs' diffs to show the run's changes on top of them, so it looks PRs up the way Seer knows them.

  • Each file also has its status and previousPath, so renames show correctly.
  • Only active repositories with an integration match, scoped to the organization.
  • Both endpoints share the provider fetch, with the same errors: 404 when the PR is gone, 429 when rate limited, and 502 when the provider fails.

The frontend that uses it is #129323, which should merge after this deploys.

🤖 Generated with Claude Code

Add `GET /organizations/{org}/repos/pull-request-files/?repo=&number=`,
which returns a pull request's files from its provider, found by the
repository's name and the PR's number rather than our PullRequest row.

Seer runs open and push to PRs we may have no record of, and Ask Seer's
PR bar needs each PR's diff to show the run's changes on top of it. The
response adds each file's status and previous path, for renames.

The existing endpoint and the new one share the provider fetch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Oct 30, 2026
@sentry-junior
sentry-junior Bot marked this pull request as ready for review November 2, 2026 19:04
@sentry-junior
sentry-junior Bot requested a review from alexsohn1126 November 2, 2026 19:04
@sentry-junior
sentry-junior Bot requested review from a team as code owners November 2, 2026 19:04

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c3de431. Configure here.

Repository names aren't unique within an org, so picking the oldest match
could fetch another repository's PR with the same number. Return 404 when
the name matches more than one active integrated repo, as resolve_active
does.

Co-Authored-By: Joseph Sawaya <[email protected]>
@joseph-sentry
joseph-sentry merged commit 46cc692 into master Nov 3, 2026
74 checks passed
@joseph-sentry
joseph-sentry deleted the joey--pr-files-by-repo-and-number branch November 3, 2026 15:20
joshuarli added a commit that referenced this pull request Nov 3, 2026
`backend typing` is red on master. It first failed on 56e837a
(#129330), but that commit isn't the cause.

The cause is #129322, which added six unannotated test methods to
`test_organization_pull_request_files.py`. It merged after strict mypy
was turned on in #129614, so the two PRs raced and CI started reporting
`no-untyped-def` on master.

This adds `MagicMock` / `-> None` annotations to those methods, the same
way the rest of the file already does it. Only type hints change. Test
behavior stays the same.

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

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:slack%3AD0BQC9WSQ2E%3A1793720276.363209 -->

--

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

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

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Joshua Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants