perf(forge): compare from the recorded base while confirming the head

Status snapshots carry the base commit the host recorded with the head
(baseSha). ForgeService.diff passes it to the provider when the latest
status names the requested head, and forge-github starts the compare read
from it while its GraphQL read confirms the head; a stale head or another
base cancels and joins the early read.
This commit is contained in:
Yichen Jiang committed 2026-11-07 16:22:24 +08:00
1 parent d8d6081f44
commit 9b456b4e93
18 files changed
+152 -39

No files matched your search

@@ -32,7 +32,7 @@ const THREAD_FIELDS = 'pageInfo { hasNextPage endCursor } nodes { isResolved }'
function pullRequestFields(threads: number): string {
return `id number url title state isDraft updatedAt closedAt
author { login }
headRefName headRefOid baseRefName additions deletions mergeable mergeStateStatus reviewDecision
headRefName headRefOid baseRefName baseRefOid additions deletions mergeable mergeStateStatus reviewDecision
reviewThreads(first: ${threads}) { ${THREAD_FIELDS} }
commits(last: 1) { nodes { commit { statusCheckRollup { id state contexts(first: ${PAGE_SIZE}) {
${CHECK_FIELDS}
@@ -132,6 +132,7 @@ const pullRequestSchema = z.object({
headRefName: z.string(),
headRefOid: z.string(),
baseRefName: z.string(),
baseRefOid: z.string().refine(isCommit),
additions: z.number().int().nonnegative(),
deletions: z.number().int().nonnegative(),
mergeable: z.string(),
@@ -466,6 +467,7 @@ function toSnapshot(
headBranch: node.headRefName,
headSha: node.headRefOid,
baseBranch: node.baseRefName,
baseSha: node.baseRefOid,
additions: node.additions,
deletions: node.deletions,
mergeability: mergeability(node.mergeable),