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

GitHubPullRequestProvider.ts

660 lines24.9 KB

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