@gitkraken/core-gitlens 0.5.101 → 0.5.103

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +25 -1
  2. package/dist/plus/integrations/collectionMetadata.d.ts +16 -10
  3. package/dist/plus/integrations/collectionMetadata.d.ts.map +1 -1
  4. package/dist/plus/integrations/collectionMetadata.js +64 -16
  5. package/dist/plus/integrations/collectionMetadata.js.map +1 -1
  6. package/dist/plus/integrations/index.d.ts +1 -1
  7. package/dist/plus/integrations/index.d.ts.map +1 -1
  8. package/dist/plus/integrations/index.js.map +1 -1
  9. package/dist/plus/integrations/providers/utils/providerPaging.d.ts.map +1 -1
  10. package/dist/plus/integrations/providers/utils/providerPaging.js +2 -1
  11. package/dist/plus/integrations/providers/utils/providerPaging.js.map +1 -1
  12. package/dist/plus/integrations/reads/drains.d.ts.map +1 -1
  13. package/dist/plus/integrations/reads/drains.js +59 -20
  14. package/dist/plus/integrations/reads/drains.js.map +1 -1
  15. package/dist/plus/integrations/reads/hierarchy.d.ts.map +1 -1
  16. package/dist/plus/integrations/reads/hierarchy.js +34 -17
  17. package/dist/plus/integrations/reads/hierarchy.js.map +1 -1
  18. package/dist/plus/integrations/reads/issueTracker.d.ts.map +1 -1
  19. package/dist/plus/integrations/reads/issueTracker.js +8 -2
  20. package/dist/plus/integrations/reads/issueTracker.js.map +1 -1
  21. package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
  22. package/dist/plus/integrations/reads/issues.js +13 -3
  23. package/dist/plus/integrations/reads/issues.js.map +1 -1
  24. package/dist/plus/integrations/reads/pullRequests.d.ts.map +1 -1
  25. package/dist/plus/integrations/reads/pullRequests.js +7 -1
  26. package/dist/plus/integrations/reads/pullRequests.js.map +1 -1
  27. package/dist/plus/integrations/reads/warnings.d.ts +43 -4
  28. package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
  29. package/dist/plus/integrations/reads/warnings.js +47 -5
  30. package/dist/plus/integrations/reads/warnings.js.map +1 -1
  31. package/dist/plus/integrations/results.d.ts +115 -1
  32. package/dist/plus/integrations/results.d.ts.map +1 -1
  33. package/dist/plus/integrations/results.js +78 -3
  34. package/dist/plus/integrations/results.js.map +1 -1
  35. package/docs/integrations.md +81 -7
  36. package/package.json +1 -1
  37. package/src/plus/integrations/collectionMetadata.ts +67 -21
  38. package/src/plus/integrations/index.ts +4 -0
  39. package/src/plus/integrations/providers/utils/providerPaging.ts +2 -1
  40. package/src/plus/integrations/reads/drains.ts +84 -20
  41. package/src/plus/integrations/reads/hierarchy.ts +43 -32
  42. package/src/plus/integrations/reads/issueTracker.ts +8 -2
  43. package/src/plus/integrations/reads/issues.ts +21 -4
  44. package/src/plus/integrations/reads/pullRequests.ts +15 -1
  45. package/src/plus/integrations/reads/warnings.ts +86 -10
  46. package/src/plus/integrations/results.ts +173 -4
@@ -11,6 +11,68 @@ export interface ConnectionStateChangeEvent {
11
11
  * needs re-connection); `isAuth` is retained as a convenience mirror of `kind === 'auth'`.
12
12
  */
13
13
  export type ProviderWarningKind = 'auth' | 'rate-limit' | 'not-found' | 'no-connection' | 'other';
