Repository navigation
feat(seer-settings): Use linked project repos as Seer repos under token-based billing - #128629
Conversation
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
| 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) |
There was a problem hiding this comment.
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
Check the token-based billing flag directly so this can merge separately from the cached helper.
| return features.has( | ||
| "organizations:seer-token-based-billing-onboarding", organization | ||
| ) and features.has("organizations:token-billed-seer-enabled", organization) |
There was a problem hiding this comment.
Adding another feature flag for my onboarding changes as an additional safeguard until "organizations:token-billed-seer-enabled" is working reliably
| repository__integration_id__isnull=False, | ||
| repository__external_id__isnull=False, | ||
| ) | ||
| .exclude(repository__external_id="") |
There was a problem hiding this comment.
These filters match the ones I added to get_autofix_repos_from_project_code_mappings
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.

fixes CW-2248
Under token-based billing, a project's Seer repos are all of its linked
ProjectRepositoryrows, withSeerProjectRepositoryas 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 theorganizations:seer-token-based-billing-onboardingflag and token-based billing are both on.Seat-based and legacy orgs are unchanged.