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

GitHubPullRequestProvider.ts

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