Skip to content

ref(repositories): Remove feature flag branching for RepositoryProjectPathConfig reads#115607

Merged
wedamija merged 5 commits into
masterfrom
danf/repo-remove-codemappings-branch
May 15, 2026
Merged

ref(repositories): Remove feature flag branching for RepositoryProjectPathConfig reads#115607
wedamija merged 5 commits into
masterfrom
danf/repo-remove-codemappings-branch

Conversation

@wedamija
Copy link
Copy Markdown
Member

Remove the organizations:project-repository-fk-reads flag checks from all RepositoryProjectPathConfig read paths. Always use project_repository FK for queries and attribute access.

For now we'll keep organizations:project-repository-fk-reads around, since we'll have a separate pr to remove reads/writes for code mappings.

Seer removals: #115606

@wedamija wedamija requested review from a team as code owners May 14, 2026 21:22
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 14, 2026
Comment thread src/sentry/integrations/api/endpoints/organization_code_mappings.py
Comment thread src/sentry/integrations/api/endpoints/organization_code_mappings.py
Comment thread src/sentry/integrations/api/endpoints/organization_code_mappings.py Outdated
@wedamija wedamija force-pushed the danf/repo-remove-codemappings-branch branch from 2ade591 to 734fb98 Compare May 14, 2026 21:53
@wedamija wedamija force-pushed the danf/repo-remove-codemappings-branch branch from ea63f2c to e2f0cc9 Compare May 14, 2026 23:03
Comment thread src/sentry/integrations/api/endpoints/organization_code_mappings_bulk.py Outdated
assert (
SeerProjectRepository.objects.filter(
project=self.proj, project_repository_id__isnull=True
project_repository__project=self.proj, project_repository_id__isnull=True
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.

Migration test assertions become vacuous no-ops

Medium Severity

The setup_before_migration now pre-creates all ProjectRepository rows and sets project_repository=pr_a (etc.) on every record before the migration runs, so the migration has nothing to backfill. Additionally, the null-check assertions at lines 174–187 filter with project_repository__project=self.proj, project_repository_id__isnull=True — Django's inner join semantics mean rows with a null FK are excluded by the join, so the count is always 0 regardless of data state. The test no longer validates the migration's actual backfill logic.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e2f0cc9. Configure here.

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.

ur a vacuous no-op

@armenzg armenzg removed the request for review from a team May 15, 2026 11:39
@wedamija wedamija force-pushed the danf/repo-remove-codemappings-branch branch from 682b946 to 6393a13 Compare May 15, 2026 17:43
wedamija added 4 commits May 15, 2026 10:56
…tPathConfig reads

Remove the `organizations:project-repository-fk-reads` flag checks from
all RepositoryProjectPathConfig read paths. Always use `project_repository`
FK for queries and attribute access.

The flag registration is left in place — it will be removed in a
follow-up PR that also drops the old model columns.

Switched paths:
- Code mappings list/validate/create API
- Code mapping serializer
- Code mapping details/delete endpoints
- Code mapping codeowners endpoint
- Stacktrace link resolution
- Source context fetching
- Commit context / suspect commits
- Code owners auto-sync
- Project code owners serializer
- get_sorted_code_mapping_configs
- Autopilot missing SDK integration detector
- Project transfer_to cleanup
@wedamija wedamija force-pushed the danf/repo-remove-codemappings-branch branch from 6393a13 to 90bbe5f Compare May 15, 2026 17:56
@wedamija wedamija requested a review from a team as a code owner May 15, 2026 18:02
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.

There are 2 total unresolved issues (including 1 from previous review).

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 925b5ee. Configure here.

assert pr.project_id == config.project_id
assert pr.repository_id == config.repository_id
assert pr.project_id == config.project_repository.project_id
assert pr.repository_id == config.project_repository.repository_id
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.

FK consistency assertions compare object with itself

Medium Severity

The FK consistency assertions are tautological. pr is fetched via config.project_repository_id, and config.project_repository.project_id resolves through the same FK — so pr.project_id == config.project_repository.project_id compares a ProjectRepository row's fields with itself. The old code compared pr.project_id == config.project_id (the direct FK), which actually verified cross-FK consistency between project_repository and the direct project/repository fields.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 925b5ee. Configure here.

@wedamija wedamija enabled auto-merge (squash) May 15, 2026 18:22
@wedamija wedamija merged commit 2ce4324 into master May 15, 2026
115 of 117 checks passed
@wedamija wedamija deleted the danf/repo-remove-codemappings-branch branch May 15, 2026 18:33
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