14
+ /**
15
+ * Why a read that SUCCEEDED still withheld results:
16
+ * - `provider-limit`: the provider refuses to serve past a cap it enforces (GitHub search's 1,000-result
17
+ * ceiling, Trello's `cards_limit`), so the excess is unreachable through that query.
18
+ * - `recovery-budget`: the internal partitioned recovery stopped spending upstream requests before it ran
19
+ * out of partitions to visit.
20
+ * - `pagination-incomplete`: pages were left unread — a sub-scope of a multi-scope read that was not drained,
21
+ * a drain that stopped at its own page backstop, or a provider that advertised another page and gave no way
22
+ * to reach it. These have DIFFERENT remedies, so the kind alone does not say whether more can be fetched;
23
+ * read {@link ProviderWarningOmission.recovery} for that.
24
+ *
25
+ * Mirrors the vocabulary the SDK reports. Declared here rather than imported so this module stays free of
26
+ * `@gitkraken/provider-apis` types (see the export block in `index.ts`); `collectionMetadata.ts` holds the
27
+ * compile-time link, so an SDK bump that adds a kind fails the build at that boundary.
28
+ */
29
+ export type ProviderWarningOmissionKind = 'provider-limit' | 'recovery-budget' | 'pagination-incomplete';
30
+ /**
31
+ * What, if anything, would fetch the withheld results — the question `kind` cannot answer.
32
+ *
33
+ * `kind` says WHY results are missing, and two omissions of the same kind can need opposite handling: a drain
34
+ * that stopped at a caller-settable page budget and a provider that advertised another page without a usable
35
+ * cursor are both `pagination-incomplete`, but only the first can be fetched. A consumer offering a "load
36
+ * more" affordance gates it on this, never on `kind`.
37
+ *
38
+ * - `none`: nothing the consumer can call returns the missing items — a provider-enforced cap, an internal
39
+ * budget it does not control, or a continuation the provider refused to hand back. Say the results are
40
+ * capped; do not offer to fetch more.
41
+ * - `page-budget`: re-run the SAME read with a higher page budget (`maxPages` on the sweep options). Note this
42
+ * re-reads from the start rather than continuing — a sweep exposes no cursor — so it is a deliberate,
43
+ * user-initiated action, not something to retry automatically.
44
+ *
45
+ * Required, not optional: an absent value would be indistinguishable from `none` while actually meaning "this
46
+ * producer didn't say", which is the ambiguity {@link ProviderWarning.omission} exists to remove. And a
47
+ * conservative union on purpose — it names only what a producer can PROVE. A value is added when some layer
48
+ * can vouch for it, never so that a plausible-looking case has something to map to; see
49
+ * `collectionMetadata.ts` for the SDK shape that looks recoverable and is not.
50
+ */
51
+ export type ProviderWarningOmissionRecovery = 'none' | 'page-budget';
52
+ /** Which repository / project / resource an omission is attributed to. All fields optional; a scope may name none. */
53
+ export interface ProviderWarningOmissionScope {
54
+ providerId?: string;
55
+ resourceId?: string;
56
+ projectId?: string;
57
+ repositoryId?: string;
58
+ }
59
+ export interface ProviderWarningOmission {
60
+ kind: ProviderWarningOmissionKind;
61
+ /**
62
+ * Whether anything would fetch the missing items, and what. Gate a "load more" affordance on this rather
63
+ * than on `kind` — see {@link ProviderWarningOmissionRecovery}.
64
+ */
65
+ recovery: ProviderWarningOmissionRecovery;
66
+ /**
67
+ * The cap the provider enforces, when it reports one. NOT a result count for every kind: on
68
+ * `recovery-budget` this is a REQUEST budget and must not be shown to a user as a number of results.
69
+ */
70
+ limit?: number;
71
+ /** Total matches the provider reported, when it reports one. Only GitHub's search cap does today. */
72
+ totalCount?: number;
73
+ /** Which repository / project / resource was affected, when one is attributed. */
74
+ scope?: ProviderWarningOmissionScope;
75
+ }
14
76
  export interface ProviderWarning {
15
77
  providerId: IntegrationIds;
16
78
  /** Disambiguates connections on self-managed hosts (where one provider id spans multiple domains). */
@@ -21,6 +83,29 @@ export interface ProviderWarning {
21
83
  kind: ProviderWarningKind;
22
84
  /** Convenience mirror of `kind === 'auth'`. */
23
85
  isAuth: boolean;
86
+ /**
87
+ * Present when this warning describes results the read could not return even though the request itself
88
+ * SUCCEEDED — a provider-enforced cap, an exhausted recovery budget, a page budget, or a sub-scope the read
89
+ * did not drain.
90
+ *
91
+ * Its presence is the signal: an omission is not a failure. Message it as incompleteness rather than as a
92
+ * failed read, and do NOT derive that from `message`, which is English prose and subject to rewording.
93
+ * `kind` stays `'other'` for these, so the failure discriminant keeps meaning exactly what it meant before
94
+ * this field existed.
95
+ *
96
+ * Whether anything would fetch the rest is a SEPARATE question — read {@link ProviderWarningOmission.recovery},
97
+ * not `kind`, and never assume a retry of the same request returns more.
98
+ *
99
+ * `limit` / `totalCount` / `scope` are forwarded only when they are reported; most omissions carry none of
100
+ * the three, so render correctly without them — and see {@link ProviderWarningOmission.limit} before
101
+ * showing that figure as a result count.
102
+ *
103
+ * Its ABSENCE proves nothing. It is never set on a warning derived from a caught exception (see
104
+ * {@link toProviderWarning}) or from a structured scope failure — those are failures, and the field would
105
+ * be a lie there. But it is also absent whenever incompleteness was reported without naming what was left
106
+ * out, so treat a bare `kind: 'other'` warning as unclassified rather than as a proven failure.
107
+ */
108
+ omission?: ProviderWarningOmission;
24
109
  }
25
110
  export interface ProviderPageInfo {
26
111
  /**
@@ -184,6 +269,35 @@ export interface ProviderRepositoryShape {
184
269
  * a 404 isn't mislabeled as auth.
185
270
  */
186
271
  export declare function toProviderWarning(providerId: IntegrationIds, domain: string | undefined, connectionId: string | undefined, ex: unknown): ProviderWarning;
187
- /** Appends `warning` to `into` only when an equal warning (by provider/connection/domain/kind/message) is absent. */
272
+ /**
273
+ * A scope's identity, as the stable string that keys it.
274
+ *
275
+ * The single definition of what "the same scope" means, shared by the failure and omission dedup keys in
276
+ * `providerPaging.ts` and by {@link providerWarningKey} below, so a scope gaining a field is one edit rather
277
+ * than three. `providerId` is included: the same repository ID under two providers is two scopes.
278
+ *
279
+ * The parameter is structural rather than the SDK's `CollectionScope` so this module keeps naming no
280
+ * `@gitkraken/provider-apis` types (see the export block in `index.ts`) while still serving its SDK-facing
281
+ * callers, which pass that type in unchanged.
282
+ */
283
+ export declare function collectionScopeKey(scope: ProviderWarningOmissionScope | undefined): string;
284
+ /**
285
+ * Strips the omission from every warning in `warnings` when the read as a whole failed.
286
+ *
287
+ * An omission asserts the request SUCCEEDED, and a drain only learns it failed AFTER it may have emitted one:
288
+ * an early page can report its own truncation and then a later page can die. Deciding per warning, at the
289
+ * moment each is built, cannot see that future — so the aggregate is reconciled once, here, where
290
+ * `fetchFailed` is final. Call it at the point a read returns its `fetchFailed`.
291
+ *
292
+ * Re-dedupes as it goes: the omission is part of a warning's identity, so two warnings that differed only
293
+ * there become identical once it is gone, and the array's contract is that no two entries are equal.
294
+ *
295
+ * Mutates in place: the warning array is the one being returned, and callers accumulate into it across pages.
296
+ */
297
+ export declare function reconcileOmissionsWithFailure(warnings: ProviderWarning[], fetchFailed: boolean): void;
298
+ /**
299
+ * Appends `warning` to `into` only when an equal warning (by provider/connection/domain/kind/message, plus the
300
+ * structured omission when one is present) is absent.
301
+ */
188
302
  export declare function appendDedupedWarning(into: ProviderWarning[], warning: ProviderWarning): void;
189
303
  //# sourceMappingURL=results.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../../../src/plus/integrations/results.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAg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  isAuth: kind === 'auth',
49
49
  };
50
50
  }
