Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

pullRequest.ts

1,082 lines42.8 KB

1import * as Schema from "effect/Schema";
2import * as Effect from "effect/Effect";
3import * as HttpServerRespondable from "effect/http/HttpServerRespondable";
4import * as HttpServerResponse from "effect/http/HttpServerResponse";
5​
6import {
7 GitRefName,
8 ForwardCompatibleArray,
9 IsoDateTime,
10 NonNegativeInt,
11 PositiveInt,
12 ProjectId,
13 ThreadId,
14 TrimmedNonEmptyString,
15} from "./baseSchemas.ts";
16import { SourceControlFailureReason, SourceControlProviderKind } from "./sourceControl.ts";
17​
18export const PullRequestInvolvement = Schema.Literals(["all", "reviewing", "authored"]);
19export type PullRequestInvolvement = typeof PullRequestInvolvement.Type;
20​
21export const PullRequestState = Schema.Literals(["open", "closed", "merged"]);
22export type PullRequestState = typeof PullRequestState.Type;
23​
24export const PullRequestListState = Schema.Literals(["all", "open", "closed", "merged"]);
25export type PullRequestListState = typeof PullRequestListState.Type;
26​
27export const PullRequestReviewDecision = Schema.Literals([
28 "approved",
29 "changes-requested",
30 "review-required",
31]);
32export type PullRequestReviewDecision = typeof PullRequestReviewDecision.Type;
33​
34const PullRequestQualifierValue = TrimmedNonEmptyString.check(Schema.isMaxLength(200));
35const PullRequestQualifierValues = Schema.Array(PullRequestQualifierValue).check(
36 Schema.isMaxLength(10),
37);
38​
39export const PullRequestListFilters = Schema.Struct({
40 draft: Schema.optional(Schema.Literals(["only", "hide"])),
41 review: Schema.optional(
42 Schema.Literals(["approved", "changes-requested", "review-required", "none"]),
43 ),
44 checks: Schema.optional(Schema.Literals(["passing", "failing"])),
45 /** GitHub label qualifiers: every group must match; any name within a group suffices. */
46 labels: Schema.optional(Schema.Array(PullRequestQualifierValues).check(Schema.isMaxLength(10))),
47 excludedLabels: Schema.optional(PullRequestQualifierValues),
48 author: Schema.optional(PullRequestQualifierValue),
49});
50export type PullRequestListFilters = typeof PullRequestListFilters.Type;
51​
52export const PullRequestChecksState = Schema.Literals(["passing", "failing", "pending"]);
53export type PullRequestChecksState = typeof PullRequestChecksState.Type;
54​
55export const PullRequestMergeability = Schema.Literals(["mergeable", "conflicting", "unknown"]);
56export type PullRequestMergeability = typeof PullRequestMergeability.Type;
57​
58/** `fast-forward` refuses unless the head contains the base, where `rebase` rewrites the branch onto it. */
59export const PullRequestMergeMethod = Schema.Literals([
60 "merge",
61 "squash",
62 "rebase",
63 "fast-forward",
64]);
65export type PullRequestMergeMethod = typeof PullRequestMergeMethod.Type;
66​
67export const PullRequestAction = Schema.Literals([
68 "merge",
69 "ready",
70 "draft",
71 "close",
72 "reopen",
73 "delete-branch",
74 "update-branch",
75 "enable-auto-merge",
76 "disable-auto-merge",
77 "revert",
78 "approve-workflows",
79]);
80export type PullRequestAction = typeof PullRequestAction.Type;
81​
82export const PullRequestUpdateMethod = Schema.Literals(["merge", "rebase"]);
83export type PullRequestUpdateMethod = typeof PullRequestUpdateMethod.Type;
84​
85export const PullRequestBaseComparison = Schema.Literals(["up-to-date", "behind", "unknown"]);
86export type PullRequestBaseComparison = typeof PullRequestBaseComparison.Type;
87​
88export const PullRequestActor = Schema.Struct({
89 isBot: Schema.optional(Schema.Boolean),
90 login: TrimmedNonEmptyString,
91 name: Schema.NullOr(Schema.String),
92 avatarUrl: Schema.NullOr(Schema.String),
93});
94export type PullRequestActor = typeof PullRequestActor.Type;
95​
96export const PullRequestLabel = Schema.Struct({
97 name: TrimmedNonEmptyString,
98 color: Schema.NullOr(Schema.String),
99 description: Schema.optional(Schema.NullOr(Schema.String)),
100});
101export type PullRequestLabel = typeof PullRequestLabel.Type;
102​
103export const PullRequestCheckStatus = Schema.Literals([
104 "pending",
105 "action-required",
106 "success",
107 "failure",
108 "skipped",
109 "neutral",
110 "cancelled",
111]);
112export type PullRequestCheckStatus = typeof PullRequestCheckStatus.Type;
113​
114export const PullRequestCheck = Schema.Struct({
115 name: TrimmedNonEmptyString,
116 status: PullRequestCheckStatus,
117 description: Schema.NullOr(Schema.String),
118 url: Schema.NullOr(Schema.String),
119 required: Schema.optional(Schema.Boolean),
120 /**
121 * Not a check: it stands for ones the host could not list, such as workflow runs awaiting
122 * approval when that read fails, so nothing waits on it or counts it as passing.
123 */
124 placeholder: Schema.optional(Schema.Boolean),
125});
126export type PullRequestCheck = typeof PullRequestCheck.Type;
127​
128export const PullRequestReactionContent = Schema.Literals([
129 "thumbs-up",
130 "thumbs-down",
131 "laugh",
132 "hooray",
133 "confused",
134 "heart",
135 "rocket",
136 "eyes",
137]);
138export type PullRequestReactionContent = typeof PullRequestReactionContent.Type;
139​
140export const PullRequestReaction = Schema.Struct({
141 content: PullRequestReactionContent,
142 count: PositiveInt,
143 /** Excludes the viewer's login when viewerHasReacted; count still includes them. */
144 actors: Schema.Array(TrimmedNonEmptyString),
145 viewerHasReacted: Schema.Boolean,
146});
147export type PullRequestReaction = typeof PullRequestReaction.Type;
148​
149export const PullRequestCommentKind = Schema.Literals([
150 "issue-comment",
151 "review-comment",
152 "review",
153]);
154export type PullRequestCommentKind = typeof PullRequestCommentKind.Type;
155​
156export const PullRequestComment = Schema.Struct({
157 id: TrimmedNonEmptyString,
158 kind: PullRequestCommentKind,
159 author: Schema.NullOr(PullRequestActor),
160 body: Schema.String,
161 createdAt: IsoDateTime,
162 editedAt: Schema.optional(Schema.NullOr(IsoDateTime)),
163 url: Schema.NullOr(Schema.String),
164 path: Schema.NullOr(Schema.String),
165 reviewState: Schema.NullOr(Schema.String),
166 reactions: Schema.optional(Schema.Array(PullRequestReaction)),
167 canEdit: Schema.optional(Schema.Boolean),
168});
169export type PullRequestComment = typeof PullRequestComment.Type;
170​
171export const PullRequestDiffSide = Schema.Literals(["left", "right"]);
172export type PullRequestDiffSide = typeof PullRequestDiffSide.Type;
173​
174export const PullRequestReviewVerdict = Schema.Literals(["comment", "approve", "request-changes"]);
175export type PullRequestReviewVerdict = typeof PullRequestReviewVerdict.Type;
176​
177export const PullRequestThreadComment = Schema.Struct({
178 id: TrimmedNonEmptyString,
179 author: Schema.NullOr(PullRequestActor),
180 body: Schema.String,
181 createdAt: IsoDateTime,
182 editedAt: Schema.optional(Schema.NullOr(IsoDateTime)),
183 url: Schema.NullOr(Schema.String),
184 /** The review that posted the comment, so a link to a review with no text finds its comments. */
185 reviewUrl: Schema.optional(Schema.NullOr(Schema.String)),
186 reactions: Schema.optional(Schema.Array(PullRequestReaction)),
187 canEdit: Schema.optional(Schema.Boolean),
188});
189export type PullRequestThreadComment = typeof PullRequestThreadComment.Type;
190​
191export const PullRequestReviewThread = Schema.Struct({
192 id: TrimmedNonEmptyString,
193 path: Schema.NonEmptyString,
194 line: Schema.NullOr(PositiveInt),
195 side: PullRequestDiffSide,
196 isResolved: Schema.Boolean,
197 isOutdated: Schema.Boolean,
198 comments: Schema.Array(PullRequestThreadComment),
199 commentCount: Schema.optional(NonNegativeInt),
200 nextCommentsCursor: Schema.optional(TrimmedNonEmptyString),
201 /** Can only narrow repository-wide resolve permission. Absent when unreported. */
202 canResolve: Schema.optional(Schema.Boolean),
203});
204export type PullRequestReviewThread = typeof PullRequestReviewThread.Type;
205​
206/** A thread on the change request as a whole, such as a GitLab overview thread. */
207export const PullRequestOverviewThread = Schema.Struct({
208 ...PullRequestReviewThread.fields,
209 path: Schema.Null,
210 line: Schema.Null,
211});
212export type PullRequestOverviewThread = typeof PullRequestOverviewThread.Type;
213​
214export type PullRequestConversationThread = PullRequestReviewThread | PullRequestOverviewThread;
215​
216export const PullRequestReviewerKind = Schema.Literals(["user", "team"]);
217export type PullRequestReviewerKind = typeof PullRequestReviewerKind.Type;
218​
219export const PullRequestReviewerCandidate = Schema.Struct({
220 ...PullRequestActor.fields,
221 id: TrimmedNonEmptyString,
222 kind: PullRequestReviewerKind,
223 isRequested: Schema.Boolean,
224});
225export type PullRequestReviewerCandidate = typeof PullRequestReviewerCandidate.Type;
226​
227export const PullRequestReviewerCandidateList = Schema.Struct({
228 candidates: Schema.Array(PullRequestReviewerCandidate),
229 truncated: Schema.Boolean,
230});
231export type PullRequestReviewerCandidateList = typeof PullRequestReviewerCandidateList.Type;
232​
233export const PullRequestLabelCandidate = Schema.Struct({
234 ...PullRequestLabel.fields,
235 description: Schema.NullOr(Schema.String),
236 isApplied: Schema.Boolean,
237});
238export type PullRequestLabelCandidate = typeof PullRequestLabelCandidate.Type;
239​
240export const PullRequestLabelCandidateList = Schema.Struct({
241 candidates: Schema.Array(PullRequestLabelCandidate),
242 truncated: Schema.Boolean,
243});
244export type PullRequestLabelCandidateList = typeof PullRequestLabelCandidateList.Type;
245​
246export const PullRequestCommit = Schema.Struct({
247 oid: TrimmedNonEmptyString,
248 messageHeadline: Schema.String,
249 committedDate: IsoDateTime,
250 additions: Schema.optional(NonNegativeInt),
251 deletions: Schema.optional(NonNegativeInt),
252 changedFiles: Schema.optional(NonNegativeInt),
253 authors: Schema.optional(Schema.Array(PullRequestActor)),
254});
255export type PullRequestCommit = typeof PullRequestCommit.Type;
256​
257export const PullRequestReviewCapabilities = Schema.Struct({
258 inlineComment: Schema.Boolean,
259 /**
260 * An inline comment can cover a range of lines rather than its last one. Absent, as from a
261 * server that predates it, means one line.
262 */
263 rangeComment: Schema.optional(Schema.Boolean),
264 reply: Schema.Boolean,
265 resolve: Schema.Boolean,
266 verdicts: ForwardCompatibleArray(PullRequestReviewVerdict),
267});
268export type PullRequestReviewCapabilities = typeof PullRequestReviewCapabilities.Type;
269​
270export const PullRequestEditCapabilities = Schema.Struct({
271 changeRequest: Schema.Boolean,
272 comment: Schema.Boolean,
273 maintainerEdits: Schema.optional(Schema.Boolean),
274});
275export type PullRequestEditCapabilities = typeof PullRequestEditCapabilities.Type;
276​
277export const PullRequestReviewerCapabilities = Schema.Struct({
278 request: Schema.Boolean,
279 listCandidates: Schema.Boolean,
280 /**
281 * Reviewer candidates take a `query` the host matches past the first page. Absent, as from a
282 * server that predates it, means the client narrows the loaded page itself.
283 */
284 searchCandidates: Schema.optional(Schema.Boolean),
285});
286export type PullRequestReviewerCapabilities = typeof PullRequestReviewerCapabilities.Type;
287​
288export const PullRequestViewedFilesStore = Schema.Literals(["host", "environment"]);
289export type PullRequestViewedFilesStore = typeof PullRequestViewedFilesStore.Type;
290​
291/** `#` references issues (and GitHub pull requests); `!` references GitLab merge requests. */
292export const PullRequestReferenceSigil = Schema.Literals(["#", "!"]);
293export type PullRequestReferenceSigil = typeof PullRequestReferenceSigil.Type;
294​
295export const PullRequestCapabilities = Schema.Struct({
296 diff: Schema.Boolean,
297 comment: Schema.Boolean,
298 actions: ForwardCompatibleArray(PullRequestAction),
299 mergeMethods: ForwardCompatibleArray(PullRequestMergeMethod),
300 deleteBranch: Schema.optional(Schema.Boolean),
301 /**
302 * Absent where it cannot at all, which is every host that has not said otherwise — so a
303 * provider that says nothing offers nothing.
304 */
305 updateMethods: Schema.optional(ForwardCompatibleArray(PullRequestUpdateMethod)),
306 search: Schema.Boolean,
307 reactions: Schema.optional(Schema.Boolean),
308 viewedFiles: Schema.optional(PullRequestViewedFilesStore),
309 review: PullRequestReviewCapabilities,
310 reviewers: PullRequestReviewerCapabilities,
311 edit: Schema.optional(PullRequestEditCapabilities),
312 stacks: Schema.optional(Schema.Boolean),
313 stackActions: Schema.optional(Schema.Boolean),
314 /** Stack actions also arm and cancel auto-merge for a layer and the open layers below it. */
315 stackAutoMerge: Schema.optional(Schema.Boolean),
316 labels: Schema.optional(Schema.Boolean),
317 /** The host searches the repository's users, so composers can complete `@login`. */
318 mentions: Schema.optional(Schema.Boolean),
319 /** The sigils whose issue and change request references composers can complete. */
320 referenceSigils: Schema.optional(ForwardCompatibleArray(PullRequestReferenceSigil)),
321 /**
322 * Every head gets at least one check, so a head that has gone a while without any means none
323 * reported rather than that the repository runs none. Absent means an empty list says nothing.
324 */
325 checksAlwaysReport: Schema.optional(Schema.Boolean),
326 /** The diff can read one file the paged diff withheld as too large (`PullRequestDiffInput.path`). */
327 withheldFileDiff: Schema.optional(Schema.Boolean),
328});
329export type PullRequestCapabilities = typeof PullRequestCapabilities.Type;
330​
331/** Unreported host permissions are granted. */
332export const PullRequestViewerPermissions = Schema.Struct({
333 stackRebase: Schema.optional(Schema.Boolean),
334 actions: ForwardCompatibleArray(PullRequestAction),
335 comment: Schema.Boolean,
336 resolve: Schema.Boolean,
337 verdicts: ForwardCompatibleArray(PullRequestReviewVerdict),
338 requestReviewers: Schema.Boolean,
339 updateMethods: Schema.optional(ForwardCompatibleArray(PullRequestUpdateMethod)),
340 labels: Schema.optional(Schema.Boolean),
341 editChangeRequest: Schema.optional(Schema.Boolean),
342 maintainerEdits: Schema.optional(Schema.Boolean),
343});
344export type PullRequestViewerPermissions = typeof PullRequestViewerPermissions.Type;
345​
346export const PullRequestMergeCapabilities = Schema.Struct({
347 merge: Schema.Boolean,
348 squash: Schema.Boolean,
349 rebase: Schema.Boolean,
350 /** Optional so servers that predate it still decode; absent means not allowed. */
351 "fast-forward": Schema.optional(Schema.Boolean),
352});
353export type PullRequestMergeCapabilities = typeof PullRequestMergeCapabilities.Type;
354​
355export const PullRequestStackMembership = Schema.Struct({
356 number: PositiveInt,
357 position: PositiveInt,
358 size: PositiveInt,
359 base: GitRefName,
360});
361export type PullRequestStackMembership = typeof PullRequestStackMembership.Type;
362​
363/** Who can read a pull request on a host that can hide one in a public repository. */
364export const PullRequestVisibility = Schema.Literals(["public", "private"]);
365export type PullRequestVisibility = typeof PullRequestVisibility.Type;
366​
367export const PullRequestListEntry = Schema.Struct({
368 stack: Schema.optional(PullRequestStackMembership),
369 provider: SourceControlProviderKind,
370 host: TrimmedNonEmptyString,
371 projectId: ProjectId,
372 projectTitle: TrimmedNonEmptyString,
373 repository: TrimmedNonEmptyString,
374 number: PositiveInt,
375 title: TrimmedNonEmptyString,
376 url: TrimmedNonEmptyString,
377 author: Schema.NullOr(PullRequestActor),
378 headBranch: GitRefName,
379 baseBranch: GitRefName,
380 state: PullRequestState,
381 isDraft: Schema.Boolean,
382 mergeability: PullRequestMergeability,
383 rebaseRequired: Schema.optional(Schema.Boolean),
384 /** Zero until fetched through `PullRequestListStatsInput`; GitHub listings omit counts. */
385 additions: NonNegativeInt,
386 deletions: NonNegativeInt,
387 createdAt: IsoDateTime,
388 updatedAt: IsoDateTime,
389 observedAt: Schema.optional(Schema.Finite),
390 viewerReviewRequested: Schema.Boolean,
391 labels: Schema.Array(PullRequestLabel),
392 reviewDecision: Schema.optional(PullRequestReviewDecision),
393 checksState: Schema.optional(PullRequestChecksState),
394 /** Absent where the host has no private pull requests or names no visibility. */
395 visibility: Schema.optional(PullRequestVisibility),
396});
397export type PullRequestListEntry = typeof PullRequestListEntry.Type;
398​
399export const PullRequestListCursors = Schema.Record(
400 TrimmedNonEmptyString,
401 TrimmedNonEmptyString.check(Schema.isMaxLength(4096)),
402);
403export type PullRequestListCursors = typeof PullRequestListCursors.Type;
404​
405export const PULL_REQUEST_LIST_PROJECT_LIMIT = 100;
406​
407export const PullRequestListInput = Schema.Struct({
408 state: PullRequestListState,
409 involvement: Schema.optional(PullRequestInvolvement),
410 filters: Schema.optional(PullRequestListFilters),
411 projectId: Schema.optional(ProjectId),
412 projectIds: Schema.optional(
413 Schema.Array(ProjectId).check(Schema.isMaxLength(PULL_REQUEST_LIST_PROJECT_LIMIT)),
414 ),
415 host: Schema.optional(TrimmedNonEmptyString),
416 limit: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 500 }))),
417 cursors: Schema.optional(PullRequestListCursors),
418 query: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(200))),
419});
420export type PullRequestListInput = typeof PullRequestListInput.Type;
421​
422export const PullRequestProviderSummary = Schema.Struct({
423 host: TrimmedNonEmptyString,
424 kind: SourceControlProviderKind,
425 searchesOnHost: Schema.Boolean,
426 actions: Schema.optional(ForwardCompatibleArray(PullRequestAction)),
427 projectCount: PositiveInt,
428 /** SSH checkouts can resolve to an HTTP authority different from their stored identity. */
429 projectIds: Schema.optional(Schema.Array(ProjectId)),
430 configured: Schema.Boolean,
431 detail: Schema.NullOr(TrimmedNonEmptyString),
432});
433export type PullRequestProviderSummary = typeof PullRequestProviderSummary.Type;
434​
435export const PullRequestListProjectError = Schema.Struct({
436 projectId: ProjectId,
437 projectTitle: TrimmedNonEmptyString,
438 message: TrimmedNonEmptyString,
439 reason: Schema.optional(SourceControlFailureReason),
440});
441export type PullRequestListProjectError = typeof PullRequestListProjectError.Type;
442​
443export const PullRequestListResult = Schema.Struct({
444 /** Unreadable hosts are absent; JSON codecs reject optional record values. */
445 viewers: Schema.Record(TrimmedNonEmptyString, TrimmedNonEmptyString),
446 providers: Schema.Array(PullRequestProviderSummary),
447 /** Re-sort after appending: one repository's older slice may outrank another's existing rows. */
448 entries: Schema.Array(PullRequestListEntry),
449 errors: Schema.Array(PullRequestListProjectError),
450 truncated: Schema.Boolean,
451 nextCursors: PullRequestListCursors,
452});
453export type PullRequestListResult = typeof PullRequestListResult.Type;
454​
455export const PullRequestRef = Schema.Struct({
456 projectId: ProjectId,
457 host: Schema.optional(TrimmedNonEmptyString),
458 expectedAccountId: Schema.optional(TrimmedNonEmptyString),
459 allowStale: Schema.optional(Schema.Boolean),
460 repository: TrimmedNonEmptyString,
461 number: PositiveInt,
462});
463export type PullRequestRef = typeof PullRequestRef.Type;
464​
465/** `query` asks the host for matches past the first page of candidates. */
466export const PullRequestReviewerCandidatesInput = Schema.Struct({
467 ...PullRequestRef.fields,
468 query: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(100))),
469});
470export type PullRequestReviewerCandidatesInput = typeof PullRequestReviewerCandidatesInput.Type;
471​
472export const PullRequestRoutingIdentityInput = Schema.Struct({
473 host: TrimmedNonEmptyString,
474});
475export type PullRequestRoutingIdentityInput = typeof PullRequestRoutingIdentityInput.Type;
476​
477export const PullRequestRoutingIdentityResult = Schema.Struct({
478 accountId: TrimmedNonEmptyString,
479 host: TrimmedNonEmptyString,
480 provider: SourceControlProviderKind,
481 viewer: TrimmedNonEmptyString,
482});
483export type PullRequestRoutingIdentityResult = typeof PullRequestRoutingIdentityResult.Type;
484​
485export const PullRequestRoutingResult = Schema.Struct({
486 accountId: TrimmedNonEmptyString,
487 host: TrimmedNonEmptyString,
488 provider: SourceControlProviderKind,
489 viewer: TrimmedNonEmptyString,
490 projectTitle: TrimmedNonEmptyString,
491 workspaceRoot: TrimmedNonEmptyString,
492});
493export type PullRequestRoutingResult = typeof PullRequestRoutingResult.Type;
494​
495export const PullRequestLinkedThreadsResult = Schema.Struct({
496 threads: Schema.Array(
497 Schema.Struct({
498 id: ThreadId,
499 projectId: ProjectId,
500 title: Schema.String,
501 archivedAt: Schema.NullOr(IsoDateTime),
502 settled: Schema.optionalKey(Schema.Boolean),
503 }),
504 ),
505});
506export type PullRequestLinkedThreadsResult = typeof PullRequestLinkedThreadsResult.Type;
507​
508export const PullRequestPreview = Schema.Struct({
509 projectId: ProjectId,
510 repository: TrimmedNonEmptyString,
511 number: PositiveInt,
512 title: TrimmedNonEmptyString,
513 url: TrimmedNonEmptyString,
514 author: Schema.NullOr(PullRequestActor),
515 state: PullRequestState,
516 isDraft: Schema.Boolean,
517 createdAt: IsoDateTime,
518 updatedAt: Schema.optional(IsoDateTime),
519 observedAt: Schema.optional(Schema.Finite),
520});
521export type PullRequestPreview = typeof PullRequestPreview.Type;
522​
523export const PullRequestSummary = Schema.Struct({
524 provider: SourceControlProviderKind,
525 projectId: ProjectId,
526 repository: TrimmedNonEmptyString,
527 number: PositiveInt,
528 title: TrimmedNonEmptyString,
529 url: TrimmedNonEmptyString,
530 state: PullRequestState,
531 isDraft: Schema.optional(Schema.Boolean),
532 headBranch: GitRefName,
533 baseBranch: GitRefName,
534 closedAt: Schema.optional(Schema.NullOr(Schema.String)),
535 mergedAt: Schema.optional(Schema.NullOr(Schema.String)),
536 updatedAt: IsoDateTime,
537 observedAt: Schema.optional(Schema.Finite),
538 author: Schema.optional(Schema.NullOr(PullRequestActor)),
539 additions: Schema.optional(NonNegativeInt),
540 deletions: Schema.optional(NonNegativeInt),
541 changedFiles: Schema.optional(NonNegativeInt),
542 reviewDecision: Schema.optional(Schema.NullOr(PullRequestReviewDecision)),
543 checksState: Schema.optional(Schema.NullOr(PullRequestChecksState)),
544 mergeability: Schema.optional(PullRequestMergeability),
545 rebaseRequired: Schema.optional(Schema.Boolean),
546 /** Null when the host says the pull request is in no stack; absent when the read did not ask. */
547 stack: Schema.optional(Schema.NullOr(PullRequestStackMembership)),
548 headSha: Schema.optional(TrimmedNonEmptyString),
549 /** Absent means the read did not report auto-merge state, not that it is off. */
550 autoMergeEnabled: Schema.optional(Schema.Boolean),
551 autoMergeMethod: Schema.optional(PullRequestMergeMethod),
552});
553export type PullRequestSummary = typeof PullRequestSummary.Type;
554​
555export const PullRequestStack = Schema.Struct({
556 id: TrimmedNonEmptyString,
557 number: PositiveInt,
558 url: TrimmedNonEmptyString,
559 base: GitRefName,
560 layers: Schema.Array(
561 Schema.Struct({
562 number: PositiveInt,
563 title: Schema.optional(Schema.String),
564 isDraft: Schema.optional(Schema.Boolean),
565 headSha: Schema.optional(TrimmedNonEmptyString),
566 headBranch: GitRefName,
567 state: PullRequestState,
568 }),
569 ),
570});
571export type PullRequestStack = typeof PullRequestStack.Type;
572​
573export const PullRequestDiffStat = Schema.Struct({
574 projectId: ProjectId,
575 /** Tells apart same-named repositories one project tracks on several hosts. Absent from older servers. */
576 host: Schema.optional(TrimmedNonEmptyString),
577 repository: TrimmedNonEmptyString,
578 number: PositiveInt,
579 additions: NonNegativeInt,
580 deletions: NonNegativeInt,
581});
582export type PullRequestDiffStat = typeof PullRequestDiffStat.Type;
583​
584export const PullRequestListStatsInput = Schema.Struct({
585 refs: Schema.Array(PullRequestRef).check(Schema.isMaxLength(500)),
586});
587export type PullRequestListStatsInput = typeof PullRequestListStatsInput.Type;
588​
589export const PullRequestListStatsResult = Schema.Struct({
590 stats: Schema.Array(PullRequestDiffStat),
591});
592export type PullRequestListStatsResult = typeof PullRequestListStatsResult.Type;
593​
594export const PullRequestFilterOptionKind = Schema.Literals(["labels", "authors", "references"]);
595export type PullRequestFilterOptionKind = typeof PullRequestFilterOptionKind.Type;
596​
597/** Scoped like `PullRequestListInput`, so the options come from the repositories it lists. */
598export const PullRequestFilterOptionsInput = Schema.Struct({
599 kind: PullRequestFilterOptionKind,
600 projectId: Schema.optional(ProjectId),
601 projectIds: Schema.optional(Schema.Array(ProjectId).check(Schema.isMaxLength(100))),
602 host: Schema.optional(TrimmedNonEmptyString),
603 query: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(100))),
604 /** For `references`, the sigil typed, so a host can search only what it links. */
605 sigil: Schema.optional(PullRequestReferenceSigil),
606});
607export type PullRequestFilterOptionsInput = typeof PullRequestFilterOptionsInput.Type;
608​
609/** An issue or change request a composer can reference, with the text the host links. */
610export const PullRequestReferenceCandidate = Schema.Struct({
611 reference: TrimmedNonEmptyString,
612 kind: Schema.Literals(["issue", "change-request"]),
613 number: PositiveInt,
614 title: Schema.String,
615 state: Schema.Literals(["open", "closed", "merged"]),
616});
617export type PullRequestReferenceCandidate = typeof PullRequestReferenceCandidate.Type;
618​
619export const PullRequestFilterOptions = Schema.Struct({
620 labels: Schema.Array(PullRequestLabel),
621 authors: Schema.Array(PullRequestActor),
622 // Servers from before reference completion send no key.
623 references: Schema.Array(PullRequestReferenceCandidate).pipe(
624 Schema.withDecodingDefault(Effect.succeed([])),
625 ),
626 truncated: Schema.Boolean,
627});
628export type PullRequestFilterOptions = typeof PullRequestFilterOptions.Type;
629​
630/**
631 * A separate request rather than a flag on the reads, so an explicit "refresh" one person
632 * presses is the only thing that spends host requests — every ordinary read shares.
633 */
634export const PullRequestInvalidateInput = Schema.Struct({
635 reference: Schema.optional(PullRequestRef),
636 filesViewedOnly: Schema.optional(Schema.Boolean),
637});
638export type PullRequestInvalidateInput = typeof PullRequestInvalidateInput.Type;
639​
640export const PullRequestReportStateInput = Schema.Struct({
641 reference: PullRequestRef,
642 state: PullRequestState,
643 isDraft: Schema.optional(Schema.Boolean),
644});
645export type PullRequestReportStateInput = typeof PullRequestReportStateInput.Type;
646​
647/** The host's merge queue letting go of a pull request without merging it, newest first. */
648export const PullRequestMergeQueueRemoval = Schema.Struct({
649 id: TrimmedNonEmptyString,
650 removedAt: IsoDateTime,
651 reason: Schema.NullOr(Schema.String),
652});
653export type PullRequestMergeQueueRemoval = typeof PullRequestMergeQueueRemoval.Type;
654​
655export const PullRequestDetail = Schema.Struct({
656 provider: SourceControlProviderKind,
657 capabilities: PullRequestCapabilities,
658 viewerPermissions: PullRequestViewerPermissions,
659 projectId: ProjectId,
660 projectTitle: TrimmedNonEmptyString,
661 workspaceRoot: TrimmedNonEmptyString,
662 repository: TrimmedNonEmptyString,
663 number: PositiveInt,
664 title: TrimmedNonEmptyString,
665 body: Schema.String,
666 url: TrimmedNonEmptyString,
667 author: Schema.NullOr(PullRequestActor),
668 state: PullRequestState,
669 isDraft: Schema.Boolean,
670 mergeability: PullRequestMergeability,
671 rebaseRequired: Schema.optional(Schema.Boolean),
672 additions: NonNegativeInt,
673 deletions: NonNegativeInt,
674 changedFiles: NonNegativeInt,
675 headBranch: GitRefName,
676 headRepositoryNameWithOwner: Schema.optional(Schema.NullOr(TrimmedNonEmptyString)),
677 headSha: Schema.optional(TrimmedNonEmptyString),
678 baseBranch: GitRefName,
679 createdAt: IsoDateTime,
680 updatedAt: IsoDateTime,
681 observedAt: Schema.optional(Schema.Finite),
682 mergedAt: Schema.NullOr(IsoDateTime),
683 mergeCommitSha: Schema.optional(TrimmedNonEmptyString),
684 mergedBy: Schema.optional(PullRequestActor),
685 closedAt: Schema.NullOr(IsoDateTime),
686 reviewers: Schema.Array(PullRequestActor),
687 labels: Schema.Array(PullRequestLabel),
688 checks: Schema.Array(PullRequestCheck),
689 mergeCapabilities: PullRequestMergeCapabilities,
690 viewer: Schema.optional(TrimmedNonEmptyString),
691 baseComparison: Schema.optional(PullRequestBaseComparison),
692 behindBy: Schema.optional(NonNegativeInt),
693 /** Absent means the host does not report auto-merge state, not that it is off. */
694 autoMergeEnabled: Schema.optional(Schema.Boolean),
695 autoMergeMethod: Schema.optional(PullRequestMergeMethod),
696 workflowApprovalsRequired: Schema.optional(NonNegativeInt),
697 /** Absent where the host has no merge queue or does not report one. */
698 mergeQueueRemoval: Schema.optional(PullRequestMergeQueueRemoval),
699 maintainerCanModify: Schema.optional(Schema.Boolean),
700 /** Absent where the host has no private pull requests or names no visibility. */
701 visibility: Schema.optional(PullRequestVisibility),
702});
703export type PullRequestDetail = typeof PullRequestDetail.Type;
704​
705export const PullRequestChecks = Schema.Struct({
706 observedAt: Schema.optional(Schema.Finite),
707 state: PullRequestState,
708 checks: Schema.Array(PullRequestCheck),
709 workflowApprovalsRequired: Schema.optional(NonNegativeInt),
710});
711export type PullRequestChecks = typeof PullRequestChecks.Type;
712​
713export const PullRequestActivity = Schema.Struct({
714 author: Schema.optional(Schema.NullOr(PullRequestActor)),
715 reviewers: Schema.optional(Schema.Array(PullRequestActor)),
716 comments: Schema.Array(PullRequestComment),
717 commentCount: NonNegativeInt,
718 commentsTruncated: Schema.Boolean,
719 reviewThreadsTruncated: Schema.optional(Schema.Boolean),
720 reviewThreads: Schema.Array(PullRequestReviewThread),
721 // Apart from reviewThreads so clients that require a thread path still decode the activity.
722 overviewThreads: Schema.optional(Schema.Array(PullRequestOverviewThread)),
723 commits: Schema.Array(PullRequestCommit),
724 reactions: Schema.optional(Schema.Array(PullRequestReaction)),
725});
726export type PullRequestActivity = typeof PullRequestActivity.Type;
727​
728export const pullRequestConversationThreads = (
729 activity: Pick<PullRequestActivity, "reviewThreads" | "overviewThreads">,
730): ReadonlyArray<PullRequestConversationThread> =>
731 activity.overviewThreads === undefined || activity.overviewThreads.length === 0
732 ? activity.reviewThreads
733 : [...activity.reviewThreads, ...activity.overviewThreads];
734​
735export const PullRequestDetailView = Schema.Struct({
736 ...PullRequestDetail.fields,
737 ...PullRequestActivity.fields,
738 author: Schema.NullOr(PullRequestActor),
739 reviewers: Schema.Array(PullRequestActor),
740});
741export type PullRequestDetailView = typeof PullRequestDetailView.Type;
742​
743/** GitHub refuses diffs past 300 files, so callers must page large changes. */
744export const PullRequestDiffInput = Schema.Struct({
745 ...PullRequestRef.fields,
746 cursor: Schema.optional(TrimmedNonEmptyString),
747 commit: Schema.optional(TrimmedNonEmptyString),
748 /** Reads one file the paged diff withheld as too large; ignores `cursor`. */
749 path: Schema.optional(Schema.NonEmptyString),
750});
751export type PullRequestDiffInput = typeof PullRequestDiffInput.Type;
752​
753export const PullRequestOmittedFileStat = Schema.Struct({
754 path: Schema.NonEmptyString,
755 additions: Schema.Number,
756 deletions: Schema.Number,
757});
758export type PullRequestOmittedFileStat = typeof PullRequestOmittedFileStat.Type;
759​
760export const PullRequestDiffResult = Schema.Struct({
761 patch: Schema.String,
762 /** Content omitted within this slice; nextCursor separately indicates more slices. */
763 truncated: Schema.Boolean,
764 nextCursor: Schema.NullOr(TrimmedNonEmptyString),
765 omittedFileStats: Schema.optional(Schema.Array(PullRequestOmittedFileStat)),
766 /** On the first page: files this diff withholds can be read one at a time with `path`. */
767 withheldFilesReadable: Schema.optional(Schema.Boolean),
768});
769export type PullRequestDiffResult = typeof PullRequestDiffResult.Type;
770​
771export const PullRequestDiffFileContentsInput = Schema.Struct({
772 ...PullRequestRef.fields,
773 commit: Schema.optional(TrimmedNonEmptyString),
774 changeType: Schema.Literals(["change", "rename-pure", "rename-changed", "new", "deleted"]),
775 oldPath: Schema.NonEmptyString,
776 newPath: Schema.NonEmptyString,
777});
778export type PullRequestDiffFileContentsInput = typeof PullRequestDiffFileContentsInput.Type;
779​
780export const PullRequestDiffFileContentsResult = Schema.Struct({
781 oldContents: Schema.String,
782 newContents: Schema.String,
783});
784export type PullRequestDiffFileContentsResult = typeof PullRequestDiffFileContentsResult.Type;
785​
786const MAX_FILE_PATH_LENGTH = 4096;
787// Preserve filename whitespace so viewed marks match host paths.
788const FilePath = Schema.String.check(Schema.isNonEmpty(), Schema.isMaxLength(MAX_FILE_PATH_LENGTH));
789​
790export const PullRequestFileViewedState = Schema.Literals(["unviewed", "viewed", "dismissed"]);
791export type PullRequestFileViewedState = typeof PullRequestFileViewedState.Type;
792​
793export const PullRequestFileViewed = Schema.Struct({
794 path: FilePath,
795 state: PullRequestFileViewedState,
796});
797export type PullRequestFileViewed = typeof PullRequestFileViewed.Type;
798​
799export const PullRequestFilesViewedResult = Schema.Struct({
800 /** Only the files the host reported a state for. A file missing from this list is unviewed. */
801 files: Schema.Array(PullRequestFileViewed),
802 truncated: Schema.Boolean,
803});
804export type PullRequestFilesViewedResult = typeof PullRequestFilesViewedResult.Type;
805​
806const PullRequestLineCount = Schema.Struct({
807 additions: NonNegativeInt,
808 deletions: NonNegativeInt,
809});
810​
811/**
812 * A change's line counts split by what the changed files are, judged from their paths. Null when
813 * the host gives no per-file counts, or has more files than one read covers: a split of part of
814 * the change would not add up to the totals shown beside it.
815 */
816export const PullRequestChangeBreakdown = Schema.NullOr(
817 Schema.Struct({
818 code: PullRequestLineCount,
819 tests: PullRequestLineCount,
820 mocks: PullRequestLineCount,
821 generated: PullRequestLineCount,
822 // Servers from before the docs split send no key; their docs lines sit in `code`.
823 docs: PullRequestLineCount.pipe(
824 Schema.withDecodingDefault(Effect.succeed({ additions: 0, deletions: 0 })),
825 ),
826 }),
827);
828export type PullRequestChangeBreakdown = typeof PullRequestChangeBreakdown.Type;
829​
830const MAX_FILES_VIEWED_PRESSES = 500;
831​
832export const PullRequestSetFilesViewedInput = Schema.Struct({
833 ...PullRequestRef.fields,
834 files: Schema.Array(
835 Schema.Struct({
836 path: FilePath,
837 viewed: Schema.Boolean,
838 /** The file's version in the diff the reader was shown; without it the head's is recorded. */
839 revision: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(256))),
840 }),
841 ).check(Schema.isMaxLength(MAX_FILES_VIEWED_PRESSES)),
842});
843export type PullRequestSetFilesViewedInput = typeof PullRequestSetFilesViewedInput.Type;
844​
845export const PullRequestStackHead = Schema.Struct({
846 number: PositiveInt,
847 headSha: TrimmedNonEmptyString,
848});
849export type PullRequestStackHead = typeof PullRequestStackHead.Type;
850​
851export const PullRequestActionInput = Schema.Struct({
852 /** Native stack scope; only send to environments advertising pullRequestStackActions. */
853 stackNumber: Schema.optional(PositiveInt),
854 expectedStackHeads: Schema.optional(Schema.Array(PullRequestStackHead)),
855 /** Merges refuse when the head commit is no longer this one. */
856 expectedHeadSha: Schema.optional(TrimmedNonEmptyString),
857 ...PullRequestRef.fields,
858 action: PullRequestAction,
859 mergeMethod: Schema.optional(PullRequestMergeMethod),
860 updateMethod: Schema.optional(PullRequestUpdateMethod),
861 /** Opt-in, because older clients decode the action's success as void and reject a summary. */
862 replyWithSummary: Schema.optional(Schema.Literal(true)),
863});
864export type PullRequestActionInput = typeof PullRequestActionInput.Type;
865​
866// Preserve whitespace because it affects Markdown formatting.
867const CommentBody = Schema.String.check(Schema.isNonEmpty()).check(Schema.isMaxLength(65_536));
868​
869export const PullRequestCommentInput = Schema.Struct({
870 ...PullRequestRef.fields,
871 body: CommentBody,
872});
873export type PullRequestCommentInput = typeof PullRequestCommentInput.Type;
874​
875export const PullRequestUpdateInput = Schema.Struct({
876 ...PullRequestRef.fields,
877 title: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(1024))),
878 body: Schema.optional(Schema.String.check(Schema.isMaxLength(65_536))),
879 maintainerCanModify: Schema.optional(Schema.Boolean),
880});
881export type PullRequestUpdateInput = typeof PullRequestUpdateInput.Type;
882​
883/** Comment kind selects the endpoint; GitHub uses separate mutations for conversation and line comments. */
884export const PullRequestCommentUpdateInput = Schema.Struct({
885 ...PullRequestRef.fields,
886 commentId: TrimmedNonEmptyString,
887 kind: Schema.Literals(["issue-comment", "review-comment"]),
888 body: CommentBody,
889});
890export type PullRequestCommentUpdateInput = typeof PullRequestCommentUpdateInput.Type;
891​
892export const PullRequestReviewPosition = Schema.Union([
893 Schema.Struct({
894 kind: Schema.Literal("added"),
895 newLine: PositiveInt,
896 }),
897 Schema.Struct({
898 kind: Schema.Literal("deleted"),
899 oldLine: PositiveInt,
900 }),
901 Schema.Struct({
902 kind: Schema.Literal("context"),
903 oldLine: PositiveInt,
904 newLine: PositiveInt,
905 side: PullRequestDiffSide,
906 }),
907]);
908export type PullRequestReviewPosition = typeof PullRequestReviewPosition.Type;
909​
910export const PullRequestReviewCommentDraft = Schema.Struct({
911 path: TrimmedNonEmptyString,
912 /** GitLab needs both names for renamed-file comments; hosts using one path ignore this. */
913 oldPath: Schema.optional(TrimmedNonEmptyString),
914 position: PullRequestReviewPosition,
915 /**
916 * The first line of a comment on a range, which ends at `position`. Sent only to a host whose
917 * capabilities include `review.rangeComment`.
918 */
919 startPosition: Schema.optional(PullRequestReviewPosition),
920 body: CommentBody,
921});
922export type PullRequestReviewCommentDraft = typeof PullRequestReviewCommentDraft.Type;
923​
924export const PullRequestSubmitReviewInput = Schema.Struct({
925 ...PullRequestRef.fields,
926 /** Reviews refuse when the head commit is no longer this one. */
927 expectedHeadSha: Schema.optional(TrimmedNonEmptyString),
928 verdict: PullRequestReviewVerdict,
929 body: Schema.String.check(Schema.isMaxLength(65_536)),
930 comments: Schema.Array(PullRequestReviewCommentDraft),
931});
932export type PullRequestSubmitReviewInput = typeof PullRequestSubmitReviewInput.Type;
933​
934export const PullRequestThreadCommentsInput = Schema.Struct({
935 ...PullRequestRef.fields,
936 threadId: TrimmedNonEmptyString,
937 cursor: TrimmedNonEmptyString,
938});
939export type PullRequestThreadCommentsInput = typeof PullRequestThreadCommentsInput.Type;
940​
941export const PullRequestThreadCommentsResult = Schema.Struct({
942 comments: Schema.Array(PullRequestThreadComment),
943 nextCursor: Schema.NullOr(TrimmedNonEmptyString),
944 // Comments the host hid that this page left out; the thread's `commentCount` still counts them.
945 hiddenCount: Schema.optional(NonNegativeInt),
946});
947export type PullRequestThreadCommentsResult = typeof PullRequestThreadCommentsResult.Type;
948​
949export const PullRequestThreadReplyInput = Schema.Struct({
950 ...PullRequestRef.fields,
951 threadId: TrimmedNonEmptyString,
952 body: CommentBody,
953});
954export type PullRequestThreadReplyInput = typeof PullRequestThreadReplyInput.Type;
955​
956export const PullRequestThreadResolutionInput = Schema.Struct({
957 ...PullRequestRef.fields,
958 threadId: TrimmedNonEmptyString,
959 resolved: Schema.Boolean,
960});
961export type PullRequestThreadResolutionInput = typeof PullRequestThreadResolutionInput.Type;
962​
963export const PullRequestReactionInput = Schema.Struct({
964 ...PullRequestRef.fields,
965 subjectId: Schema.optional(TrimmedNonEmptyString),
966 content: PullRequestReactionContent,
967 reacted: Schema.Boolean,
968});
969export type PullRequestReactionInput = typeof PullRequestReactionInput.Type;
970​
971/** The most labels or reviewers one write may change. */
972export const PULL_REQUEST_CHANGE_BATCH_LIMIT = 25;
973​
974export const PullRequestReviewerRequestInput = Schema.Struct({
975 ...PullRequestRef.fields,
976 reviewers: Schema.Array(
977 Schema.Struct({ id: TrimmedNonEmptyString, kind: PullRequestReviewerKind }),
978 ).check(Schema.isMinLength(1), Schema.isMaxLength(PULL_REQUEST_CHANGE_BATCH_LIMIT)),
979 requested: Schema.Boolean,
980});
981export type PullRequestReviewerRequestInput = typeof PullRequestReviewerRequestInput.Type;
982​
983export const PullRequestLabelChangeInput = Schema.Struct({
984 ...PullRequestRef.fields,
985 labels: Schema.Array(TrimmedNonEmptyString).check(
986 Schema.isMinLength(1),
987 Schema.isMaxLength(PULL_REQUEST_CHANGE_BATCH_LIMIT),
988 ),
989 applied: Schema.Boolean,
990});
991export type PullRequestLabelChangeInput = typeof PullRequestLabelChangeInput.Type;
992​
993/**
994 * The names keep their `cli-` prefix for wire compatibility; for a host read with a credential
995 * rather than a tool they mean "no credential" and "a refused credential".
996 */
997export const PullRequestUnavailableReason = Schema.Literals([
998 "cli-missing",
999 "cli-unauthenticated",
1000 "provider-unsupported",
1001 "repository-without-project",
1002]);
1003export type PullRequestUnavailableReason = typeof PullRequestUnavailableReason.Type;
1004​
1005/**
1006 * `author:me` names whoever is signed in to the host being read, GitHub's `@me` spelled either
1007 * way. A host's own search would answer it, but the page and the server both re-check an author
1008 * against the row's login, so the name is resolved before either comparison rather than being
1009 * matched as the literal login "me".
1010 */
1011export function resolvePullRequestAuthorFilter(
1012 author: string,
1013 viewer: string | null | undefined,
1014): string {
1015 const trimmed = author.trim();
1016 if (!/^@?me$/i.test(trimmed)) return trimmed;
1017 return viewer === null || viewer === undefined || viewer.trim().length === 0 ? trimmed : viewer;
1019​
1020export class PullRequestUnavailableError extends Schema.TaggedError<PullRequestUnavailableError>()(
1021 "PullRequestUnavailableError",
1023 reason: PullRequestUnavailableReason,
1024 provider: Schema.optional(SourceControlProviderKind),
1025 listResult: Schema.optional(PullRequestListResult),
1026 /**
1027 * What the host needs on the server, in its own words. Absent from older servers, which
1028 * shipped no such field, and for a host that names nothing.
1029 */
1030 requirement: Schema.optional(TrimmedNonEmptyString),
1031 /** The repository no project has, for `repository-without-project`. */
1032 repository: Schema.optional(TrimmedNonEmptyString),
1033 /**
1034 * For `repository-without-project` on a host read through any checkout on it: the host no
1035 * project is on.
1036 */
1037 host: Schema.optional(TrimmedNonEmptyString),
1038 cause: Schema.optional(Schema.Defect()),
1039 },
1040 { httpApiStatus: 503 },
1041) {
1042 [HttpServerRespondable.symbol]() {
1043 return HttpServerResponse.schemaJson(PullRequestUnavailableError)(this, { status: 503 });
1045​
1046 override get message(): string {
1047 switch (this.reason) {
1048 case "cli-missing":
1049 return this.requirement ?? "The tool this host is read through is not installed or set up.";
1050 case "cli-unauthenticated":
1051 return this.requirement ?? "This host has no working credentials.";
1052 case "provider-unsupported":
1053 return "Change requests cannot be browsed for this project's host yet.";
1054 case "repository-without-project":
1055 if (this.host !== undefined) {
1056 return `No project in T3 Code is on ${this.host}. Add any ${this.host} project to read its change requests.`;
1058 return `${this.repository ?? "This repository"} is not a project in T3 Code. Add it as a project to read its change requests.`;
1062​
1063export class PullRequestOperationError extends Schema.TaggedError<PullRequestOperationError>()(
1064 "PullRequestOperationError",
1066 operation: Schema.String,
1067 detail: TrimmedNonEmptyString,
1068 reason: Schema.optional(Schema.Literal("not-found")),
1069 listResult: Schema.optional(PullRequestListResult),
1070 cause: Schema.optional(Schema.Defect()),
1071 },
1072 // Not 502: Cloudflare, in front of T3 Connect, swaps an origin 502 for its own page.
1073 { httpApiStatus: 503 },
1074) {
1075 [HttpServerRespondable.symbol]() {
1076 return HttpServerResponse.schemaJson(PullRequestOperationError)(this, { status: 503 });
1078​
1079 override get message(): string {
1080 return `Pull request operation ${this.operation} failed: ${this.detail}`;