Skip to content

feat(seer-settings): Use linked project repos as Seer repos under token-based billing - #128629

Merged
srest2021 merged 10 commits into
masterfrom
feat/seer-token-based-billing-readers
Oct 23, 2026
Merged

srest2021 merged 10 commits into
masterfrom
feat/seer-token-based-billing-readers

Conversation

@srest2021

@srest2021 srest2021 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

fixes CW-2248

Under token-based billing, a project's Seer repos are all of its linked ProjectRepository rows, with SeerProjectRepository as optional per-repo config. This switches the shared preference readers (read_preference_from_sentry_db, bulk_read_preferences_from_sentry_db, has_project_connected_repos) to a new shared query when the organizations:seer-token-based-billing-onboarding flag and token-based billing are both on.

Seat-based and legacy orgs are unchanged.

srest2021 and others added 3 commits October 22, 2026 14:26
Add is_seer_token_billed_enabled, which checks organizations:token-billed-seer-enabled with the same Redis cache and 4h TTL as is_seer_seat_based_tier_enabled. The flag resolves through getsentry's billing entitlement service, which is uncached. Nothing calls it yet.

Refs CW-2246
Under token-based billing, a project's Seer repos are its linked ProjectRepository rows, with SeerProjectRepository as optional per-repo config. read_preference_from_sentry_db, bulk_read_preferences_from_sentry_db and has_project_connected_repos switch to a shared query when the new organizations:seer-token-based-billing-onboarding flag and token-based billing are both enabled. Seat-based and legacy paths are unchanged.

The shared query only returns active repos with a supported provider, an integration and an external ID, and skips repos disabled for Seer.

Refs CW-2248
@linear-code

linear-code Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

CW-2248

CW-2246

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 23, 2026
@srest2021 srest2021 changed the title feat(seer): Use linked repos as Seer repos under token-based billing feat(seer): Use linked project repos as Seer repos under token-based billing Oct 23, 2026
Comment thread src/sentry/features/temporary.py Outdated
Comment thread src/sentry/seer/autofix/utils.py Outdated
Returns None if Repository name is invalid."""
repo = seer_project_repo.project_repository.repository
repo = project_repo.repository
seer_project_repo = get_seer_project_repo(project_repo)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Verified that when the seat-based path passes seer_project_repo.project_repository as project_repo, get_seer_project_repo(project_repo) does not do an additional query

@srest2021
srest2021 changed the base branch from feat/seer-token-billed-helper to master October 23, 2026 17:42
Check the token-based billing flag directly so this can merge separately from the cached helper.
Comment on lines +1003 to +1005
return features.has(
"organizations:seer-token-based-billing-onboarding", organization
) and features.has("organizations:token-billed-seer-enabled", organization)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Adding another feature flag for my onboarding changes as an additional safeguard until "organizations:token-billed-seer-enabled" is working reliably

@srest2021
srest2021 marked this pull request as ready for review October 23, 2026 17:56
@srest2021
srest2021 requested review from a team as code owners October 23, 2026 17:56
@srest2021
srest2021 requested a review from a team October 23, 2026 17:57
repository__integration_id__isnull=False,
repository__external_id__isnull=False,
)
.exclude(repository__external_id="")

@srest2021 srest2021 Oct 23, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

These filters match the ones I added to get_autofix_repos_from_project_code_mappings

@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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 018fa63. Configure here.

Comment thread src/sentry/seer/autofix/utils.py
@srest2021 srest2021 changed the title feat(seer): Use linked project repos as Seer repos under token-based billing feat(seer-settings): Use linked project repos as Seer repos under token-based billing Oct 23, 2026
Comment thread src/sentry/seer/autofix/utils.py Outdated
@srest2021
srest2021 removed the request for review from a team October 23, 2026 22:22
@srest2021
srest2021 enabled auto-merge (squash) October 23, 2026 22:52
@srest2021
srest2021 merged commit 555f01a into master Oct 23, 2026
89 checks passed
@srest2021
srest2021 deleted the feat/seer-token-based-billing-readers branch October 23, 2026 22:53
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants