authorgravatar for lucenz@proton.meSimone <lucenz@proton.me> 2026-10-14 04:34:46+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-13 23:34:46-03:00
log5e5c52b7a70c16734e42faa072248a597e1333ee
tree5988bda363180b2a924fb6670f40d65e65f9837f
parent573cec01664d8bfef9da53dd31d68398e5814170
signature Signed by PGP key B5690EEEBB952194

fix(source-control): keep distinct CI checks with overlapping names (#19162)

Co-authored-by: Simone <185146821+Lucenx9@users.noreply.github.com>

2 files changed, 23 insertions(+), 1 deletions(-)

packages/source-control-core/src/server/pullRequestChecks.test.ts+22
...@@ -50,6 +50,28 @@ describe("dedupeChecks", () => {...@@ -50,6 +50,28 @@ describe("dedupeChecks", () => {
50 ]);50 ]);
51 });51 });
5252
53 it("keeps distinct workflow and check pairs even when their names join to the same text", () => {
54 const checks = dedupeChecks([
55 entry("Linux tests", "success", {
56 workflowName: "Build",
57 at: "2026-08-11T16:00:00Z",
58 }),
59 entry("tests", "success", {
60 workflowName: "Build Linux",
61 at: "2026-08-11T17:00:00Z",
62 }),
63 entry("Linux tests", "failure", {
64 workflowName: "Build",
65 at: "2026-08-11T18:00:00Z",
66 }),
67 ]);
68
69 expect(checks.map((check) => [check.name, check.status])).toEqual([
70 ["Linux tests", "failure"],
71 ["tests", "success"],
72 ]);
73 });
74
53 it("loses a run that never said when it happened to one that did, whichever came first", () => {75 it("loses a run that never said when it happened to one that did, whichever came first", () => {
54 const undated = dedupeChecks([76 const undated = dedupeChecks([
55 entry("build", "success", { at: "2026-08-11T16:00:00Z" }),77 entry("build", "success", { at: "2026-08-11T16:00:00Z" }),
packages/source-control-core/src/server/pullRequestChecks.ts+1-1
...@@ -36,7 +36,7 @@ export function dedupeChecks(...@@ -36,7 +36,7 @@ export function dedupeChecks(
36): ReadonlyArray<PullRequestCheck> {36): ReadonlyArray<PullRequestCheck> {
37 const newestByCheck = new Map<string, (typeof entries)[number]>();37 const newestByCheck = new Map<string, (typeof entries)[number]>();
38 for (const entry of entries) {38 for (const entry of entries) {
39 const key = `${entry.workflowName ?? ""} ${entry.check.name}`;39 const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]);
40 const kept = newestByCheck.get(key);40 const kept = newestByCheck.get(key);
41 // Re-setting a key a Map already holds keeps its first position, which is the order wanted.41 // Re-setting a key a Map already holds keeps its first position, which is the order wanted.
42 if (kept === undefined || isAtLeastAsNew(entry.at, kept.at)) newestByCheck.set(key, entry);42 if (kept === undefined || isAtLeastAsNew(entry.at, kept.at)) newestByCheck.set(key, entry);