Skip to content

feat(code-mappings): Add directory prefix ranking helper - #126209

Open
Abdkhan14 wants to merge 3 commits into
masterfrom
abdullahkhan/vdy-245-m11-1-directory-prefix-helper-no-http
Open

Abdkhan14 wants to merge 3 commits into
masterfrom
abdullahkhan/vdy-245-m11-1-directory-prefix-helper-no-http

Conversation

@Abdkhan14

@Abdkhan14 Abdkhan14 commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

For project: https://linear.app/getsentry/project/code-mappings-refactor-d3987c38f5f1/overview

directory_prefixes turns one file path into its directory prefixes, each with a trailing slash and never including the filename. rank_directory_prefixes unions those prefixes across many files, counts how many unique files sit under each, and keeps the top 200.

The repo-prefix and stack-prefix autocomplete endpoints will call this. This change has no HTTP surface.

Refs VDY-245

Split file paths into directory prefixes and rank them by how many unique files they cover, for the upcoming prefix autocomplete endpoints.

Refs VDY-245

Co-authored-by: Cursor <cursoragent@cursor.com>
@linear-code

linear-code Bot commented Oct 1, 2026

Copy link
Copy Markdown

VDY-245

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 1, 2026
@Abdkhan14
Abdkhan14 marked this pull request as ready for review October 1, 2026 18:04
@Abdkhan14
Abdkhan14 requested a review from a team as a code owner October 1, 2026 18:04

@cursor cursor Bot left a comment

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.

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 523bbf5. Configure here.

Comment thread src/sentry/issues/auto_source_code_config/directory_prefixes.py Outdated
…efixes

Splitting on '/' dropped the empty segments between the triple slashes, collapsing app:///src/index.tsx into prefixes starting with app:/ instead of app:///. Peel the scheme before splitting and re-attach it to each prefix.

Refs VDY-245

Co-authored-by: Cursor <cursoragent@cursor.com>
@Abdkhan14
Abdkhan14 marked this pull request as draft October 2, 2026 02:32
…e raw path

Stack roots are matched with startswith before any slash rewrite. Rebuilding a path by dropping empty segments turned UNC, scheme:///, and backslash frames into prefixes the frame does not start with. Emit each prefix as a slice of the original path and keep that path's separator.

Refs VDY-245

Co-authored-by: Cursor <cursoragent@cursor.com>
@Abdkhan14
Abdkhan14 marked this pull request as ready for review October 2, 2026 02:58

This branch has not been deployed

No deployments
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