Skip to content

feat(seer): Add bulk Seer project connected repos endpoint#115942

Merged
srest2021 merged 55 commits into
masterfrom
srest2021/CW-1286-bulk
May 21, 2026
Merged

feat(seer): Add bulk Seer project connected repos endpoint#115942
srest2021 merged 55 commits into
masterfrom
srest2021/CW-1286-bulk

Conversation

@srest2021
Copy link
Copy Markdown
Member

@srest2021 srest2021 commented May 20, 2026

Fixes CW-1286

Depends on #115199 and #115904

Adds a bulk Seer project repos endpoint ProjectSeerReposEndpoint (GET/POST/PUT) at /api/0/projects/{org}/{project}/seer/repos/ with ProjectPermission.

GET — List connected repos

Lists all connected Seer project repos for a project. Supports search by name (substring, case-insensitive) and provider (exact match, supports =, !=, IN, NOT IN, with or without integrations: prefix), sorting by name/-name/provider/-provider, and offset pagination. Excludes inactive repos and unsupported providers.

GET /api/0/projects/my-org/my-project/seer/repos/?query=relay&sortBy=-name

POST — Add repos

Upserts repos by ID. Validates all repo IDs are active, belong to the org, and have supported providers — returns 400 with invalid IDs if not. Rejects empty lists, duplicate repo IDs, and duplicate branch overrides.

POST /api/0/projects/my-org/my-project/seer/repos/
{
  "repos": [
    {"repositoryId": 1, "branchName": "main", "instructions": "use pytest"},
    {"repositoryId": 2, "branchOverrides": [
      {"tagName": "environment", "tagValue": "production", "branchName": "release"}
    ]}
  ]
}

PUT — Replace all repos

Replaces all connected repos for the project atomically. Accepts an empty list to disconnect all repos. Same validation as POST for non-empty lists.

PUT /api/0/projects/my-org/my-project/seer/repos/
{
  "repos": [
    {"repositoryId": 3, "branchName": "develop"}
  ]
}

srest2021 and others added 29 commits May 8, 2026 10:37
Add utility functions for managing SeerProjectRepository records:
- add_seer_project_repos (upsert with branch overrides)
- replace_all_seer_project_repos (atomic replace)
- update_seer_project_repo (single-repo update with row lock)
- replace_all_branch_overrides helper
- _validate_repo_ids for repo ID validation
- Resolve conflicts with utils branch (CW-1286-utils)
- Strip bulk endpoint (GET list, POST, PUT) — will be in separate PR
- Keep only single-repo details endpoint (GET, PUT, DELETE)
- Move repo ID validation to endpoint layer
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 20, 2026

CW-1286

@srest2021 srest2021 requested a review from a team as a code owner May 20, 2026 21:33
Comment thread src/sentry/seer/endpoints/project_seer_repos.py
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 6b1b6cf. Configure here.

Comment thread src/sentry/seer/endpoints/project_seer_repos.py
JonasBa pushed a commit that referenced this pull request May 21, 2026
Relates to CW-1286

CRUD helpers for `SeerProjectRepository`, to be used by the new bulk
Seer project repos endpoints in
#115942.

- **`add_seer_project_repos(project, repos_data)`** — Upsert repos with
`update_or_create`. Creates `ProjectRepository` if needed. Returns list
of created/updated IDs. Used by the bulk POST endpoint.
- **`replace_all_seer_project_repos(project, repos_data)`** — Atomically
deletes all active Seer repos for a project and recreates from
`repos_data`. Used by the bulk PUT endpoint.
Base automatically changed from srest2021/CW-1286 to master May 21, 2026 18:26
Comment thread src/sentry/seer/endpoints/project_seer_repos.py
Comment thread src/sentry/seer/endpoints/project_seer_repos.py
Comment thread src/sentry/seer/endpoints/project_seer_repos.py Outdated
Comment thread src/sentry/seer/endpoints/project_seer_repos.py
@srest2021 srest2021 merged commit f7661e9 into master May 21, 2026
65 checks passed
@srest2021 srest2021 deleted the srest2021/CW-1286-bulk branch May 21, 2026 19:58
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