From e5eaa82955ba50a7b228917b86ec5fe700f9d047 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 27 Oct 2026 01:50:00 +0000 Subject: [PATCH 1/2] test(source-control-github): reproduce #25717 review required shown as approved These tests reproduce #25717: a PR whose branch rule still needs more approvals (reviewDecision REVIEW_REQUIRED) with one APPROVED latest review decodes as "approved" instead of "review-required". Co-Authored-By: Claude Opus 5.5 --- .../src/server/gitHubPullRequestJson.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts index b217d490143ee..1e891c9f59d3b 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.test.ts @@ -293,6 +293,20 @@ describe("pull request list decoding", () => { ]); }); + it("keeps review required when an approval falls short of the branch's required count", () => { + const batch = expectSuccess( + decodePullRequestListJson( + listJson([ + { + reviewDecision: "REVIEW_REQUIRED", + latestReviews: [{ author: user("octocat"), state: "APPROVED" }], + }, + ]), + ), + ); + expect(batch.items.map((entry) => entry.reviewDecision)).toEqual(["review-required"]); + }); + it("skips malformed entries but still counts them, so paging does not stop early", () => { const batch = expectSuccess( decodePullRequestListJson(listJson([{}, { number: "not-a-number" }])), From dcbaace3211bcfb629d94b41f5db58dd89443fd6 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Tue, 27 Oct 2026 01:52:10 +0000 Subject: [PATCH 2/2] fix(github): pull requests short of required approvals no longer show as approved GitHub reports REVIEW_REQUIRED when a PR has fewer approvals than its branch rules require, but one APPROVED latest review upgraded it to approved. Derive approval from latest reviews only when GitHub reports no verdict at all, as for a bot's approval on an unprotected branch. Fixes pingdotgg/t3code#25717 Co-Authored-By: Claude Opus 5.5 --- .../source-control-github/src/server/gitHubPullRequestJson.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts index cf4def54bbd03..62256acf056c4 100644 --- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts +++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts @@ -505,7 +505,7 @@ function toReviewDecisionWithReviews( if (summarized === "approved" || summarized === "changes-requested") return summarized; const states = new Set((reviews ?? []).map((review) => review.state?.trim().toUpperCase() ?? "")); if (states.has("CHANGES_REQUESTED")) return "changes-requested"; - if (states.has("APPROVED")) return "approved"; + if (summarized === null && states.has("APPROVED")) return "approved"; return summarized; }