Skip to content

Commit 3b1d1a4

Browse files
committed
fix(issue list): use org/project key in trimWithProjectGuarantee to handle cross-org slug collisions
1 parent fc05fc3 commit 3b1d1a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/commands/issue/list.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ function writeListHeader(
124124
/** Issue with formatting options attached */
125125
/** @internal */ export type IssueWithOptions = {
126126
issue: SentryIssue;
127+
/** Org slug — used as part of the per-project key in trimWithProjectGuarantee. */
128+
orgSlug: string;
127129
formatOptions: FormatShortIdOptions;
128130
};
129131

@@ -239,6 +241,7 @@ function attachFormatOptions(
239241
const alias = aliasMap.get(key);
240242
return {
241243
issue,
244+
orgSlug: result.target.org,
242245
formatOptions: {
243246
projectSlug: result.target.project,
244247
projectAlias: alias,
@@ -601,7 +604,7 @@ function trimWithProjectGuarantee(
601604
// Pass 1: pick one representative per project from the sorted list
602605
for (let i = 0; i < issues.length && guaranteed.size < limit; i++) {
603606
// biome-ignore lint/style/noNonNullAssertion: i is within bounds
604-
const projectKey = issues[i]!.formatOptions.projectSlug ?? "";
607+
const projectKey = `${issues[i]!.orgSlug}/${issues[i]!.formatOptions.projectSlug ?? ""}`;
605608
if (!seenProjects.has(projectKey)) {
606609
seenProjects.add(projectKey);
607610
guaranteed.add(i);

0 commit comments

Comments
 (0)