fix(server): background GitHub polling uses ~74% fewer calls with batched GraphQL (#14673)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Theo BrowneandClaude Opus 5.5 authored and GitHub committed 2026-10-01 16:48:29 -07:00
1 parent a3abb52660
commit 10ac2f2ba4
15 files changed
+1039 -213

No files matched your search

+26
View File
@@ -13,6 +13,7 @@ import * as Logger from "effect/Logger";
import * as Option from "effect/Option";
import * as PlatformError from "effect/PlatformError";
import * as References from "effect/References";
import * as Result from "effect/Result";
import * as Schema from "effect/Schema";
import * as Scope from "effect/Scope";
import { TestClock } from "effect/testing";
@@ -32,6 +33,7 @@ import {
TextGenerationError,
} from "@t3tools/contracts";
import * as GitHubCli from "../sourceControl/GitHubCli.ts";
import { decodeGitHubPullRequestListJson } from "../sourceControl/gitHubPullRequests.ts";
import * as GitLabCli from "../sourceControl/GitLabCli.ts";
import * as TextGeneration from "../textGeneration/TextGeneration.ts";
import * as GitVcsDriver from "../vcs/GitVcsDriver.ts";
@@ -510,6 +512,30 @@ function createGitHubCliWithFakeGh(scenario: FakeGhScenario = {}): {
return {
service: {
execute,
// The fake answers the CLI shape, so batched lookups read it the way the fallback does.
listPullRequestsByHead: (input) =>
execute({
cwd: input.cwd,
args: [
"pr",
"list",
"--head",
input.headSelector,
"--state",
input.state,
"--limit",
String(input.limit),
"--json",
"number,title,url,baseRefName,headRefName,state,isDraft,mergedAt,closedAt,updatedAt,isCrossRepository,headRepository,headRepositoryOwner",
],
}).pipe(
Effect.map((result) => {
const raw = result.stdout.trim();
if (raw.length === 0) return [];
const decoded = decodeGitHubPullRequestListJson(raw);
return Result.isSuccess(decoded) ? decoded.success : [];
}),
),
listOpenPullRequests: (input) =>
execute({
cwd: input.cwd,