@gitkraken/core-gitlens 0.5.112 → 0.5.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -3
- package/dist/git/cache.d.ts +4 -0
- package/dist/git/cache.d.ts.map +1 -1
- package/dist/git/cache.js +33 -0
- package/dist/git/cache.js.map +1 -1
- package/dist/git/context.d.ts +10 -0
- package/dist/git/context.d.ts.map +1 -1
- package/dist/git/context.js.map +1 -1
- package/dist/git/errors.d.ts +6 -3
- package/dist/git/errors.d.ts.map +1 -1
- package/dist/git/errors.js +9 -1
- package/dist/git/errors.js.map +1 -1
- package/dist/git/features.d.ts +1 -1
- package/dist/git/features.d.ts.map +1 -1
- package/dist/git/features.js +38 -0
- package/dist/git/features.js.map +1 -1
- package/dist/git/gitHealth.d.ts +153 -0
- package/dist/git/gitHealth.d.ts.map +1 -0
- package/dist/git/gitHealth.js +353 -0
- package/dist/git/gitHealth.js.map +1 -0
- package/dist/git/models/search.d.ts +6 -3
- package/dist/git/models/search.d.ts.map +1 -1
- package/dist/git/models/search.js +5 -1
- package/dist/git/models/search.js.map +1 -1
- package/dist/git/parsers/diffParser.d.ts +8 -2
- package/dist/git/parsers/diffParser.d.ts.map +1 -1
- package/dist/git/parsers/diffParser.js +27 -4
- package/dist/git/parsers/diffParser.js.map +1 -1
- package/dist/git/providers/config.d.ts +36 -3
- package/dist/git/providers/config.d.ts.map +1 -1
- package/dist/git/providers/graph.d.ts +9 -0
- package/dist/git/providers/graph.d.ts.map +1 -1
- package/dist/git/providers/maintenance.d.ts +222 -0
- package/dist/git/providers/maintenance.d.ts.map +1 -0
- package/dist/git/providers/maintenance.js +20 -0
- package/dist/git/providers/maintenance.js.map +1 -0
- package/dist/git/providers/operations.d.ts +10 -0
- package/dist/git/providers/operations.d.ts.map +1 -1
- package/dist/git/providers/pausedOperations.d.ts +3 -0
- package/dist/git/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git/providers/provider.d.ts +2 -0
- package/dist/git/providers/provider.d.ts.map +1 -1
- package/dist/git/providers/tags.d.ts +3 -0
- package/dist/git/providers/tags.d.ts.map +1 -1
- package/dist/git/repositoryService.d.ts +1 -0
- package/dist/git/repositoryService.d.ts.map +1 -1
- package/dist/git/repositoryService.js.map +1 -1
- package/dist/git/run.types.d.ts +8 -0
- package/dist/git/run.types.d.ts.map +1 -1
- package/dist/git/service.js +3 -0
- package/dist/git/service.js.map +1 -1
- package/dist/git/utils/search.utils.d.ts.map +1 -1
- package/dist/git/utils/search.utils.js +112 -5
- package/dist/git/utils/search.utils.js.map +1 -1
- package/dist/git/watching/watchService.d.ts +3 -0
- package/dist/git/watching/watchService.d.ts.map +1 -1
- package/dist/git/watching/watchService.js +8 -0
- package/dist/git/watching/watchService.js.map +1 -1
- package/dist/git-cli/cliGitProvider.d.ts +11 -0
- package/dist/git-cli/cliGitProvider.d.ts.map +1 -1
- package/dist/git-cli/cliGitProvider.js +12 -0
- package/dist/git-cli/cliGitProvider.js.map +1 -1
- package/dist/git-cli/exec/git.d.ts +23 -1
- package/dist/git-cli/exec/git.d.ts.map +1 -1
- package/dist/git-cli/exec/git.js +83 -8
- package/dist/git-cli/exec/git.js.map +1 -1
- package/dist/git-cli/exec/gitQueue.d.ts +2 -0
- package/dist/git-cli/exec/gitQueue.d.ts.map +1 -1
- package/dist/git-cli/exec/gitQueue.js +19 -17
- package/dist/git-cli/exec/gitQueue.js.map +1 -1
- package/dist/git-cli/parsers/logParser.d.ts.map +1 -1
- package/dist/git-cli/parsers/logParser.js +4 -1
- package/dist/git-cli/parsers/logParser.js.map +1 -1
- package/dist/git-cli/providers/blame.d.ts.map +1 -1
- package/dist/git-cli/providers/blame.js +4 -7
- package/dist/git-cli/providers/blame.js.map +1 -1
- package/dist/git-cli/providers/branches.d.ts.map +1 -1
- package/dist/git-cli/providers/branches.js +13 -3
- package/dist/git-cli/providers/branches.js.map +1 -1
- package/dist/git-cli/providers/commits.d.ts.map +1 -1
- package/dist/git-cli/providers/commits.js +34 -3
- package/dist/git-cli/providers/commits.js.map +1 -1
- package/dist/git-cli/providers/config.d.ts +27 -0
- package/dist/git-cli/providers/config.d.ts.map +1 -1
- package/dist/git-cli/providers/config.js +31 -6
- package/dist/git-cli/providers/config.js.map +1 -1
- package/dist/git-cli/providers/graph.d.ts +8 -0
- package/dist/git-cli/providers/graph.d.ts.map +1 -1
- package/dist/git-cli/providers/graph.js +85 -6
- package/dist/git-cli/providers/graph.js.map +1 -1
- package/dist/git-cli/providers/maintenance.d.ts +306 -0
- package/dist/git-cli/providers/maintenance.d.ts.map +1 -0
- package/dist/git-cli/providers/maintenance.js +2129 -0
- package/dist/git-cli/providers/maintenance.js.map +1 -0
- package/dist/git-cli/providers/operations.d.ts +1 -0
- package/dist/git-cli/providers/operations.d.ts.map +1 -1
- package/dist/git-cli/providers/operations.js +8 -0
- package/dist/git-cli/providers/operations.js.map +1 -1
- package/dist/git-cli/providers/pausedOperations.d.ts +1 -0
- package/dist/git-cli/providers/pausedOperations.d.ts.map +1 -1
- package/dist/git-cli/providers/pausedOperations.js +1 -1
- package/dist/git-cli/providers/pausedOperations.js.map +1 -1
- package/dist/git-cli/providers/tags.d.ts +3 -0
- package/dist/git-cli/providers/tags.d.ts.map +1 -1
- package/dist/git-cli/providers/tags.js +23 -1
- package/dist/git-cli/providers/tags.js.map +1 -1
- package/dist/plus/agents/agentCapabilities.d.ts +77 -0
- package/dist/plus/agents/agentCapabilities.d.ts.map +1 -0
- package/dist/plus/agents/agentCapabilities.js +197 -0
- package/dist/plus/agents/agentCapabilities.js.map +1 -0
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts +77 -13
- package/dist/plus/agents/providers/claudeCodeTranscript.d.ts.map +1 -1
- package/dist/plus/agents/providers/claudeCodeTranscript.js +263 -55
- package/dist/plus/agents/providers/claudeCodeTranscript.js.map +1 -1
- package/dist/plus/agents/providers/{claudeCodeProvider.d.ts → gkAgentProvider.d.ts} +52 -19
- package/dist/plus/agents/providers/gkAgentProvider.d.ts.map +1 -0
- package/dist/plus/agents/providers/{claudeCodeProvider.js → gkAgentProvider.js} +935 -262
- package/dist/plus/agents/providers/gkAgentProvider.js.map +1 -0
- package/dist/plus/agents/types.d.ts +113 -35
- package/dist/plus/agents/types.d.ts.map +1 -1
- package/dist/plus/agents/types.js +7 -4
- package/dist/plus/agents/types.js.map +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts +1 -1
- package/dist/plus/ai/models/promptTemplates.d.ts.map +1 -1
- package/dist/plus/ai/prompts.d.ts +4 -0
- package/dist/plus/ai/prompts.d.ts.map +1 -1
- package/dist/plus/ai/prompts.js +59 -4
- package/dist/plus/ai/prompts.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +50 -1
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +333 -29
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.d.ts +13 -0
- package/dist/plus/git-github/api/issueSearchQuery.d.ts.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.js +41 -0
- package/dist/plus/git-github/api/issueSearchQuery.js.map +1 -1
- package/dist/plus/git-github/providers/github/blame.d.ts.map +1 -1
- package/dist/plus/git-github/providers/github/blame.js +2 -1
- package/dist/plus/git-github/providers/github/blame.js.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +15 -0
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +4 -0
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +43 -0
- package/dist/plus/integrations/manager.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +49 -17
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +40 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +1 -1
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +10 -0
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +8 -0
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +2 -1
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +47 -10
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js +144 -33
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/filters.d.ts +18 -0
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
- package/dist/plus/integrations/reads/filters.js +37 -1
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issueBatch.d.ts +51 -0
- package/dist/plus/integrations/reads/issueBatch.d.ts.map +1 -0
- package/dist/plus/integrations/reads/issueBatch.js +91 -0
- package/dist/plus/integrations/reads/issueBatch.js.map +1 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts +6 -0
- package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/pullRequests.js +28 -40
- package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.d.ts +2 -0
- package/dist/plus/integrations/reads/searchPullRequests.d.ts.map +1 -1
- package/dist/plus/integrations/reads/searchPullRequests.js +1 -0
- package/dist/plus/integrations/reads/searchPullRequests.js.map +1 -1
- package/dist/plus/integrations/reads/sweeps.d.ts.map +1 -1
- package/dist/plus/integrations/reads/sweeps.js +5 -3
- package/dist/plus/integrations/reads/sweeps.js.map +1 -1
- package/dist/utils/promiseCache.d.ts +19 -0
- package/dist/utils/promiseCache.d.ts.map +1 -1
- package/dist/utils/promiseCache.js +30 -0
- package/dist/utils/promiseCache.js.map +1 -1
- package/dist/utils/resourceUsage.d.ts +5 -0
- package/dist/utils/resourceUsage.d.ts.map +1 -0
- package/dist/utils/resourceUsage.js +2 -0
- package/dist/utils/resourceUsage.js.map +1 -0
- package/dist/utils/string.d.ts +12 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +36 -1
- package/dist/utils/string.js.map +1 -1
- package/docs/integrations.md +29 -25
- package/docs/kepler-read-api-parity.md +12 -4
- package/package.json +12 -4
- package/src/git/cache.ts +36 -0
- package/src/git/context.ts +11 -0
- package/src/git/errors.ts +13 -1
- package/src/git/features.ts +51 -0
- package/src/git/gitHealth.ts +522 -0
- package/src/git/models/search.ts +19 -4
- package/src/git/parsers/diffParser.ts +27 -4
- package/src/git/providers/config.ts +42 -1
- package/src/git/providers/graph.ts +12 -0
- package/src/git/providers/maintenance.ts +224 -0
- package/src/git/providers/operations.ts +10 -0
- package/src/git/providers/pausedOperations.ts +3 -0
- package/src/git/providers/provider.ts +2 -0
- package/src/git/providers/tags.ts +1 -0
- package/src/git/repositoryService.ts +1 -0
- package/src/git/run.types.ts +8 -0
- package/src/git/service.ts +3 -0
- package/src/git/utils/search.utils.ts +129 -5
- package/src/git/watching/watchService.ts +10 -0
- package/src/git-cli/cliGitProvider.ts +25 -0
- package/src/git-cli/exec/git.ts +120 -6
- package/src/git-cli/exec/gitQueue.ts +19 -17
- package/src/git-cli/parsers/logParser.ts +4 -1
- package/src/git-cli/providers/blame.ts +3 -8
- package/src/git-cli/providers/branches.ts +28 -8
- package/src/git-cli/providers/commits.ts +34 -2
- package/src/git-cli/providers/config.ts +38 -6
- package/src/git-cli/providers/graph.ts +107 -7
- package/src/git-cli/providers/maintenance.ts +2599 -0
- package/src/git-cli/providers/operations.ts +11 -0
- package/src/git-cli/providers/pausedOperations.ts +7 -2
- package/src/git-cli/providers/tags.ts +36 -1
- package/src/plus/agents/agentCapabilities.ts +286 -0
- package/src/plus/agents/providers/claudeCodeTranscript.ts +313 -58
- package/src/plus/agents/providers/{claudeCodeProvider.ts → gkAgentProvider.ts} +1123 -277
- package/src/plus/agents/types.ts +137 -40
- package/src/plus/ai/models/promptTemplates.ts +1 -1
- package/src/plus/ai/prompts.ts +62 -4
- package/src/plus/git-github/api/github.ts +381 -31
- package/src/plus/git-github/api/issueSearchQuery.ts +49 -1
- package/src/plus/git-github/providers/github/blame.ts +2 -1
- package/src/plus/integrations/integrationService.ts +19 -0
- package/src/plus/integrations/manager.ts +43 -0
- package/src/plus/integrations/models/gitHostIntegration.ts +77 -18
- package/src/plus/integrations/models/integration.ts +1 -0
- package/src/plus/integrations/providers/github.ts +20 -0
- package/src/plus/integrations/providers/models.ts +6 -0
- package/src/plus/integrations/reads/broaden.ts +282 -70
- package/src/plus/integrations/reads/filters.ts +39 -1
- package/src/plus/integrations/reads/issueBatch.ts +197 -0
- package/src/plus/integrations/reads/pullRequests.ts +51 -70
- package/src/plus/integrations/reads/searchPullRequests.ts +3 -0
- package/src/plus/integrations/reads/sweeps.ts +19 -12
- package/src/utils/promiseCache.ts +43 -0
- package/src/utils/resourceUsage.ts +5 -0
- package/src/utils/string.ts +38 -1
- package/dist/plus/agents/providers/claudeCodeProvider.d.ts.map +0 -1
- package/dist/plus/agents/providers/claudeCodeProvider.js.map +0 -1
|
@@ -27,7 +27,7 @@ import { parseUri } from '../../../utils/uri.js';
|
|
|
27
27
|
import { fromString, satisfies } from '../../../utils/version.js';
|
|
28
28
|
import { fromGitHubIssue, fromGitHubIssueOrPullRequestState, fromGitHubPullRequest, fromGitHubPullRequestLite, } from '../models.js';
|
|
29
29
|
import { githubSearchResultLimit } from './config.js';
|
|
30
|
-
import { gitHubIssueSearchRelationships, toGitHubIssueSearchQualifiers, toGitHubIssueSearchScopeQualifiers, toGitHubIssueSortQualifier, } from './issueSearchQuery.js';
|
|
30
|
+
import { gitHubIssueSearchRelationships, toGitHubIssueSearchQualifiers, toGitHubIssueSearchScopeQualifiers, toGitHubIssueSearchSlideQualifier, toGitHubIssueSortQualifier, } from './issueSearchQuery.js';
|
|
31
31
|
import { toGitHubPullRequestSearchFacets } from './pullRequestSearchQuery.js';
|
|
32
32
|
const emptyPagedResult = Object.freeze({ values: [] });
|
|
33
33
|
/**
|
|
@@ -55,7 +55,8 @@ const accountResolveBatchSize = 25;
|
|
|
55
55
|
// exceeded` on large repositories. Thirty keeps the default within that GraphQL cost budget;
|
|
56
56
|
// the 100-node maximum the connection accepts is for the lite shape, whose per-node cost is a
|
|
57
57
|
// fraction of it. The budget is per DOCUMENT, and one document holds every relationship × state
|
|
58
|
-
// facet, so the worst case scales with the facet count (five relationships ×
|
|
58
|
+
// facet, so the worst case scales with the facet count (five relationships × three states = 15;
|
|
59
|
+
// `all` subsumes the concrete states).
|
|
59
60
|
const defaultPullRequestSearchPageSize = 30;
|
|
60
61
|
const maxPullRequestSearchPageSize = 100;
|
|
61
62
|
// Pages `searchMyPullRequests` drains for a caller that wants a whole list rather than a page.
|
|
@@ -109,6 +110,48 @@ function getRequestRetryDelay(attempt) {
|
|
|
109
110
|
const backoff = Math.min(requestRetryMaxDelay, requestRetryBaseDelay * 2 ** (attempt - 1));
|
|
110
111
|
return Math.round(backoff / 2 + Math.random() * (backoff / 2));
|
|
111
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* The sort value of the last item on a page, which is the boundary a ceiling slide continues from.
|
|
115
|
+
*
|
|
116
|
+
* Reads the DATE off the issue rather than taking a caller-supplied position, so the boundary can only ever be a
|
|
117
|
+
* point this walk actually reached. Returns `undefined` for an empty page or a key carrying no date, which is the
|
|
118
|
+
* signal to report the ceiling instead of sliding.
|
|
119
|
+
*/
|
|
120
|
+
function lastSortBoundary(issues, sort) {
|
|
121
|
+
const last = issues.at(-1);
|
|
122
|
+
if (last == null)
|
|
123
|
+
return undefined;
|
|
124
|
+
const value = sort.startsWith('created:')
|
|
125
|
+
? last.createdDate
|
|
126
|
+
: sort.startsWith('updated:')
|
|
127
|
+
? last.updatedDate
|
|
128
|
+
: undefined;
|
|
129
|
+
return value instanceof Date && !Number.isNaN(value.getTime()) ? value : undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The per-alias ceiling-slide state, read defensively off a composite cursor.
|
|
133
|
+
*
|
|
134
|
+
* Keys are `<field>:<alias>`. The colon is what makes them collision-proof: a GraphQL alias is a name (a letter
|
|
135
|
+
* or underscore followed by letters, digits or underscores) and so can never contain one, which is why these need
|
|
136
|
+
* no entry in the reserved-alias check and that list does not have to grow with every field added here.
|
|
137
|
+
*
|
|
138
|
+
* Everything is validated to the shape this module emits, because a cursor is caller-supplied data on a round
|
|
139
|
+
* trip: an unrecognized value restarts the walk instead of reaching the query, which is the difference between a
|
|
140
|
+
* repeated page and an attacker-chosen qualifier re-scoping someone's search.
|
|
141
|
+
*/
|
|
142
|
+
function cursorString(cursor, key) {
|
|
143
|
+
const value = cursor?.[key];
|
|
144
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
145
|
+
}
|
|
146
|
+
function cursorNumber(cursor, key) {
|
|
147
|
+
const value = cursor?.[key];
|
|
148
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
149
|
+
}
|
|
150
|
+
/** The urls a prior page already served at this alias's inclusive slide boundary. */
|
|
151
|
+
function slideSeenFor(cursor, alias) {
|
|
152
|
+
const value = cursorString(cursor, `slideSeen:${alias}`);
|
|
153
|
+
return value != null ? new Set(value.split(' ')) : undefined;
|
|
154
|
+
}
|
|
112
155
|
// Matches a GraphQL document whose operation is definitely a read query — the `query` keyword as
|
|
113
156
|
// the first significant token, after any leading whitespace or `#` comment lines. We retry only
|
|
114
157
|
// when this matches; a mutation (even one prefixed by a comment), a subscription, or anything we
|
|
@@ -1959,7 +2002,19 @@ export class GitHubApi {
|
|
|
1959
2002
|
// Inflight dedupe: identical concurrent GraphQL requests share a single promise
|
|
1960
2003
|
// to cut redundant traffic during graph/details enrichment bursts.
|
|
1961
2004
|
_pendingGraphQL = new Map();
|
|
1962
|
-
async graphql(provider, token, query, variables, scope, cancellation
|
|
2005
|
+
async graphql(provider, token, query, variables, scope, cancellation,
|
|
2006
|
+
/**
|
|
2007
|
+
* Accept a response whose only failures are NOT_FOUND, returning its PARTIAL data instead of throwing.
|
|
2008
|
+
*
|
|
2009
|
+
* For a single-entity query a NOT_FOUND is the whole answer, so throwing is right. For an ALIASED batch it
|
|
2010
|
+
* is one slot's answer: GitHub replies 200 with every resolvable alias populated and a NOT_FOUND per
|
|
2011
|
+
* missing one, so throwing discards the results that did resolve. Since a missing coordinate is the common
|
|
2012
|
+
* case for a batch, that would make the read useless for the very question it answers.
|
|
2013
|
+
*
|
|
2014
|
+
* Narrow on purpose: any error that is NOT a NOT_FOUND still throws, so auth, rate-limit and query-cost
|
|
2015
|
+
* failures keep their existing handling rather than being silently reported as a batch of absences.
|
|
2016
|
+
*/
|
|
2017
|
+
allowPartialNotFound) {
|
|
1963
2018
|
const { accessToken, ...tokenInfo } = token;
|
|
1964
2019
|
// Only dedupe when no cancellation/request option is in play — sharing a promise that
|
|
1965
2020
|
// carries one caller's AbortSignal would let one cancellation cancel for everyone.
|
|
@@ -1996,6 +2051,13 @@ export class GitHubApi {
|
|
|
1996
2051
|
}
|
|
1997
2052
|
catch (ex) {
|
|
1998
2053
|
if (ex instanceof GraphqlResponseError) {
|
|
2054
|
+
// `every`, not `[0]`: a batch can report several, and one non-NOT_FOUND among them is a real
|
|
2055
|
+
// failure that must not be reported as a set of absences.
|
|
2056
|
+
if (allowPartialNotFound &&
|
|
2057
|
+
ex.data != null &&
|
|
2058
|
+
(ex.errors?.every(e => e.type === 'NOT_FOUND') ?? false)) {
|
|
2059
|
+
return ex.data;
|
|
2060
|
+
}
|
|
1999
2061
|
switch (ex.errors?.[0]?.type) {
|
|
2000
2062
|
case 'NOT_FOUND':
|
|
2001
2063
|
throw new RequestNotFoundError(ex);
|
|
@@ -2413,15 +2475,29 @@ export class GitHubApi {
|
|
|
2413
2475
|
// - the ORDER is assigned → mentioned → authored, which is the order the union is emitted in and, because
|
|
2414
2476
|
// the dedupe keeps the first occurrence of a url, also the precedence between the three. An issue that
|
|
2415
2477
|
// is both assigned to and authored by the user surfaces as the assigned one.
|
|
2478
|
+
// The per-alias ceiling-slide bound a prior page sealed. Applied HERE because this method owns its query
|
|
2479
|
+
// text: without it the bound would be recorded and never honoured, so the continuation would re-issue the
|
|
2480
|
+
// unbounded query, serve the same first 1.000, and have every one of them filtered out as already-seen —
|
|
2481
|
+
// a page of nothing, repeated until the walk gave up (measured: 20 requests to do 10 requests' work).
|
|
2482
|
+
const bound = this.parseSlidesFromCursor(options?.cursor);
|
|
2416
2483
|
const searches = [];
|
|
2417
2484
|
if (requested.assigned) {
|
|
2418
|
-
searches.push({
|
|
2485
|
+
searches.push({
|
|
2486
|
+
alias: 'assigned',
|
|
2487
|
+
query: `${search} ${baseFilters} ${assignedQualifier} ${bound('assigned') ?? ''}`.trim(),
|
|
2488
|
+
});
|
|
2419
2489
|
}
|
|
2420
2490
|
if (requested.mentioned) {
|
|
2421
|
-
searches.push({
|
|
2491
|
+
searches.push({
|
|
2492
|
+
alias: 'mentioned',
|
|
2493
|
+
query: `${search} ${baseFilters} mentions:@me ${bound('mentioned') ?? ''}`.trim(),
|
|
2494
|
+
});
|
|
2422
2495
|
}
|
|
2423
2496
|
if (requested.authored) {
|
|
2424
|
-
searches.push({
|
|
2497
|
+
searches.push({
|
|
2498
|
+
alias: 'authored',
|
|
2499
|
+
query: `${search} ${baseFilters} author:@me ${bound('authored') ?? ''}`.trim(),
|
|
2500
|
+
});
|
|
2425
2501
|
}
|
|
2426
2502
|
// Field by field, like `searchIssuesPage`: `options` also carries `repos`/`includeAllAssignees`/`categories`,
|
|
2427
2503
|
// already folded into `searches[].query` above and undeclared by the callee.
|
|
@@ -2449,7 +2525,15 @@ export class GitHubApi {
|
|
|
2449
2525
|
*
|
|
2450
2526
|
* With more than one relationship the page is a UNION of several searches, each ordered by the provider; the
|
|
2451
2527
|
* merged page is re-sorted here so the whole page honors the requested key. Across pages the order is still
|
|
2452
|
-
* per-alias — see {@link searchIssuesByAlias}.
|
|
2528
|
+
* per-alias — see {@link searchIssuesByAlias}. Note a union can also serve the same issue on two pages when
|
|
2529
|
+
* its relationships OVERLAP (an issue both authored by and assigned to the user sits at different depths in
|
|
2530
|
+
* the two), which predates the ceiling slide and is a property of unioning independent walks: measured at 50
|
|
2531
|
+
* repeats over 450 issues with no ceiling involved. Dedupe by url if that matters to the surface.
|
|
2532
|
+
*
|
|
2533
|
+
* GitHub's per-query result ceiling is NOT terminal here: an alias that runs out of pages while capped
|
|
2534
|
+
* continues bounded to the far side of its own last item, which is a fresh query with a fresh budget. Bounded
|
|
2535
|
+
* per alias, since they exhaust independently. Only a ceiling an alias cannot slide past (a sort key with no
|
|
2536
|
+
* usable range qualifier) is reported as an omission.
|
|
2453
2537
|
*
|
|
2454
2538
|
* Each requested relationship becomes its own aliased search, unioned and deduped by url; with none, a single
|
|
2455
2539
|
* search runs over the scope alone. `criteria.text` and the other free-form values are sanitized so user input
|
|
@@ -2463,16 +2547,21 @@ export class GitHubApi {
|
|
|
2463
2547
|
...toGitHubIssueSearchScopeQualifiers(options?.org, options?.repos),
|
|
2464
2548
|
...toGitHubIssueSearchQualifiers(options?.criteria, sort),
|
|
2465
2549
|
].join(' ');
|
|
2550
|
+
// A cursor from a walk that already slid past the ceiling carries the bound each alias slid to, and the
|
|
2551
|
+
// query has to be rebuilt with it or that alias would restart at the top and re-serve its first 1.000.
|
|
2552
|
+
// PER ALIAS, because they slide independently: one bound shared across them would sit below where an
|
|
2553
|
+
// early-finishing alias stopped and re-serve everything it had already delivered.
|
|
2554
|
+
const bound = this.parseSlidesFromCursor(options?.cursor);
|
|
2466
2555
|
// One aliased search per relationship, OR-ed by union. They can't be one query: GitHub AND-s qualifiers,
|
|
2467
2556
|
// so `author:@me assignee:@me` would return the intersection — issues the user both opened and is assigned
|
|
2468
2557
|
// to — instead of either set. With no relationship the scope + criteria are already the whole query.
|
|
2469
2558
|
const relationships = options?.criteria?.relationships;
|
|
2470
2559
|
const searches = relationships?.length
|
|
2471
|
-
? relationships.map(r =>
|
|
2472
|
-
alias
|
|
2473
|
-
query: `${base} ${
|
|
2474
|
-
})
|
|
2475
|
-
: [{ alias: 'matched', query: base }];
|
|
2560
|
+
? relationships.map(r => {
|
|
2561
|
+
const { alias, qualifier } = gitHubIssueSearchRelationships[r];
|
|
2562
|
+
return { alias: alias, query: `${base} ${qualifier} ${bound(alias) ?? ''}`.trim() };
|
|
2563
|
+
})
|
|
2564
|
+
: [{ alias: 'matched', query: `${base} ${bound('matched') ?? ''}`.trim() }];
|
|
2476
2565
|
// Forwarded field by field rather than spread: `options` also carries `repos`/`org`/`criteria`, which are
|
|
2477
2566
|
// already baked into `searches[].query` above and which the callee declares nothing about. `sort` is the
|
|
2478
2567
|
// EFFECTIVE key, since the merged page and the cursor's fingerprint must both use the one the query used.
|
|
@@ -2489,6 +2578,31 @@ export class GitHubApi {
|
|
|
2489
2578
|
legacySort: defaultIssueSort,
|
|
2490
2579
|
}, cancellation);
|
|
2491
2580
|
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Reads back the per-alias ceiling-slide bounds a prior page sealed into its cursor.
|
|
2583
|
+
*
|
|
2584
|
+
* Each value is validated against the EXACT shape {@link toGitHubIssueSearchSlideQualifier} emits, not merely
|
|
2585
|
+
* checked for being a string. A cursor is caller-supplied data on a round trip, so an unvalidated value here
|
|
2586
|
+
* would be a qualifier of someone else's choosing appended to the search: `org:evil-corp` in a cursor would
|
|
2587
|
+
* re-scope the read. Anything unrecognized yields no bound, which restarts that alias at the top — a repeated
|
|
2588
|
+
* page, which is the safe failure.
|
|
2589
|
+
*/
|
|
2590
|
+
parseSlidesFromCursor(cursor) {
|
|
2591
|
+
let parsed;
|
|
2592
|
+
if (cursor != null) {
|
|
2593
|
+
try {
|
|
2594
|
+
parsed = JSON.parse(cursor);
|
|
2595
|
+
}
|
|
2596
|
+
catch { }
|
|
2597
|
+
}
|
|
2598
|
+
return alias => {
|
|
2599
|
+
const slide = parsed?.[`slide:${alias}`];
|
|
2600
|
+
return typeof slide === 'string' &&
|
|
2601
|
+
/^(?:created|updated):(?:<=|>=)\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(slide)
|
|
2602
|
+
? slide
|
|
2603
|
+
: undefined;
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2492
2606
|
/**
|
|
2493
2607
|
* Counts issues for several scopes in ONE request, transferring no issues at all — each scope is an aliased
|
|
2494
2608
|
* `search` selecting only `issueCount`, with `first: 0` so no nodes are fetched.
|
|
@@ -2547,6 +2661,80 @@ export class GitHubApi {
|
|
|
2547
2661
|
throw this.handleException(ex, provider, scope);
|
|
2548
2662
|
}
|
|
2549
2663
|
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Resolves several issues BY COORDINATE — `(owner, repo, number)` — in one request, via aliased `repository`
|
|
2666
|
+
* fields rather than aliased searches.
|
|
2667
|
+
*
|
|
2668
|
+
* Aliasing the point read rather than {@link searchIssuesByAlias} is the whole design, and each difference
|
|
2669
|
+
* matters to the caller this exists for (correlating a branch name to the issue it references):
|
|
2670
|
+
* - it resolves by EXACT NUMBER, where a search answers a relevance question;
|
|
2671
|
+
* - no result ceiling applies, so there is no partial window to reason about;
|
|
2672
|
+
* - and a null is a PROVEN ABSENCE rather than "not found within a page budget", which is what makes a miss
|
|
2673
|
+
* cacheable. That last one is the point: a caller that cannot prove absence re-walks its budget forever.
|
|
2674
|
+
*
|
|
2675
|
+
* Returns POSITIONALLY — one slot per input coordinate, in order — for the same reason {@link countIssues}
|
|
2676
|
+
* does: a caller's key is arbitrary text and would break the GraphQL document, so the aliases are generated
|
|
2677
|
+
* and the caller maps back by index. `undefined` in a slot means the issue does not exist (or is not visible
|
|
2678
|
+
* to this token), never that the read failed; a failure throws.
|
|
2679
|
+
*/
|
|
2680
|
+
async getIssuesBatch(provider, token, coordinates, options, cancellation) {
|
|
2681
|
+
const scope = getScopedLogger();
|
|
2682
|
+
if (coordinates.length === 0)
|
|
2683
|
+
return [];
|
|
2684
|
+
const params = coordinates
|
|
2685
|
+
.map((_, i) => `$o${i}: String!\n\t\t\t\t$n${i}: String!\n\t\t\t\t$k${i}: Int!`)
|
|
2686
|
+
.join('\n\t\t\t\t');
|
|
2687
|
+
const fields = coordinates
|
|
2688
|
+
.map((_, i) => `i${i}: repository(owner: $o${i}, name: $n${i}) {
|
|
2689
|
+
issue(number: $k${i}) {
|
|
2690
|
+
${gqIssueFragment}${options?.includeBody ? '\n\t\t\t\t\t\tbody' : ''}
|
|
2691
|
+
}
|
|
2692
|
+
}`)
|
|
2693
|
+
.join('\n\t\t\t\t');
|
|
2694
|
+
const query = `query getIssuesBatch(
|
|
2695
|
+
${params}
|
|
2696
|
+
$avatarSize: Int
|
|
2697
|
+
) {
|
|
2698
|
+
${fields}
|
|
2699
|
+
}`;
|
|
2700
|
+
const variables = {
|
|
2701
|
+
baseUrl: options?.baseUrl,
|
|
2702
|
+
avatarSize: options?.avatarSize,
|
|
2703
|
+
};
|
|
2704
|
+
coordinates.forEach((c, i) => {
|
|
2705
|
+
variables[`o${i}`] = c.owner;
|
|
2706
|
+
variables[`n${i}`] = c.repo;
|
|
2707
|
+
variables[`k${i}`] = c.number;
|
|
2708
|
+
});
|
|
2709
|
+
try {
|
|
2710
|
+
// `allowPartialNotFound`: a coordinate that does not exist is this read's ANSWER for that slot, not a
|
|
2711
|
+
// failure of the batch. GitHub replies 200 with the resolvable aliases populated and a NOT_FOUND per
|
|
2712
|
+
// missing one, so without this a single bad coordinate would discard every good result — and a miss
|
|
2713
|
+
// is the common outcome for the caller this read exists for.
|
|
2714
|
+
const rsp = await this.graphql(provider, token, query, variables, scope, cancellation, true);
|
|
2715
|
+
if (rsp == null)
|
|
2716
|
+
return coordinates.map(() => undefined);
|
|
2717
|
+
// Mapped slot by slot so one unmappable issue can't discard the whole batch, matching the aliased
|
|
2718
|
+
// search's node-by-node mapping. An unmappable issue reads as absent, which is the safe direction
|
|
2719
|
+
// here only because the caller is asking "does this exist", and a false absent costs a re-read
|
|
2720
|
+
// rather than a wrong issue.
|
|
2721
|
+
return coordinates.map((c, i) => {
|
|
2722
|
+
const node = rsp[`i${i}`]?.issue;
|
|
2723
|
+
if (node == null)
|
|
2724
|
+
return undefined;
|
|
2725
|
+
try {
|
|
2726
|
+
return fromGitHubIssue(node, provider);
|
|
2727
|
+
}
|
|
2728
|
+
catch (ex) {
|
|
2729
|
+
scope?.warn(`skipped unmappable issue; ${c.owner}/${c.repo}#${c.number}, ex=${ex}`);
|
|
2730
|
+
return undefined;
|
|
2731
|
+
}
|
|
2732
|
+
});
|
|
2733
|
+
}
|
|
2734
|
+
catch (ex) {
|
|
2735
|
+
throw this.handleException(ex, provider, scope);
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2550
2738
|
/**
|
|
2551
2739
|
* The PR twin of {@link countIssues}: counts pull requests for several scopes in ONE request via aliased
|
|
2552
2740
|
* `search` fields selecting only `issueCount` with `first: 0`. Same positional/undefined contract as the issue
|
|
@@ -2740,20 +2928,32 @@ export class GitHubApi {
|
|
|
2740
2928
|
const rsp = await this.graphql(provider, token, query, variables, scope, cancellation);
|
|
2741
2929
|
if (rsp == null)
|
|
2742
2930
|
return { values: [], hasMore: false, page: page, truncated: false };
|
|
2743
|
-
// Map node-by-node so one unmappable issue can't discard the whole result set
|
|
2744
|
-
|
|
2931
|
+
// Map node-by-node so one unmappable issue can't discard the whole result set. Kept PER ALIAS rather
|
|
2932
|
+
// than flattened straight away: a ceiling slide bounds each alias at its OWN last item, so the
|
|
2933
|
+
// boundary has to be read off that alias's own page and not off the merged one (see below).
|
|
2934
|
+
const issuesByAlias = new Map();
|
|
2745
2935
|
for (const s of active) {
|
|
2936
|
+
const mapped = [];
|
|
2937
|
+
// Drop what a previous page already served at this alias's INCLUSIVE slide boundary. Applied
|
|
2938
|
+
// before the merge so the dedupe's precedence rules only ever see genuinely new items.
|
|
2939
|
+
const seen = slideSeenFor(cursor, s.alias);
|
|
2746
2940
|
for (const node of rsp[s.alias]?.nodes ?? []) {
|
|
2747
2941
|
if (node?.id == null)
|
|
2748
2942
|
continue;
|
|
2749
2943
|
try {
|
|
2750
|
-
|
|
2944
|
+
const issue = fromGitHubIssue(node, provider);
|
|
2945
|
+
if (seen?.has(issue.url) !== true) {
|
|
2946
|
+
mapped.push(issue);
|
|
2947
|
+
}
|
|
2751
2948
|
}
|
|
2752
2949
|
catch (ex) {
|
|
2753
2950
|
scope?.warn(`skipped unmappable issue; id=${node.id}, url=${node.url}, ex=${ex}`);
|
|
2754
2951
|
}
|
|
2755
2952
|
}
|
|
2953
|
+
issuesByAlias.set(s.alias, mapped);
|
|
2756
2954
|
}
|
|
2955
|
+
// Flattened in `active` order, which is `searches` order, so the dedupe's precedence is unchanged.
|
|
2956
|
+
const issues = active.flatMap(s => issuesByAlias.get(s.alias) ?? []);
|
|
2757
2957
|
// Dedupe by `url`, not `IssueShape.id`: for some providers `id` is a per-repository number, so an
|
|
2758
2958
|
// id-keyed map would collapse distinct issues across repositories.
|
|
2759
2959
|
const deduped = [
|
|
@@ -2785,27 +2985,118 @@ export class GitHubApi {
|
|
|
2785
2985
|
let hasMore = false;
|
|
2786
2986
|
let continuationMissing = false;
|
|
2787
2987
|
let maxIssueCount = 0;
|
|
2988
|
+
// Whether ANY alias slid this round. A slide is forward progress, so it makes the read continuable
|
|
2989
|
+
// exactly as an ordinary next-cursor does.
|
|
2990
|
+
let slid = false;
|
|
2991
|
+
// Whether any alias ran out of pages against a capped query WITHOUT being able to slide, which is the
|
|
2992
|
+
// only remaining way this read leaves results unreachable.
|
|
2993
|
+
let strandedByCeiling = false;
|
|
2994
|
+
const sortKey = options.sort;
|
|
2788
2995
|
for (const s of searches) {
|
|
2789
2996
|
const category = rsp[s.alias];
|
|
2790
2997
|
const endCursor = category?.pageInfo?.hasNextPage && category.pageInfo.endCursor ? category.pageInfo.endCursor : null;
|
|
2791
|
-
next[s.alias] = endCursor;
|
|
2792
|
-
if (endCursor != null) {
|
|
2793
|
-
hasMore = true;
|
|
2794
|
-
}
|
|
2795
2998
|
if (category?.pageInfo?.hasNextPage === true && category.pageInfo.endCursor == null) {
|
|
2796
2999
|
continuationMissing = true;
|
|
2797
3000
|
}
|
|
2798
|
-
|
|
3001
|
+
const issueCount = category?.issueCount ?? 0;
|
|
3002
|
+
maxIssueCount = Math.max(maxIssueCount, issueCount);
|
|
3003
|
+
// The urls already served at THIS alias's trailing timestamp, which its inclusive slide re-serves.
|
|
3004
|
+
// Accumulated across pages while that timestamp holds, and reset when it moves, so it carries one
|
|
3005
|
+
// second's worth of urls rather than the walk's — a tied block from a bulk edit can span several
|
|
3006
|
+
// pages, and rebuilding this from the last page alone would re-serve the earlier ones.
|
|
3007
|
+
const mapped = issuesByAlias.get(s.alias);
|
|
3008
|
+
const trailingTs = mapped != null ? lastSortBoundary(mapped, sortKey ?? defaultIssueSort)?.getTime() : undefined;
|
|
3009
|
+
const trailing = new Set(trailingTs != null && cursorNumber(cursor, `slideTs:${s.alias}`) === trailingTs
|
|
3010
|
+
? (slideSeenFor(cursor, s.alias) ?? [])
|
|
3011
|
+
: []);
|
|
3012
|
+
// Accumulated only while this alias is CAPPED, since only a capped alias can reach a slide. Without
|
|
3013
|
+
// that test every page of every search would seal its trailing second's urls for a slide that
|
|
3014
|
+
// will never happen — a rounding error for an ordinary search, where a second holds one or two
|
|
3015
|
+
// issues, but this rides in a cursor `broadenIssues` nests once per org.
|
|
3016
|
+
//
|
|
3017
|
+
// The carry-forward below is NOT gated the same way: a slid query's remainder is often under the
|
|
3018
|
+
// cap, and its first page still needs the filter for the boundary second the inclusive bound
|
|
3019
|
+
// deliberately re-serves. Gating both re-served that block (measured: 100 duplicates).
|
|
3020
|
+
//
|
|
3021
|
+
// Bounded by the reachable window: one second's worth of urls drawn from at most
|
|
3022
|
+
// `githubSearchResultLimit` items, so ~45 KB per alias at the very worst, which takes a bulk edit
|
|
3023
|
+
// stamping a thousand issues with a single timestamp.
|
|
3024
|
+
const carryBoundary = issueCount > githubSearchResultLimit;
|
|
3025
|
+
if (trailingTs != null && carryBoundary) {
|
|
3026
|
+
for (const issue of mapped ?? []) {
|
|
3027
|
+
if (lastSortBoundary([issue], sortKey ?? defaultIssueSort)?.getTime() === trailingTs) {
|
|
3028
|
+
trailing.add(issue.url);
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
next[`slideTs:${s.alias}`] = trailingTs;
|
|
3032
|
+
next[`slideSeen:${s.alias}`] = [...trailing].join(' ');
|
|
3033
|
+
}
|
|
3034
|
+
else {
|
|
3035
|
+
// A page can come back EMPTY right after a slide: the re-issued query restarts at the top of
|
|
3036
|
+
// the bounded range, so its first page can be entirely items this set already filtered out.
|
|
3037
|
+
// Dropping the set here would un-filter them on the page after, so carry it forward untouched.
|
|
3038
|
+
next[`slideTs:${s.alias}`] = cursorNumber(cursor, `slideTs:${s.alias}`);
|
|
3039
|
+
next[`slideSeen:${s.alias}`] = cursorString(cursor, `slideSeen:${s.alias}`);
|
|
3040
|
+
}
|
|
3041
|
+
// A CEILING SLIDE turns the per-query cap from terminal into continuable: re-issuing THIS alias's
|
|
3042
|
+
// search bounded to the far side of its own last item gives its remainder a full budget. Bounded
|
|
3043
|
+
// PER ALIAS and not once for the page, because aliases exhaust independently: one bound taken
|
|
3044
|
+
// from the merged page would sit below where an early-finishing alias stopped and re-serve
|
|
3045
|
+
// everything it had already delivered.
|
|
3046
|
+
let aliasSlide;
|
|
3047
|
+
// Capped AND out of pages is where the ceiling actually bites. Evaluated on its own rather than
|
|
3048
|
+
// inside the slide attempt below: a read that cannot slide at all (no order requested, so no
|
|
3049
|
+
// boundary to slide from) must still REPORT the ceiling, and folding the two together silently
|
|
3050
|
+
// dropped that for `searchMyIssues`, whose ordering is opt-in.
|
|
3051
|
+
const strandedHere = endCursor == null && issueCount > githubSearchResultLimit;
|
|
3052
|
+
if (strandedHere && sortKey != null) {
|
|
3053
|
+
const boundary = mapped != null ? lastSortBoundary(mapped, sortKey) : undefined;
|
|
3054
|
+
aliasSlide = boundary != null ? toGitHubIssueSearchSlideQualifier(sortKey, boundary) : undefined;
|
|
3055
|
+
// A bound identical to the one this alias is ALREADY under would re-issue the same query
|
|
3056
|
+
// forever. NOT needed for correctness, and that is measured rather than assumed: against a
|
|
3057
|
+
// provider that honours the bound there is no walk that reaches it. The nearest case, a tied
|
|
3058
|
+
// block larger than the cap, terminates on its own instead — every page inside the block is
|
|
3059
|
+
// filtered away by `slideSeen` until the walk ends on an empty page with no boundary to slide
|
|
3060
|
+
// from, so the second slide is never computed (verified: 1.200 issues sharing one second serve
|
|
3061
|
+
// the reachable 1.000 and report the ceiling, with this guard never firing).
|
|
3062
|
+
//
|
|
3063
|
+
// It is here purely as defence in depth against a bound that silently does nothing, because
|
|
3064
|
+
// that failure mode is an unbounded request loop rather than a wrong answer, and this read
|
|
3065
|
+
// walks until a provider tells it to stop. Cheap insurance against the one bug class that
|
|
3066
|
+
// cannot be shrugged off.
|
|
3067
|
+
if (aliasSlide != null && aliasSlide === cursorString(cursor, `slide:${s.alias}`)) {
|
|
3068
|
+
aliasSlide = undefined;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
if (strandedHere && aliasSlide == null) {
|
|
3072
|
+
strandedByCeiling = true;
|
|
3073
|
+
}
|
|
3074
|
+
if (aliasSlide != null) {
|
|
3075
|
+
// Restart this alias inside its new bound: a position from the old query is meaningless there.
|
|
3076
|
+
next[s.alias] = undefined;
|
|
3077
|
+
next[`slide:${s.alias}`] = aliasSlide;
|
|
3078
|
+
slid = true;
|
|
3079
|
+
}
|
|
3080
|
+
else {
|
|
3081
|
+
next[s.alias] = endCursor;
|
|
3082
|
+
// Carry the bound this alias is already walking under, or it would restart at the top.
|
|
3083
|
+
next[`slide:${s.alias}`] = cursorString(cursor, `slide:${s.alias}`);
|
|
3084
|
+
if (endCursor != null) {
|
|
3085
|
+
hasMore = true;
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
2799
3088
|
}
|
|
2800
|
-
//
|
|
2801
|
-
//
|
|
2802
|
-
//
|
|
2803
|
-
|
|
3089
|
+
// Only the ceiling an alias could NOT slide past is incompleteness. A capped alias with pages left has
|
|
3090
|
+
// nothing to slide past yet, and one that slid has its remainder reachable through the cursor: marking
|
|
3091
|
+
// either would seal `truncated: true` and keep it there for the rest of the read, so a completed walk
|
|
3092
|
+
// would report results it went on to fetch as omitted.
|
|
3093
|
+
const truncated = cursor?.truncated === true || strandedByCeiling || continuationMissing;
|
|
2804
3094
|
next.truncated = truncated || undefined;
|
|
3095
|
+
const continuable = hasMore || slid;
|
|
2805
3096
|
return {
|
|
2806
3097
|
values: deduped,
|
|
2807
|
-
cursor:
|
|
2808
|
-
hasMore:
|
|
3098
|
+
cursor: continuable ? JSON.stringify(next) : undefined,
|
|
3099
|
+
hasMore: continuable,
|
|
2809
3100
|
page: page,
|
|
2810
3101
|
truncated: truncated,
|
|
2811
3102
|
totalCount: maxIssueCount,
|
|
@@ -2828,7 +3119,6 @@ export class GitHubApi {
|
|
|
2828
3119
|
*/
|
|
2829
3120
|
async searchPullRequestsPage(provider, token, options, cancellation) {
|
|
2830
3121
|
const scope = getScopedLogger();
|
|
2831
|
-
const pageSize = Math.min(maxPullRequestSearchPageSize, Math.max(1, Math.trunc(options?.pageSize ?? defaultPullRequestSearchPageSize)));
|
|
2832
3122
|
const facets = toGitHubPullRequestSearchFacets(options?.criteria);
|
|
2833
3123
|
const facetAliases = facets.map(f => f.alias).sort();
|
|
2834
3124
|
const scopeQualifiers = toGitHubIssueSearchScopeQualifiers(options?.org, options?.repos);
|
|
@@ -2884,6 +3174,12 @@ export class GitHubApi {
|
|
|
2884
3174
|
totalCount: cursor?.totalCount,
|
|
2885
3175
|
};
|
|
2886
3176
|
}
|
|
3177
|
+
// Each active facet selects its own page in the same GraphQL document. Share the lite projection's
|
|
3178
|
+
// 100-node default across those selections; an explicit page size remains a per-facet request.
|
|
3179
|
+
const defaultSize = options?.summary === true
|
|
3180
|
+
? Math.max(1, Math.floor(maxPullRequestSearchPageSize / activeFacets.length))
|
|
3181
|
+
: defaultPullRequestSearchPageSize;
|
|
3182
|
+
const pageSize = Math.min(maxPullRequestSearchPageSize, Math.max(1, Math.trunc(options?.pageSize ?? defaultSize)));
|
|
2887
3183
|
const includeVar = (alias) => `include${alias.charAt(0).toUpperCase()}${alias.slice(1)}`;
|
|
2888
3184
|
const params = facets.flatMap(f => [
|
|
2889
3185
|
`$${f.alias}Search: String!`,
|
|
@@ -2899,7 +3195,7 @@ export class GitHubApi {
|
|
|
2899
3195
|
}
|
|
2900
3196
|
nodes {
|
|
2901
3197
|
... on PullRequest {
|
|
2902
|
-
${gqlPullRequestFragment}
|
|
3198
|
+
${options?.summary ? gqlPullRequestLiteFragment : gqlPullRequestFragment}
|
|
2903
3199
|
${gqlPullRequestStackFragmentFor(options)}
|
|
2904
3200
|
}
|
|
2905
3201
|
}
|
|
@@ -2929,7 +3225,12 @@ export class GitHubApi {
|
|
|
2929
3225
|
if (node?.id == null)
|
|
2930
3226
|
continue;
|
|
2931
3227
|
try {
|
|
2932
|
-
|
|
3228
|
+
// Must follow the projection: the lite fragment does not select reviews, checks or diff
|
|
3229
|
+
// stats, and the full mapper reads them — mapping a lite node with it would silently
|
|
3230
|
+
// report "no reviewers"/"no checks" as FACTS rather than as unselected.
|
|
3231
|
+
pullRequests.push(options?.summary
|
|
3232
|
+
? fromGitHubPullRequestLite(node, provider)
|
|
3233
|
+
: fromGitHubPullRequest(node, provider));
|
|
2933
3234
|
}
|
|
2934
3235
|
catch (ex) {
|
|
2935
3236
|
scope?.warn(`skipped unmappable pull request; id=${node.id}, url=${node.url}, ex=${ex}`);
|
|
@@ -3484,6 +3785,9 @@ __decorate([
|
|
|
3484
3785
|
__decorate([
|
|
3485
3786
|
trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })
|
|
3486
3787
|
], GitHubApi.prototype, "countIssues", null);
|
|
3788
|
+
__decorate([
|
|
3789
|
+
trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })
|
|
3790
|
+
], GitHubApi.prototype, "getIssuesBatch", null);
|
|
3487
3791
|
__decorate([
|
|
3488
3792
|
trace({ args: (provider, token) => ({ provider: provider.name, token: `<token:${token.microHash}>` }) })
|
|
3489
3793
|
], GitHubApi.prototype, "countPullRequests", null);
|