Skip to content
TypeScript

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

Simone5e5c52b7a70c
diff --git a/packages/source-control-core/src/server/pullRequestChecks.test.ts b/packages/source-control-core/src/server/pullRequestChecks.test.ts
index ba685083292..5033e719dec 100644
--- a/packages/source-control-core/src/server/pullRequestChecks.test.ts
+++ b/packages/source-control-core/src/server/pullRequestChecks.test.ts
@@ -50,6 +50,28 @@ describe("dedupeChecks", () => {
]);
});
+ it("keeps distinct workflow and check pairs even when their names join to the same text", () => {
+ const checks = dedupeChecks([
+ entry("Linux tests", "success", {
+ workflowName: "Build",
+ at: "2026-08-11T16:00:00Z",
+ }),
+ entry("tests", "success", {
+ workflowName: "Build Linux",
+ at: "2026-08-11T17:00:00Z",
+ }),
+ entry("Linux tests", "failure", {
+ workflowName: "Build",
+ at: "2026-08-11T18:00:00Z",
+ }),
+ ]);
+
+ expect(checks.map((check) => [check.name, check.status])).toEqual([
+ ["Linux tests", "failure"],
+ ["tests", "success"],
+ ]);
+ });
+
it("loses a run that never said when it happened to one that did, whichever came first", () => {
const undated = dedupeChecks([
entry("build", "success", { at: "2026-08-11T16:00:00Z" }),
diff --git a/packages/source-control-core/src/server/pullRequestChecks.ts b/packages/source-control-core/src/server/pullRequestChecks.ts
index 819cf47b01a..491b0180323 100644
--- a/packages/source-control-core/src/server/pullRequestChecks.ts
+++ b/packages/source-control-core/src/server/pullRequestChecks.ts
@@ -36,7 +36,7 @@ export function dedupeChecks(
): ReadonlyArray<PullRequestCheck> {
const newestByCheck = new Map<string, (typeof entries)[number]>();
for (const entry of entries) {
- const key = `${entry.workflowName ?? ""} ${entry.check.name}`;
+ const key = JSON.stringify([entry.workflowName ?? "", entry.check.name]);
const kept = newestByCheck.get(key);
// Re-setting a key a Map already holds keeps its first position, which is the order wanted.
if (kept === undefined || isAtLeastAsNew(entry.at, kept.at)) newestByCheck.set(key, entry);