GeezerVison is showing github.com — fix(web): scope pull request list diff stats by repository (#43557) · Ryoku-dev/hyakki@45ce79f
File treeExpand file treeCollapse file tree Open diff view settings apps/web/src/components/pullRequest
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/pullRequest/pullRequestList.logic.test.ts +20Lines changed: 20 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,6 +23,7 @@ import { | 23 | 23 | pullRequestStatsKeysToRequest, | 24 | 24 | pullRequestStatsRefreshBatches, | 25 | 25 | mergePullRequestDiffStats, | | 26 | + withDiffStat, | 26 | 27 | partitionPullRequestsWithPriority, | 27 | 28 | pullRequestAuthorChoices, | 28 | 29 | selectedPullRequestAuthor, | @@ -88,6 +89,7 @@ describe("visible pull request line-count targets", () => { | 88 | 89 | { | 89 | 90 | environmentId: ENV_1, | 90 | 91 | projectId: "project-1", | | 92 | + repository: "pingdotgg/t3code", | 91 | 93 | number: 1, | 92 | 94 | additions: 1, | 93 | 95 | deletions: 1, | @@ -106,6 +108,24 @@ describe("visible pull request line-count targets", () => { | 106 | 108 | ]); | 107 | 109 | }); | 108 | 110 |
| | 111 | + it("matches diff stats by repository, ignoring case", () => { | | 112 | + const own = entry({ additions: 0, deletions: 0, number: 42 }); | | 113 | + const stat = { environmentId: ENV_1, projectId: "project-1", number: 42, deletions: 2 }; | | 114 | + const stats = mergePullRequestDiffStats(new Map(), [ | | 115 | + { ...stat, repository: "other/lib", additions: 120 }, | | 116 | + ]); | | 117 | + | | 118 | + expect(withDiffStat(own, stats)).toEqual(own); | | 119 | + expect( | | 120 | + withDiffStat( | | 121 | + own, | | 122 | + mergePullRequestDiffStats(stats, [ | | 123 | + { ...stat, repository: "PingDotGG/T3Code", additions: 7 }, | | 124 | + ]), | | 125 | + ), | | 126 | + ).toMatchObject({ additions: 7, deletions: 2 }); | | 127 | + }); | | 128 | + | 109 | 129 | it("keeps every per-environment batch within the stats contract limit", () => { | 110 | 130 | const entries = Array.from({ length: 501 }, (_, index) => | 111 | 131 | entry({ additions: 0, deletions: 0, number: index + 1 }), | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/pullRequest/pullRequestList.logic.ts +3-1Lines changed: 3 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -500,6 +500,7 @@ export function mergePullRequestDiffStats( | 500 | 500 | stats: ReadonlyArray<{ | 501 | 501 | readonly environmentId: string; | 502 | 502 | readonly projectId: string; | | 503 | + readonly repository: string; | 503 | 504 | readonly number: number; | 504 | 505 | readonly additions: number; | 505 | 506 | readonly deletions: number; | @@ -519,8 +520,9 @@ export function mergePullRequestDiffStats( | 519 | 520 | export const pullRequestDiffStatKey = (row: { | 520 | 521 | readonly environmentId: string; | 521 | 522 | readonly projectId: string; | | 523 | + readonly repository: string; | 522 | 524 | readonly number: number; | 523 | | -}) => `${row.environmentId} ${row.projectId} ${row.number}`; | | 525 | +}) => `${row.environmentId} ${row.projectId} ${row.repository.toLowerCase()} ${row.number}`; | 524 | 526 |
| 525 | 527 | export interface MergedPullRequestList { | 526 | 528 | readonly viewers: PullRequestViewers; | |
|