The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 03:15 UTC
fix(prs): reviewer menu searches past the first page and keeps GitLab's requested reviewers (#22489)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
Antony committed
Nov 6, 2026 at 02:54 UTC
c52df24d285a072ad9c3f7ab5b3656c0be1cb0f5
26 files changed
+593
-65
apps/mobile/src/features/pull-requests/PullRequestReviewersScreen.tsx
+52
-17
@@ -6,6 +6,11 @@ import { useAtomValue } from "@effect/atom-react";
6
import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
7
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
8
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
9
+import {
10
+ hostReviewerQuery,
11
+ reviewerCandidateView,
12
+ type ReviewerTruncation,
13
+} from "@t3tools/client-runtime/pull-request-reviewers";
14
import type { PullRequestReviewerCandidate } from "@t3tools/contracts";
15
import { useRef, useState } from "react";
16
import { FlatList, Pressable, ScrollView, View } from "react-native";
@@ -17,10 +22,21 @@ import { Button } from "../../components/ui/Button";
22
import { SymbolView } from "../../components/ui/AppSymbol";
23
import { composerPullRequests } from "../../state/pull-requests";
24
import { useEnvironmentQuery } from "../../state/query";
25
+import { useDebouncedValue } from "../../state/queries";
26
import { useAtomCommand } from "../../state/use-atom-command";
27
import { PullRequestAvatar } from "./PullRequestPresentation";
28
import { pullRequestTarget, type PullRequestParams } from "./usePullRequestDiff";
29
30
+const TRUNCATED_LABELS: Record<ReviewerTruncation, (error: string | null) => string> = {
31
+ unsearchable: () =>
32
+ "The provider has more reviewers than it returned. Find additional reviewers on the provider.",
33
+ searchable: () => "The provider has more reviewers than are listed here. Search to find them.",
34
+ "search-failed": (error) =>
35
+ `Only listed reviewers are matched: the provider search failed. ${error ?? ""}`,
36
+ "search-truncated": () =>
37
+ "More reviewers match than the provider returned. Keep typing to narrow it down.",
38
+};
39
+
40
export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequestParams>) {
41
const navigation = useNavigation();
42
const contentTopInset = useContentTopInset();
@@ -51,16 +67,30 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
67
const [pending, setPending] = useState<string | null>(null);
68
const [error, setError] = useState<string | null>(null);
69
const inFlight = useRef(false);
54
- const candidates = (() => {
55
- const needle = query.trim().toLowerCase();
56
- return [...(result.data?.candidates ?? [])]
57
- .filter((candidate) =>
58
- `${candidate.login} ${candidate.name ?? ""}`.toLowerCase().includes(needle),
59
- )
60
- .sort(
61
- (a, b) => Number(b.isRequested) - Number(a.isRequested) || a.login.localeCompare(b.login),
62
- );
63
- })();
70
+ const debouncedQuery = useDebouncedValue(query.trim(), 250);
71
+ const searchInput = {
72
+ loaded: result.data,
73
+ searchable: pr?.capabilities.reviewers.searchCandidates === true,
74
+ query,
75
+ debouncedQuery,
76
+ };
77
+ const hostQuery = hostReviewerQuery(searchInput);
78
+ const searchResult = useEnvironmentQuery(
79
+ hostQuery !== null
80
+ ? composerPullRequests.reviewerSearch({
81
+ ...target,
82
+ input: { ...target.input, query: hostQuery },
83
+ })
84
+ : null,
85
+ );
86
+ const view = reviewerCandidateView({
87
+ ...searchInput,
88
+ search: searchResult,
89
+ });
90
+ const candidates = [...view.candidates].sort(
91
+ (a, b) => Number(b.isRequested) - Number(a.isRequested) || a.login.localeCompare(b.login),
92
+ );
93
+ const queryError = result.error ?? view.searchError;
94
// A new search shows its best matches from the top.
95
const search = (next: string) => {
96
setQuery(next);
@@ -93,6 +123,7 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
123
);
124
return;
125
}
126
+ if (hostQuery !== null) searchResult.refresh();
127
if (!pr?.capabilities.reviewers.listCandidates) {
128
search("");
129
detail.refresh();
@@ -181,30 +212,34 @@ export function PullRequestReviewersScreen({ route }: StaticScreenProps<PullRequ
212
);
213
}}
214
ListEmptyComponent={
184
- result.isPending && !result.data ? (
215
+ (result.isPending && !result.data) || view.searchPending ? (
216
<AppActivityIndicator className="my-8" />
217
) : (
218
<View className="px-4 py-6">
219
<EmptyState
220
title={
190
- result.error
221
+ queryError
222
? "Couldn't load reviewers"
223
: query.trim()
224
? "No matching reviewers"
225
: "No reviewers available"
226
}
196
- detail={result.error ?? "Search people and teams with access to this repository."}
227
+ detail={queryError ?? "Search people and teams with access to this repository."}
228
variant="plain"
229
/>
199
- {result.error ? <Button label="Retry" onPress={result.refresh} /> : null}
230
+ {queryError ? (
231
+ <Button
232
+ label="Retry"
233
+ onPress={result.error ? result.refresh : searchResult.refresh}
234
+ />
235
+ ) : null}
236
</View>
237
)
238
}
239
ListFooterComponent={
204
- result.data?.truncated ? (
240
+ view.truncation ? (
241
<Text className="px-4 py-4 text-xs text-foreground-muted">
206
- The provider has more reviewers than it returned. Find additional reviewers on the
207
- provider.
242
+ {TRUNCATED_LABELS[view.truncation](view.searchError)}
243
</Text>
244
) : undefined
245
}
apps/server/src/pullRequest/PullRequestService.ts
+3
-1
@@ -58,6 +58,7 @@ import {
58
type PullRequestRoutingIdentityResult,
59
type PullRequestReviewVerdict,
60
type PullRequestReviewerCandidateList,
61
+ type PullRequestReviewerCandidatesInput,
62
type PullRequestReviewerRequestInput,
63
type PullRequestLabelCandidateList,
64
type PullRequestLabelChangeInput,
@@ -274,7 +275,7 @@ export class PullRequestService extends Context.Service<
275
input: PullRequestReactionInput,
276
) => Effect.Effect<void, PullRequestError>;
277
readonly reviewerCandidates: (
277
- input: PullRequestRef,
278
+ input: PullRequestReviewerCandidatesInput,
279
) => Effect.Effect<PullRequestReviewerCandidateList, PullRequestError>;
280
readonly requestReviewers: (
281
input: PullRequestReviewerRequestInput,
@@ -2499,6 +2500,7 @@ export const make = Effect.gen(function* () {
2500
repository: project.repository,
2501
host: project.host,
2502
number: input.number,
2503
+ query: input.query,
2504
})
2505
.pipe(Effect.mapError(toPullRequestError("reviewerCandidates")))
2506
: Effect.fail(
apps/web/src/components/pullRequest/PullRequestReviewerPicker.tsx
+47
-15
@@ -4,11 +4,17 @@ import type {
4
PullRequestRef,
5
PullRequestReviewerCandidate,
6
} from "@t3tools/contracts";
7
+import {
8
+ hostReviewerQuery,
9
+ reviewerCandidateView,
10
+ type ReviewerTruncation,
11
+} from "@t3tools/client-runtime/pull-request-reviewers";
12
import { CheckIcon, UserPlusIcon } from "lucide-react";
13
import { useState } from "react";
14
15
import { pullRequestEnvironment } from "~/state/pullRequests";
16
import { useEnvironmentQuery } from "~/state/query";
17
+import { useDebouncedValue } from "~/state/queries";
18
import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
19
20
import { toastManager } from "../ui/toast";
@@ -16,23 +22,27 @@ import { PullRequestCandidatePicker } from "./PullRequestCandidatePicker";
22
import { PullRequestActorLabel } from "./pullRequestPresentation";
23
import { readableFailure } from "./pullRequestDetail.logic";
24
19
-function matches(candidate: PullRequestReviewerCandidate, query: string): boolean {
20
- if (query.length === 0) return true;
21
- const needle = query.toLowerCase();
22
- return (
23
- candidate.login.toLowerCase().includes(needle) ||
24
- (candidate.name ?? "").toLowerCase().includes(needle)
25
- );
26
-}
25
+const TRUNCATED_LABELS: Record<ReviewerTruncation, (error: string | null) => string> = {
26
+ unsearchable: () =>
27
+ "This repository has more people with access than are listed here. Ask for the rest on the host.",
28
+ searchable: () =>
29
+ "This repository has more people with access than are listed here. Search to find them.",
30
+ "search-failed": (error) =>
31
+ `Only the people already listed are matched: the host search failed. ${error ?? ""}`,
32
+ "search-truncated": () =>
33
+ "More people match than the host returned. Keep typing to narrow it down.",
34
+};
35
36
export function PullRequestReviewerPicker({
37
environmentId,
38
reference,
39
allowed,
40
+ searchable,
41
}: {
42
environmentId: EnvironmentId;
43
reference: PullRequestRef;
44
allowed: boolean;
45
+ searchable: boolean;
46
}) {
47
const [open, setOpen] = useState(false);
48
const [query, setQuery] = useState("");
@@ -41,13 +51,26 @@ export function PullRequestReviewerPicker({
51
const candidatesQuery = useEnvironmentQuery(
52
open ? pullRequestEnvironment.reviewerCandidates({ environmentId, input: reference }) : null,
53
);
54
+ // Past the first page the host is asked, since what was loaded cannot answer for the rest.
55
+ const debouncedQuery = useDebouncedValue(query.trim(), 250);
56
+ const searchInput = { loaded: candidatesQuery.data, searchable, query, debouncedQuery };
57
+ const hostQuery = hostReviewerQuery(searchInput);
58
+ const searchResult = useEnvironmentQuery(
59
+ open && hostQuery !== null
60
+ ? pullRequestEnvironment.reviewerSearch({
61
+ environmentId,
62
+ input: { ...reference, query: hostQuery },
63
+ })
64
+ : null,
65
+ );
66
const requestReviewers = useAtomCommand(pullRequestEnvironment.requestReviewers, {
67
reportFailure: false,
68
});
69
48
- const candidates = (candidatesQuery.data?.candidates ?? []).filter((entry) =>
49
- matches(entry, query),
50
- );
70
+ const { candidates, searchPending, searchError, truncation } = reviewerCandidateView({
71
+ ...searchInput,
72
+ search: searchResult,
73
+ });
74
75
const toggle = async (candidate: PullRequestReviewerCandidate) => {
76
if (pending !== null) return;
@@ -74,6 +97,9 @@ export function PullRequestReviewerPicker({
97
});
98
return;
99
}
100
+ // The command reads the loaded list again only for somebody it lacked, and a search result
101
+ // is keyed by what was typed, so the one on screen is read here or it keeps the old request.
102
+ if (hostQuery !== null) searchResult.refresh();
103
toastManager.add({
104
type: "success",
105
title: candidate.isRequested
@@ -93,14 +119,20 @@ export function PullRequestReviewerPicker({
119
query={query}
120
onQueryChange={setQuery}
121
searchLabel="Search people with access"
96
- isPending={candidatesQuery.isPending && candidatesQuery.data === null}
97
- error={candidatesQuery.data === null ? candidatesQuery.error : null}
122
+ isPending={(candidatesQuery.isPending && candidatesQuery.data === null) || searchPending}
123
+ error={
124
+ candidatesQuery.data === null
125
+ ? candidatesQuery.error
126
+ : candidates.length === 0
127
+ ? searchError
128
+ : null
129
+ }
130
candidates={candidates}
131
emptyLabel="Nobody else has access to this repository."
132
noMatchLabel="Nobody with access matches that."
133
errorLabel="The people with access could not be read."
102
- truncated={candidatesQuery.data?.truncated === true}
103
- truncatedLabel="This repository has more people with access than are listed here. Ask for the rest on the host."
134
+ truncated={truncation !== null}
135
+ truncatedLabel={truncation === null ? "" : TRUNCATED_LABELS[truncation](searchError)}
136
candidateKey={(candidate) => `${candidate.kind}:${candidate.id}`}
137
disabled={pending !== null}
138
onSelect={(candidate) => void toggle(candidate)}
apps/web/src/components/pullRequest/PullRequestSummaryTab.tsx
+1
@@ -802,6 +802,7 @@ export function PullRequestSummaryTab({
802
{detail.capabilities.reviewers.request &&
803
detail.capabilities.reviewers.listCandidates ? (
804
<PullRequestReviewerPicker
805
+ searchable={detail.capabilities.reviewers.searchCandidates === true}
806
environmentId={environmentId}
807
reference={reference}
808
allowed={detail.viewerPermissions.requestReviewers}
packages/client-runtime/package.json
+4
@@ -527,6 +527,10 @@
527
"types": "./src/modelTraits.ts",
528
"default": "./src/modelTraits.ts"
529
},
530
+ "./pull-request-reviewers": {
531
+ "types": "./src/pullRequestReviewers.ts",
532
+ "default": "./src/pullRequestReviewers.ts"
533
+ },
534
"./provider-clients": {
535
"types": "./src/providerClients.ts",
536
"default": "./src/providerClients.ts"
packages/client-runtime/src/pullRequestReviewers.test.ts
new
+131
@@ -0,0 +1,131 @@
1
+import { describe, expect, it } from "@effect/vitest";
2
+
3
+import {
4
+ hostReviewerQuery,
5
+ mergeReviewerCandidates,
6
+ reviewerCandidateView,
7
+} from "./pullRequestReviewers.ts";
8
+
9
+const reviewer = (
10
+ login: string,
11
+ { isRequested = false, name = null, kind = "user" } = {} as {
12
+ isRequested?: boolean;
13
+ name?: string | null;
14
+ kind?: "user" | "team";
15
+ },
16
+) => ({ login, name, avatarUrl: null, id: login, kind, isRequested });
17
+
18
+describe("mergeReviewerCandidates", () => {
19
+ it("narrows the loaded candidates by login or name", () => {
20
+ const loaded = [
21
+ reviewer("ada"),
22
+ reviewer("grace", { name: "Grace Hopper" }),
23
+ reviewer("linus"),
24
+ ];
25
+ expect(mergeReviewerCandidates(loaded, [], "HOP").map((entry) => entry.login)).toEqual([
26
+ "grace",
27
+ ]);
28
+ });
29
+
30
+ it("adds candidates only the host's search found, after the loaded ones", () => {
31
+ const loaded = [reviewer("ada"), reviewer("adam")];
32
+ const searched = [reviewer("adam"), reviewer("adalbert")];
33
+ expect(mergeReviewerCandidates(loaded, searched, "ada").map((entry) => entry.login)).toEqual([
34
+ "ada",
35
+ "adam",
36
+ "adalbert",
37
+ ]);
38
+ });
39
+
40
+ it("keeps the loaded entry for somebody both lists name, since a request updates that one", () => {
41
+ const loaded = [reviewer("ada", { isRequested: true })];
42
+ expect(mergeReviewerCandidates(loaded, [reviewer("ada")], "ada")).toEqual(loaded);
43
+ });
44
+
45
+ it("keeps a host match on a field absent from the loaded row", () => {
46
+ const loaded = [reviewer("ada", { isRequested: true })];
47
+ expect(mergeReviewerCandidates(loaded, [reviewer("ada")], "ada@example.com")).toEqual(loaded);
48
+ });
49
+
50
+ it("tells a team from a person sharing its id", () => {
51
+ const loaded = [reviewer("core", { kind: "team", isRequested: true })];
52
+ expect(
53
+ mergeReviewerCandidates(loaded, [reviewer("core")], "core").map((entry) => entry.kind),
54
+ ).toEqual(["team", "user"]);
55
+ });
56
+});
57
+
58
+describe("reviewerCandidateView", () => {
59
+ const firstPage = { candidates: [reviewer("ada"), reviewer("grace")], truncated: true };
60
+ const idle = { data: null, isPending: false, error: null };
61
+
62
+ it.each([
63
+ {
64
+ name: "a host without search, as from an older server, narrows the loaded page itself",
65
+ searchable: false,
66
+ query: "zed",
67
+ debouncedQuery: "zed",
68
+ search: idle,
69
+ expected: { hostQuery: null, logins: [], searchPending: false, truncation: "unsearchable" },
70
+ },
71
+ {
72
+ name: "a searchable host is asked once the debounce catches up",
73
+ searchable: true,
74
+ query: "zed",
75
+ debouncedQuery: "zed",
76
+ search: {
77
+ data: { candidates: [reviewer("zed")], truncated: false },
78
+ isPending: false,
79
+ error: null,
80
+ },
81
+ expected: { hostQuery: "zed", logins: ["zed"], searchPending: false, truncation: null },
82
+ },
83
+ {
84
+ name: "results for text the debounce has not reached are neither shown nor a no-match",
85
+ searchable: true,
86
+ query: "zed",
87
+ debouncedQuery: "ze",
88
+ search: {
89
+ data: { candidates: [reviewer("zelda")], truncated: false },
90
+ isPending: false,
91
+ error: null,
92
+ },
93
+ expected: { hostQuery: "ze", logins: [], searchPending: true, truncation: null },
94
+ },
95
+ {
96
+ name: "a failed search falls back to the loaded page and says so",
97
+ searchable: true,
98
+ query: "gr",
99
+ debouncedQuery: "gr",
100
+ search: { data: null, isPending: false, error: "rate limited" },
101
+ expected: {
102
+ hostQuery: "gr",
103
+ logins: ["grace"],
104
+ searchPending: false,
105
+ truncation: "search-failed",
106
+ },
107
+ },
108
+ {
109
+ name: "an empty query lists the loaded page and offers search",
110
+ searchable: true,
111
+ query: "",
112
+ debouncedQuery: "",
113
+ search: idle,
114
+ expected: {
115
+ hostQuery: null,
116
+ logins: ["ada", "grace"],
117
+ searchPending: false,
118
+ truncation: "searchable",
119
+ },
120
+ },
121
+ ])("$name", ({ searchable, query, debouncedQuery, search, expected }) => {
122
+ const input = { loaded: firstPage, searchable, query, debouncedQuery };
123
+ const view = reviewerCandidateView({ ...input, search });
124
+ expect({
125
+ hostQuery: hostReviewerQuery(input),
126
+ logins: view.candidates.map((entry) => entry.login),
127
+ searchPending: view.searchPending,
128
+ truncation: view.truncation,
129
+ }).toEqual(expected);
130
+ });
131
+});
packages/client-runtime/src/pullRequestReviewers.ts
new
+101
@@ -0,0 +1,101 @@
1
+import type {
2
+ PullRequestReviewerCandidate,
3
+ PullRequestReviewerCandidateList,
4
+} from "@t3tools/contracts";
5
+
6
+// Loaded rows retain the request state updated by mutations.
7
+export function mergeReviewerCandidates(
8
+ loaded: ReadonlyArray<PullRequestReviewerCandidate>,
9
+ searched: ReadonlyArray<PullRequestReviewerCandidate>,
10
+ query: string,
11
+): ReadonlyArray<PullRequestReviewerCandidate> {
12
+ const needle = query.trim().toLowerCase();
13
+ const key = (candidate: PullRequestReviewerCandidate) => `${candidate.kind}:${candidate.id}`;
14
+ const known = new Set(loaded.map(key));
15
+ const hostMatches = new Set(searched.map(key));
16
+ return [
17
+ ...loaded.filter(
18
+ (candidate) =>
19
+ hostMatches.has(key(candidate)) ||
20
+ needle.length === 0 ||
21
+ candidate.login.toLowerCase().includes(needle) ||
22
+ (candidate.name ?? "").toLowerCase().includes(needle),
23
+ ),
24
+ // The host matched these on its own terms, an email for one, so they are not narrowed again.
25
+ ...searched.filter((candidate) => !known.has(key(candidate))),
26
+ ];
27
+}
28
+
29
+export interface ReviewerSearchInput {
30
+ readonly loaded: PullRequestReviewerCandidateList | null;
31
+ /** The host declared `reviewers.searchCandidates`. */
32
+ readonly searchable: boolean;
33
+ readonly query: string;
34
+ readonly debouncedQuery: string;
35
+}
36
+
37
+/** What to ask the host for, or null when the loaded page already answers the query. */
38
+export function hostReviewerQuery(input: ReviewerSearchInput): string | null {
39
+ const debounced = input.debouncedQuery.trim();
40
+ return input.searchable && input.loaded?.truncated === true && debounced.length > 0
41
+ ? debounced
42
+ : null;
43
+}
44
+
45
+/**
46
+ * Why the list may be missing people: `unsearchable` hosts cannot be asked, `searchable` ones
47
+ * can once something is typed, and a search that ran either `failed` or was `truncated` itself.
48
+ */
49
+export type ReviewerTruncation =
50
+ | "unsearchable"
51
+ | "searchable"
52
+ | "search-failed"
53
+ | "search-truncated";
54
+
55
+export function reviewerCandidateView(
56
+ input: ReviewerSearchInput & {
57
+ readonly search: {
58
+ readonly data: PullRequestReviewerCandidateList | null;
59
+ readonly isPending: boolean;
60
+ readonly error: string | null;
61
+ };
62
+ },
63
+): {
64
+ readonly candidates: ReadonlyArray<PullRequestReviewerCandidate>;
65
+ /** Nothing matches yet and the host has not answered, which is not "nobody matches". */
66
+ readonly searchPending: boolean;
67
+ readonly searchError: string | null;
68
+ readonly truncation: ReviewerTruncation | null;
69
+} {
70
+ const query = input.query.trim();
71
+ const hostQuery = hostReviewerQuery(input);
72
+ // Only once the debounce has caught up, or rows matching the previous text would linger.
73
+ const searched = hostQuery !== null && hostQuery === query;
74
+ const candidates = mergeReviewerCandidates(
75
+ input.loaded?.candidates ?? [],
76
+ searched ? (input.search.data?.candidates ?? []) : [],
77
+ query,
78
+ );
79
+ const searching = input.searchable && input.loaded?.truncated === true && query.length > 0;
80
+ const searchError = searched ? input.search.error : null;
81
+ const truncation: ReviewerTruncation | null =
82
+ input.loaded?.truncated !== true
83
+ ? null
84
+ : !input.searchable
85
+ ? "unsearchable"
86
+ : query.length === 0
87
+ ? "searchable"
88
+ : !searched
89
+ ? null
90
+ : searchError !== null
91
+ ? "search-failed"
92
+ : input.search.data?.truncated === true
93
+ ? "search-truncated"
94
+ : null;
95
+ return {
96
+ candidates,
97
+ searchPending: candidates.length === 0 && searching && (!searched || input.search.isPending),
98
+ searchError,
99
+ truncation,
100
+ };
101
+}
packages/client-runtime/src/state/pullRequests.ts
+22
-6
@@ -611,6 +611,13 @@ export function createPullRequestEnvironmentAtoms<R, E>(
611
staleTimeMs: 60_000,
612
}),
613
);
614
+ // Asked only when the menu's first page is not everybody, so a query cannot be answered from it.
615
+ const reviewerSearch = createEnvironmentRpcQueryAtomFamily(runtime, {
616
+ label: "environment-data:pull-requests:reviewer-search",
617
+ tag: WS_METHODS.pullRequestsReviewerCandidates,
618
+ execute: (input) => routedRequest(WS_METHODS.pullRequestsReviewerCandidates, input),
619
+ staleTimeMs: 60_000,
620
+ });
621
const loadDiff = Effect.fn("PullRequests.loadDiff")(function* (input: PullRequestDiffInput) {
622
const supervisor = yield* EnvironmentSupervisor.EnvironmentSupervisor;
623
const loader = yield* PullRequestDiffLoader.PullRequestDiffLoader;
@@ -914,6 +921,8 @@ export function createPullRequestEnvironmentAtoms<R, E>(
921
concurrency: serialPerEnvironment,
922
}),
923
reviewerCandidates,
924
+ /** The host's search for reviewers past the first page, keyed by what was typed. */
925
+ reviewerSearch,
926
requestReviewers: createEnvironmentRpcCommand(runtime, {
927
label: "environment-data:pull-requests:request-reviewers",
928
tag: WS_METHODS.pullRequestsRequestReviewers,
@@ -932,12 +941,19 @@ export function createPullRequestEnvironmentAtoms<R, E>(
941
),
942
) ?? [];
943
const missingIdentities = selected.length < reviewers.length;
935
- updateCached(registry, candidatesAtom, (value) => ({
936
- ...value,
937
- candidates: value.candidates.map((candidate) =>
938
- selected.includes(candidate) ? { ...candidate, isRequested: requested } : candidate,
939
- ),
940
- }));
944
+ // Somebody found only by the host's search is not in the loaded list yet; the host
945
+ // puts requested reviewers first, so reading it again brings them in.
946
+ updateCached(
947
+ registry,
948
+ candidatesAtom,
949
+ (value) => ({
950
+ ...value,
951
+ candidates: value.candidates.map((candidate) =>
952
+ selected.includes(candidate) ? { ...candidate, isRequested: requested } : candidate,
953
+ ),
954
+ }),
955
+ missingIdentities,
956
+ );
957
const selectedLogins = new Set(
958
selected.map((candidate) => candidate.login.toLowerCase()),
959
);
packages/contracts/src/pullRequest.ts
+12
@@ -251,6 +251,11 @@ export type PullRequestEditCapabilities = typeof PullRequestEditCapabilities.Typ
251
export const PullRequestReviewerCapabilities = Schema.Struct({
252
request: Schema.Boolean,
253
listCandidates: Schema.Boolean,
254
+ /**
255
+ * Reviewer candidates take a `query` the host matches past the first page. Absent, as from a
256
+ * server that predates it, means the client narrows the loaded page itself.
257
+ */
258
+ searchCandidates: Schema.optional(Schema.Boolean),
259
});
260
export type PullRequestReviewerCapabilities = typeof PullRequestReviewerCapabilities.Type;
261
@@ -411,6 +416,13 @@ export const PullRequestRef = Schema.Struct({
416
});
417
export type PullRequestRef = typeof PullRequestRef.Type;
418
419
+/** `query` asks the host for matches past the first page of candidates. */
420
+export const PullRequestReviewerCandidatesInput = Schema.Struct({
421
+ ...PullRequestRef.fields,
422
+ query: Schema.optional(TrimmedNonEmptyString.check(Schema.isMaxLength(100))),
423
+});
424
+export type PullRequestReviewerCandidatesInput = typeof PullRequestReviewerCandidatesInput.Type;
425
+
426
export const PullRequestRoutingIdentityInput = Schema.Struct({
427
host: TrimmedNonEmptyString,
428
});
packages/contracts/src/rpc.ts
+2
-1
@@ -201,6 +201,7 @@ import {
201
PullRequestLinkedThreadsResult,
202
PullRequestSummary,
203
PullRequestReviewerCandidateList,
204
+ PullRequestReviewerCandidatesInput,
205
PullRequestReviewerRequestInput,
206
PullRequestLabelCandidateList,
207
PullRequestLabelChangeInput,
@@ -1187,7 +1188,7 @@ const WsPullRequestsSubscribeRefreshesRpc = Rpc.make(WS_METHODS.pullRequestsSubs
1188
1189
// Fetch reviewer candidates only when the menu opens to avoid unused host requests.
1190
const WsPullRequestsReviewerCandidatesRpc = Rpc.make(WS_METHODS.pullRequestsReviewerCandidates, {
1190
- payload: PullRequestRef,
1191
+ payload: PullRequestReviewerCandidatesInput,
1192
success: PullRequestReviewerCandidateList,
1193
error: PullRequestRpcError,
1194
});
packages/source-control-azure-devops/src/server/AzureDevOpsPullRequestProvider.ts
+1
-1
@@ -56,7 +56,7 @@ const CAPABILITIES: PullRequestCapabilities = {
56
referenceSigils: [],
57
review: { inlineComment: false, reply: false, resolve: false, verdicts: [] },
58
// Reviewer candidates require separate identity/graph APIs and permissions.
59
- reviewers: { request: true, listCandidates: false },
59
+ reviewers: { request: true, listCandidates: false, searchCandidates: false },
60
edit: { changeRequest: true, comment: false },
61
// Azure's viewed marks use an undocumented endpoint and are invalidated by each push.
62
viewedFiles: "environment",
packages/source-control-bitbucket/src/server/BitbucketPullRequestProvider.ts
+1
-1
@@ -31,7 +31,7 @@ const CAPABILITIES: PullRequestCapabilities = {
31
resolve: true,
32
verdicts: ["comment", "approve", "request-changes"],
33
},
34
- reviewers: { request: true, listCandidates: true },
34
+ reviewers: { request: true, listCandidates: true, searchCandidates: false },
35
edit: { changeRequest: true, comment: true },
36
// Bitbucket PR properties are shared, not per-reader viewed marks.
37
viewedFiles: "environment",
packages/source-control-core/src/server/PullRequestProvider.ts
+5
-1
@@ -523,7 +523,11 @@ export interface PullRequestProviderApi {
523
524
/** Exclude the author using host-specific account identities. */
525
readonly listReviewerCandidates: (
526
- input: ProviderRepositoryRef & { readonly number: number },
526
+ input: ProviderRepositoryRef & {
527
+ readonly number: number;
528
+ /** Asks the host to search past its first page of candidates. */
529
+ readonly query?: string | undefined;
530
+ },
531
) => Effect.Effect<PullRequestReviewerCandidateList, PullRequestProviderError>;
532
533
readonly setReviewerRequest: (
packages/source-control-forgejo/src/server/ForgejoPullRequestProvider.ts
+1
-1
@@ -58,7 +58,7 @@ const CAPABILITIES: PullRequestCapabilities = {
58
resolve: false,
59
verdicts: ["comment", "approve", "request-changes"],
60
},
61
- reviewers: { request: true, listCandidates: true },
61
+ reviewers: { request: true, listCandidates: true, searchCandidates: false },
62
edit: { changeRequest: true, comment: true },
63
};
64
const USER_SEARCH_LIMIT = 50;
packages/source-control-gitcafe/src/server/GitCafePullRequestProvider.ts
+1
-1
@@ -44,7 +44,7 @@ const CAPABILITIES: PullRequestCapabilities = {
44
resolve: true,
45
verdicts: ["approve", "request-changes", "comment"],
46
},
47
- reviewers: { request: true, listCandidates: true },
47
+ reviewers: { request: true, listCandidates: true, searchCandidates: false },
48
edit: { changeRequest: true, comment: true },
49
};
50
packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
+48
@@ -4001,6 +4001,54 @@ layer("GitHubPullRequestApi.layer", (it) => {
4001
}),
4002
);
4003
4004
+ it.effect("asks GitHub to search everyone assignable when the reviewer menu has a query", () =>
4005
+ Effect.gen(function* () {
4006
+ mockedExecute.mockReturnValue(
4007
+ Effect.succeed(
4008
+ output(
4009
+ encodeJson({
4010
+ data: {
4011
+ repository: {
4012
+ assignableUsers: {
4013
+ pageInfo: { hasNextPage: false },
4014
+ nodes: [{ login: "octocat", name: null, avatarUrl: "https://avatars/octocat" }],
4015
+ },
4016
+ pullRequest: {
4017
+ author: { __typename: "User", login: "bilal" },
4018
+ reviewRequests: {
4019
+ nodes: ["octocat", "unrelated"].map((login) => ({
4020
+ requestedReviewer: {
4021
+ __typename: "User",
4022
+ login,
4023
+ name: null,
4024
+ avatarUrl: "https://avatars/user",
4025
+ },
4026
+ })),
4027
+ },
4028
+ },
4029
+ },
4030
+ },
4031
+ }),
4032
+ ),
4033
+ ),
4034
+ );
4035
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
4036
+
4037
+ const list = yield* cli.listReviewerCandidates({
4038
+ cwd: "/w",
4039
+ repository: "acme/web",
4040
+ host: "github.com",
4041
+ number: 7,
4042
+ query: "octo",
4043
+ });
4044
+
4045
+ expect(varsAt(0)).toMatchObject({ owner: "acme", name: "web", number: 7, query: "octo" });
4046
+ expect(list.candidates.map((candidate) => [candidate.login, candidate.isRequested])).toEqual([
4047
+ ["octocat", true],
4048
+ ]);
4049
+ }),
4050
+ );
4051
+
4052
it.effect("takes labels off one at a time, naming each in the path encoded", () =>
4053
Effect.gen(function* () {
4054
mockedExecute.mockReturnValue(Effect.succeed(output("[]")));
packages/source-control-github/src/server/GitHubPullRequestApi.ts
+3
-2
@@ -605,6 +605,7 @@ export class GitHubPullRequestApi extends Context.Service<
605
readonly repository: string;
606
readonly host: string;
607
readonly number: number;
608
+ readonly query?: string | undefined;
609
}) => Effect.Effect<PullRequestReviewerCandidateList, GitHubPullRequestApiError>;
610
611
readonly setReviewerRequest: (input: {
@@ -2325,10 +2326,10 @@ export const make = Effect.gen(function* () {
2326
const { owner, name } = parseRepositorySelector(input.repository);
2327
const operation = "listReviewerCandidates";
2328
return client
2328
- .ReviewerCandidates({ owner, name, number: input.number })
2329
+ .ReviewerCandidates({ owner, name, number: input.number, query: input.query ?? null })
2330
.pipe(
2331
graphql({ ...input, operation, allowReserve: true }),
2331
- Effect.map(toReviewerCandidates),
2332
+ Effect.map((result) => toReviewerCandidates(result, input.query)),
2333
Effect.flatMap(found({ ...input, operation })),
2334
);
2335
},
packages/source-control-github/src/server/GitHubPullRequestProvider.ts
+1
-1
@@ -51,7 +51,7 @@ const CAPABILITIES: PullRequestCapabilities = {
51
resolve: true,
52
verdicts: ["comment", "approve", "request-changes"],
53
},
54
- reviewers: { request: true, listCandidates: true },
54
+ reviewers: { request: true, listCandidates: true, searchCandidates: true },
55
edit: { changeRequest: true, comment: true, maintainerEdits: true },
56
stacks: true,
57
stackActions: true,
packages/source-control-github/src/server/gitHubPullRequestJson.ts
+6
-1
@@ -1462,6 +1462,7 @@ export interface GitHubBaseComparison {
1462
/** assignableUsers avoids push/read:org requirements. Keep requested outsiders/apps removable. */
1463
export function toReviewerCandidates(
1464
result: ReviewerCandidates.Result,
1465
+ query?: string,
1466
): PullRequestReviewerCandidateList | null {
1467
const repository = result.repository;
1468
if (repository == null) return null;
@@ -1485,8 +1486,10 @@ export function toReviewerCandidates(
1486
isRequested: true,
1487
});
1488
}
1489
+ const hostMatches = new Set<string>();
1490
for (const node of nodesOf(repository.assignableUsers)) {
1491
const login = trimmed(node.login);
1492
+ if (login !== null) hostMatches.add(login);
1493
if (login === null || login === author || candidates.has(`user ${login}`)) continue;
1494
candidates.set(`user ${login}`, {
1495
id: login,
@@ -1498,7 +1501,9 @@ export function toReviewerCandidates(
1501
});
1502
}
1503
return {
1501
- candidates: [...candidates.values()],
1504
+ candidates: [...candidates.values()].filter(
1505
+ (candidate) => !query?.trim() || (candidate.kind === "user" && hostMatches.has(candidate.id)),
1506
+ ),
1507
truncated: repository.assignableUsers.pageInfo.hasNextPage,
1508
};
1509
}
packages/source-control-github/src/server/pullRequestReads.graphql
+2
-2
@@ -409,9 +409,9 @@ query ViewerPermissions($owner: String!, $name: String!, $number: Int!) {
409
# taken back. The teams a repository could newly be sent to live on the owning organization and
410
# need `read:org`, which a repository-scoped token need not carry, and a query GitHub refuses
411
# fails whole, taking the people down with the teams.
412
-query ReviewerCandidates($owner: String!, $name: String!, $number: Int!) {
412
+query ReviewerCandidates($owner: String!, $name: String!, $number: Int!, $query: String) {
413
repository(owner: $owner, name: $name) {
414
- assignableUsers(first: 100) {
414
+ assignableUsers(first: 100, query: $query) {
415
pageInfo {
416
hasNextPage
417
}
packages/source-control-github/src/server/pullRequestReads.graphql.ts
+5
-3
@@ -1199,17 +1199,19 @@ export const ReviewerCandidates = GraphQL.query("ReviewerCandidates", {
1199
variables: [
1200
{ name: "owner", body: "String!" },
1201
{ name: "name", body: "String!" },
1202
- { name: "number", body: "Int!" }
1202
+ { name: "number", body: "Int!" },
1203
+ { name: "query", body: "String" }
1204
],
1205
selections: [
1205
- { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){assignableUsers(first:100){pageInfo{hasNextPage}nodes{login name avatarUrl}}pullRequest(number:$", "number", "){author{__typename login}reviewRequests(first:100){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}...on Bot{login avatarUrl}}}}}}"] }
1206
+ { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){assignableUsers(first:100 query:$", "query", "){pageInfo{hasNextPage}nodes{login name avatarUrl}}pullRequest(number:$", "number", "){author{__typename login}reviewRequests(first:100){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Team{slug combinedSlug teamName:name teamAvatarUrl:avatarUrl}...on Bot{login avatarUrl}}}}}}"] }
1207
],
1208
fragments: []
1209
},
1210
variables: {
1211
owner: Schema.String,
1212
name: Schema.String,
1212
- number: Shared.Int
1213
+ number: Shared.Int,
1214
+ query: Schema.optional(Schema.NullOr(Schema.String))
1215
},
1216
result: Schema.Struct({
1217
/** Lookup a given repository by the owner and repository name. */
packages/source-control-gitlab/src/server/GitLabPullRequestCli.test.ts
+97
@@ -2069,6 +2069,82 @@ layer("GitLabPullRequestCli.layer", (it) => {
2069
}),
2070
);
2071
2072
+ it.effect(
2073
+ "lists the requested reviewers first, even when the users page does not reach them",
2074
+ () =>
2075
+ Effect.gen(function* () {
2076
+ mockedExecute
2077
+ .mockReturnValueOnce(
2078
+ Effect.succeed(output(mergeRequestJson({ reviewers: [{ id: 42, username: "late" }] }))),
2079
+ )
2080
+ .mockReturnValueOnce(Effect.succeed(output(JSON.stringify([author, reviewer]))));
2081
+ const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
2082
+
2083
+ const list = yield* cli.listReviewerCandidates({
2084
+ cwd: "/w",
2085
+ repository: "acme/web",
2086
+ number: 7,
2087
+ });
2088
+
2089
+ expect(
2090
+ list.candidates.map((candidate) => [
2091
+ candidate.login,
2092
+ candidate.id,
2093
+ candidate.isRequested,
2094
+ ]),
2095
+ ).toEqual([
2096
+ ["late", "42", true],
2097
+ [reviewer.username, "5", false],
2098
+ ]);
2099
+ }),
2100
+ );
2101
+
2102
+ it.effect("marks a reviewer GitLab sent without a username as requested on the users page", () =>
2103
+ Effect.gen(function* () {
2104
+ mockedExecute
2105
+ .mockReturnValueOnce(
2106
+ Effect.succeed(output(mergeRequestJson({ reviewers: [{ id: 5, username: "" }] }))),
2107
+ )
2108
+ .mockReturnValueOnce(Effect.succeed(output(JSON.stringify([author, reviewer]))));
2109
+ const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
2110
+
2111
+ const list = yield* cli.listReviewerCandidates({
2112
+ cwd: "/w",
2113
+ repository: "acme/web",
2114
+ number: 7,
2115
+ });
2116
+
2117
+ expect(list.candidates.map((candidate) => [candidate.id, candidate.isRequested])).toEqual([
2118
+ ["5", true],
2119
+ ]);
2120
+ }),
2121
+ );
2122
+
2123
+ it.effect("asks GitLab to search the project's users when the menu has a query", () =>
2124
+ Effect.gen(function* () {
2125
+ mockedExecute
2126
+ .mockReturnValueOnce(
2127
+ Effect.succeed(
2128
+ output(mergeRequestJson({ reviewers: [reviewer, { id: 42, username: "unrelated" }] })),
2129
+ ),
2130
+ )
2131
+ .mockReturnValueOnce(Effect.succeed(output(JSON.stringify([reviewer]))));
2132
+ const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
2133
+
2134
+ const list = yield* cli.listReviewerCandidates({
2135
+ cwd: "/w",
2136
+ repository: "acme/web",
2137
+ number: 7,
2138
+ query: "octo cat",
2139
+ });
2140
+
2141
+ expect(list.candidates.map((candidate) => [candidate.login, candidate.isRequested])).toEqual([
2142
+ [reviewer.username, true],
2143
+ ]);
2144
+ expect(argsOfCall(1)[1]).toBe("projects/acme%2Fweb/users?per_page=100&search=octo%20cat");
2145
+ }),
2146
+ );
2147
+
2148
it.effect("writes the reviewer set back with the one being asked added to it", () =>
2149
Effect.gen(function* () {
2150
mockedExecute
@@ -2089,6 +2165,27 @@ layer("GitLabPullRequestCli.layer", (it) => {
2165
}),
2166
);
2167
2168
+ it.effect("keeps a reviewer it cannot show when writing the set back", () =>
2169
+ Effect.gen(function* () {
2170
+ mockedExecute
2171
+ .mockReturnValueOnce(
2172
+ Effect.succeed(output(mergeRequestJson({ reviewers: [{ id: 3, username: "" }] }))),
2173
+ )
2174
+ .mockReturnValueOnce(Effect.succeed(output("{}")));
2175
+ const cli = yield* GitLabPullRequestCli.GitLabPullRequestCli;
2176
+
2177
+ yield* cli.setReviewerRequest({
2178
+ cwd: "/w",
2179
+ repository: "acme/web",
2180
+ number: 7,
2181
+ reviewers: [{ id: "9" }],
2182
+ requested: true,
2183
+ });
2184
+
2185
+ expect(JSON.parse(callAt(1).stdin ?? "")).toEqual({ reviewer_ids: [3, 9] });
2186
+ }),
2187
+ );
2188
+
2189
it.effect("takes a reviewer out of the set rather than clearing it", () =>
2190
Effect.gen(function* () {
2191
mockedExecute
packages/source-control-gitlab/src/server/GitLabPullRequestCli.ts
+34
-10
@@ -481,6 +481,7 @@ export class GitLabPullRequestCli extends Context.Service<
481
readonly host?: string | undefined;
482
readonly repository: string;
483
readonly number: number;
484
+ readonly query?: string | undefined;
485
}) => Effect.Effect<PullRequestReviewerCandidateList, GitLabPullRequestCliError>;
486
487
readonly listProjectLabels: (input: {
@@ -2358,19 +2359,42 @@ export const make = Effect.gen(function* () {
2359
2360
listReviewerCandidates: Effect.fn("GitLabPullRequestCli.listReviewerCandidates")(
2361
function (input) {
2361
- return Effect.all([mergeRequestDetail(input), projectUsers(input)], {
2362
- concurrency: 2,
2363
- }).pipe(
2362
+ return Effect.all(
2363
+ [mergeRequestDetail(input), projectUsers({ ...input, search: input.query })],
2364
+ {
2365
+ concurrency: 2,
2366
+ },
2367
+ ).pipe(
2368
Effect.map(([mergeRequest, users]) => {
2369
const author = mergeRequest.author?.login;
2366
- const requested = new Set(mergeRequest.reviewRequestLogins);
2370
+ const requested = (input.query?.trim() ? [] : mergeRequest.reviewerUsers).map(
2371
+ ({ id, ...actor }) => ({
2372
+ ...actor,
2373
+ id: String(id),
2374
+ kind: "user" as const,
2375
+ isRequested: true,
2376
+ }),
2377
+ );
2378
+ const listed = new Set(requested.map((reviewer) => reviewer.id));
2379
+ // Every reviewer id, not just the ones shown above: a reviewer GitLab sent without a
2380
+ // username can still turn up on the users page, and must read as requested there or
2381
+ // choosing them would ask again instead of taking the request back.
2382
+ const requestedIds = new Set(mergeRequest.reviewerIds.map(String));
2383
return {
2368
- // GitLab forbids requesting a review from the MR author.
2369
- candidates: users.candidates.flatMap((candidate) =>
2370
- candidate.login === author
2371
- ? []
2372
- : [{ ...candidate, isRequested: requested.has(candidate.login) }],
2373
- ),
2384
+ // The reviewers lead, and come from the merge request rather than the users page:
2385
+ // that page stops at a hundred, and somebody missing from it could not be taken off.
2386
+ // The author is dropped rather than shown unusable: GitLab refuses to make the person
2387
+ // who opened a merge request its reviewer.
2388
+ candidates: [
2389
+ ...requested,
2390
+ ...users.candidates
2391
+ .filter((candidate) => candidate.login !== author && !listed.has(candidate.id))
2392
+ .map((candidate) =>
2393
+ requestedIds.has(candidate.id)
2394
+ ? { ...candidate, isRequested: true }
2395
+ : candidate,
2396
+ ),
2397
+ ],
2398
truncated: users.rawCount >= MAX_PAGE_SIZE,
2399
};
2400
}),
packages/source-control-gitlab/src/server/GitLabPullRequestProvider.test.ts
+4
@@ -189,6 +189,7 @@ describe("getChangeRequest base freshness", () => {
189
checks: [],
190
viewerCanMerge: true,
191
reviewerIds: [],
192
+ reviewerUsers: [],
193
};
194
195
it.effect.each(["getChangeRequestPreview", "getChangeRequestSummary"] as const)(
@@ -344,6 +345,7 @@ describe("merge request reads", () => {
345
checks: [],
346
viewerCanMerge: true,
347
reviewerIds: [],
348
+ reviewerUsers: [],
349
};
350
351
const countingProvider = Effect.gen(function* () {
@@ -537,6 +539,7 @@ describe("optional activity reads", () => {
539
checks: [],
540
viewerCanMerge: true,
541
reviewerIds: [],
542
+ reviewerUsers: [],
543
diffRefs: currentRefs,
544
}),
545
listNotes: () => Effect.succeed({ comments: [comment], truncated: false }),
@@ -869,6 +872,7 @@ describe("review decisions", () => {
872
checks: [],
873
viewerCanMerge: true,
874
reviewerIds: [],
875
+ reviewerUsers: [],
876
};
877
const providerWith = (
878
getListStates: GitLabPullRequestCli.GitLabPullRequestCli["Service"]["getListStates"],
packages/source-control-gitlab/src/server/GitLabPullRequestProvider.ts
+2
-1
@@ -42,7 +42,7 @@ const CAPABILITIES: PullRequestCapabilities = {
42
resolve: true,
43
verdicts: ["comment", "approve", "request-changes"],
44
},
45
- reviewers: { request: true, listCandidates: true },
45
+ reviewers: { request: true, listCandidates: true, searchCandidates: true },
46
labels: true,
47
edit: { changeRequest: true, comment: true, maintainerEdits: true },
48
};
@@ -496,6 +496,7 @@ export const make = Effect.gen(function* () {
496
host: input.host,
497
repository: input.repository,
498
number: input.number,
499
+ query: input.query,
500
})
501
.pipe(Effect.mapError(fail("listReviewerCandidates"))),
502
packages/source-control-gitlab/src/server/gitLabMergeRequestJson.ts
+7
@@ -219,7 +219,10 @@ export interface GitLabMergeRequestDetail extends GitLabMergeRequestListItem {
219
readonly viewerCanDeleteBranch?: boolean;
220
/** Set by the detail read, which asks GraphQL; REST carries no label permission. */
221
readonly viewerCanEditLabels?: boolean;
222
+ /** Every reviewer id, even one without a username to show, since writes replace the set. */
223
readonly reviewerIds: ReadonlyArray<number>;
224
+ /** The candidate list leads with these, since one page of project users need not reach them. */
225
+ readonly reviewerUsers: ReadonlyArray<PullRequestActor & { readonly id: number }>;
226
readonly autoMergeEnabled?: boolean;
227
readonly autoMergeMethod?: PullRequestMergeMethod;
228
/** Absent means not counted, not up to date. */
@@ -521,6 +524,10 @@ function toDetail(raw: Schema.Schema.Type<typeof RawMergeRequestSchema>): GitLab
524
reviewerIds: (raw.reviewers ?? []).flatMap((reviewer) =>
525
reviewer.id === undefined ? [] : [reviewer.id],
526
),
527
+ reviewerUsers: (raw.reviewers ?? []).flatMap((reviewer) => {
528
+ const actor = toActor(reviewer);
529
+ return actor === null || reviewer.id === undefined ? [] : [{ ...actor, id: reviewer.id }];
530
+ }),
531
...(autoMerge === undefined ? {} : { autoMergeEnabled: autoMerge }),
532
...(autoMerge === true && raw.squash_on_merge === true
533
? { autoMergeMethod: "squash" as const }