fix(issue): handle cross-org project slug collisions in alias generation#62
Merged
fix(issue): handle cross-org project slug collisions in alias generation#62
Conversation
When multiple organizations have projects with the same slug (e.g., org1:dashboard and org2:dashboard), the alias generation now produces unique aliases by prefixing with an org abbreviation (e.g., o1-d, o2-d). - Add buildOrgAwareAliases() to detect and handle slug collisions - Store both hyphenated (o1-d) and compact (o1d) formats for ease of use - Preserve existing short alias behavior for non-colliding projects Fixes #48
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Issue
Other
Bug Fixes 🐛Issue
Other
Documentation 📚
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ Patch coverage is 99.24%. Project has 1424 uncovered lines. Files with missing lines (18)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 60.64% 63.25% +2.61%
==========================================
Files 33 33 —
Lines 3775 3875 +100
Branches 0 0 —
==========================================
+ Hits 2289 2451 +162
- Misses 1486 1424 -62
- Partials 0 0 —Generated by Codecov Action |
- Use findShortestUniquePrefixes for colliding project slugs to handle cases like 'api' and 'app' both colliding across orgs (prevents identical aliases like 'o1-a' for both) - Remove compact alias storage (e.g., 'o1d' for 'o1-d') to avoid potential overwrites and edge cases with hyphenated org names - Add test for same-letter colliding project slugs
…ollision Change the separator in org-prefixed aliases from hyphen to colon (e.g., 'o1:d' instead of 'o1-d'). This prevents potential collisions between unique project aliases (which can contain hyphens) and colliding project aliases. Since Sentry slugs cannot contain colons, the two alias namespaces are now completely disjoint.
Add a dedicated ALIAS column in multi-project mode that shows the typeable shorthand (e.g., 'o1:d-a3') for each issue. This replaces the previous approach of trying to underline parts of the short ID. Changes: - Add COL_ALIAS constant (15 chars) for the new column - Update formatIssueListHeader to conditionally show ALIAS column - Update formatIssueRow to include alias shorthand in multi-project mode - Simplify formatShortId since alias is now in its own column - Add tests for ALIAS column formatting Layout in multi-project mode: LEVEL ALIAS SHORT ID COUNT SEEN TITLE ERROR o1:d-a3 DASHBOARD-A3 42 2h ago Something broke Layout in single-project mode (unchanged): LEVEL SHORT ID COUNT SEEN TITLE ERROR DASHBOARD-A3 42 2h ago Something broke
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
The strippedPrefix field was no longer used after simplifying formatShortId() to show alias in a dedicated ALIAS column. This removes: - strippedPrefix from FormatShortIdOptions type - strippedPrefix from OrgAwareAliasResult type - References in list.ts and related tests The prefix stripping logic is preserved internally in alias.ts for generating short aliases, but is no longer exposed in the return type.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #48 - Project alias collisions when multiple orgs have the same project slug.
Problem
The
buildProjectAliasMapfunction only considered project slugs when computing aliases, ignoring the organization. This caused collisions when two projects from different orgs had the same slug (e.g.,org1:dashboardandorg2:dashboardboth got aliasd), making one project's issues inaccessible via alias shortcuts.Solution
buildOrgAwareAliases()function that detects cross-org slug collisions{orgPrefix}-{projectPrefix}format (e.g.,o1-d,o2-d)f,b)o1-d) and compact (o1d) formats for ease of useBehavior
acme:frontend,acme:backendf,bf,b(unchanged)org1:dashboard,org2:dashboardd(bug)o1-d,o2-dTesting
Added 10 test cases covering collision detection, org prefix generation, and edge cases.