From 60d21aa6af3fb09224b59e407f5e85ec8c3d7df4 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 21:19:15 +0000 Subject: [PATCH 1/8] test(github): reproduce #30378 superseded cancelled run keeps checks failing These tests reproduce #30378: a cancelled check from a workflow run that a newer run of the same workflow superseded survives dedupe when the job names differ, so checksState reads failing. Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 58 ++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 622b48db3b85d..0a743234df6ec 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -323,10 +323,10 @@ describe("pull request detail decoding", () => { checkSuite: { workflowRun: null }, ...fields, }; - const inWorkflow = ({ workflowName, ...fields }: Record) => + const inWorkflow = ({ workflowName, runId, ...fields }: Record) => check({ ...fields, - checkSuite: { workflowRun: { workflow: { name: workflowName } } }, + checkSuite: { workflowRun: { databaseId: runId, workflow: { name: workflowName } } }, }); const coreJson = ( @@ -576,6 +576,60 @@ describe("pull request detail decoding", () => { } }); + it("drops a cancelled check whose workflow run was superseded by a newer run on the head", () => { + const superseded = { + workflowName: "CI", + runId: 100, + status: "COMPLETED", + startedAt: "2026-10-30T10:00:00Z", + completedAt: "2026-10-30T10:00:05Z", + }; + const replacement = { + workflowName: "CI", + runId: 200, + status: "COMPLETED", + conclusion: "SUCCESS", + startedAt: "2026-10-30T10:00:10Z", + completedAt: "2026-10-30T10:05:00Z", + }; + const rollup = [ + inWorkflow({ ...superseded, name: "check", conclusion: "CANCELLED" }), + inWorkflow({ + ...superseded, + name: "web browser tests (runner ${{ matrix.slice }} of 6)", + conclusion: "CANCELLED", + }), + inWorkflow({ ...replacement, name: "check" }), + inWorkflow({ ...replacement, name: "web browser tests (runner 1 of 6)" }), + inWorkflow({ ...replacement, name: "web browser tests (runner 2 of 6)" }), + ]; + const checksOf = (contexts: ReadonlyArray>) => { + const detail = detailOf(contexts); + return [detail.checks.map((check) => [check.name, check.status]), detail.checksState]; + }; + + expect(checksOf(rollup)).toEqual([ + [ + ["check", "success"], + ["web browser tests (runner 1 of 6)", "success"], + ["web browser tests (runner 2 of 6)", "success"], + ], + "passing", + ]); + expect( + checksOf([ + ...rollup, + inWorkflow({ + ...superseded, + workflowName: "Release", + runId: 300, + name: "publish", + conclusion: "CANCELLED", + }), + ])[0], + ).toContainEqual(["publish", "cancelled"]); + }); + it("merges reviews with comments in time order and keeps a bodyless approval", () => { const detail = expectSuccess(activity(JSON.parse(detailJson) as Record)); expect(detail.comments.map((comment) => comment.id)).toEqual(["r1", "c1", "r2"]); From aef65358e17bb17f227244e3d49ba420f527225b Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 21:25:23 +0000 Subject: [PATCH 2/8] fix(github): superseded runs' cancelled checks no longer block PR watches A workflow run cancelled by a newer run of the same workflow (concurrency cancel-in-progress) kept its cancelled checks whenever their names differed from the replacement's, such as a matrix job cancelled before expansion. The rollup then read failing and the PR watch never sent checks-passed. The check rollup now reads each check run's workflow run id, and decoding drops a cancelled check whose run is older than another run of the same workflow on the head. Failures and successes of older runs are untouched, and checks without a run id behave as before. Fixes pingdotgg/t3code#30378 Co-Authored-By: Claude Opus 5.5 --- .../src/server/GitHubPullRequestApi.test.ts | 8 +++-- .../src/server/gitHubPullRequestJson.test.ts | 2 +- .../src/server/gitHubPullRequestJson.ts | 34 +++++++++++++++++-- .../src/server/pullRequestReads.graphql | 1 + .../src/server/pullRequestReads.graphql.ts | 6 ++-- 5 files changed, 43 insertions(+), 8 deletions(-) diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts index 5a5c46f28d99a..21bb1c65ca185 100644 --- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts +++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts @@ -3366,13 +3366,17 @@ layer("GitHubPullRequestApi.layer", (it) => { name: "build", status: "COMPLETED", conclusion: "SUCCESS", - checkSuite: { workflowRun: { workflow: { name: "linux" } } }, + checkSuite: { + workflowRun: { databaseId: 1, workflow: { name: "linux" } }, + }, }), checkRun({ name: "build", status: "COMPLETED", conclusion: "FAILURE", - checkSuite: { workflowRun: { workflow: { name: "windows" } } }, + checkSuite: { + workflowRun: { databaseId: 2, workflow: { name: "windows" } }, + }, }), ], pageInfo: { hasNextPage: false }, diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 0a743234df6ec..9410fca8919d4 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -326,7 +326,7 @@ describe("pull request detail decoding", () => { const inWorkflow = ({ workflowName, runId, ...fields }: Record) => check({ ...fields, - checkSuite: { workflowRun: { databaseId: runId, workflow: { name: workflowName } } }, + checkSuite: { workflowRun: { databaseId: runId ?? null, workflow: { name: workflowName } } }, }); const coreJson = ( diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index e7c05a4aa8445..5cce0d7a4e4cd 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -130,6 +130,8 @@ interface CheckFields { readonly targetUrl?: string | null | undefined; /** Empty for app-owned runs; absent for commit statuses. */ readonly workflowName?: string | null | undefined; + /** The workflow run's id, which GitHub assigns in creation order. */ + readonly workflowRunId?: number | null | undefined; readonly startedAt?: string | null | undefined; readonly completedAt?: string | null | undefined; /** Branch protection requires this check; asked for on github.com only. */ @@ -570,16 +572,38 @@ function isNamelessCheck(raw: CheckFields): boolean { return trimmed(raw.name) === null && trimmed(raw.context) === null; } -/** Unfinished runs outrank finished runs of the same check across push/PR workflows. */ +/** + * Unfinished runs outrank finished runs of the same check across push/PR workflows. A newer run of + * a workflow cancels the older one (concurrency cancel-in-progress), and the older run's job names + * can differ (an unexpanded matrix), so its cancelled checks are dropped rather than deduped. + */ function toCheckEntries(raw: ReadonlyArray | null | undefined): ReadonlyArray<{ readonly check: PullRequestCheck; readonly workflowName: string | null; readonly at: string | null; }> { + const newestRunByWorkflow = new Map(); + for (const check of raw ?? []) { + const workflowName = trimmed(check.workflowName); + if (workflowName === null || check.workflowRunId == null) continue; + const newest = newestRunByWorkflow.get(workflowName); + if (newest === undefined || check.workflowRunId > newest) { + newestRunByWorkflow.set(workflowName, check.workflowRunId); + } + } return (raw ?? []).flatMap((check) => { const name = trimmed(check.name) ?? trimmed(check.context); if (name === null) return []; const status = toCheckStatus(check); + const workflowName = trimmed(check.workflowName); + if ( + status === "cancelled" && + workflowName !== null && + check.workflowRunId != null && + check.workflowRunId < (newestRunByWorkflow.get(workflowName) ?? check.workflowRunId) + ) { + return []; + } return [ { check: { @@ -589,7 +613,7 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea url: trimmed(check.detailsUrl) ?? trimmed(check.targetUrl), ...(typeof check.isRequired === "boolean" ? { required: check.isRequired } : {}), }, - workflowName: trimmed(check.workflowName), + workflowName, at: status === "pending" ? STILL_RUNNING @@ -1155,7 +1179,11 @@ export type GitHubCheckContext = CheckFields; function toCheckContexts(nodes: ReadonlyArray): ReadonlyArray { return nodes.map((check) => check.__typename === "CheckRun" - ? { ...check, workflowName: check.checkSuite.workflowRun?.workflow.name ?? null } + ? { + ...check, + workflowName: check.checkSuite.workflowRun?.workflow.name ?? null, + workflowRunId: check.checkSuite.workflowRun?.databaseId ?? null, + } : check, ); } diff --git a/packages/source-control-github/src/server/pullRequestReads.graphql b/packages/source-control-github/src/server/pullRequestReads.graphql index 78e5efe0e4558..68a52cfd6706c 100644 --- a/packages/source-control-github/src/server/pullRequestReads.graphql +++ b/packages/source-control-github/src/server/pullRequestReads.graphql @@ -42,6 +42,7 @@ fragment CheckContext on StatusCheckRollupContext { isRequired(pullRequestNumber: $number) @include(if: $required) checkSuite { workflowRun { + databaseId workflow { name } diff --git a/packages/source-control-github/src/server/pullRequestReads.graphql.ts b/packages/source-control-github/src/server/pullRequestReads.graphql.ts index 5bc09fa4e2ce4..6843769688794 100644 --- a/packages/source-control-github/src/server/pullRequestReads.graphql.ts +++ b/packages/source-control-github/src/server/pullRequestReads.graphql.ts @@ -30,6 +30,8 @@ export interface Workflow extends Schema.Struct.Type {} /** A workflow run. */ export const WorkflowRun = Schema.Struct({ + /** Identifies the primary key from the database. */ + databaseId: Schema.NullOr(Shared.Int), /** The workflow executed in this workflow run. */ workflow: Workflow }) @@ -462,7 +464,7 @@ export const PullRequestCore = GraphQL.query("PullRequestCore", { { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){mergeCommitAllowed squashMergeAllowed rebaseMergeAllowed autoMergeAllowed viewerPermission pullRequest(number:$", "number", "){number title url body state isDraft mergeable mergeStateStatus reviewDecision additions deletions changedFiles createdAt updatedAt mergedAt closedAt headRefName baseRefName headRefOid isCrossRepository maintainerCanModify headRepositoryOwner{__typename login}headRepository{nameWithOwner viewerPermission}headRef{id}author{__typename login avatarUrl...on User{id name}}autoMergeRequest{mergeMethod}viewerCanUpdate viewerDidAuthor viewerCanUpdateBranch baseRef{compare(headRef:$", "headRef", "){behindBy}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name}...on Bot{login}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}labels(first:100){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage}}}}}}}}"] } ], fragments: [ - { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{workflow{name}}}}}"] } + { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{databaseId workflow{name}}}}}"] } ] }, variables: { @@ -559,7 +561,7 @@ export const PullRequestCheckContexts = GraphQL.query("PullRequestCheckContexts" { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){headRefOid commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100 after:$", "after", "){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage endCursor}}}}}}}}"] } ], fragments: [ - { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{workflow{name}}}}}"] } + { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{databaseId workflow{name}}}}}"] } ] }, variables: { From e4c0446b1047da0fc2372860c7bbde5ec5cb8824 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 21:45:07 +0000 Subject: [PATCH 3/8] fix(github): identify superseded runs by workflow, event and run number The previous fix read the workflow run's databaseId, which the schema types as a 32-bit Int while real run ids are around 4e10, so decoding the check rollup failed for every pull request with an Actions check. It also treated any run of a workflow with the same name as a replacement, though two workflow files can share a name and push and pull_request runs of one workflow do not cancel each other. A cancelled check is now dropped only when the head carries a run of the same workflow (node id) for the same event with a higher run number. Fixes pingdotgg/t3code#30378 Co-Authored-By: Claude Opus 5.5 --- .../src/server/GitHubPullRequestApi.test.ts | 79 ++++++++++++++++++- .../src/server/gitHubPullRequestJson.test.ts | 46 +++++++++-- .../src/server/gitHubPullRequestJson.ts | 40 ++++++---- .../src/server/pullRequestReads.graphql | 4 +- .../src/server/pullRequestReads.graphql.ts | 12 ++- 5 files changed, 152 insertions(+), 29 deletions(-) diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts index 21bb1c65ca185..98dd7df04a9b8 100644 --- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts +++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts @@ -3367,7 +3367,11 @@ layer("GitHubPullRequestApi.layer", (it) => { status: "COMPLETED", conclusion: "SUCCESS", checkSuite: { - workflowRun: { databaseId: 1, workflow: { name: "linux" } }, + workflowRun: { + event: "push", + runNumber: 1, + workflow: { id: "W_linux", name: "linux" }, + }, }, }), checkRun({ @@ -3375,7 +3379,11 @@ layer("GitHubPullRequestApi.layer", (it) => { status: "COMPLETED", conclusion: "FAILURE", checkSuite: { - workflowRun: { databaseId: 2, workflow: { name: "windows" } }, + workflowRun: { + event: "push", + runNumber: 1, + workflow: { id: "W_windows", name: "windows" }, + }, }, }), ], @@ -3415,6 +3423,73 @@ layer("GitHubPullRequestApi.layer", (it) => { }), ); + it.effect("reads checks as GitHub reports them for a run a newer run superseded", () => + Effect.gen(function* () { + // Verbatim GitHub nodes, including unselected ids beyond int32. + const ciRun = (run: number, runNumber: number) => ({ + databaseId: run, + event: "pull_request", + runNumber, + runAttempt: 1, + workflow: { id: "W_kwDORLtfbc4N00ni", databaseId: 231950818, name: "CI" }, + }); + mockedExecute.mockReturnValueOnce( + Effect.succeed( + output( + encodeJson( + coreResponse({ + commits: { + nodes: [ + { + commit: { + statusCheckRollup: { + contexts: { + nodes: [ + checkRun({ + name: "web browser tests (runner ${{ matrix.slice }} of 6)", + conclusion: "CANCELLED", + startedAt: "2026-11-03T21:30:02Z", + completedAt: "2026-11-03T21:30:02Z", + detailsUrl: + "https://github.com/pingdotgg/t3code/actions/runs/41719063754/job/126207741102", + checkSuite: { workflowRun: ciRun(41719063754, 95379) }, + }), + checkRun({ + name: "web browser tests (runner 1 of 6)", + conclusion: "SUCCESS", + startedAt: "2026-11-03T21:34:14Z", + completedAt: "2026-11-03T21:41:45Z", + detailsUrl: + "https://github.com/pingdotgg/t3code/actions/runs/41722982377/job/126220308427", + checkSuite: { workflowRun: ciRun(41722982377, 95380) }, + }), + ], + pageInfo: { hasNextPage: false }, + }, + }, + }, + }, + ], + }, + }), + ), + ), + ), + ); + const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi; + const detail = yield* cli.getPullRequestDetail({ + cwd: "/w", + repository: "pingdotgg/t3code", + host: "github.com", + number: 30378, + }); + expect(detail.checks.map((check) => [check.name, check.status])).toEqual([ + ["web browser tests (runner 1 of 6)", "success"], + ]); + expect(detail.checksState).toBe("passing"); + }), + ); + it.effect.each([false, true])( "reads every check when the combined response has another page (reviewer refusal: %s)", (refused) => diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 9410fca8919d4..87e7ebcf8b30b 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -323,10 +323,18 @@ describe("pull request detail decoding", () => { checkSuite: { workflowRun: null }, ...fields, }; - const inWorkflow = ({ workflowName, runId, ...fields }: Record) => + const inWorkflow = ({ + workflowName, + workflowId = `W_kwDORLtfbc4${String(workflowName)}`, + event = "pull_request", + runNumber = 95380, + ...fields + }: Record) => check({ ...fields, - checkSuite: { workflowRun: { databaseId: runId ?? null, workflow: { name: workflowName } } }, + checkSuite: { + workflowRun: { event, runNumber, workflow: { id: workflowId, name: workflowName } }, + }, }); const coreJson = ( @@ -579,14 +587,16 @@ describe("pull request detail decoding", () => { it("drops a cancelled check whose workflow run was superseded by a newer run on the head", () => { const superseded = { workflowName: "CI", - runId: 100, + workflowId: "W_kwDORLtfbc4N00ni", + runNumber: 95379, status: "COMPLETED", startedAt: "2026-10-30T10:00:00Z", completedAt: "2026-10-30T10:00:05Z", }; const replacement = { workflowName: "CI", - runId: 200, + workflowId: "W_kwDORLtfbc4N00ni", + runNumber: 95380, status: "COMPLETED", conclusion: "SUCCESS", startedAt: "2026-10-30T10:00:10Z", @@ -622,7 +632,8 @@ describe("pull request detail decoding", () => { inWorkflow({ ...superseded, workflowName: "Release", - runId: 300, + workflowId: "W_kwDORLtfbc4Onf3y", + runNumber: 92888, name: "publish", conclusion: "CANCELLED", }), @@ -630,6 +641,31 @@ describe("pull request detail decoding", () => { ).toContainEqual(["publish", "cancelled"]); }); + it("keeps a cancelled check when the newer run is another workflow with the same name", () => { + const detail = detailOf([ + inWorkflow({ + name: "test", + workflowName: "CI", + workflowId: "W_kwDORLtfbc4N00ni", + runNumber: 95379, + conclusion: "CANCELLED", + }), + inWorkflow({ + name: "lint", + workflowName: "CI", + workflowId: "W_kwDORLtfbc4ToKTh", + runNumber: 95380, + conclusion: "SUCCESS", + }), + ]); + + expect(detail.checks.map((check) => [check.name, check.status])).toContainEqual([ + "test", + "cancelled", + ]); + expect(detail.checksState).toBe("failing"); + }); + it("merges reviews with comments in time order and keeps a bodyless approval", () => { const detail = expectSuccess(activity(JSON.parse(detailJson) as Record)); expect(detail.comments.map((comment) => comment.id)).toEqual(["r1", "c1", "r2"]); diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index 5cce0d7a4e4cd..7376531360e83 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -118,6 +118,13 @@ interface LatestReviewFields { readonly state?: string | null | undefined; } +/** Run numbers count up per workflow file, whatever its name; database ids exceed int32. */ +interface WorkflowRunFields { + readonly event: string; + readonly runNumber: number; + readonly workflow: { readonly id: string }; +} + /** Check runs use status/conclusion; commit statuses use a single state. */ interface CheckFields { readonly name?: string | null | undefined; @@ -130,8 +137,8 @@ interface CheckFields { readonly targetUrl?: string | null | undefined; /** Empty for app-owned runs; absent for commit statuses. */ readonly workflowName?: string | null | undefined; - /** The workflow run's id, which GitHub assigns in creation order. */ - readonly workflowRunId?: number | null | undefined; + /** Absent for commit statuses and app-owned runs. */ + readonly workflowRun?: WorkflowRunFields | null | undefined; readonly startedAt?: string | null | undefined; readonly completedAt?: string | null | undefined; /** Branch protection requires this check; asked for on github.com only. */ @@ -574,33 +581,32 @@ function isNamelessCheck(raw: CheckFields): boolean { /** * Unfinished runs outrank finished runs of the same check across push/PR workflows. A newer run of - * a workflow cancels the older one (concurrency cancel-in-progress), and the older run's job names - * can differ (an unexpanded matrix), so its cancelled checks are dropped rather than deduped. + * the same workflow and event cancels the older one (concurrency cancel-in-progress), whose job + * names can differ (an unexpanded matrix), so its cancelled checks are dropped rather than deduped. */ function toCheckEntries(raw: ReadonlyArray | null | undefined): ReadonlyArray<{ readonly check: PullRequestCheck; readonly workflowName: string | null; readonly at: string | null; }> { - const newestRunByWorkflow = new Map(); - for (const check of raw ?? []) { - const workflowName = trimmed(check.workflowName); - if (workflowName === null || check.workflowRunId == null) continue; - const newest = newestRunByWorkflow.get(workflowName); - if (newest === undefined || check.workflowRunId > newest) { - newestRunByWorkflow.set(workflowName, check.workflowRunId); + const lineageOf = (run: WorkflowRunFields) => `${run.workflow.id} ${run.event}`; + const newestRunNumber = new Map(); + for (const { workflowRun: run } of raw ?? []) { + if (run == null) continue; + const newest = newestRunNumber.get(lineageOf(run)); + if (newest === undefined || run.runNumber > newest) { + newestRunNumber.set(lineageOf(run), run.runNumber); } } return (raw ?? []).flatMap((check) => { const name = trimmed(check.name) ?? trimmed(check.context); if (name === null) return []; const status = toCheckStatus(check); - const workflowName = trimmed(check.workflowName); + const run = check.workflowRun; if ( status === "cancelled" && - workflowName !== null && - check.workflowRunId != null && - check.workflowRunId < (newestRunByWorkflow.get(workflowName) ?? check.workflowRunId) + run != null && + run.runNumber < (newestRunNumber.get(lineageOf(run)) ?? run.runNumber) ) { return []; } @@ -613,7 +619,7 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea url: trimmed(check.detailsUrl) ?? trimmed(check.targetUrl), ...(typeof check.isRequired === "boolean" ? { required: check.isRequired } : {}), }, - workflowName, + workflowName: trimmed(check.workflowName), at: status === "pending" ? STILL_RUNNING @@ -1182,7 +1188,7 @@ function toCheckContexts(nodes: ReadonlyArray): ReadonlyArray {} /** A workflow run. */ export const WorkflowRun = Schema.Struct({ - /** Identifies the primary key from the database. */ - databaseId: Schema.NullOr(Shared.Int), + /** The event that triggered the workflow run */ + event: Schema.String, + /** A number that uniquely identifies this workflow run in its parent workflow. */ + runNumber: Shared.Int, /** The workflow executed in this workflow run. */ workflow: Workflow }) @@ -464,7 +468,7 @@ export const PullRequestCore = GraphQL.query("PullRequestCore", { { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){mergeCommitAllowed squashMergeAllowed rebaseMergeAllowed autoMergeAllowed viewerPermission pullRequest(number:$", "number", "){number title url body state isDraft mergeable mergeStateStatus reviewDecision additions deletions changedFiles createdAt updatedAt mergedAt closedAt headRefName baseRefName headRefOid isCrossRepository maintainerCanModify headRepositoryOwner{__typename login}headRepository{nameWithOwner viewerPermission}headRef{id}author{__typename login avatarUrl...on User{id name}}autoMergeRequest{mergeMethod}viewerCanUpdate viewerDidAuthor viewerCanUpdateBranch baseRef{compare(headRef:$", "headRef", "){behindBy}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name}...on Bot{login}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}labels(first:100){nodes{name color}}commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage}}}}}}}}"] } ], fragments: [ - { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{databaseId workflow{name}}}}}"] } + { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{event runNumber workflow{id name}}}}}"] } ] }, variables: { @@ -561,7 +565,7 @@ export const PullRequestCheckContexts = GraphQL.query("PullRequestCheckContexts" { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){headRefOid commits(last:1){nodes{commit{statusCheckRollup{contexts(first:100 after:$", "after", "){nodes{__typename...", "CheckContext", "}pageInfo{hasNextPage endCursor}}}}}}}}"] } ], fragments: [ - { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{databaseId workflow{name}}}}}"] } + { name: "CheckContext", body: ["on StatusCheckRollupContext{__typename...on StatusContext{context state targetUrl createdAt description isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")}...on CheckRun{name status conclusion startedAt completedAt detailsUrl isRequired(pullRequestNumber:$", "number", ")@include(if:$", "required", ")checkSuite{workflowRun{event runNumber workflow{id name}}}}}"] } ] }, variables: { From 6c8e4a466c65123f376048ecbe21fa802340b379 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 22:03:06 +0000 Subject: [PATCH 4/8] fix(github): a newer manual dispatch no longer hides an older cancelled run Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 25 +++++++++++++++++++ .../src/server/gitHubPullRequestJson.ts | 3 ++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 87e7ebcf8b30b..e5fabcc429ef4 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -666,6 +666,31 @@ describe("pull request detail decoding", () => { expect(detail.checksState).toBe("failing"); }); + it("keeps a cancelled check when the newer run is another manual dispatch", () => { + const detail = detailOf([ + inWorkflow({ + name: "test (packages/shared)", + workflowName: "Windows Tests", + event: "workflow_dispatch", + runNumber: 41, + conclusion: "CANCELLED", + }), + inWorkflow({ + name: "test (apps/server)", + workflowName: "Windows Tests", + event: "workflow_dispatch", + runNumber: 42, + conclusion: "SUCCESS", + }), + ]); + + expect(detail.checks.map((check) => [check.name, check.status])).toContainEqual([ + "test (packages/shared)", + "cancelled", + ]); + expect(detail.checksState).toBe("failing"); + }); + it("merges reviews with comments in time order and keeps a bodyless approval", () => { const detail = expectSuccess(activity(JSON.parse(detailJson) as Record)); expect(detail.comments.map((comment) => comment.id)).toEqual(["r1", "c1", "r2"]); diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index 7376531360e83..3d87d495814e5 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -583,6 +583,7 @@ function isNamelessCheck(raw: CheckFields): boolean { * Unfinished runs outrank finished runs of the same check across push/PR workflows. A newer run of * the same workflow and event cancels the older one (concurrency cancel-in-progress), whose job * names can differ (an unexpanded matrix), so its cancelled checks are dropped rather than deduped. + * Manual dispatches can take different inputs, so a newer one replaces nothing. */ function toCheckEntries(raw: ReadonlyArray | null | undefined): ReadonlyArray<{ readonly check: PullRequestCheck; @@ -592,7 +593,7 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea const lineageOf = (run: WorkflowRunFields) => `${run.workflow.id} ${run.event}`; const newestRunNumber = new Map(); for (const { workflowRun: run } of raw ?? []) { - if (run == null) continue; + if (run == null || run.event === "workflow_dispatch") continue; const newest = newestRunNumber.get(lineageOf(run)); if (newest === undefined || run.runNumber > newest) { newestRunNumber.set(lineageOf(run), run.runNumber); From 488e30950c507034169b465b241b507cf4edb2ea Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 22:22:24 +0000 Subject: [PATCH 5/8] fix(github): only pull request runs supersede an older cancelled run Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 54 +++++++++++-------- .../src/server/gitHubPullRequestJson.ts | 12 +++-- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index e5fabcc429ef4..7e52f17b6445a 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -666,30 +666,38 @@ describe("pull request detail decoding", () => { expect(detail.checksState).toBe("failing"); }); - it("keeps a cancelled check when the newer run is another manual dispatch", () => { - const detail = detailOf([ - inWorkflow({ - name: "test (packages/shared)", - workflowName: "Windows Tests", - event: "workflow_dispatch", - runNumber: 41, - conclusion: "CANCELLED", - }), - inWorkflow({ - name: "test (apps/server)", - workflowName: "Windows Tests", - event: "workflow_dispatch", - runNumber: 42, - conclusion: "SUCCESS", - }), - ]); + it.each([ + ["a manual dispatch", "workflow_dispatch", "workflow_dispatch", "CANCELLED", "cancelled"], + ["a push of another ref", "push", "push", "CANCELLED", "cancelled"], + ["another event", "pull_request", "pull_request_target", "CANCELLED", "cancelled"], + ["a pull request run", "pull_request", "pull_request", "FAILURE", "failure"], + ])( + "keeps an older run's check when the newer run is %s", + (_, olderEvent, newerEvent, conclusion, status) => { + const detail = detailOf([ + inWorkflow({ + name: "test (packages/shared)", + workflowName: "CI", + event: olderEvent, + runNumber: 41, + conclusion, + }), + inWorkflow({ + name: "test (apps/server)", + workflowName: "CI", + event: newerEvent, + runNumber: 42, + conclusion: "SUCCESS", + }), + ]); - expect(detail.checks.map((check) => [check.name, check.status])).toContainEqual([ - "test (packages/shared)", - "cancelled", - ]); - expect(detail.checksState).toBe("failing"); - }); + expect(detail.checks.map((check) => [check.name, check.status])).toContainEqual([ + "test (packages/shared)", + status, + ]); + expect(detail.checksState).toBe("failing"); + }, + ); it("merges reviews with comments in time order and keeps a bodyless approval", () => { const detail = expectSuccess(activity(JSON.parse(detailJson) as Record)); diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index 3d87d495814e5..c3ccc86c1addd 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -579,11 +579,13 @@ function isNamelessCheck(raw: CheckFields): boolean { return trimmed(raw.name) === null && trimmed(raw.context) === null; } +const PULL_REQUEST_EVENTS = new Set(["pull_request", "pull_request_target"]); + /** - * Unfinished runs outrank finished runs of the same check across push/PR workflows. A newer run of - * the same workflow and event cancels the older one (concurrency cancel-in-progress), whose job - * names can differ (an unexpanded matrix), so its cancelled checks are dropped rather than deduped. - * Manual dispatches can take different inputs, so a newer one replaces nothing. + * Unfinished runs outrank finished runs of the same check across push/PR workflows. A newer pull + * request run of a workflow supersedes the older one's cancelled checks, whose names can differ + * (an unexpanded matrix). Other events can run one commit in different scopes (a branch and a + * tag, dispatch inputs), so their runs replace nothing. */ function toCheckEntries(raw: ReadonlyArray | null | undefined): ReadonlyArray<{ readonly check: PullRequestCheck; @@ -593,7 +595,7 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea const lineageOf = (run: WorkflowRunFields) => `${run.workflow.id} ${run.event}`; const newestRunNumber = new Map(); for (const { workflowRun: run } of raw ?? []) { - if (run == null || run.event === "workflow_dispatch") continue; + if (run == null || !PULL_REQUEST_EVENTS.has(run.event)) continue; const newest = newestRunNumber.get(lineageOf(run)); if (newest === undefined || run.runNumber > newest) { newestRunNumber.set(lineageOf(run), run.runNumber); From 535c052240b6326fe396652f9d1134eafe33ca45 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 22:33:46 +0000 Subject: [PATCH 6/8] fix(github): a superseded run's required cancelled check still blocks Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 4 +++- .../source-control-github/src/server/gitHubPullRequestJson.ts | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 7e52f17b6445a..0be39101f1633 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -671,9 +671,10 @@ describe("pull request detail decoding", () => { ["a push of another ref", "push", "push", "CANCELLED", "cancelled"], ["another event", "pull_request", "pull_request_target", "CANCELLED", "cancelled"], ["a pull request run", "pull_request", "pull_request", "FAILURE", "failure"], + ["a pull request run, if required", "pull_request", "pull_request", "CANCELLED", "cancelled"], ])( "keeps an older run's check when the newer run is %s", - (_, olderEvent, newerEvent, conclusion, status) => { + (label, olderEvent, newerEvent, conclusion, status) => { const detail = detailOf([ inWorkflow({ name: "test (packages/shared)", @@ -681,6 +682,7 @@ describe("pull request detail decoding", () => { event: olderEvent, runNumber: 41, conclusion, + ...(label.endsWith("if required") ? { isRequired: true } : {}), }), inWorkflow({ name: "test (apps/server)", diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index c3ccc86c1addd..2e7ffa6d38e54 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -606,8 +606,10 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea if (name === null) return []; const status = toCheckStatus(check); const run = check.workflowRun; + // Branch protection names required checks, so only a same-name result can replace one. if ( status === "cancelled" && + check.isRequired !== true && run != null && run.runNumber < (newestRunNumber.get(lineageOf(run)) ?? run.runNumber) ) { From 66ec76b49c935589f28e227cdc47fc3a81f9ded0 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 3 Nov 2026 22:43:35 +0000 Subject: [PATCH 7/8] fix(github): run order decides when a newer check replaces a required cancellation Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 26 +++++++++++++++++++ .../src/server/gitHubPullRequestJson.ts | 26 +++++++++---------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 0be39101f1633..c7838f33a5897 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -666,6 +666,32 @@ describe("pull request detail decoding", () => { expect(detail.checksState).toBe("failing"); }); + it("drops a required cancelled check once a newer run reports it, whenever it finished", () => { + const detail = detailOf([ + inWorkflow({ + name: "test", + workflowName: "CI", + runNumber: 41, + conclusion: "CANCELLED", + isRequired: true, + startedAt: "2026-10-30T10:00:00Z", + completedAt: "2026-10-30T10:09:00Z", + }), + inWorkflow({ + name: "test", + workflowName: "CI", + runNumber: 42, + conclusion: "SUCCESS", + isRequired: true, + startedAt: "2026-10-30T10:01:00Z", + completedAt: "2026-10-30T10:05:00Z", + }), + ]); + + expect(detail.checks.map((check) => [check.name, check.status])).toEqual([["test", "success"]]); + expect(detail.checksState).toBe("passing"); + }); + it.each([ ["a manual dispatch", "workflow_dispatch", "workflow_dispatch", "CANCELLED", "cancelled"], ["a push of another ref", "push", "push", "CANCELLED", "cancelled"], diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index 2e7ffa6d38e54..4995356897087 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -594,26 +594,26 @@ function toCheckEntries(raw: ReadonlyArray | null | undefined): Rea }> { const lineageOf = (run: WorkflowRunFields) => `${run.workflow.id} ${run.event}`; const newestRunNumber = new Map(); - for (const { workflowRun: run } of raw ?? []) { - if (run == null || !PULL_REQUEST_EVENTS.has(run.event)) continue; - const newest = newestRunNumber.get(lineageOf(run)); - if (newest === undefined || run.runNumber > newest) { - newestRunNumber.set(lineageOf(run), run.runNumber); + const note = (key: string, runNumber: number) => { + if (runNumber > (newestRunNumber.get(key) ?? Number.NEGATIVE_INFINITY)) { + newestRunNumber.set(key, runNumber); } + }; + for (const check of raw ?? []) { + const run = check.workflowRun; + if (run == null || !PULL_REQUEST_EVENTS.has(run.event)) continue; + note(lineageOf(run), run.runNumber); + note(`${lineageOf(run)} ${trimmed(check.name) ?? ""}`, run.runNumber); } return (raw ?? []).flatMap((check) => { const name = trimmed(check.name) ?? trimmed(check.context); if (name === null) return []; const status = toCheckStatus(check); const run = check.workflowRun; - // Branch protection names required checks, so only a same-name result can replace one. - if ( - status === "cancelled" && - check.isRequired !== true && - run != null && - run.runNumber < (newestRunNumber.get(lineageOf(run)) ?? run.runNumber) - ) { - return []; + if (status === "cancelled" && run != null) { + // Branch protection names required checks, so only a newer same-name check replaces one. + const replacedBy = check.isRequired === true ? `${lineageOf(run)} ${name}` : lineageOf(run); + if (run.runNumber < (newestRunNumber.get(replacedBy) ?? run.runNumber)) return []; } return [ { From e5166baddc386c608914d06a786ef599a310b5f5 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 10 Nov 2026 23:28:03 +0000 Subject: [PATCH 8/8] test(github): keep superseded-run cases at the decoder layer Drop the API-level duplicate of the decoder case and the dispatch row that exercised the same non-pull-request branch as push. AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 --- .../src/server/GitHubPullRequestApi.test.ts | 67 ------------------- .../src/server/gitHubPullRequestJson.test.ts | 40 +++++------ 2 files changed, 15 insertions(+), 92 deletions(-) diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts index 79e3555e551a7..4693d373554e9 100644 --- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts +++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts @@ -3581,73 +3581,6 @@ layer("GitHubPullRequestApi.layer", (it) => { }), ); - it.effect("reads checks as GitHub reports them for a run a newer run superseded", () => - Effect.gen(function* () { - // Verbatim GitHub nodes, including unselected ids beyond int32. - const ciRun = (run: number, runNumber: number) => ({ - databaseId: run, - event: "pull_request", - runNumber, - runAttempt: 1, - workflow: { id: "W_kwDORLtfbc4N00ni", databaseId: 231950818, name: "CI" }, - }); - mockedExecute.mockReturnValueOnce( - Effect.succeed( - output( - encodeJson( - coreResponse({ - commits: { - nodes: [ - { - commit: { - statusCheckRollup: { - contexts: { - nodes: [ - checkRun({ - name: "web browser tests (runner ${{ matrix.slice }} of 6)", - conclusion: "CANCELLED", - startedAt: "2026-11-03T21:30:02Z", - completedAt: "2026-11-03T21:30:02Z", - detailsUrl: - "https://github.com/pingdotgg/t3code/actions/runs/41719063754/job/126207741102", - checkSuite: { workflowRun: ciRun(41719063754, 95379) }, - }), - checkRun({ - name: "web browser tests (runner 1 of 6)", - conclusion: "SUCCESS", - startedAt: "2026-11-03T21:34:14Z", - completedAt: "2026-11-03T21:41:45Z", - detailsUrl: - "https://github.com/pingdotgg/t3code/actions/runs/41722982377/job/126220308427", - checkSuite: { workflowRun: ciRun(41722982377, 95380) }, - }), - ], - pageInfo: { hasNextPage: false }, - }, - }, - }, - }, - ], - }, - }), - ), - ), - ), - ); - const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi; - const detail = yield* cli.getPullRequestDetail({ - cwd: "/w", - repository: "pingdotgg/t3code", - host: "github.com", - number: 30378, - }); - expect(detail.checks.map((check) => [check.name, check.status])).toEqual([ - ["web browser tests (runner 1 of 6)", "success"], - ]); - expect(detail.checksState).toBe("passing"); - }), - ); - it.effect.each([false, true])( "continues after the core check page without reading it twice (reviewer refusal: %s)", (refused) => diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index 0ddcdb4656bc3..6d8d64066f0bc 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -653,12 +653,9 @@ describe("pull request detail decoding", () => { inWorkflow({ ...replacement, name: "web browser tests (runner 1 of 6)" }), inWorkflow({ ...replacement, name: "web browser tests (runner 2 of 6)" }), ]; - const checksOf = (contexts: ReadonlyArray>) => { - const detail = detailOf(contexts); - return [detail.checks.map((check) => [check.name, check.status]), detail.checksState]; - }; + const detail = detailOf(rollup); - expect(checksOf(rollup)).toEqual([ + expect([detail.checks.map((check) => [check.name, check.status]), detail.checksState]).toEqual([ [ ["check", "success"], ["web browser tests (runner 1 of 6)", "success"], @@ -666,19 +663,6 @@ describe("pull request detail decoding", () => { ], "passing", ]); - expect( - checksOf([ - ...rollup, - inWorkflow({ - ...superseded, - workflowName: "Release", - workflowId: "W_kwDORLtfbc4Onf3y", - runNumber: 92888, - name: "publish", - conclusion: "CANCELLED", - }), - ])[0], - ).toContainEqual(["publish", "cancelled"]); }); it("keeps a cancelled check when the newer run is another workflow with the same name", () => { @@ -733,14 +717,20 @@ describe("pull request detail decoding", () => { }); it.each([ - ["a manual dispatch", "workflow_dispatch", "workflow_dispatch", "CANCELLED", "cancelled"], - ["a push of another ref", "push", "push", "CANCELLED", "cancelled"], - ["another event", "pull_request", "pull_request_target", "CANCELLED", "cancelled"], - ["a pull request run", "pull_request", "pull_request", "FAILURE", "failure"], - ["a pull request run, if required", "pull_request", "pull_request", "CANCELLED", "cancelled"], + ["a push", "push", "push", "CANCELLED", false, "cancelled"], + ["another event", "pull_request", "pull_request_target", "CANCELLED", false, "cancelled"], + ["a pull request run", "pull_request", "pull_request", "FAILURE", false, "failure"], + [ + "a pull request run, if required", + "pull_request", + "pull_request", + "CANCELLED", + true, + "cancelled", + ], ])( "keeps an older run's check when the newer run is %s", - (label, olderEvent, newerEvent, conclusion, status) => { + (_label, olderEvent, newerEvent, conclusion, isRequired, status) => { const detail = detailOf([ inWorkflow({ name: "test (packages/shared)", @@ -748,7 +738,7 @@ describe("pull request detail decoding", () => { event: olderEvent, runNumber: 41, conclusion, - ...(label.endsWith("if required") ? { isRequired: true } : {}), + isRequired, }), inWorkflow({ name: "test (apps/server)",