@testrelic/playwright-analytics 2.13.1 → 2.14.0-next.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/dist/index.d.cts CHANGED
@@ -5,6 +5,58 @@ export { testRelicFixture } from './fixture.cjs';
5
5
  export { testRelicApiFixture } from './api-fixture.cjs';
6
6
  import { PlaywrightTestConfig, defineConfig as defineConfig$1 } from '@playwright/test';
7
7
 
8
+ /**
9
+ * Cloud upload receipt — the honest record of whether a run reached the platform.
10
+ *
11
+ * `summary.json` has always carried `testRunId`, and consumers (TestRelic Studio
12
+ * among them) read its presence as proof the run was uploaded. It is not proof:
13
+ * `testRunId` is `config.testRunId ?? randomUUID()`, generated locally in `onBegin`
14
+ * and written on every run — including a fully offline one, which then renders as
15
+ * "Uploaded" behind a dashboard link that 404s.
16
+ *
17
+ * The platform does not mint run ids either — `POST /runs/init` and `POST /runs`
18
+ * both file the run under the id the SDK sent — so there is no server-side id to
19
+ * record instead. What the SDK *does* know, and never wrote down, is whether the
20
+ * platform acknowledged the run. That is what `cloudUpload` carries.
21
+ *
22
+ * The block is written on EVERY run, so a consumer can distinguish three states:
23
+ * - block absent → an SDK too old to report a verdict; treat as unknown
24
+ * - `acknowledged:false` → the run did not reach the platform, and `detail` says why
25
+ * - `acknowledged:true` → the platform accepted the run under `runId`
26
+ *
27
+ * It is written twice per run, both times atomically (tmp + rename): once with the
28
+ * pre-upload state, and again once the upload settles. A process killed between the
29
+ * two leaves the earlier, more conservative verdict on disk — this block under-claims
30
+ * when it is wrong, never over-claims.
31
+ */
32
+
33
+ /**
34
+ * Whether the platform acknowledged this run, and what it did with it.
35
+ * Written to `summary.json` as `cloudUpload` on every run.
36
+ */
37
+ interface CloudUploadReceipt {
38
+ /** Cloud mode was on and a strategy the reporter acts on was selected. */
39
+ readonly attempted: boolean;
40
+ /** The platform accepted the run — realtime `/runs/init`, or the batch `POST /runs`. */
41
+ readonly acknowledged: boolean;
42
+ /** The id the run was filed under on the platform, or null when never acknowledged. */
43
+ readonly runId: string | null;
44
+ /** The ingest endpoint the run was sent to, or null when nothing was sent. */
45
+ readonly endpoint: string | null;
46
+ /** The run was closed out — realtime finalize returned ok, or the batch upload landed. */
47
+ readonly finalized: boolean;
48
+ /** Artifacts the platform confirmed it stored. */
49
+ readonly artifactsUploaded: number;
50
+ /** Artifacts offered for upload. */
51
+ readonly artifactsTotal: number;
52
+ /** Short plain reason when the run was not acknowledged. Null once it was. */
53
+ readonly detail: string | null;
54
+ }
55
+ /** A streaming summary carrying the upload receipt. */
56
+ type WithCloudUpload<T> = T & {
57
+ readonly cloudUpload: CloudUploadReceipt;
58
+ };
59
+
8
60
  /**
9
61
  * JSON schema version for the analytics timeline output.
10
62
  */
@@ -59,4 +111,4 @@ declare function recordNavigation(testInfo: {
59
111
  }>;
60
112
  } | null | undefined, url: string, navigationType?: NavigationType): void;
61
113
 
62
- export { SCHEMA_VERSION, defineConfig, recordNavigation };
114
+ export { type CloudUploadReceipt, SCHEMA_VERSION, type WithCloudUpload, defineConfig, recordNavigation };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,58 @@ export { testRelicFixture } from './fixture.js';
5
5
  export { testRelicApiFixture } from './api-fixture.js';
6
6
  import { PlaywrightTestConfig, defineConfig as defineConfig$1 } from '@playwright/test';
7
7
 
8
+ /**
9
+ * Cloud upload receipt — the honest record of whether a run reached the platform.
10
+ *
11
+ * `summary.json` has always carried `testRunId`, and consumers (TestRelic Studio
12
+ * among them) read its presence as proof the run was uploaded. It is not proof:
13
+ * `testRunId` is `config.testRunId ?? randomUUID()`, generated locally in `onBegin`
14
+ * and written on every run — including a fully offline one, which then renders as
15
+ * "Uploaded" behind a dashboard link that 404s.
16
+ *
17
+ * The platform does not mint run ids either — `POST /runs/init` and `POST /runs`
18
+ * both file the run under the id the SDK sent — so there is no server-side id to
19
+ * record instead. What the SDK *does* know, and never wrote down, is whether the
20
+ * platform acknowledged the run. That is what `cloudUpload` carries.
21
+ *
22
+ * The block is written on EVERY run, so a consumer can distinguish three states:
23
+ * - block absent → an SDK too old to report a verdict; treat as unknown
24
+ * - `acknowledged:false` → the run did not reach the platform, and `detail` says why
25
+ * - `acknowledged:true` → the platform accepted the run under `runId`
26
+ *
27
+ * It is written twice per run, both times atomically (tmp + rename): once with the
28
+ * pre-upload state, and again once the upload settles. A process killed between the
29
+ * two leaves the earlier, more conservative verdict on disk — this block under-claims
30
+ * when it is wrong, never over-claims.
31
+ */
32
+
33
+ /**
34
+ * Whether the platform acknowledged this run, and what it did with it.
35
+ * Written to `summary.json` as `cloudUpload` on every run.
36
+ */
37
+ interface CloudUploadReceipt {
38
+ /** Cloud mode was on and a strategy the reporter acts on was selected. */
39
+ readonly attempted: boolean;
40
+ /** The platform accepted the run — realtime `/runs/init`, or the batch `POST /runs`. */
41
+ readonly acknowledged: boolean;
42
+ /** The id the run was filed under on the platform, or null when never acknowledged. */
43
+ readonly runId: string | null;
44
+ /** The ingest endpoint the run was sent to, or null when nothing was sent. */
45
+ readonly endpoint: string | null;
46
+ /** The run was closed out — realtime finalize returned ok, or the batch upload landed. */
47
+ readonly finalized: boolean;
48
+ /** Artifacts the platform confirmed it stored. */
49
+ readonly artifactsUploaded: number;
50
+ /** Artifacts offered for upload. */
51
+ readonly artifactsTotal: number;
52
+ /** Short plain reason when the run was not acknowledged. Null once it was. */
53
+ readonly detail: string | null;
54
+ }
55
+ /** A streaming summary carrying the upload receipt. */
56
+ type WithCloudUpload<T> = T & {
57
+ readonly cloudUpload: CloudUploadReceipt;
58
+ };
59
+
8
60
  /**
9
61
  * JSON schema version for the analytics timeline output.
10
62
  */
@@ -59,4 +111,4 @@ declare function recordNavigation(testInfo: {
59
111
  }>;
60
112
  } | null | undefined, url: string, navigationType?: NavigationType): void;
61
113
 
62
- export { SCHEMA_VERSION, defineConfig, recordNavigation };
114
+ export { type CloudUploadReceipt, SCHEMA_VERSION, type WithCloudUpload, defineConfig, recordNavigation };