@plune-ai/cli 0.15.0 → 0.17.0

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.
@@ -50,11 +50,17 @@ interface Attachment {
50
50
  url: string;
51
51
  contentType?: string;
52
52
  }
53
- /** A file the runner kept for an attempt, where it lies on this machine. */
53
+ /**
54
+ * A file the runner kept for an attempt: where it lies on this machine, or — for a text a test attached as
55
+ * a `body`, which leaves no file — the bytes themselves. Playwright gives one of the two; were both here,
56
+ * the bytes are what is sent.
57
+ */
54
58
  interface ResultFile {
55
59
  name: string;
56
60
  contentType?: string;
57
- path: string;
61
+ path?: string;
62
+ /** Only a JSON or a plain text — the types the platform keeps as a text; see `filesOf`. */
63
+ body?: Buffer;
58
64
  }
59
65
  /** One assertion's outcome, in the shape the platform already stores for its own runner. */
60
66
  interface AssertionRecord {
@@ -117,7 +123,8 @@ interface PendingResult {
117
123
  /**
118
124
  * The files the runner kept for this attempt, passed or not — built by `filesOf`. Never part of a
119
125
  * batch: the paths are this machine's. Once the platform has accepted the result, the core uploads
120
- * the screenshots among them to it (platform ADR 0040).
126
+ * the screenshots and the text files among them to it (platform ADR 0040) — never a body to the
127
+ * fallback file either, which keeps a file by its path and leaves the bytes out.
121
128
  */
122
129
  files?: ResultFile[];
123
130
  }
@@ -137,8 +144,8 @@ interface FailureDetail {
137
144
  line: number;
138
145
  column?: number;
139
146
  };
140
- /** The files the runner kept for the attempt, by name. The screenshots among them are uploaded to the
141
- * result besides (`files`); the rest stay in the CI run. */
147
+ /** The files the runner kept for the attempt, by name. The screenshots and text files among them are
148
+ * uploaded to the result besides (`files`); the rest stay in the CI run. */
142
149
  artifacts?: {
143
150
  name: string;
144
151
  contentType?: string;
@@ -177,11 +184,13 @@ interface FailedAttempt {
177
184
  errors: AttemptError[];
178
185
  /** The declared steps, outermost first — as the JSON report keeps them. */
179
186
  steps: DeclaredStep[];
180
- /** What the runner kept; `path` is what makes one a file. */
187
+ /** What the runner kept; `path` is what makes one a file, and a `body` — the bytes of a test's own
188
+ * attachment — is one to the platform only as a text. */
181
189
  attachments: {
182
190
  name: string;
183
191
  contentType?: string;
184
192
  path?: string;
193
+ body?: Buffer;
185
194
  }[];
186
195
  /** `metadata.ci.buildHref` of the run — the CI run that produced the report. */
187
196
  buildHref?: string;
@@ -200,6 +209,12 @@ interface ExpectedEntry {
200
209
  testCaseId?: string;
201
210
  externalKey?: KeyRef;
202
211
  }
212
+ /**
213
+ * Why the platform would not take the tests offered to it (plune-ai/cli#71): its review queue is at its
214
+ * ceiling, the project is at its case limit, or anything else — a throttle, an outage, a run that is not
215
+ * there. What a person does next depends on which, and only the first two have advice of their own.
216
+ */
217
+ type UnofferedWhy = 'queue' | 'cases' | 'other';
203
218
  /** The run as the platform answers with it. Only `id` is load-bearing for the client. */
204
219
  interface RunRecord {
205
220
  id: string;
@@ -240,6 +255,12 @@ interface RunStats extends SubmitCounts {
240
255
  * queue at capacity means "empty it and import again"; nothing else here means that.
241
256
  */
242
257
  unoffered: number;
258
+ /**
259
+ * Why they were not, said by the platform's own words and present only when `unoffered` is not zero:
260
+ * that is what carries the reason the paragraph above says a subtraction cannot. The platform's line
261
+ * about it is printed with the failure; this is what a command turns into the advice that fits.
262
+ */
263
+ unofferedWhy?: UnofferedWhy;
243
264
  /**
244
265
  * Results not delivered, written to the fallback file instead of the platform (#790): a batch
245
266
  * refused for any reason — its size, the network, the token, a closed run — or a result whose keys
@@ -256,6 +277,16 @@ interface RunStats extends SubmitCounts {
256
277
  skipped: number;
257
278
  failed: number;
258
279
  };
280
+ /**
281
+ * The same for the JSON and plain-text files of the accepted results (plune-ai/plune#928): counted
282
+ * apart from the screenshots because the two have limits of their own — 512 KiB and ten a result against
283
+ * 2 MB and twenty — and a person reading "3 skipped" has to know which kind it was.
284
+ */
285
+ textFiles: {
286
+ uploaded: number;
287
+ skipped: number;
288
+ failed: number;
289
+ };
259
290
  }
260
291
  /** Everything the core needs to talk to a deployment. */
261
292
  interface ReporterConfig {
@@ -375,6 +406,20 @@ interface EnvSettings {
375
406
  ignored: string[];
376
407
  }
377
408
  declare function readEnv(env?: NodeJS.ProcessEnv): EnvSettings;
409
+ /**
410
+ * The commit and the branch a run belongs to (plune-ai/plune#927), for `meta.sha` and `meta.branch`.
411
+ *
412
+ * `reported` is what the runner said about its CI — Playwright's `metadata.ci`, or the copy of it in
413
+ * its JSON report — and outranks the job's variables: it is a project's own word where the CI is one
414
+ * Playwright does not know, and it is where the tests ran when another job imports the report. So a
415
+ * report naming a commit other than this job's gets that commit and no branch of this job's: half of
416
+ * each would be a commit on a branch it is not on. Playwright gives no branch on GitHub at all, which
417
+ * is why the job's variables are read there.
418
+ *
419
+ * Each field is present only when something said it: outside a CI there is nothing to say, and nothing
420
+ * is guessed.
421
+ */
422
+ declare function ciCommit(reported?: unknown, env?: NodeJS.ProcessEnv): Pick<RunMeta, 'sha' | 'branch'>;
378
423
 
379
424
  /**
380
425
  * What ends up in a deferred batch.
@@ -397,10 +442,21 @@ declare const DEFAULT_FALLBACK_PATH: string;
397
442
  *
398
443
  * `runId: null` is a real state, not a missing value — the platform was unreachable when the run
399
444
  * was supposed to be created, so these results have no run yet and replay has to make one.
445
+ *
446
+ * `meta` is where that run came from — the commit and branch, the CI run, the runner (plune-ai/plune#927).
447
+ * Recorded so the run replay makes is the run the reporter would have made; replay reads it and nothing
448
+ * else about the machine it runs on. A line written before the field existed has none.
449
+ *
450
+ * `session` marks the reporter session that wrote the line, made once by that session (plune-ai/cli#45).
451
+ * A run of 24 tests at a batch of 10 is three lines, and replay opens one run for the lines that share a
452
+ * marker rather than one for each. A line written before the field existed has none, and is one run's
453
+ * worth by itself — nothing in it says otherwise.
400
454
  */
401
455
  interface DeferredBatch {
402
456
  runId: string | null;
403
457
  externalKey: string | null;
458
+ session?: string;
459
+ meta?: RunMeta;
404
460
  results: DeferredResult[];
405
461
  }
406
462
  /**
@@ -442,6 +498,11 @@ declare function errorContextOf(attempt: FailedAttempt, home?: string): string;
442
498
  * The files the runner kept for one attempt, whatever its status: a screenshot of a test that passed
443
499
  * is how a person sees what it checked (plune-ai/plune#913). Which of them the platform takes, the
444
500
  * session decides as it uploads — once, for both roads.
501
+ *
502
+ * A file is what has a `path`. What a test attached as a `body` leaves none — Playwright hands the bytes
503
+ * over and keeps nothing — so a JSON or a text is kept with its bytes (plune-ai/plune#928), and nothing
504
+ * else is: an image, a trace or a page is not taken from memory, and a suite whose screenshots are
505
+ * bodies must not hold them all until a batch is sent.
445
506
  */
446
507
  declare function filesOf(attempt: FailedAttempt): ResultFile[];
447
508
  /**
@@ -496,4 +557,4 @@ interface PlatformClient {
496
557
  }
497
558
  declare function createClient(opts: ClientOptions): PlatformClient;
498
559
 
499
- export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, appendBatch, createClient, errorContextOf, failureOf, filesOf, readEnv, repoRootOf, resultKey, startRun, webLink };
560
+ export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextOf, failureOf, filesOf, readEnv, repoRootOf, resultKey, startRun, webLink };
@@ -50,11 +50,17 @@ interface Attachment {
50
50
  url: string;
51
51
  contentType?: string;
52
52
  }
53
- /** A file the runner kept for an attempt, where it lies on this machine. */
53
+ /**
54
+ * A file the runner kept for an attempt: where it lies on this machine, or — for a text a test attached as
55
+ * a `body`, which leaves no file — the bytes themselves. Playwright gives one of the two; were both here,
56
+ * the bytes are what is sent.
57
+ */
54
58
  interface ResultFile {
55
59
  name: string;
56
60
  contentType?: string;
57
- path: string;
61
+ path?: string;
62
+ /** Only a JSON or a plain text — the types the platform keeps as a text; see `filesOf`. */
63
+ body?: Buffer;
58
64
  }
59
65
  /** One assertion's outcome, in the shape the platform already stores for its own runner. */
60
66
  interface AssertionRecord {
@@ -117,7 +123,8 @@ interface PendingResult {
117
123
  /**
118
124
  * The files the runner kept for this attempt, passed or not — built by `filesOf`. Never part of a
119
125
  * batch: the paths are this machine's. Once the platform has accepted the result, the core uploads
120
- * the screenshots among them to it (platform ADR 0040).
126
+ * the screenshots and the text files among them to it (platform ADR 0040) — never a body to the
127
+ * fallback file either, which keeps a file by its path and leaves the bytes out.
121
128
  */
122
129
  files?: ResultFile[];
123
130
  }
@@ -137,8 +144,8 @@ interface FailureDetail {
137
144
  line: number;
138
145
  column?: number;
139
146
  };
140
- /** The files the runner kept for the attempt, by name. The screenshots among them are uploaded to the
141
- * result besides (`files`); the rest stay in the CI run. */
147
+ /** The files the runner kept for the attempt, by name. The screenshots and text files among them are
148
+ * uploaded to the result besides (`files`); the rest stay in the CI run. */
142
149
  artifacts?: {
143
150
  name: string;
144
151
  contentType?: string;
@@ -177,11 +184,13 @@ interface FailedAttempt {
177
184
  errors: AttemptError[];
178
185
  /** The declared steps, outermost first — as the JSON report keeps them. */
179
186
  steps: DeclaredStep[];
180
- /** What the runner kept; `path` is what makes one a file. */
187
+ /** What the runner kept; `path` is what makes one a file, and a `body` — the bytes of a test's own
188
+ * attachment — is one to the platform only as a text. */
181
189
  attachments: {
182
190
  name: string;
183
191
  contentType?: string;
184
192
  path?: string;
193
+ body?: Buffer;
185
194
  }[];
186
195
  /** `metadata.ci.buildHref` of the run — the CI run that produced the report. */
187
196
  buildHref?: string;
@@ -200,6 +209,12 @@ interface ExpectedEntry {
200
209
  testCaseId?: string;
201
210
  externalKey?: KeyRef;
202
211
  }
212
+ /**
213
+ * Why the platform would not take the tests offered to it (plune-ai/cli#71): its review queue is at its
214
+ * ceiling, the project is at its case limit, or anything else — a throttle, an outage, a run that is not
215
+ * there. What a person does next depends on which, and only the first two have advice of their own.
216
+ */
217
+ type UnofferedWhy = 'queue' | 'cases' | 'other';
203
218
  /** The run as the platform answers with it. Only `id` is load-bearing for the client. */
204
219
  interface RunRecord {
205
220
  id: string;
@@ -240,6 +255,12 @@ interface RunStats extends SubmitCounts {
240
255
  * queue at capacity means "empty it and import again"; nothing else here means that.
241
256
  */
242
257
  unoffered: number;
258
+ /**
259
+ * Why they were not, said by the platform's own words and present only when `unoffered` is not zero:
260
+ * that is what carries the reason the paragraph above says a subtraction cannot. The platform's line
261
+ * about it is printed with the failure; this is what a command turns into the advice that fits.
262
+ */
263
+ unofferedWhy?: UnofferedWhy;
243
264
  /**
244
265
  * Results not delivered, written to the fallback file instead of the platform (#790): a batch
245
266
  * refused for any reason — its size, the network, the token, a closed run — or a result whose keys
@@ -256,6 +277,16 @@ interface RunStats extends SubmitCounts {
256
277
  skipped: number;
257
278
  failed: number;
258
279
  };
280
+ /**
281
+ * The same for the JSON and plain-text files of the accepted results (plune-ai/plune#928): counted
282
+ * apart from the screenshots because the two have limits of their own — 512 KiB and ten a result against
283
+ * 2 MB and twenty — and a person reading "3 skipped" has to know which kind it was.
284
+ */
285
+ textFiles: {
286
+ uploaded: number;
287
+ skipped: number;
288
+ failed: number;
289
+ };
259
290
  }
260
291
  /** Everything the core needs to talk to a deployment. */
261
292
  interface ReporterConfig {
@@ -375,6 +406,20 @@ interface EnvSettings {
375
406
  ignored: string[];
376
407
  }
377
408
  declare function readEnv(env?: NodeJS.ProcessEnv): EnvSettings;
409
+ /**
410
+ * The commit and the branch a run belongs to (plune-ai/plune#927), for `meta.sha` and `meta.branch`.
411
+ *
412
+ * `reported` is what the runner said about its CI — Playwright's `metadata.ci`, or the copy of it in
413
+ * its JSON report — and outranks the job's variables: it is a project's own word where the CI is one
414
+ * Playwright does not know, and it is where the tests ran when another job imports the report. So a
415
+ * report naming a commit other than this job's gets that commit and no branch of this job's: half of
416
+ * each would be a commit on a branch it is not on. Playwright gives no branch on GitHub at all, which
417
+ * is why the job's variables are read there.
418
+ *
419
+ * Each field is present only when something said it: outside a CI there is nothing to say, and nothing
420
+ * is guessed.
421
+ */
422
+ declare function ciCommit(reported?: unknown, env?: NodeJS.ProcessEnv): Pick<RunMeta, 'sha' | 'branch'>;
378
423
 
379
424
  /**
380
425
  * What ends up in a deferred batch.
@@ -397,10 +442,21 @@ declare const DEFAULT_FALLBACK_PATH: string;
397
442
  *
398
443
  * `runId: null` is a real state, not a missing value — the platform was unreachable when the run
399
444
  * was supposed to be created, so these results have no run yet and replay has to make one.
445
+ *
446
+ * `meta` is where that run came from — the commit and branch, the CI run, the runner (plune-ai/plune#927).
447
+ * Recorded so the run replay makes is the run the reporter would have made; replay reads it and nothing
448
+ * else about the machine it runs on. A line written before the field existed has none.
449
+ *
450
+ * `session` marks the reporter session that wrote the line, made once by that session (plune-ai/cli#45).
451
+ * A run of 24 tests at a batch of 10 is three lines, and replay opens one run for the lines that share a
452
+ * marker rather than one for each. A line written before the field existed has none, and is one run's
453
+ * worth by itself — nothing in it says otherwise.
400
454
  */
401
455
  interface DeferredBatch {
402
456
  runId: string | null;
403
457
  externalKey: string | null;
458
+ session?: string;
459
+ meta?: RunMeta;
404
460
  results: DeferredResult[];
405
461
  }
406
462
  /**
@@ -442,6 +498,11 @@ declare function errorContextOf(attempt: FailedAttempt, home?: string): string;
442
498
  * The files the runner kept for one attempt, whatever its status: a screenshot of a test that passed
443
499
  * is how a person sees what it checked (plune-ai/plune#913). Which of them the platform takes, the
444
500
  * session decides as it uploads — once, for both roads.
501
+ *
502
+ * A file is what has a `path`. What a test attached as a `body` leaves none — Playwright hands the bytes
503
+ * over and keeps nothing — so a JSON or a text is kept with its bytes (plune-ai/plune#928), and nothing
504
+ * else is: an image, a trace or a page is not taken from memory, and a suite whose screenshots are
505
+ * bodies must not hold them all until a batch is sent.
445
506
  */
446
507
  declare function filesOf(attempt: FailedAttempt): ResultFile[];
447
508
  /**
@@ -496,4 +557,4 @@ interface PlatformClient {
496
557
  }
497
558
  declare function createClient(opts: ClientOptions): PlatformClient;
498
559
 
499
- export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, appendBatch, createClient, errorContextOf, failureOf, filesOf, readEnv, repoRootOf, resultKey, startRun, webLink };
560
+ export { type AssertionRecord, type Attachment, type AttemptError, type ClientFailureKind, type ClientOptions, type ClientOutcome, DEFAULT_FALLBACK_PATH, type DeclaredStep, type DeferredBatch, type DeferredResult, type EnvSettings, type Execution, type ExpectedEntry, type ExternalKeyKind, type FailedAttempt, type FailureDetail, type KeyRef, type PendingResult, type PlatformClient, RESULT_KEY_MAX, type ReporterConfig, type ResultFile, type ResultStatus, type ResultSubmission, type RunKind, type RunMeta, type RunRecord, type RunSession, type RunStats, type RunnerLocation, type SubmitCounts, UNSUPPORTED_VARS, type UnofferedWhy, appendBatch, ciCommit, createClient, errorContextOf, failureOf, filesOf, readEnv, repoRootOf, resultKey, startRun, webLink };