@plune-ai/cli 0.16.0 → 0.17.1

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;
@@ -268,6 +277,25 @@ interface RunStats extends SubmitCounts {
268
277
  skipped: number;
269
278
  failed: number;
270
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
+ };
290
+ /**
291
+ * Every other file (a trace, a video, a page): only a project's bucket takes them (plune-ai/plune#946), so
292
+ * without one they are counted as skipped. With one, the summary adds all three kinds up.
293
+ */
294
+ otherFiles: {
295
+ uploaded: number;
296
+ skipped: number;
297
+ failed: number;
298
+ };
271
299
  }
272
300
  /** Everything the core needs to talk to a deployment. */
273
301
  interface ReporterConfig {
@@ -479,6 +507,11 @@ declare function errorContextOf(attempt: FailedAttempt, home?: string): string;
479
507
  * The files the runner kept for one attempt, whatever its status: a screenshot of a test that passed
480
508
  * is how a person sees what it checked (plune-ai/plune#913). Which of them the platform takes, the
481
509
  * session decides as it uploads — once, for both roads.
510
+ *
511
+ * A file is what has a `path`. What a test attached as a `body` leaves none — Playwright hands the bytes
512
+ * over and keeps nothing — so a JSON or a text is kept with its bytes (plune-ai/plune#928), and nothing
513
+ * else is: an image, a trace or a page is not taken from memory, and a suite whose screenshots are
514
+ * bodies must not hold them all until a batch is sent.
482
515
  */
483
516
  declare function filesOf(attempt: FailedAttempt): ResultFile[];
484
517
  /**
@@ -508,6 +541,26 @@ type ClientOutcome<T> = {
508
541
  kind: ClientFailureKind;
509
542
  status: number | null;
510
543
  detail: string;
544
+ code?: string;
545
+ };
546
+ /** What a PUT to a bucket carries: a file on disk, streamed at a length known beforehand, or bytes in memory. */
547
+ type PutSource = {
548
+ path: string;
549
+ size: number;
550
+ } | {
551
+ body: Buffer;
552
+ };
553
+ /**
554
+ * How a PUT ended. Never a URL, never a message: the link is a write key to someone's bucket, and the
555
+ * errors of the transports (`getaddrinfo ENOTFOUND <host>`, `no answer from <origin>`) name the host. All
556
+ * that survives is a status and a short code.
557
+ */
558
+ type PutOutcome = {
559
+ ok: true;
560
+ } | {
561
+ ok: false;
562
+ status: number | null;
563
+ code: string;
511
564
  };
512
565
  interface ClientOptions {
513
566
  apiUrl: string;
@@ -530,6 +583,12 @@ interface PlatformClient {
530
583
  * a proxy error page that echoes the request would put a token in a CI log.
531
584
  */
532
585
  del<T>(path: string): Promise<ClientOutcome<T>>;
586
+ /**
587
+ * The bytes to a short-lived link of the customer's bucket (plune-ai/plune#946): exactly the headers the
588
+ * link came with, no token of ours. Network failures and 5xx wait and try again, up to three times; a 403
589
+ * (the link has expired) comes back at once, for the caller to ask for a new one.
590
+ */
591
+ put(url: string, headers: Record<string, string>, source: PutSource): Promise<PutOutcome>;
533
592
  }
534
593
  declare function createClient(opts: ClientOptions): PlatformClient;
535
594
 
@@ -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;
@@ -268,6 +277,25 @@ interface RunStats extends SubmitCounts {
268
277
  skipped: number;
269
278
  failed: number;
270
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
+ };
290
+ /**
291
+ * Every other file (a trace, a video, a page): only a project's bucket takes them (plune-ai/plune#946), so
292
+ * without one they are counted as skipped. With one, the summary adds all three kinds up.
293
+ */
294
+ otherFiles: {
295
+ uploaded: number;
296
+ skipped: number;
297
+ failed: number;
298
+ };
271
299
  }
272
300
  /** Everything the core needs to talk to a deployment. */
273
301
  interface ReporterConfig {
@@ -479,6 +507,11 @@ declare function errorContextOf(attempt: FailedAttempt, home?: string): string;
479
507
  * The files the runner kept for one attempt, whatever its status: a screenshot of a test that passed
480
508
  * is how a person sees what it checked (plune-ai/plune#913). Which of them the platform takes, the
481
509
  * session decides as it uploads — once, for both roads.
510
+ *
511
+ * A file is what has a `path`. What a test attached as a `body` leaves none — Playwright hands the bytes
512
+ * over and keeps nothing — so a JSON or a text is kept with its bytes (plune-ai/plune#928), and nothing
513
+ * else is: an image, a trace or a page is not taken from memory, and a suite whose screenshots are
514
+ * bodies must not hold them all until a batch is sent.
482
515
  */
483
516
  declare function filesOf(attempt: FailedAttempt): ResultFile[];
484
517
  /**
@@ -508,6 +541,26 @@ type ClientOutcome<T> = {
508
541
  kind: ClientFailureKind;
509
542
  status: number | null;
510
543
  detail: string;
544
+ code?: string;
545
+ };
546
+ /** What a PUT to a bucket carries: a file on disk, streamed at a length known beforehand, or bytes in memory. */
547
+ type PutSource = {
548
+ path: string;
549
+ size: number;
550
+ } | {
551
+ body: Buffer;
552
+ };
553
+ /**
554
+ * How a PUT ended. Never a URL, never a message: the link is a write key to someone's bucket, and the
555
+ * errors of the transports (`getaddrinfo ENOTFOUND <host>`, `no answer from <origin>`) name the host. All
556
+ * that survives is a status and a short code.
557
+ */
558
+ type PutOutcome = {
559
+ ok: true;
560
+ } | {
561
+ ok: false;
562
+ status: number | null;
563
+ code: string;
511
564
  };
512
565
  interface ClientOptions {
513
566
  apiUrl: string;
@@ -530,6 +583,12 @@ interface PlatformClient {
530
583
  * a proxy error page that echoes the request would put a token in a CI log.
531
584
  */
532
585
  del<T>(path: string): Promise<ClientOutcome<T>>;
586
+ /**
587
+ * The bytes to a short-lived link of the customer's bucket (plune-ai/plune#946): exactly the headers the
588
+ * link came with, no token of ours. Network failures and 5xx wait and try again, up to three times; a 403
589
+ * (the link has expired) comes back at once, for the caller to ask for a new one.
590
+ */
591
+ put(url: string, headers: Record<string, string>, source: PutSource): Promise<PutOutcome>;
533
592
  }
534
593
  declare function createClient(opts: ClientOptions): PlatformClient;
535
594