51
- /** A stable key for deduplicating warnings accumulated across drained pages / fan-out scopes. */
51
+ /**
52
+ * A scope's identity, as the stable string that keys it.
53
+ *
54
+ * The single definition of what "the same scope" means, shared by the failure and omission dedup keys in
55
+ * `providerPaging.ts` and by {@link providerWarningKey} below, so a scope gaining a field is one edit rather
56
+ * than three. `providerId` is included: the same repository ID under two providers is two scopes.
57
+ *
58
+ * The parameter is structural rather than the SDK's `CollectionScope` so this module keeps naming no
59
+ * `@gitkraken/provider-apis` types (see the export block in `index.ts`) while still serving its SDK-facing
60
+ * callers, which pass that type in unchanged.
61
+ */
62
+ export function collectionScopeKey(scope) {
63
+ return [scope?.providerId ?? '', scope?.resourceId ?? '', scope?.projectId ?? '', scope?.repositoryId ?? ''].join(' ');
64
+ }
65
+ /**
66
+ * The omission's contribution to a warning's identity — empty when there is none, so a warning without an
67
+ * omission keeps deduping exactly as it did before the field existed.
68
+ *
69
+ * Two omissions of different kinds do produce different `message` values today, so message alone would still
70
+ * separate them. That is incidental: the premise of `omission` is that consumers must not depend on prose
71
+ * carrying the distinguishing fact, and this key must not either.
72
+ */
73
+ function providerWarningOmissionKey(omission) {
74
+ if (omission == null)
75
+ return '';
76
+ return [
77
+ omission.kind,
78
+ omission.recovery,
79
+ omission.limit ?? '',
80
+ omission.totalCount ?? '',
81
+ collectionScopeKey(omission.scope),
82
+ ].join(' ');
83
+ }
84
+ /**
85
+ * Strips the omission from every warning in `warnings` when the read as a whole failed.
86
+ *
87
+ * An omission asserts the request SUCCEEDED, and a drain only learns it failed AFTER it may have emitted one:
88
+ * an early page can report its own truncation and then a later page can die. Deciding per warning, at the
89
+ * moment each is built, cannot see that future — so the aggregate is reconciled once, here, where
90
+ * `fetchFailed` is final. Call it at the point a read returns its `fetchFailed`.
91
+ *
92
+ * Re-dedupes as it goes: the omission is part of a warning's identity, so two warnings that differed only
93
+ * there become identical once it is gone, and the array's contract is that no two entries are equal.
94
+ *
95
+ * Mutates in place: the warning array is the one being returned, and callers accumulate into it across pages.
96
+ */
97
+ export function reconcileOmissionsWithFailure(warnings, fetchFailed) {
98
+ if (!fetchFailed || !warnings.some(w => w.omission != null))
99
+ return;
100
+ const reconciled = [];
101
+ for (const warning of warnings) {
102
+ if (warning.omission == null) {
103
+ appendDedupedWarning(reconciled, warning);
104
+ continue;
105
+ }
106
+ const { omission: _omission, ...rest } = warning;
107
+ appendDedupedWarning(reconciled, rest);
108
+ }
109
+ warnings.splice(0, warnings.length, ...reconciled);
110
+ }
111
+ /**
112
+ * A stable key for deduplicating warnings accumulated across drained pages / fan-out scopes.
113
+ *
114
+ * `message` stays LAST. It is the only free-form segment — provider prose, spaces and all — so anything
115
+ * appended after it could be impersonated by a message that happens to end in the same text.
116
+ */
52
117
  function providerWarningKey(warning) {
53
- return [warning.providerId, warning.connectionId ?? '', warning.domain ?? '', warning.kind, warning.message].join(' ');
118
+ return [
119
+ warning.providerId,
120
+ warning.connectionId ?? '',
121
+ warning.domain ?? '',
122
+ warning.kind,
123
+ providerWarningOmissionKey(warning.omission),
124
+ warning.message,
125
+ ].join(' ');
54
126
  }
