Skip to content

fix(code-mappings): Match a pasted link to its repo at a path boundary - #128185

Closed
vaind wants to merge 1 commit into
masterfrom
ivan/repo-path-parsing-repo-boundary
Closed

vaind wants to merge 1 commit into
masterfrom
ivan/repo-path-parsing-repo-boundary

Conversation

@vaind

@vaind vaind commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

When you set up a code mapping by pasting a link to a file, Sentry finds the connected repository the link points into. It took any repository whose URL was the start of the link, so a link into acme/app-v2 also matched acme/app. The repositories come back in no particular order, so Sentry could create the code mapping against acme/app without any error: the file path still parses, because the parser strips the shorter repository's URL and finds /blob/<branch>/... right after it.

The repository URL now has to end where the link continues with a /. This is the repository-level version of the integration-level bug fixed in #128171 and its sibling PRs, and it doesn't depend on them.

No flag: the check only gets stricter, and the only links it stops matching are ones that pointed into a different repository. Azure DevOps links name the file in the query string, not the path, but they never reach this check: the endpoint already rejects them, because the last path segment is the repository name, not the file name.

repo_match took any repository whose URL was a text prefix of the link, so a link into
acme/app-v2 also matched acme/app. The repository query has no order, so the code mapping
could silently point at the wrong repository: the path parser strips the shorter repo's
prefix and still finds a plausible branch and file path.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 20, 2026
@vaind

vaind commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #128328.

@vaind vaind closed this Oct 22, 2026
@vaind
vaind deleted the ivan/repo-path-parsing-repo-boundary branch October 22, 2026 13:16
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