Skip to content

Commit d2356fb

Browse files
committed
fix(report): show bare repo name in top-repos-by-severity bars
Every repo in scope shares the scan target's owner, so the prefix is noise in these bars. Strip it for the visible label via a new format/repo.ts helper; the full owner/name stays in the hover tooltip and the methodology appendix.
1 parent eb84da9 commit d2356fb

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/report/web/App.browser.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ describe('App report shell', () => {
148148
});
149149

150150
const table = screen.getByTestId(riskStoryTestIds.topReposTable);
151-
expect(within(table).getByText('acme/repo-5')).toBeInTheDocument();
152-
expect(within(table).queryByText('acme/repo-6')).not.toBeInTheDocument();
151+
expect(within(table).getByText('repo-5')).toBeInTheDocument();
152+
expect(within(table).queryByText('repo-6')).not.toBeInTheDocument();
153153

154154
fireEvent.click(screen.getByTestId(riskStoryTestIds.topReposToggle));
155155

156-
expect(within(table).getByText('acme/repo-6')).toBeInTheDocument();
156+
expect(within(table).getByText('repo-6')).toBeInTheDocument();
157157
expect(screen.getByTestId(riskStoryTestIds.topReposToggle)).toHaveTextContent('Show top 5');
158158
});
159159

src/report/web/acts/RiskStory.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useState } from 'react';
22
import { useEmbeddedData } from '../data/EmbeddedDataContext.tsx';
3+
import { repoShortName } from '../format/repo.ts';
34
import { useAssumptionsDisclosure } from '../hooks/useAssumptionsDisclosure.tsx';
45
import { Citation } from '../primitives/Citation.tsx';
56
import { SEGMENTS, StackedBar } from '../primitives/StackedBar.tsx';
@@ -193,7 +194,7 @@ function RepoSeverityBar({ repo, maxTotal }: { repo: RepoSeverityRow; maxTotal:
193194
return (
194195
<div className="grid grid-cols-[minmax(0,10rem)_1fr_2.5rem] items-center gap-3 text-sm">
195196
<div className="text-foreground truncate font-mono text-xs" title={repo.repo}>
196-
{repo.repo}
197+
{repoShortName(repo.repo)}
197198
</div>
198199
<div className="bg-muted h-3.5 overflow-hidden rounded-full">
199200
<div className="flex h-full" style={{ width: `${(total / maxTotal) * 100}%` }}>

src/report/web/format/repo.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function repoShortName(repo: string): string {
2+
return repo.slice(repo.lastIndexOf('/') + 1);
3+
}

0 commit comments

Comments
 (0)