Skip to content

fix(issues): Prefer project repositories for code mapping - #123093

Draft
scttcper wants to merge 3 commits into
masterfrom
scttcper/prioritize-linked-repos
Draft

fix(issues): Prefer project repositories for code mapping#123093
scttcper wants to merge 3 commits into
masterfrom
scttcper/prioritize-linked-repos

Conversation

@scttcper

@scttcper scttcper commented Aug 28, 2026

Copy link
Copy Markdown
Member

Automatic code mapping was searching every repository an organization's GitHub installation could see before checking whether the project already had a working mapping. That meant extra tree requests, and repositories unrelated to the project were considered alongside repositories already linked to it.

This checks active project mappings first and skips files they already cover. If discovery is still needed, it searches active repositories linked to the project through ProjectRepository (sentry_projectrepository) first, then falls back to the full organization repository list when none match.

When the same file exists in multiple linked repositories, it stays ambiguous instead of picking one. Java still performs discovery when it needs to rebuild a missing derived in-app rule.

Automatic code mapping scanned every repository the installation could see, including files already covered by an active mapping. That was wasteful and gave unrelated organization repositories the same weight as repositories linked to the project.

Skip covered frames, search linked repositories first, and fall back to organization-wide discovery when none match. Keep Java discovery running when it still needs to rebuild a derived in-app rule.

Preserve repository identity so identical paths in two linked repositories remain ambiguous instead of picking one.

Co-Authored-By: Codex <noreply@openai.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 28, 2026
Comment thread src/sentry/issues/auto_source_code_config/task.py
scttcper and others added 2 commits August 28, 2026 16:56
Filename-only matches create broad empty stack roots. Do not let automatically generated ones suppress discovery for unrelated frames, while keeping manually configured empty roots authoritative.

Co-Authored-By: Codex <noreply@openai.com>
Leave short comments around the Java exception, repository ordering, and ambiguity handling.

Co-Authored-By: Codex <noreply@openai.com>
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.

1 participant