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

GitHubPullRequestProvider.ts

662 lines25.7 KB

1import * as Cache from "effect/Cache";
2import * as Duration from "effect/Duration";
3import * as Effect from "effect/Effect";
4import * as Exit from "effect/Exit";
5import type {
6 PullRequestActor,
7 PullRequestCapabilities,
8 PullRequestCheck,
9 PullRequestReaction,
10 PullRequestViewerPermissions,
11} from "@t3tools/contracts";
12​
13import * as GitHubPullRequestCli from "./GitHubPullRequestCli.ts";
14import { PinnedGitHubCredential } from "../sourceControl/GitHubCli.ts";
15import {
16 PullRequestProviderError,
17 type PullRequestProviderFailure,
18 type ProviderChangeRequestActivity,
19 type ProviderChangeRequestDetail,
20 type PullRequestProviderApi,
21} from "./PullRequestProvider.ts";
22import type { GitHubViewerAccess, GitHubWorkflowRunApproval } from "./gitHubPullRequestJson.ts";
23​
24const CAPABILITIES: PullRequestCapabilities = {
25 diff: true,
26 comment: true,
27 actions: [
28 "merge",
29 "ready",
30 "draft",
31 "close",
32 "reopen",
33 "update-branch",
34 "enable-auto-merge",
35 "disable-auto-merge",
36 "revert",
37 "approve-workflows",
38 ],
39 mergeMethods: ["merge", "squash", "rebase"],
40 updateMethods: ["merge", "rebase"],
41 search: true,
42 reactions: true,
43 review: {
44 inlineComment: true,
45 reply: true,
46 resolve: true,
47 verdicts: ["comment", "approve", "request-changes"],
48 },
49 reviewers: { request: true, listCandidates: true },
50 edit: { changeRequest: true, comment: true },
51 stacks: true,
52 stackActions: true,
53 labels: true,
54};
55​
56/**
57 * What the signed-in account may do here, from the three things GitHub says about it.
58 *
59 * Merging needs a role that can push, which is the one thing a stranger on an open-source
60 * repository never has. The other four actions go by `viewerCanUpdate`, because the author of a
61 * pull request may close it, reopen it and move it in and out of draft with no more than read
62 * access on the repository it was opened against.
63 *
64 * Commenting and reviewing are not gated at all: read access is enough to say something and
65 * enough to approve or ask for changes, which is what open-source review consists of. Resolving a
66 * conversation is the exception — GitHub allows it to whoever can write, and to the author of the
67 * pull request the conversation is on.
68 *
69 * Asking somebody else for a review needs write access, which is the one thing here an author
70 * cannot do on their own pull request: GitHub shows an outside contributor the reviewer control
71 * and refuses the request behind it.
72 */
73export function gitHubViewerPermissions(access: GitHubViewerAccess): PullRequestViewerPermissions {
74 return {
75 ...(access.canWrite ? { stackRebase: true } : {}),
76 actions: [
77 // Arming a merge and taking the arming back are the merge, deferred: whoever may not
78 // merge here may not leave an instruction to merge later either.
79 ...(access.canWrite
80 ? ([
81 "merge",
82 "enable-auto-merge",
83 "disable-auto-merge",
84 "revert",
85 "approve-workflows",
86 ] as const)
87 : []),
88 ...(access.canUpdate ? (["ready", "draft", "close", "reopen"] as const) : []),
89 // Whether this viewer may update the branch is GitHub's own answer, read with the
90 // comparison; without it the action is offered to nobody rather than to everybody.
91 ...(access.canUpdateBranch === true ? (["update-branch"] as const) : []),
92 ],
93 comment: true,
94 resolve: access.canWrite || access.didAuthor,
95 // Anyone may review a pull request they can see, except their own: GitHub refuses an author's
96 // approval and their request for changes ("Can not approve your own pull request"), and
97 // leaves them commenting, which is what an author has to say about their own change anyway.
98 verdicts: access.didAuthor ? (["comment"] as const) : CAPABILITIES.review.verdicts,
99 requestReviewers: access.canWrite,
100 ...(access.canUpdateBranch === true ? { updateMethods: CAPABILITIES.updateMethods } : {}),
101 // Triage is the one role that labels without writing, which is what triage is for.
102 labels: access.canTriage,
103 };
105​
106/** The CLI tags that mean the tool itself is unusable, rather than one request failing. */
107export function gitHubProviderFailure(
108 error: GitHubPullRequestCli.GitHubPullRequestCliError,
109): PullRequestProviderFailure {
110 if (error._tag === "GitHubCliUnavailableError") return { reason: "missing-tool" };
111 if (error._tag === "GitHubCliAuthenticationError") return { reason: "unauthenticated" };
112 if (error._tag === "GitHubCliRateLimitError") return { reason: "rate-limited" };
113 if (error._tag === "SourceControlRateLimitPausedError") {
114 return { reason: "rate-limited", retryAt: error.retryAt };
115 }
116 return { reason: "failed" };
118​
119/**
120 * `gh pr view --json` reports no avatar for anyone, so the ones the GraphQL read collected are
121 * applied here by login. An actor already carrying one keeps it.
122 *
123 * A login GitHub did not answer for falls back to the picture every GitHub install serves at
124 * `/<login>.png`. The lookup is one more request per repository and can be refused — a rate
125 * limit, a slow host — and a face that comes and goes between two loads of the same page reads
126 * as a bug in the page rather than as a request that failed quietly.
127 */
128function withAvatar(
129 actor: PullRequestActor | null,
130 avatarsByLogin: ReadonlyMap<string, string>,
131 host: string,
132): PullRequestActor | null {
133 if (actor === null || actor.avatarUrl !== null) return actor;
134 const avatarUrl = avatarsByLogin.get(actor.login) ?? loginAvatarUrl(actor.login, host);
135 return avatarUrl === null ? actor : { ...actor, avatarUrl };
137​
138function withWorkflowApprovals(
139 checks: ReadonlyArray<PullRequestCheck>,
140 runs: ReadonlyArray<GitHubWorkflowRunApproval>,
141 unavailable: boolean,
142): ReadonlyArray<PullRequestCheck> {
143 const representedRunIds = new Set<number>();
144 for (const check of checks) {
145 if (check.status !== "action-required" || check.url === null) continue;
146 const id = check.url.match(/\/actions\/runs\/(\d+)(?:\/|$)/)?.[1];
147 if (id !== undefined) representedRunIds.add(Number(id));
148 }
149 const approvalChecks = runs
150 .filter((run) => !representedRunIds.has(run.id))
151 .map((run): PullRequestCheck => ({
152 name: run.name,
153 status: "action-required",
154 description: "A maintainer must approve this workflow before it can run.",
155 url: run.url,
156 }));
157 return [
158 ...checks,
159 ...approvalChecks,
160 ...(unavailable
161 ? [
162 {
163 name: "Workflow approval status",
164 status: "action-required" as const,
165 description: "GitHub could not determine whether workflows are awaiting approval.",
166 url: null,
167 },
168 ]
169 : []),
170 ];
172​
173/**
174 * Null for anything that is not a plain user login: an app posts as `dependabot[bot]`, which
175 * names no page, and a guessed URL that 404s is worse than the initials it would replace.
176 */
177export function loginAvatarUrl(login: string, host: string): string | null {
178 return /^[a-z0-9][a-z0-9-]{0,38}$/iu.test(login) ? `https://${host}/${login}.png?size=80` : null;
180​
181/** True where markdown would render nothing: whitespace, or only HTML comments. */
182const rendersEmpty = (body: string): boolean =>
183 body.replace(/<!--[\s\S]*?-->/g, "").trim().length === 0;
184​
185export const make = Effect.gen(function* () {
186 const cli = yield* GitHubPullRequestCli.GitHubPullRequestCli;
187​
188 const repositoryAccessCache = yield* Cache.makeWith(
189 (key: string) => {
190 const [cwd, repository, host] = JSON.parse(key) as [string, string, string];
191 return cli.getRepositoryAccess({ cwd, repository, host });
192 },
193 {
194 capacity: 128,
195 timeToLive: (exit) => (Exit.isSuccess(exit) ? Duration.minutes(10) : Duration.zero),
196 },
197 );
198 const getRepositoryAccess = (input: {
199 readonly cwd: string;
200 readonly repository: string;
201 readonly host: string;
202 }) =>
203 PinnedGitHubCredential.pipe(
204 Effect.flatMap((credential) =>
205 Cache.get(
206 repositoryAccessCache,
207 JSON.stringify([
208 input.cwd,
209 input.repository,
210 input.host,
211 credential?.credentialFingerprint ?? null,
212 ]),
213 ),
214 ),
215 );
216​
217 const fail = (operation: string) => (error: GitHubPullRequestCli.GitHubPullRequestCliError) =>
218 new PullRequestProviderError({
219 provider: "github",
220 operation,
221 ...gitHubProviderFailure(error),
222 detail: error.detail,
223 cause: error,
224 });
225​
226 const provider: PullRequestProviderApi = {
227 kind: "github",
228 capabilities: CAPABILITIES,
229 getRoutingIdentity: (input) =>
230 cli.getRoutingIdentity(input).pipe(Effect.mapError(fail("routeIdentity"))),
231 withVerifiedCredential: (input, use) =>
232 cli
233 .withVerifiedCredential(input, (identity) => use(identity).pipe(Effect.result))
234 .pipe(Effect.mapError(fail("routeIdentity")), Effect.flatMap(Effect.fromResult)),
235​
236 getViewer: (input) =>
237 cli
238 .getViewerLogin({ cwd: input.cwd, host: input.host ?? "github.com" })
239 .pipe(Effect.mapError(fail("getViewer"))),
240​
241 listChangeRequests: (input) =>
242 cli
243 .listPullRequests({
244 cwd: input.cwd,
245 repository: input.repository,
246 host: input.host,
247 state: input.state,
248 involvement: input.involvement,
249 viewer: input.viewer,
250 limit: input.limit,
251 query: input.query,
252 cursor: input.cursor,
253 filters: input.filters,
254 })
255 .pipe(
256 Effect.mapError(fail("listChangeRequests")),
257 Effect.flatMap((page) =>
258 cli
259 .listActorAvatars({
260 cwd: input.cwd,
261 repository: input.repository,
262 host: input.host,
263 ids: [...new Set(page.items.flatMap((item) => item.authorId ?? []))],
264 })
265 // A listing without faces is still a listing, so a failed lookup falls back to
266 // the initials rather than taking the rows down with it.
267 .pipe(
268 Effect.orElseSucceed(() => new Map<string, string>()),
269 Effect.map((avatarsByLogin) => ({
270 ...page,
271 items: page.items.map((item) => ({
272 ...item,
273 author: withAvatar(item.author, avatarsByLogin, input.host),
274 })),
275 })),
276 ),
277 ),
278 ),
279​
280 /**
281 * The same listing for a whole host in one search. The avatar lookup the per-repository read
282 * needs is not here: a search reports an author's picture itself, so a face costs no request
283 * of its own — `withAvatar` still stands behind it for the login GitHub answered nothing for.
284 */
285 listChangeRequestsAcross: (input) =>
286 cli
287 .searchPullRequests({
288 cwd: input.cwd,
289 host: input.host,
290 repositories: input.repositories,
291 state: input.state,
292 involvement: input.involvement,
293 viewer: input.viewer,
294 limit: input.limit,
295 query: input.query,
296 cursor: input.cursor,
297 filters: input.filters,
298 })
299 .pipe(
300 Effect.mapError(fail("listChangeRequestsAcross")),
301 Effect.map((batch) => ({
302 truncated: batch.truncated,
303 items: batch.items.map((item) => ({
304 ...item,
305 author: withAvatar(item.author, new Map<string, string>(), input.host),
306 })),
307 })),
308 ),
309​
310 listChangeRequestStats: (input) =>
311 cli
312 .listPullRequestStats({
313 cwd: input.cwd,
314 host: input.host,
315 changeRequests: input.changeRequests,
316 })
317 .pipe(Effect.mapError(fail("listChangeRequestStats"))),
318​
319 getChangeRequestSummary: (input) =>
320 cli.getPullRequestSummary(input).pipe(
321 // `gh pr view` names the author without an avatar; the login-shaped URL every user
322 // has stands in, without the second request the listing spends on it.
323 Effect.map((summary) => ({
324 ...summary,
325 ...(summary.author === undefined
326 ? {}
327 : { author: withAvatar(summary.author, new Map(), input.host) }),
328 })),
329 Effect.mapError(fail("getChangeRequestSummary")),
330 ),
331​
332 getChangeRequestStack: (input) =>
333 cli.getPullRequestStack(input).pipe(Effect.mapError(fail("getChangeRequestStack"))),
334​
335 getChangeRequest: (input) =>
336 Effect.all(
337 [
338 cli.getPullRequestDetail(input).pipe(
339 Effect.flatMap((pullRequest) =>
340 Effect.all({
341 // Only an open pull request can be behind anything worth saying so about, and
342 // only one whose head repository is known can be compared at all.
343 comparison:
344 pullRequest.state !== "open" || pullRequest.headRepositoryOwner === null
345 ? Effect.succeed(null)
346 : cli
347 .getPullRequestBaseComparison({
348 ...input,
349 headRef: `${pullRequest.headRepositoryOwner}:${pullRequest.headBranch}`,
350 })
351 .pipe(Effect.orElseSucceed(() => null)),
352 // GitHub omits a fork workflow that has not been approved from the normal check
353 // rollup. Read the action-required runs by head revision so "all passed" cannot
354 // be shown while a whole workflow is still waiting to start.
355 workflowApprovals:
356 pullRequest.state !== "open" || pullRequest.isCrossRepository !== true
357 ? Effect.succeed({
358 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
359 unavailable: false,
360 })
361 : pullRequest.headSha == null || pullRequest.headRepositoryOwner == null
362 ? Effect.succeed({
363 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
364 unavailable: true,
365 })
366 : cli
367 .listWorkflowRunsRequiringApproval({
368 ...input,
369 headSha: pullRequest.headSha,
370 headBranch: pullRequest.headBranch,
371 headRepositoryOwner: pullRequest.headRepositoryOwner,
372 isCrossRepository: true,
373 })
374 .pipe(
375 Effect.matchEffect({
376 onFailure: (error) =>
377 error._tag === "GitHubCliRateLimitError" ||
378 error._tag === "SourceControlRateLimitPausedError"
379 ? Effect.fail(error)
380 : Effect.succeed({
381 runs: [] as ReadonlyArray<GitHubWorkflowRunApproval>,
382 unavailable: true,
383 }),
384 onSuccess: (runs) => Effect.succeed({ runs, unavailable: false }),
385 }),
386 ),
387 }).pipe(Effect.map((extra) => ({ pullRequest, ...extra }))),
388 ),
389 ),
390 getRepositoryAccess({
391 cwd: input.cwd,
392 repository: input.repository,
393 host: input.host,
394 }),
395 // A small permissions query replaces the deeply paginated review-thread walk on the
396 // core path. Writes ask again immediately before mutating, so this is presentation.
397 cli.getViewerAccess(input),
398 ],
399 { concurrency: 3 },
400 ).pipe(
401 Effect.mapError(fail("getChangeRequest")),
402 Effect.map(([detail, repository, viewerAccess]): ProviderChangeRequestDetail => ({
403 ...detail.pullRequest,
404 checks: withWorkflowApprovals(
405 detail.pullRequest.checks,
406 detail.workflowApprovals.runs,
407 detail.workflowApprovals.unavailable,
408 ),
409 ...(detail.workflowApprovals.unavailable
410 ? {}
411 : { workflowApprovalsRequired: detail.workflowApprovals.runs.length }),
412 reviewers: detail.pullRequest.reviewRequestLogins.map((login) => ({
413 login,
414 name: null,
415 avatarUrl: null,
416 })),
417 mergeCapabilities: repository.mergeCapabilities,
418 viewerPermissions: gitHubViewerPermissions({
419 ...viewerAccess,
420 canUpdateBranch: detail.comparison?.viewerCanUpdate === true,
421 }),
422 baseComparison:
423 detail.comparison === null || detail.comparison.behindBy === null
424 ? "unknown"
425 : detail.comparison.behindBy > 0
426 ? "behind"
427 : "up-to-date",
428 ...(detail.comparison?.behindBy == null ? {} : { behindBy: detail.comparison.behindBy }),
429 })),
430 ),
431​
432 getChangeRequestActivity: (input) =>
433 Effect.all(
434 [
435 cli.getPullRequestActivity(input),
436 // Line comments live on review threads, which `gh pr view --json` cannot reach. A
437 // GraphQL hiccup degrades to a truncated conversation rather than blanking activity.
438 cli.listReviewThreadComments(input).pipe(
439 Effect.orElseSucceed(() => ({
440 comments: [],
441 dismissalsByReviewId: new Map<string, string>(),
442 reactions: [],
443 reactionsById: new Map<string, ReadonlyArray<PullRequestReaction>>(),
444 reviewThreads: [],
445 commentCount: 0,
446 truncated: true,
447 reviewers: [],
448 avatarsByLogin: new Map<string, string>(),
449 commitStats: new Map<
450 string,
451 { readonly additions: number; readonly deletions: number }
452 >(),
453 commits: [],
454 viewer: { canUpdate: true, didAuthor: false },
455 })),
456 ),
457 ],
458 { concurrency: 2 },
459 ).pipe(
460 Effect.mapError(fail("getChangeRequestActivity")),
461 Effect.map(([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
462 author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
463 reviewers: reviewThreads.reviewers,
464 reactions: reviewThreads.reactions,
465 commits: (reviewThreads.commits.length > 0
466 ? reviewThreads.commits
467 : pullRequest.commits
468 ).map((commit) => ({
469 ...commit,
470 ...reviewThreads.commitStats.get(commit.oid),
471 authors: commit.authors?.map(
472 (author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author,
473 ),
474 })),
475 comments: [...pullRequest.comments, ...reviewThreads.comments]
476 .map((comment) => ({
477 ...comment,
478 // GitHub keeps the dismissal reason on the timeline event, not on the review,
479 // so a dismissed review with nothing visible of its own reads its words from
480 // there. "Visible" and not "empty": bot reviews often carry only an HTML
481 // marker comment, which markdown renders as nothing.
482 body:
483 comment.kind === "review" &&
484 comment.reviewState?.toUpperCase() === "DISMISSED" &&
485 rendersEmpty(comment.body)
486 ? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
487 : comment.body,
488 author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
489 // A comment out of `gh pr view --json` carries none of its own: that read
490 // reports no reaction at all, so they arrive from the GraphQL page by node id.
491 reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
492 }))
493 .toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
494 // `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
495 // are always whole and only the thread walk can stop short of the host.
496 commentCount: pullRequest.comments.length + reviewThreads.commentCount,
497 commentsTruncated: reviewThreads.truncated,
498 reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
499 ...thread,
500 comments: thread.comments.map((comment) => ({
501 ...comment,
502 author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
503 })),
504 })),
505 })),
506 ),
507​
508 getReviewThreadComments: (input) =>
509 cli.getReviewThreadComments(input).pipe(Effect.mapError(fail("getReviewThreadComments"))),
510​
511 getViewerPermissions: (input) =>
512 Effect.all(
513 [
514 cli.getViewerAccess({ ...input, allowReserve: true }),
515 // Whether this viewer may update the branch is only on the comparison, and the
516 // comparison only resolves through the head ref the detail carries. A failure here
517 // withholds that one action rather than the whole answer, the way the detail path
518 // leaves the banner unknown.
519 input.includeUpdateBranch === false
520 ? Effect.succeed(false)
521 : cli.getPullRequestDetail(input).pipe(
522 Effect.flatMap((pullRequest) =>
523 pullRequest.state !== "open" || pullRequest.headRepositoryOwner === null
524 ? Effect.succeed(false)
525 : cli
526 .getPullRequestBaseComparison({
527 ...input,
528 headRef: `${pullRequest.headRepositoryOwner}:${pullRequest.headBranch}`,
529 allowReserve: true,
530 })
531 .pipe(Effect.map((comparison) => comparison.viewerCanUpdate === true)),
532 ),
533 Effect.orElseSucceed(() => false),
534 ),
535 ],
536 { concurrency: 2 },
537 ).pipe(
538 Effect.mapError(fail("getViewerPermissions")),
539 Effect.map(([access, canUpdateBranch]) =>
540 gitHubViewerPermissions({ ...access, canUpdateBranch }),
541 ),
542 ),
543​
544 getDiff: (input) => cli.getPullRequestDiff(input).pipe(Effect.mapError(fail("getDiff"))),
545​
546 getDiffFileContents: (input) =>
547 cli.getPullRequestDiffFileContents(input).pipe(Effect.mapError(fail("getDiffFileContents"))),
548​
549 listReviewerCandidates: (input) =>
550 cli.listReviewerCandidates(input).pipe(Effect.mapError(fail("listReviewerCandidates"))),
551​
552 setReviewerRequest: (input) =>
553 cli
554 .setReviewerRequest({
555 cwd: input.cwd,
556 repository: input.repository,
557 host: input.host,
558 number: input.number,
559 reviewers: input.reviewers,
560 requested: input.requested,
561 })
562 .pipe(Effect.mapError(fail("setReviewerRequest"))),
563​
564 listLabelCandidates: (input) =>
565 cli.listLabelCandidates(input).pipe(Effect.mapError(fail("listLabelCandidates"))),
566​
567 setLabels: (input) =>
568 cli
569 .setLabels({
570 cwd: input.cwd,
571 repository: input.repository,
572 host: input.host,
573 number: input.number,
574 labels: input.labels,
575 applied: input.applied,
576 })
577 .pipe(Effect.mapError(fail("setLabels"))),
578​
579 runAction: (input) =>
580 cli
581 .runPullRequestAction({
582 cwd: input.cwd,
583 repository: input.repository,
584 host: input.host,
585 number: input.number,
586 action: input.action,
587 ...(input.stackNumber === undefined ? {} : { stackNumber: input.stackNumber }),
588 ...(input.expectedStackHeads === undefined
589 ? {}
590 : { expectedStackHeads: input.expectedStackHeads }),
591 ...(input.mergeMethod === undefined ? {} : { mergeMethod: input.mergeMethod }),
592 ...(input.updateMethod === undefined ? {} : { updateMethod: input.updateMethod }),
593 })
594 .pipe(Effect.mapError(fail("runAction"))),
595​
596 updateChangeRequest: (input) =>
597 cli
598 .updatePullRequest({
599 cwd: input.cwd,
600 repository: input.repository,
601 host: input.host,
602 number: input.number,
603 ...(input.title === undefined ? {} : { title: input.title }),
604 ...(input.body === undefined ? {} : { body: input.body }),
605 })
606 .pipe(Effect.mapError(fail("updateChangeRequest"))),
607​
608 comment: (input) => cli.commentOnPullRequest(input).pipe(Effect.mapError(fail("comment"))),
609​
610 updateComment: (input) =>
611 cli
612 .updateComment({
613 cwd: input.cwd,
614 repository: input.repository,
615 host: input.host,
616 number: input.number,
617 commentId: input.commentId,
618 kind: input.kind,
619 body: input.body,
620 })
621 .pipe(Effect.mapError(fail("updateComment"))),
622​
623 submitReview: (input) => cli.submitReview(input).pipe(Effect.mapError(fail("submitReview"))),
624​
625 replyToThread: (input) =>
626 cli
627 .replyToReviewThread({
628 cwd: input.cwd,
629 repository: input.repository,
630 host: input.host,
631 threadId: input.threadId,
632 body: input.body,
633 })
634 .pipe(Effect.mapError(fail("replyToThread"))),
635​
636 setReaction: (input) =>
637 cli
638 .setReaction({
639 cwd: input.cwd,
640 repository: input.repository,
641 host: input.host,
642 number: input.number,
643 ...(input.subjectId === undefined ? {} : { subjectId: input.subjectId }),
644 content: input.content,
645 reacted: input.reacted,
646 })
647 .pipe(Effect.mapError(fail("setReaction"))),
648​
649 setThreadResolution: (input) =>
650 cli
651 .setReviewThreadResolution({
652 cwd: input.cwd,
653 repository: input.repository,
654 host: input.host,
655 threadId: input.threadId,
656 resolved: input.resolved,
657 })
658 .pipe(Effect.mapError(fail("setThreadResolution"))),
659 };
660​
661 return provider;
662});