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", () => {
5050 ]);
5151 });
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
5375 it("loses a run that never said when it happened to one that did, whichever came first", () => {
5476 const undated = dedupeChecks([
5577 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(
3636): ReadonlyArray<PullRequestCheck> {
3737 const newestByCheck = new Map<string, (typeof entries)[number]>();
3838 for (const entry of entries) {
39 const key = `${entry.workflowName ?? ""} ${entry.check.name}`;
39 const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]);
4040 const kept = newestByCheck.get(key);
4141 // Re-setting a key a Map already holds keeps its first position, which is the order wanted.
4242 if (kept === undefined || isAtLeastAsNew(entry.at, kept.at)) newestByCheck.set(key, entry);