55
- /** Appends `warning` to `into` only when an equal warning (by provider/connection/domain/kind/message) is absent. */
127
+ /**
128
+ * Appends `warning` to `into` only when an equal warning (by provider/connection/domain/kind/message, plus the
129
+ * structured omission when one is present) is absent.
130
+ */
56
131
  export function appendDedupedWarning(into, warning) {
57
132
  const key = providerWarningKey(warning);
58
133
  if (into.some(existing => providerWarningKey(existing) === key))
@@ -1 +1 @@
1
- {"version":3,"file":"results.js","sourceRoot":"","sources":["../../../src/plus/integrations/results.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AA8K1G,MAAM,+BAA+B,GAAG,GAAG,CAAC;AAE5C,SAAS,sBAAsB,CAAC,EAAW;IAC1C,MAAM,GAAG,GAAG,CAAC,EAAE,YAAY,KAAK,CAAC,CA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YAC9B,oBAAoB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC1C,SAAS;QACV,CAAC;QAED,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;QACjD,oBAAoB,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,OAAwB;IACnD,OAAO;QACN,OAAO,CAAC,UAAU;QAClB,OAAO,CAAC,YAAY,IAAI,EAAE;QAC1B,OAAO,CAAC,MAAM,IAAI,EAAE;QACpB,OAAO,CAAC,IAAI;QACZ,0BAA0B,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5C,OAAO,CAAC,OAAO;KACf,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAuB,EAAE,OAAwB;IACrF,MAAM,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC;QAAE,OAAO;IAExE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACpB,CAAC"}
@@ -177,13 +177,13 @@ result** instead of rejecting the call. One provider's expired token never blank
177
177
  `ProviderWarning.kind` (also exported as `ProviderWarningKind`) carries the classifications the facade can
178
178
  prove from structured errors:
179
179
 
180
- | `kind` | Meaning | Reasonable response |
181
- | --------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
182
- | `auth` | Token rejected (401/403 that isn't a throttle). | Prompt to reconnect that connection. |
183
- | `rate-limit` | Throttled (429, or a 403 whose body says so). | Back off and retry; keep the last snapshot. |
184
- | `not-found` | 404/410/422 on the requested scope. | Drop that scope; don't reconnect. |
185
- | `no-connection` | The requested `connectionId`/`domain` doesn't resolve. | Re-resolve the target or re-authenticate. |
186
- | `other` | Catch-all: unsupported input, truncation, upstream/network failure, or an unclassified error. | Preserve the warning and use the result flags; do not assume it is benign or non-retryable. |
180
+ | `kind` | Meaning | Reasonable response |
181
+ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
182
+ | `auth` | Token rejected (401/403 that isn't a throttle). | Prompt to reconnect that connection. |
183
+ | `rate-limit` | Throttled (429, or a 403 whose body says so). | Back off and retry; keep the last snapshot. |
184
+ | `not-found` | 404/410/422 on the requested scope. | Drop that scope; don't reconnect. |
185
+ | `no-connection` | The requested `connectionId`/`domain` doesn't resolve. | Re-resolve the target or re-authenticate. |
186
+ | `other` | Catch-all: unsupported input, truncation, upstream/network failure, or an unclassified error. Read `omission` before treating one as a failure. | Preserve the warning and use the result flags; do not assume it is benign or non-retryable. |
187
187
 
188
188
  `isAuth` is a convenience mirror of `kind === 'auth'`. **Collapsing `kind` into that boolean loses the
189
189
  rate-limit and not-found distinctions**, which then have to be re-derived from raw provider prose.
@@ -191,6 +191,70 @@ Conversely, `other` is intentionally not a complete failure taxonomy. Treat `mes
191
191
  text rather than a stable protocol; use `fetchFailed`, `page.truncated`, and `page.allPages` for completeness
192
192
  and keep unknown failures conservative.
193
193
 
194
+ ### `omission` — succeeded, but withheld results
195
+
196
+ `other` covers two facts with **opposite remedies**: a request that failed, and a request that succeeded while
197
+ part of the answer was withheld. `ProviderWarning.omission` is set only for the second, so a consumer can act
198
+ on it without parsing `message`:
199
+
200
+ ```ts
201
+ if (warning.omission != null) {
202
+ // The read SUCCEEDED — message it as incompleteness, not failure.
203
+ // Whether anything would fetch the rest is a separate question; see `recovery` below.
204
+ if (warning.omission.recovery !== 'none') offerLoadMore(warning.omission);
205
+ }
206
+ ```
207
+
208
+ `kind` stays `'other'` for these on purpose: it is the discriminant derived from a caught exception's type, and
209
+ adding a member would silently change what `'other'` means for every existing build.
210
+
211
+ **Its absence proves nothing.** It is never set on a failure — an exception or a structured scope failure —
212
+ where it would be a lie. But it is also absent whenever incompleteness was reported without naming what was
213
+ left out, so treat a bare `kind: 'other'` warning as unclassified rather than as a proven failure.
214
+
215
+ The line that matters is whether the request **succeeded**, not whether a tail was left unread. A drain that
216
+ stopped on its own accounting succeeded and is capped, so it carries the omission; a drain that was interrupted
217
+ mid-read left an unread tail too, but a retry may complete it — that one carries no omission and sets
218
+ `fetchFailed`.
219
+
220
+ `kind` says **why** results are missing:
221
+
222
+ | `omission.kind` | What happened |
223
+ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
224
+ | `provider-limit` | The provider refuses to serve past a cap (GitHub search's 1,000, Trello's `cards_limit`). |
225
+ | `recovery-budget` | The internal partitioned recovery stopped before visiting every partition. |
226
+ | `pagination-incomplete` | Pages were left unread: an undrained sub-scope, a page budget, or a provider that advertised another page without a usable cursor. |
227
+
228
+ #### `recovery` — what, if anything, would fetch the rest
229
+
230
+ **`kind` does not answer that**, and `pagination-incomplete` is why: a drain that stopped at a page budget and
231
+ a provider that gave no usable cursor are the same kind, but only the first can be fetched. Gate a "load more"
232
+ affordance on `recovery`, never on `kind`:
233
+
234
+ | `omission.recovery` | Means | What a consumer does |
235
+ | ------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------- |
236
+ | `none` | Nothing you can call returns the missing items. | Say the results are capped. Do not offer to fetch more. |
237
+ | `page-budget` | Re-run the same read with a higher `maxPages` (sweep options). | Offer it — but note it re-reads from the start, so make it user-initiated. |
238
+
239
+ `recovery` is **required** — unlike `limit`, `totalCount` and `scope`, it is never absent. An absent value
240
+ would be indistinguishable from `none` while actually meaning "this producer didn't say", which is the
241
+ ambiguity `omission` exists to remove.
242
+
243
+ It is also **conservative**: it names only what a producer can prove, so `none` means "not known to be
244
+ recoverable", not "proven unrecoverable". Today only a sweep that spent its own page budget reports
245
+ `page-budget`; everything else — every provider cap, every exhausted internal budget, and every omission
246
+ derived from SDK metadata — is `none`. A `scope` does not change that. It attributes where results were
247
+ withheld, and the SDK reports the same scoped shape both for a scope it merely sampled and for one whose
248
+ cursor stalled, so re-reading it is not something this layer can promise.
249
+
250
+ `limit`, `totalCount` and `scope` are forwarded only when reported; **most omissions carry none of the three**,
251
+ so render correctly without them. Two traps: `totalCount` is `number | undefined` and never `null` (the SDK's
252
+ `null` is normalized to absent at the boundary), and `limit` on `recovery-budget` is a **request** budget — do
253
+ not show it to a user as a number of results.
254
+
255
+ Warnings dedup on their structure, `omission` included, so two omissions that differ only in kind, recovery or
256
+ scope stay two warnings even if their messages ever converge.
257
+
194
258
  | Flag | Says |
195
259
  | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
196
260
  | `fetchFailed` | `items` is incomplete because a scope failed, or because a flat hierarchy read was truncated. Distinguishes this from a genuine empty result. |
@@ -199,6 +263,16 @@ and keep unknown failures conservative.
199
263
  | `failedProviderIds` | Sweeps/broadens: providers whose requested scopes produced no usable result. |
200
264
  | `incompleteProviderIds` | Sweeps/broadens: providers with a usable result plus a failed, partial, or truncated sibling scope. |
201
265
 
266
+ An omission pairs with `page.truncated: true` — results are missing — and typically with `fetchFailed: false`,
267
+ since nothing failed. But the flags are **per result** and `omission` is **per warning**, so the two can differ
268
+ on a fan-out: a sweep where provider A was capped and provider B failed outright reports `fetchFailed: true`
269
+ while A's omission stays true for A. Read `omission` on the warning that carries it — its `providerId`,
270
+ `domain` and `connectionId` say who it is about — rather than inferring it from the aggregate.
271
+
272
+ What is guaranteed is the narrower thing: a warning never claims its own read succeeded when it didn't. A drain
273
+ that dies mid-read publishes its unread tail with no omission, even if an earlier page had already reported
274
+ one.
275
+
202
276
  `resolveRepository` reports through `resolution.status` instead: `resolved` · `not-found` · `unauthorized` ·
203
277
  `unsupported-provider` · `invalid-remote-url` · `host-mismatch` · `undetermined`. A `resolved` identity
204
278
  carries the provider's **canonical** owner/name plus `renamed: true` when the local remote is stale.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gitkraken/core-gitlens",
3
3
  "description": "GitLens core — shared Git / AI / GitHub primitives for internal GitKraken consumption",
4
- "version": "0.5.101",
4
+ "version": "0.5.103",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
7
7
  "name": "GitKraken",
@@ -7,7 +7,7 @@ import type {
7
7
  import { AuthenticationError, RequestNotFoundError, RequestRateLimitError } from '../../git/errors.js';
8
8
  import type { IntegrationIds } from './constants.js';
9
9
  import { isRateLimitResponse } from './errors.js';
10
- import type { ProviderWarning } from './results.js';
10
+ import type { ProviderWarning, ProviderWarningOmission } from './results.js';
11
11
  import { appendDedupedWarning } from './results.js';
12
12
 
13
13
  /**
@@ -73,19 +73,6 @@ function toCollectionFailureWarningKind(failure: CollectionScopeFailure): Provid
73
73
  }
74
74
  }
75
75
 
76
- /**
77
- * A scope's identity, as the stable string that keys it.
78
- *
79
- * The dedup keys in `providerPaging.ts` build on this, so failures and omissions can never disagree about
80
- * what "the same scope" means. `providerId` is included: the same repository ID under two providers is two
81
- * scopes.
82
- */
83
- export function collectionScopeKey(scope: CollectionScope | undefined): string {
84
- return [scope?.providerId ?? '', scope?.resourceId ?? '', scope?.projectId ?? '', scope?.repositoryId ?? ''].join(
85
- ' ',
86
- );
87
- }
88
-
89
76
  /** ` (resource r, project p, repository o/n)` for the scope IDs present; empty when the scope names none. */
90
77
  function collectionScopeText(scope: CollectionScope | undefined): string {
91
78
  const parts: string[] = [];
@@ -110,9 +97,10 @@ function collectionFailureMessage(failure: CollectionScopeFailure): string {
110
97
  /**
111
98
  * Explains one omission in the consumer's terms — what was left out and, where the SDK reports it, how much.
112
99
  *
113
- * An omission is a completeness fact, never a failure: the read succeeded and the provider (or the SDK's own
114
- * recovery budget) is what withheld results, so retrying the same request cannot recover them. That is why
115
- * these never contribute to `fetchFailed`.
100
+ * An omission is a completeness fact, never a failure: the read succeeded, and the provider (or the SDK's own
101
+ * recovery budget) is what withheld results. That is why these never contribute to `fetchFailed`. Whether a
102
+ * retry would recover anything is a separate question this layer cannot answer — see the `recovery` note on
103
+ * {@link toProviderWarningOmission}.
116
104
  */
117
105
  function collectionOmissionMessage(omission: CollectionOmission): string {
118
106
  const scopeText = collectionScopeText(omission.scope);
@@ -142,6 +130,39 @@ function collectionOmissionMessage(omission: CollectionOmission): string {
142
130
  }
143
131
  }
144
132
 
133
+ /**
134
+ * Forwards an SDK omission as the structured signal consumers read instead of parsing {@link
135
+ * collectionOmissionMessage}'s prose.
136
+ *
137
+ * `results.ts` re-spells `CollectionOmissionKind` rather than importing it, so the published warning surface
138
+ * carries no `@gitkraken/provider-apis` types (see the export block in `index.ts`). The return type is what
139
+ * keeps the two unions honest: an SDK bump that adds a member fails to compile here, alongside
140
+ * `collectionOmissionMessage`'s `satisfies never`.
141
+ *
142
+ * `scope` is copied because the SDK's own object is retained and re-merged across drained pages
143
+ * (`providerPaging.ts`), and this one crosses the package boundary.
144
+ *
145
+ * `recovery` is always `'none'`, deliberately, and a scoped `pagination-incomplete` is why it looks wrong: the
146
+ * SDK emits that one shape from situations with opposite remedies and says so itself — "Either the read
147
+ * deliberately took one page per scope, or the provider advertised another page it gave no way to reach." Its
148
+ * `collectAcrossScopes` producers (Azure, Bitbucket, Bitbucket Server) are the first, its `drainAcrossScopes`
149
+ * producers (GitLab, Jira) the second, and those report an omission only when a cursor STALLED — so re-reading
150
+ * that scope stalls at the identical page. Nothing in `CollectionOmission` separates the two, so claiming
151
+ * recoverability would ship the dead-end button `recovery` exists to prevent. Making the recoverable case
152
+ * claimable needs provider-apis to say whether a scope was drained or merely sampled: a fact to forward, not
153
+ * to guess here.
154
+ */
155
+ function toProviderWarningOmission(omission: CollectionOmission): ProviderWarningOmission {
156
+ return {
157
+ kind: omission.kind,
158
+ recovery: 'none',
159
+ ...(omission.limit != null ? { limit: omission.limit } : {}),
160
+ // The SDK types this `number | null | undefined`; normalize to one absence for consumers.
161
+ ...(omission.totalCount != null ? { totalCount: omission.totalCount } : {}),
162
+ ...(omission.scope != null ? { scope: { ...omission.scope } } : {}),
163
+ };
164
+ }
165
+
145
166
  /**
146
167
  * Whether SDK metadata describes a read that may be missing results.
147
168
  *
@@ -184,7 +205,8 @@ export function assessCollectionMetadata(
184
205
 
185
206
  // Omissions explain WHY a read is incomplete when nothing failed — a provider cap, an exhausted recovery
186
207
  // budget, an undrained scope. They classify as `other`, never `auth`, and are deliberately excluded from
187
- // `fetchFailed` below: the request succeeded, so a retry would return the same truncated set.
208
+ // `fetchFailed` below: the request itself succeeded. `omission` carries that same fact structurally, so a
209
+ // consumer can act on it without parsing the message.
188
210
  const omissions = metadata.omissions ?? [];
189
211
  for (const omission of omissions) {
190
212
  appendDedupedWarning(warnings, {
@@ -194,12 +216,17 @@ export function assessCollectionMetadata(
194
216
  message: collectionOmissionMessage(omission),
195
217
  kind: 'other',
196
218
  isAuth: false,
219
+ omission: toProviderWarningOmission(omission),
197
220
  });
198
221
  }
199
222
 
200
223
  const incomplete = isIncompleteCollection(metadata);
201
224
  // Only fall back to the generic message when nothing more specific was reported; an omission already
202
225
  // explains the incompleteness in the consumer's terms, so adding this on top would be noise.
226
+ //
227
+ // This one deliberately carries no `omission`: it fires precisely when the SDK reported incompleteness
228
+ // WITHOUT saying what was left out, so there is no structured fact to forward and synthesizing one would
229
+ // assert a specificity this layer does not have.
203
230
  if (incomplete && failures.length === 0 && omissions.length === 0) {
204
231
  appendDedupedWarning(warnings, {
205
232
  providerId: providerId,
@@ -217,17 +244,36 @@ export function assessCollectionMetadata(
217
244
  return { warnings: warnings, fetchFailed: failures.length > 0, truncated: incomplete };
218
245
  }
219
246
 
220
- /** Appends neutral warnings derived from SDK metadata and returns its failure/truncation assessment. */
247
+ /**
248
+ * Appends neutral warnings derived from SDK metadata and returns its failure/truncation assessment.
249
+ *
250
+ * `reported` says whether the metadata described this read's incompleteness at all. A caller that would
251
+ * otherwise add its own generic "this was truncated" warning uses it to stay quiet — the same rule
252
+ * {@link assessCollectionMetadata} applies to its own generic fallback, one layer up: whatever the metadata
253
+ * reported already names this provider and, unless it was that same fallback, says something a consumer can
254
+ * act on. Restating it in a weaker vocabulary is how one gap becomes two warnings with two different verdicts.
255
+ *
256
+ * `truncated` is the near-synonym that must NOT be used for that question: it comes from
257
+ * {@link isIncompleteCollection}, which does not consider failures, so metadata carrying a typed failure
258
+ * alongside `completeness: 'complete'` reports `truncated: false` while having already appended the warning
259
+ * that explains everything. Gating on it would restate exactly the case this field exists to keep quiet.
260
+ */
221
261
  export function mergeAssessmentInto(
222
262
  warnings: ProviderWarning[],
223
263
  providerId: IntegrationIds,
224
264
  domain: string | undefined,
225
265
  connectionId: string | undefined,
226
266
  metadata: CollectionMetadata | undefined,
227
- ): { fetchFailed: boolean; truncated: boolean } {
267
+ ): { fetchFailed: boolean; truncated: boolean; reported: boolean } {
228
268
  const assessment = assessCollectionMetadata(providerId, domain, connectionId, metadata);
229
269
  for (const warning of assessment.warnings) {
230
270
  appendDedupedWarning(warnings, warning);
231
271
  }
232
- return { fetchFailed: assessment.fetchFailed, truncated: assessment.truncated };
272
+ return {
273
+ fetchFailed: assessment.fetchFailed,
274
+ truncated: assessment.truncated,
275
+ // What the assessment PRODUCED, not what `appendDedupedWarning` accepted: a warning dropped as a
276
+ // duplicate is still one the consumer will see, so it still makes a restatement redundant.
277
+ reported: assessment.warnings.length > 0,
278
+ };
233
279
  }
@@ -202,6 +202,10 @@ export type {
202
202
  ProviderSweepResult,
203
203
  ProviderWarning,
204
204
  ProviderWarningKind,
205
+ ProviderWarningOmission,
206
+ ProviderWarningOmissionKind,
207
+ ProviderWarningOmissionRecovery,
208
+ ProviderWarningOmissionScope,
205
209
  ProviderOrganization,
206
210
  ProviderRepositoryShape,
207
211
  RepositoryIdentity,
@@ -6,7 +6,8 @@ import type {
6
6
  } from '@gitkraken/provider-apis';
7
7
  import { isCancellationError } from '../../../../utils/cancellation.js';
8
8
  import { uniqueBy } from '../../../../utils/iterable.js';
9
- import { collectionScopeKey, toCollectionScopeFailure } from '../../collectionMetadata.js';
9
+ import { toCollectionScopeFailure } from '../../collectionMetadata.js';
10
+ import { collectionScopeKey } from '../../results.js';
10
11
  import type { ProviderApiPagedResult, ProviderHierarchyResult } from '../models.js';
11
12
 
12
13
  /**