Skip to content
TypeScript

perf(server): GitHub activity reads skip PR-wide fields on later review-thread pages (8.9 s → 6.8 s median) (#30294)

Andrei596752cffe9f
diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
index 705a25b13e8..f46c91fd695 100644
--- a/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
+++ b/packages/source-control-github/src/server/GitHubPullRequestApi.test.ts
@@ -338,13 +338,14 @@ function threadComments(
ids: ReadonlyArray<string>,
endCursor: string | null,
totalCount = ids.length,
+ author: Readonly<Record<string, unknown>> | null = null,
) {
return {
totalCount,
pageInfo: { hasNextPage: endCursor !== null, endCursor },
nodes: ids.map((id) => ({
id,
- author: null,
+ author,
body: id,
createdAt: "2026-07-01T00:00:00Z",
lastEditedAt: null,
@@ -3455,67 +3456,31 @@ layer("GitHubPullRequestApi.layer", (it) => {
}),
);
- it.effect.each([false, true])(
- "keeps thread cursors and reviewers after a refusal (later page: %s)",
- (later) =>
- Effect.gen(function* () {
- if (later)
- mockedExecute.mockReturnValueOnce(
- Effect.succeed(
- output(
- reviewThreadsPage([thread("T1", "c1")], "next", [
- {
- __typename: "User",
- login: "prior",
- name: null,
- avatarUrl: "https://avatars/prior",
- },
- ]),
- ),
- ),
- );
- mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
- mockedExecute.mockReturnValueOnce(
- Effect.succeed(output(reviewThreadsPage([thread("T2", "c2")], "last"))),
- );
- mockedExecute.mockReturnValueOnce(
- Effect.succeed(output(reviewThreadsPage([thread("T3", "c3")], null))),
- );
- const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
- const read = cli.listReviewThreadComments({
- ...pullRequestInput,
- repository: `acme/refused-threads-${later}`,
- });
- const conversation = yield* read;
- expect(
- variablesOf("ReviewThreads").map((v) => [v["after"], v["requestedReviewers"]]),
- ).toEqual(
- later
- ? [
- [null, 50],
- ["next", 50],
- ["next", 0],
- ["last", 0],
- ]
- : [
- [null, 50],
- [null, 0],
- ["last", 0],
- ],
- );
- expect(conversation.comments.map((c) => c.id)).toEqual(
- later ? ["c1", "c2", "c3"] : ["c2", "c3"],
- );
- expect(conversation.reviewers.map((r) => r.login)).toEqual(later ? ["prior"] : []);
- expect(conversation.truncated).toBe(false);
-
- mockedExecute.mockReturnValueOnce(Effect.succeed(output(reviewThreadsPage([], null))));
- yield* read;
- expect(variablesOf("ReviewThreads").at(-1)).toMatchObject({
- after: null,
- requestedReviewers: 0,
- });
- }),
+ it.effect("keeps thread cursors after a reviewer refusal", () =>
+ Effect.gen(function* () {
+ mockedExecute.mockReturnValueOnce(refusedReviewerResponse());
+ mockedExecute.mockReturnValueOnce(
+ Effect.succeed(output(reviewThreadsPage([thread("T2", "c2")], "last"))),
+ );
+ mockedExecute.mockReturnValueOnce(
+ Effect.succeed(output(reviewThreadsPage([thread("T3", "c3")], null))),
+ );
+ const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
+ const read = cli.listReviewThreadComments({
+ ...pullRequestInput,
+ repository: "acme/refused-threads",
+ });
+ const conversation = yield* read;
+ expect(variablesOf("ReviewThreads").map((v) => v["requestedReviewers"])).toEqual([50, 0]);
+ expect(variablesOf("ReviewThreadPages").map((v) => v["after"])).toEqual(["last"]);
+ expect(conversation.comments.map((c) => c.id)).toEqual(["c2", "c3"]);
+ expect(conversation.reviewers).toEqual([]);
+ expect(conversation.truncated).toBe(false);
+
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(reviewThreadsPage([], null))));
+ yield* read;
+ expect(variablesOf("ReviewThreads").at(-1)).toMatchObject({ requestedReviewers: 0 });
+ }),
);
it.effect("decodes reviewers, labels and workflow checks without another detail read", () =>
@@ -3767,10 +3732,32 @@ layer("GitHubPullRequestApi.layer", (it) => {
it.effect("follows the cursor to the review threads the first page left behind", () =>
Effect.gen(function* () {
mockedExecute.mockReturnValueOnce(
- Effect.succeed(output(reviewThreadsPage([thread("PRRT_1", "c1")], "Y3Vyc29yOjE"))),
+ Effect.succeed(
+ output(
+ reviewThreadsPage([thread("PRRT_1", "c1")], "Y3Vyc29yOjE", [
+ { __typename: "User", login: "prior", name: null, avatarUrl: "https://avatars/p" },
+ ]),
+ ),
+ ),
);
mockedExecute.mockReturnValueOnce(
- Effect.succeed(output(reviewThreadsPage([thread("PRRT_2", "c2")], null))),
+ Effect.succeed(
+ output(
+ reviewThreadsPage(
+ [
+ {
+ ...thread("PRRT_2", "c2"),
+ comments: threadComments(["c2"], null, 1, {
+ __typename: "Bot",
+ login: "later-bot",
+ avatarUrl: "https://avatars/later-bot",
+ }),
+ },
+ ],
+ null,
+ ),
+ ),
+ ),
);
const cli = yield* GitHubPullRequestApi.GitHubPullRequestApi;
@@ -3781,9 +3768,20 @@ layer("GitHubPullRequestApi.layer", (it) => {
number: 7,
});
- expect(varsAt(0)["after"]).toBeNull();
- expect(varsAt(1)["after"]).toBe("Y3Vyc29yOjE");
+ expect(callAt(0)).toMatchObject({ operationName: "ReviewThreads" });
+ // Later pages ask for the threads alone and keep the first page's PR-wide fields.
+ const later = callAt(1);
+ assert(later.kind === "graphql");
+ expect(later).toMatchObject({
+ operationName: "ReviewThreadPages",
+ variables: { after: "Y3Vyc29yOjE" },
+ });
+ for (const field of ["reviewRequests", "commits(", "reviewDismissals", "latestReviews"])
+ expect(later.query).not.toContain(field);
expect(conversation.comments.map((comment) => comment.id)).toEqual(["c1", "c2"]);
+ expect(conversation.reviewers.map((reviewer) => reviewer.login)).toEqual(["prior"]);
+ expect(conversation.avatarsByLogin.get("later-bot")).toBe("https://avatars/later-bot");
+ expect(conversation.botLogins.has("later-bot")).toBe(true);
assert.isFalse(conversation.truncated);
}),
);
diff --git a/packages/source-control-github/src/server/GitHubPullRequestApi.ts b/packages/source-control-github/src/server/GitHubPullRequestApi.ts
index c4fbbfcd9f6..ce38cc726a2 100644
--- a/packages/source-control-github/src/server/GitHubPullRequestApi.ts
+++ b/packages/source-control-github/src/server/GitHubPullRequestApi.ts
@@ -33,7 +33,6 @@ import {
type PullRequestListState,
type PullRequestMergeMethod,
type PullRequestOmittedFileStat,
- type PullRequestReaction,
type PullRequestReactionContent,
type PullRequestReviewCommentDraft,
type PullRequestReviewVerdict,
@@ -95,6 +94,7 @@ import {
toReviewDismissalsPage,
toReviewerCandidates,
toReviewThreadCommentsPage,
+ toLaterReviewThreadPage,
toReviewThreadPage,
toStackMembership,
toViewerPermissions,
@@ -2216,45 +2216,39 @@ export const make = Effect.gen(function* () {
function* (input) {
const { owner, name } = parseRepositorySelector(input.repository);
const target = { ...input, operation: "listReviewThreadComments" };
- const threadPage = (
- after: string | null,
- ): Effect.Effect<GitHubReviewThreadPage, GitHubPullRequestApiError> =>
- readRequestedReviewers(input, 50, (requestedReviewers) =>
- client.ReviewThreads({ owner, name, number: input.number, after, requestedReviewers }),
- ).pipe(graphql(target), Effect.map(toReviewThreadPage), Effect.flatMap(found(target)));
- const entries: GitHubReviewThreadEntry[] = [];
- const avatarsByLogin = new Map<string, string>();
- const botLogins = new Set<string>();
- let reviewers: ReadonlyArray<PullRequestActor> = [];
- let reactions: GitHubReviewThreadPage["reactions"] = [];
- const reactionsById = new Map<string, ReadonlyArray<PullRequestReaction>>();
- const editedAtById = new Map<string, string>();
- let commits: GitHubReviewThreadPage["commits"] = [];
- let viewer: GitHubReviewThreadPage["viewer"] = { canUpdate: true, didAuthor: false };
- const dismissalsByReviewId = new Map<string, string>();
- let dismissalCursor: string | null = null;
- let cursor: string | null = null;
- let page = 0;
- do {
- const read: GitHubReviewThreadPage = yield* threadPage(cursor);
- entries.push(...read.threads);
- for (const login of read.botLogins) botLogins.add(login);
- for (const [login, avatarUrl] of read.avatarsByLogin)
+ const first: GitHubReviewThreadPage = yield* readRequestedReviewers(
+ input,
+ 50,
+ (requestedReviewers) =>
+ client.ReviewThreads({ owner, name, number: input.number, requestedReviewers }),
+ ).pipe(graphql(target), Effect.map(toReviewThreadPage), Effect.flatMap(found(target)));
+ const entries: GitHubReviewThreadEntry[] = [...first.threads];
+ const avatarsByLogin = new Map(first.avatarsByLogin);
+ const botLogins = new Set(first.botLogins);
+ const { reviewers, reactions, reactionsById, editedAtById, commits, viewer } = first;
+ const dismissalsByReviewId = new Map(first.dismissalsByReviewId);
+ const dismissalCursor = first.nextDismissalCursor;
+ let cursor = first.nextCursor;
+ let page = 1;
+ // Later pages carry the threads alone; the PR-wide fields above come from the first.
+ while (cursor !== null && page < REVIEW_THREAD_PAGES) {
+ const later: Pick<
+ GitHubReviewThreadPage,
+ "threads" | "nextCursor" | "avatarsByLogin" | "botLogins"
+ > = yield* client
+ .ReviewThreadPages({ owner, name, number: input.number, after: cursor })
+ .pipe(
+ graphql(target),
+ Effect.map(toLaterReviewThreadPage),
+ Effect.flatMap(found(target)),
+ );
+ entries.push(...later.threads);
+ for (const login of later.botLogins) botLogins.add(login);
+ for (const [login, avatarUrl] of later.avatarsByLogin)
avatarsByLogin.set(login, avatarUrl);
- if (page === 0) {
- reviewers = read.reviewers;
- reactions = read.reactions;
- for (const [id, entry] of read.reactionsById) reactionsById.set(id, entry);
- for (const [id, editedAt] of read.editedAtById) editedAtById.set(id, editedAt);
- commits = read.commits;
- viewer = read.viewer;
- for (const [id, message] of read.dismissalsByReviewId)
- dismissalsByReviewId.set(id, message);
- dismissalCursor = read.nextDismissalCursor;
- }
- cursor = read.nextCursor;
+ cursor = later.nextCursor;
page += 1;
- } while (cursor !== null && page < REVIEW_THREAD_PAGES);
+ }
if (dismissalCursor !== null) {
let after: string | null = dismissalCursor;
diff --git a/packages/source-control-github/src/server/gitHubPullRequestJson.ts b/packages/source-control-github/src/server/gitHubPullRequestJson.ts
index 98a95a363e3..a4c509e9444 100644
--- a/packages/source-control-github/src/server/gitHubPullRequestJson.ts
+++ b/packages/source-control-github/src/server/gitHubPullRequestJson.ts
@@ -75,6 +75,8 @@ import type {
ReactionGroup,
ReviewDismissals,
ReviewThreadComments,
+ ReviewThreadPage,
+ ReviewThreadPages,
ReviewThreads,
ThreadComment,
} from "./pullRequestReviews.graphql.ts";
@@ -1313,11 +1315,8 @@ type ReviewThreadsPullRequest = NonNullable<
NonNullable<ReviewThreads.Result["repository"]>["pullRequest"]
>;
-export function toReviewThreadPage(result: ReviewThreads.Result): GitHubReviewThreadPage | null {
- const pullRequest = result.repository?.pullRequest;
- if (pullRequest == null) return null;
- const viewer = trimmed(result.viewer.login);
- const threads = pullRequest.reviewThreads;
+/** A page of threads and the people commenting on them, whichever query carried it. */
+function toReviewThreadEntries(threads: ReviewThreadPage, viewer: string | null) {
const threadNodes = nodesOf(threads);
const entries = threadNodes.flatMap((thread): ReadonlyArray<GitHubReviewThreadEntry> => {
const path = trimmed(thread.path);
@@ -1341,27 +1340,58 @@ export function toReviewThreadPage(result: ReviewThreads.Result): GitHubReviewTh
},
];
});
+ return {
+ entries,
+ nextCursor: nextCursorOf(threads.pageInfo),
+ authors: threadNodes.flatMap((thread) =>
+ nodesOf(thread.comments).map((comment) => comment.author),
+ ),
+ };
+}
+
+function collectActors(raws: ReadonlyArray<ActorFields | null | undefined>) {
+ const avatarsByLogin = new Map<string, string>();
+ const botLogins = new Set<string>();
+ for (const raw of raws) {
+ const login = trimmed(raw?.login);
+ const avatarUrl = trimmed(raw?.avatarUrl);
+ if (login !== null && avatarUrl !== null) avatarsByLogin.set(login, avatarUrl);
+ if (login !== null && toActor(raw)?.isBot) botLogins.add(login);
+ }
+ return { avatarsByLogin, botLogins };
+}
+
+export function toLaterReviewThreadPage(
+ result: ReviewThreadPages.Result,
+): Pick<GitHubReviewThreadPage, "threads" | "nextCursor" | "avatarsByLogin" | "botLogins"> | null {
+ const threads = result.repository?.pullRequest?.reviewThreads;
+ if (threads === undefined) return null;
+ const { entries, nextCursor, authors } = toReviewThreadEntries(
+ threads,
+ trimmed(result.viewer.login),
+ );
+ return { threads: entries, nextCursor, ...collectActors(authors) };
+}
+
+export function toReviewThreadPage(result: ReviewThreads.Result): GitHubReviewThreadPage | null {
+ const pullRequest = result.repository?.pullRequest;
+ if (pullRequest == null) return null;
+ const viewer = trimmed(result.viewer.login);
+ const page = toReviewThreadEntries(pullRequest.reviewThreads, viewer);
const requestedReviewers = nodesOf(pullRequest.reviewRequests).map(
(node): ActorFields | null => node.requestedReviewer,
);
const latestReviews = nodesOf(pullRequest.latestReviews);
const comments = nodesOf(pullRequest.comments);
const reviews = nodesOf(pullRequest.reviews);
- const avatarsByLogin = new Map<string, string>();
- const botLogins = new Set<string>();
- for (const raw of [
+ const { avatarsByLogin, botLogins } = collectActors([
pullRequest.author,
...comments.map((node) => node.author),
...reviews.map((node) => node.author),
...requestedReviewers,
...latestReviews.map((node) => node.author),
- ...threadNodes.flatMap((thread) => nodesOf(thread.comments).map((comment) => comment.author)),
- ]) {
- const login = trimmed(raw?.login);
- const avatarUrl = trimmed(raw?.avatarUrl);
- if (login !== null && avatarUrl !== null) avatarsByLogin.set(login, avatarUrl);
- if (login !== null && toActor(raw)?.isBot) botLogins.add(login);
- }
+ ...page.authors,
+ ]);
const reviewers = new Map<string, PullRequestActor>();
for (const raw of [...requestedReviewers, ...latestReviews.map((node) => node.author)]) {
const actor = toActor(raw) ?? toRequestedTeam(raw);
@@ -1391,8 +1421,8 @@ export function toReviewThreadPage(result: ReviewThreads.Result): GitHubReviewTh
if (reactions.length > 0) reactionsById.set(id, reactions);
}
return {
- threads: entries,
- nextCursor: nextCursorOf(threads.pageInfo),
+ threads: page.entries,
+ nextCursor: page.nextCursor,
reactions: toReactions(pullRequest.reactionGroups, viewer),
reactionsById,
editedAtById,
diff --git a/packages/source-control-github/src/server/pullRequestReviews.graphql b/packages/source-control-github/src/server/pullRequestReviews.graphql
index 96c35783dc1..94646874d80 100644
--- a/packages/source-control-github/src/server/pullRequestReviews.graphql
+++ b/packages/source-control-github/src/server/pullRequestReviews.graphql
@@ -40,9 +40,39 @@ fragment ThreadComment on PullRequestReviewComment {
...Reactions
}
-# One page of review threads with their comments, and the people on the review. `$after` is null
-# for the first page and the last page's `endCursor` after that, so a pull request with more
-# threads than one page holds is walked rather than cut off.
+# One page of review threads. Only ten comments ride with each thread. A hundred threads times a
+# hundred comments made GitHub reserve 10,000 nested rows and charge 104 points; unfinished threads
+# are paged from their own cursor by `ReviewThreadComments`.
+fragment ReviewThreadPage on PullRequestReviewThreadConnection {
+ totalCount
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ nodes {
+ id
+ isResolved
+ isOutdated
+ path
+ # Null once the thread's line has left the diff, which `isOutdated` reports.
+ line
+ diffSide
+ comments(first: 10) {
+ totalCount
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ nodes {
+ ...ThreadComment
+ }
+ }
+ }
+}
+
+# The first page of review threads with their comments, and the people on the review. Later pages
+# come from `ReviewThreadPages`, so a pull request with more threads than one page holds is walked
+# rather than cut off.
#
# `viewer` rides along: GitHub names who reacted but never says whether that is the reader, so the
# comparison is made locally rather than paid for with a request of its own.
@@ -53,46 +83,14 @@ fragment ThreadComment on PullRequestReviewComment {
#
# `viewerCanUpdate` and `viewerDidAuthor` belong to the pull request this query is already
# standing on, so what the reader may do with it arrives with the conversation.
-query ReviewThreads(
- $owner: String!
- $name: String!
- $number: Int!
- $after: String
- $requestedReviewers: Int!
-) {
+query ReviewThreads($owner: String!, $name: String!, $number: Int!, $requestedReviewers: Int!) {
viewer {
login
}
repository(owner: $owner, name: $name) {
pullRequest(number: $number) {
- reviewThreads(first: 100, after: $after) {
- totalCount
- pageInfo {
- hasNextPage
- endCursor
- }
- nodes {
- id
- isResolved
- isOutdated
- path
- # Null once the thread's line has left the diff, which `isOutdated` reports.
- line
- diffSide
- # Only ten comments ride with each thread. A hundred threads times a hundred comments
- # made GitHub reserve 10,000 nested rows and charge 104 points; unfinished threads are
- # paged from their own cursor by `ReviewThreadComments`.
- comments(first: 10) {
- totalCount
- pageInfo {
- hasNextPage
- endCursor
- }
- nodes {
- ...ThreadComment
- }
- }
- }
+ reviewThreads(first: 100) {
+ ...ReviewThreadPage
}
viewerCanUpdate
viewerDidAuthor
@@ -198,6 +196,21 @@ query ReviewThreads(
}
}
+# The review threads past the first page. Everything else `ReviewThreads` asks for describes the
+# whole pull request and arrived with that page, so later pages carry the threads alone.
+query ReviewThreadPages($owner: String!, $name: String!, $number: Int!, $after: String!) {
+ viewer {
+ login
+ }
+ repository(owner: $owner, name: $name) {
+ pullRequest(number: $number) {
+ reviewThreads(first: 100, after: $after) {
+ ...ReviewThreadPage
+ }
+ }
+ }
+}
+
# The rest of one thread's conversation. GraphQL pages a connection nested inside another only
# from the inner node itself, so a thread longer than a page is followed on its own: a request
# GitHub makes necessary, and one no ordinary pull request ever provokes.
diff --git a/packages/source-control-github/src/server/pullRequestReviews.graphql.ts b/packages/source-control-github/src/server/pullRequestReviews.graphql.ts
index 0711ed9ebcf..9a1351f8cd1 100644
--- a/packages/source-control-github/src/server/pullRequestReviews.graphql.ts
+++ b/packages/source-control-github/src/server/pullRequestReviews.graphql.ts
@@ -112,13 +112,6 @@ export const ThreadComment = Schema.Struct({
})
export interface ThreadComment extends Schema.Struct.Type<typeof ThreadComment.fields> {}
-/** A user is an individual's account on GitHub that owns repositories and can make new content. */
-export const ViewerUser = Schema.Struct({
- /** The username used to login. */
- login: Schema.String
-})
-export interface ViewerUser extends Schema.Struct.Type<typeof ViewerUser.fields> {}
-
/** Information about pagination in a connection. */
export const PageInfo = Schema.Struct({
/** When paginating forwards, are there more items? */
@@ -158,8 +151,12 @@ export const NodesPullRequestReviewThread = Schema.Struct({
})
export interface NodesPullRequestReviewThread extends Schema.Struct.Type<typeof NodesPullRequestReviewThread.fields> {}
-/** Review comment threads for a pull request review. */
-export const PullRequestReviewThreadConnection = Schema.Struct({
+/**
+ * `fragment ReviewThreadPage on PullRequestReviewThreadConnection`
+ *
+ * Review comment threads for a pull request review.
+ */
+export const ReviewThreadPage = Schema.Struct({
/** Identifies the total count of items in the connection. */
totalCount: Shared.Int,
/** Information to aid in pagination. */
@@ -167,7 +164,14 @@ export const PullRequestReviewThreadConnection = Schema.Struct({
/** A list of nodes. */
nodes: Schema.NullOr(Schema.Array(Schema.NullOr(NodesPullRequestReviewThread)))
})
-export interface PullRequestReviewThreadConnection extends Schema.Struct.Type<typeof PullRequestReviewThreadConnection.fields> {}
+export interface ReviewThreadPage extends Schema.Struct.Type<typeof ReviewThreadPage.fields> {}
+
+/** A user is an individual's account on GitHub that owns repositories and can make new content. */
+export const ViewerUser = Schema.Struct({
+ /** The username used to login. */
+ login: Schema.String
+})
+export interface ViewerUser extends Schema.Struct.Type<typeof ViewerUser.fields> {}
/** Represents a comment on an Issue. */
export const IssueComment = Schema.Struct({
@@ -370,7 +374,7 @@ export interface PullRequestCommitConnection extends Schema.Struct.Type<typeof P
/** A repository pull request. */
export const ReviewThreadsRepositoryPullRequestPullRequest = Schema.Struct({
/** The list of all review threads for this pull request. */
- reviewThreads: PullRequestReviewThreadConnection,
+ reviewThreads: ReviewThreadPage,
/** Check if the current viewer can update this object. */
viewerCanUpdate: Schema.Boolean,
/** Did the viewer author this comment. */
@@ -408,23 +412,22 @@ export const ReviewThreads = GraphQL.query("ReviewThreads", {
{ name: "owner", body: "String!" },
{ name: "name", body: "String!" },
{ name: "number", body: "Int!" },
- { name: "after", body: "String" },
{ name: "requestedReviewers", body: "Int!" }
],
selections: [
{ name: "viewer", body: ["{login}"] },
- { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){reviewThreads(first:100 after:$", "after", "){totalCount pageInfo{hasNextPage endCursor}nodes{id isResolved isOutdated path line diffSide comments(first:10){totalCount pageInfo{hasNextPage endCursor}nodes{...ThreadComment}}}}viewerCanUpdate viewerDidAuthor author{__typename login avatarUrl}...Reactions comments(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviews(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Bot{login avatarUrl}...on Team{combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}latestReviews(first:50){nodes{state author{__typename login avatarUrl}}}reviewDismissals:timelineItems(itemTypes:[REVIEW_DISMISSED_EVENT]first:100){pageInfo{hasNextPage endCursor}nodes{__typename...on ReviewDismissedEvent{dismissalMessage review{id}}}}commits(last:100){nodes{commit{oid messageHeadline committedDate authors(first:3){nodes{name avatarUrl user{login}}}}}}}}"] }
+ { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){reviewThreads(first:100){...ReviewThreadPage}viewerCanUpdate viewerDidAuthor author{__typename login avatarUrl}...Reactions comments(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviews(first:100){nodes{id lastEditedAt author{__typename login avatarUrl}...Reactions}}reviewRequests(first:$", "requestedReviewers", "){nodes{requestedReviewer{__typename...on User{login name avatarUrl}...on Bot{login avatarUrl}...on Team{combinedSlug teamName:name teamAvatarUrl:avatarUrl}}}}latestReviews(first:50){nodes{state author{__typename login avatarUrl}}}reviewDismissals:timelineItems(itemTypes:[REVIEW_DISMISSED_EVENT]first:100){pageInfo{hasNextPage endCursor}nodes{__typename...on ReviewDismissedEvent{dismissalMessage review{id}}}}commits(last:100){nodes{commit{oid messageHeadline committedDate authors(first:3){nodes{name avatarUrl user{login}}}}}}}}"] }
],
fragments: [
- { name: "ThreadComment", body: ["on PullRequestReviewComment{id author{__typename login avatarUrl}body createdAt lastEditedAt url...Reactions}"] },
- { name: "Reactions", body: ["on Reactable{__typename reactionGroups{content viewerHasReacted reactors(first:10){totalCount nodes{__typename...on User{login}...on Bot{login}...on Organization{login}...on Mannequin{login}}}}}"] }
+ { name: "ReviewThreadPage", body: ["on PullRequestReviewThreadConnection{totalCount pageInfo{hasNextPage endCursor}nodes{id isResolved isOutdated path line diffSide comments(first:10){totalCount pageInfo{hasNextPage endCursor}nodes{...ThreadComment}}}}"] },
+ { name: "Reactions", body: ["on Reactable{__typename reactionGroups{content viewerHasReacted reactors(first:10){totalCount nodes{__typename...on User{login}...on Bot{login}...on Organization{login}...on Mannequin{login}}}}}"] },
+ { name: "ThreadComment", body: ["on PullRequestReviewComment{id author{__typename login avatarUrl}body createdAt lastEditedAt url...Reactions}"] }
]
},
variables: {
owner: Schema.String,
name: Schema.String,
number: Shared.Int,
- after: Schema.optional(Schema.NullOr(Schema.String)),
requestedReviewers: Shared.Int
},
result: Schema.Struct({
@@ -439,6 +442,57 @@ export declare namespace ReviewThreads {
export type Result = typeof ReviewThreads.result.Type
}
+/** A repository pull request. */
+export const ReviewThreadPagesRepositoryPullRequestPullRequest = Schema.Struct({
+ /** The list of all review threads for this pull request. */
+ reviewThreads: ReviewThreadPage
+})
+export interface ReviewThreadPagesRepositoryPullRequestPullRequest extends Schema.Struct.Type<typeof ReviewThreadPagesRepositoryPullRequestPullRequest.fields> {}
+
+/** A repository contains the content for a project. */
+export const ReviewThreadPagesRepositoryRepository = Schema.Struct({
+ /** Returns a single pull request from the current repository by number. */
+ pullRequest: Schema.NullOr(ReviewThreadPagesRepositoryPullRequestPullRequest)
+})
+export interface ReviewThreadPagesRepositoryRepository extends Schema.Struct.Type<typeof ReviewThreadPagesRepositoryRepository.fields> {}
+
+/** `query ReviewThreadPages` */
+export const ReviewThreadPages = GraphQL.query("ReviewThreadPages", {
+ document: {
+ variables: [
+ { name: "owner", body: "String!" },
+ { name: "name", body: "String!" },
+ { name: "number", body: "Int!" },
+ { name: "after", body: "String!" }
+ ],
+ selections: [
+ { name: "viewer", body: ["{login}"] },
+ { name: "repository", body: ["(owner:$", "owner", " name:$", "name", "){pullRequest(number:$", "number", "){reviewThreads(first:100 after:$", "after", "){...ReviewThreadPage}}}"] }
+ ],
+ fragments: [
+ { name: "ReviewThreadPage", body: ["on PullRequestReviewThreadConnection{totalCount pageInfo{hasNextPage endCursor}nodes{id isResolved isOutdated path line diffSide comments(first:10){totalCount pageInfo{hasNextPage endCursor}nodes{...ThreadComment}}}}"] },
+ { name: "ThreadComment", body: ["on PullRequestReviewComment{id author{__typename login avatarUrl}body createdAt lastEditedAt url...Reactions}"] },
+ { name: "Reactions", body: ["on Reactable{__typename reactionGroups{content viewerHasReacted reactors(first:10){totalCount nodes{__typename...on User{login}...on Bot{login}...on Organization{login}...on Mannequin{login}}}}}"] }
+ ]
+ },
+ variables: {
+ owner: Schema.String,
+ name: Schema.String,
+ number: Shared.Int,
+ after: Schema.String
+ },
+ result: Schema.Struct({
+ /** The currently authenticated user. */
+ viewer: ViewerUser,
+ /** Lookup a given repository by the owner and repository name. */
+ repository: Schema.NullOr(ReviewThreadPagesRepositoryRepository)
+ })
+})
+export declare namespace ReviewThreadPages {
+ export type Variables = typeof ReviewThreadPages.variables.Type
+ export type Result = typeof ReviewThreadPages.result.Type
+}
+
/** A repository pull request. */
export const ReviewThreadCommentsRepositoryPullRequestPullRequest = Schema.Struct({
/** The Node ID of the PullRequest object */
@@ -567,4 +621,4 @@ export declare namespace ReviewDismissals {
}
/** Every operation in pullRequestReviews.graphql. */
-export const PullRequestReviewsGraphQLGroup = GraphQLGroup.make(ReviewThreads, ReviewThreadComments, ReviewDismissals)
+export const PullRequestReviewsGraphQLGroup = GraphQLGroup.make(ReviewThreads, ReviewThreadPages, ReviewThreadComments, ReviewDismissals)