Skip to content

chore(repositories): When making a ProjectRepository link, upgrade the source if we have a stronger signal#116543

Open
wedamija wants to merge 2 commits into
masterfrom
danf/proj-repo-link-upgrade-source
Open

chore(repositories): When making a ProjectRepository link, upgrade the source if we have a stronger signal#116543
wedamija wants to merge 2 commits into
masterfrom
danf/proj-repo-link-upgrade-source

Conversation

@wedamija
Copy link
Copy Markdown
Member

We're adding auto detection of links in #116533 and potentially in other places. If we get a stronger signal that the link is correct later we should update the row.

…e source if we have a stronger signal

We're adding auto detection of links in #116533 and potentially in other places. If we get a stronger signal that the link is correct later we should update the row.
@wedamija wedamija requested a review from a team May 29, 2026 23:31
@wedamija wedamija requested review from a team as code owners May 29, 2026 23:31
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 29, 2026
…notation

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Comment thread src/sentry/models/projectrepository.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 202ffbb. Configure here.

Comment thread src/sentry/models/projectrepository.py
Copy link
Copy Markdown
Member

@srest2021 srest2021 left a comment

Choose a reason for hiding this comment

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

Lgtm, couple minor optional nits

source=ProjectRepositorySource.SCM_ONBOARDING,
)
assert not created
assert pr.source == ProjectRepositorySource.MANUAL
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

missing refresh_from_db?

self,
project_id: int,
repository_id: int,
source: int,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can be typed ProjectRepositorySource

and source != ProjectRepositorySource.AUTO_NAME_MATCH
):
project_repo.source = source
project_repo.save(update_fields=["source"])
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could be nice to have an array like

# Indicates how 'strong of a signal' each source is. A lower number indicates
# less confdence that the linking is correct.
SOURCE_PRIORITY: dict[ProjectRepositorySource, int] = {
  MANUAL = 500
  SEE_PREFERENCE = 500
  AUTO_EVENT = 200
  AUTO_NAME_MATCH = 100
}

then we could compare current and new source to decide if we're upgrading.

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.

3 participants