@empiricalrun/playwright-utils 0.58.5 → 0.59.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.
@@ -255,6 +255,26 @@ export interface paths {
255
255
  patch?: never;
256
256
  trace?: never;
257
257
  };
258
+ "/api/test-runs/{id}/shard-plan": {
259
+ parameters: {
260
+ query?: never;
261
+ header?: never;
262
+ path?: never;
263
+ cookie?: never;
264
+ };
265
+ get?: never;
266
+ put?: never;
267
+ /**
268
+ * ⚙️ 🧪 Store a test run's shard plan
269
+ * @description Stores the partition of a run's test selection across its run_test shards, keyed by the external run_id. Each shard reads its own slice back from `/{id}/shards/{shard_index}/assigned-tests` to build a `--test-list`. Idempotent: the first plan for a run wins.
270
+ */
271
+ post: operations["createTestRunShardPlan"];
272
+ delete?: never;
273
+ options?: never;
274
+ head?: never;
275
+ patch?: never;
276
+ trace?: never;
277
+ };
258
278
  "/api/test-runs/{id}/shards": {
259
279
  parameters: {
260
280
  query?: never;
@@ -275,6 +295,26 @@ export interface paths {
275
295
  patch?: never;
276
296
  trace?: never;
277
297
  };
298
+ "/api/test-runs/{id}/shards/{shard_index}/assigned-tests": {
299
+ parameters: {
300
+ query?: never;
301
+ header?: never;
302
+ path?: never;
303
+ cookie?: never;
304
+ };
305
+ /**
306
+ * ⚙️ 🧪 Get test run shard assigned tests
307
+ * @description Returns the duration-based shard plan's test-case ids for one shard, addressed by the run's external run_id. Used by the test-run-worker to build its `--test-list`. Returns 417 when the run has no plan, so the worker falls back to Playwright's `--shard=i/N` split.
308
+ */
309
+ get: operations["getTestRunShardAssignedTests"];
310
+ put?: never;
311
+ post?: never;
312
+ delete?: never;
313
+ options?: never;
314
+ head?: never;
315
+ patch?: never;
316
+ trace?: never;
317
+ };
278
318
  "/api/test-runs/{id}/shards/{shard_index}/resume": {
279
319
  parameters: {
280
320
  query?: never;
@@ -355,6 +395,26 @@ export interface paths {
355
395
  patch?: never;
356
396
  trace?: never;
357
397
  };
398
+ "/api/test-runs/{id}/test-case-durations": {
399
+ parameters: {
400
+ query?: never;
401
+ header?: never;
402
+ path?: never;
403
+ cookie?: never;
404
+ };
405
+ /**
406
+ * ⚙️ 🧪 Get test case durations for shard planning
407
+ * @description Returns the run's project's 7-day average duration per test case, keyed by the normalized 41-char Playwright test id, addressed by the run's external run_id. Used by the `run_setup` container to pack a shard plan: the analytics token is account-scoped and cannot be handed to a sandbox running customer test code, so the api-worker holds it and serves the numbers. Project-wide rather than per-run — the container filters to the tests it listed. A project with no history returns an empty object; a broken analytics query returns 503, so the container can tell the two apart and fall back rather than plan off nothing.
408
+ */
409
+ get: operations["getTestRunTestCaseDurations"];
410
+ put?: never;
411
+ post?: never;
412
+ delete?: never;
413
+ options?: never;
414
+ head?: never;
415
+ patch?: never;
416
+ trace?: never;
417
+ };
358
418
  "/api/test-runs/{id}/triage-session": {
359
419
  parameters: {
360
420
  query?: never;
@@ -2433,26 +2493,6 @@ export interface paths {
2433
2493
  patch?: never;
2434
2494
  trace?: never;
2435
2495
  };
2436
- "/api/chat-sessions/{id}/sandbox/terminal-session": {
2437
- parameters: {
2438
- query?: never;
2439
- header?: never;
2440
- path?: never;
2441
- cookie?: never;
2442
- };
2443
- get?: never;
2444
- put?: never;
2445
- /**
2446
- * ⚙️ Create a sandbox terminal session
2447
- * @description Creates a PTY session on the sandbox and returns the WebSocket URL and token to connect to it. Super-admin only.
2448
- */
2449
- post: operations["createChatSessionSandboxTerminalSession"];
2450
- delete?: never;
2451
- options?: never;
2452
- head?: never;
2453
- patch?: never;
2454
- trace?: never;
2455
- };
2456
2496
  "/api/chat-sessions/{id}/session-state": {
2457
2497
  parameters: {
2458
2498
  query?: never;
@@ -2593,6 +2633,26 @@ export interface paths {
2593
2633
  patch?: never;
2594
2634
  trace?: never;
2595
2635
  };
2636
+ "/api/chat-sessions/sandbox/protected-branches": {
2637
+ parameters: {
2638
+ query?: never;
2639
+ header?: never;
2640
+ path?: never;
2641
+ cookie?: never;
2642
+ };
2643
+ /**
2644
+ * ⚙️ List branches the sandbox may not push to
2645
+ * @description Returns the project's default branch and the chat session's base branch. The sandbox git proxy blocks pushes to these. The session is derived from the sandbox-delegation principal.
2646
+ */
2647
+ get: operations["getChatSessionSandboxProtectedBranches"];
2648
+ put?: never;
2649
+ post?: never;
2650
+ delete?: never;
2651
+ options?: never;
2652
+ head?: never;
2653
+ patch?: never;
2654
+ trace?: never;
2655
+ };
2596
2656
  "/api/chat-sessions/users": {
2597
2657
  parameters: {
2598
2658
  query?: never;
@@ -8920,6 +8980,10 @@ export interface components {
8920
8980
  /** @description Human-readable error message. */
8921
8981
  error: string;
8922
8982
  };
8983
+ SandboxProtectedBranches: {
8984
+ /** @description Branch names the sandbox must not push to. */
8985
+ branches: string[];
8986
+ };
8923
8987
  SandboxActionSuccess: {
8924
8988
  /** @description Always true when the action succeeded. */
8925
8989
  success: boolean;
@@ -8986,14 +9050,6 @@ export interface components {
8986
9050
  /** @description Human-readable error message. */
8987
9051
  error: string;
8988
9052
  };
8989
- SandboxTerminalSession: {
8990
- /** @description WebSocket URL for the PTY session. */
8991
- ws_url: string;
8992
- /** @description Auth token for the terminal WebSocket. */
8993
- token: string;
8994
- /** @description Error message, or null on success. */
8995
- error: string | null;
8996
- };
8997
9053
  SubscribeChatSessionResponse: {
8998
9054
  data: {
8999
9055
  already_waiting: boolean;
@@ -10143,8 +10199,6 @@ export interface components {
10143
10199
  id: number;
10144
10200
  /** @description ISO 8601 creation timestamp. */
10145
10201
  created_at: string;
10146
- /** @description Test case slug. */
10147
- slug: string | null;
10148
10202
  /** @description Playwright test ID. */
10149
10203
  pw_test_id: string | null;
10150
10204
  /** @description Test run ID. */
@@ -10367,7 +10421,6 @@ export interface components {
10367
10421
  /** @enum {string} */
10368
10422
  job_type: "merge_reports";
10369
10423
  storage_bucket?: string;
10370
- assigned_shard_manifest_formula?: string;
10371
10424
  resume_run_from_shard?: number;
10372
10425
  } | null;
10373
10426
  };
@@ -10555,6 +10608,29 @@ export interface components {
10555
10608
  resume_from: number | null;
10556
10609
  };
10557
10610
  };
10611
+ TestRunTestCaseDurationsResponse: {
10612
+ data: {
10613
+ /** @description Length of the analytics window the averages cover. */
10614
+ days: number;
10615
+ /** @description Per-test-case history, keyed by the normalized 41-char Playwright test id. */
10616
+ durations: {
10617
+ [key: string]: {
10618
+ /** @description Mean total duration over the window, in ms. */
10619
+ avg_duration_total: number;
10620
+ /** @description Results the average was taken over. */
10621
+ total_runs: number;
10622
+ };
10623
+ };
10624
+ };
10625
+ };
10626
+ TestRunShardAssignedTestsResponse: {
10627
+ data: {
10628
+ /** @description Playwright test-case ids this shard is assigned to execute. */
10629
+ test_case_ids: string[];
10630
+ /** @description Shard count the plan was built for. */
10631
+ total_shards: number;
10632
+ };
10633
+ };
10558
10634
  TestRunLogsResponse: {
10559
10635
  /** @description Response payload. */
10560
10636
  data: {
@@ -10607,7 +10683,7 @@ export interface components {
10607
10683
  /** @description Zero-based shard index, when stopping a sharded run. */
10608
10684
  shard_index?: number;
10609
10685
  /**
10610
- * @description Job type of the shard to stop. merge_reports and run_setup share shard_index 0. Defaults to merge_reports for index 0 (legacy callers), run_test otherwise.
10686
+ * @description Job type of the shard to stop. merge_reports and run_setup share shard_index 0. When omitted, the job is resolved from the run's shard rows; an index that carries more than one stoppable job is a 400. `run_setup` is never stoppable and is always rejected.
10611
10687
  * @enum {string}
10612
10688
  */
10613
10689
  job_type?: "run_test" | "merge_reports" | "run_setup";
@@ -10655,20 +10731,70 @@ export interface components {
10655
10731
  };
10656
10732
  };
10657
10733
  PutRunManifestRequest: {
10658
- /** @description Structured scheduled tests (preferred). */
10659
- tests?: {
10734
+ /** @description Structured scheduled tests. */
10735
+ tests: {
10660
10736
  /** @description Full test title. */
10661
10737
  name: string;
10662
10738
  /** @description Playwright test id, if known. */
10663
10739
  pw_test_id?: string | null;
10664
10740
  }[];
10665
- /** @description Legacy base64-gzip manifest blob. Ignored when `tests` is present. */
10666
- run_manifest?: string;
10741
+ /** @description Scheduled dependency groups (serial blocks). */
10742
+ dependency_groups?: {
10743
+ /** @description Stable group id. */
10744
+ id: string;
10745
+ /**
10746
+ * @description Only Playwright serial groups today.
10747
+ * @enum {string}
10748
+ */
10749
+ kind: "playwright_serial";
10750
+ /** @description Members in execution order. */
10751
+ members: {
10752
+ /** @description Playwright test id of the member. */
10753
+ test_case_id: string;
10754
+ /** @description 0-based execution order within the group. */
10755
+ dependency_order: number;
10756
+ }[];
10757
+ }[];
10667
10758
  /** @description Zero-based shard index, when the run is sharded. */
10668
10759
  shard_index?: number;
10669
10760
  /** @description Total number of shards, when the run is sharded. */
10670
10761
  total_shards?: number;
10671
10762
  };
10763
+ ShardPlanResponse: {
10764
+ /** @description Response payload. */
10765
+ data: {
10766
+ /** @description Rows inserted. Zero when the run was already planned — the first plan wins and a retried POST is a no-op. */
10767
+ shards_written: number;
10768
+ /** @description Tests across the posted partition. */
10769
+ total_tests: number;
10770
+ };
10771
+ };
10772
+ PostShardPlanRequest: {
10773
+ /** @description Shard count this partition was built for. Stored on every row and checked against the shard's own total_shards when the plan is read. */
10774
+ total_shards: number;
10775
+ /** @description One entry per run_test shard. */
10776
+ shards: {
10777
+ /** @description 1-based index of the run_test shard. Index 0 is the run_setup job and never carries an assignment. */
10778
+ shard_index: number;
10779
+ /** @description Tests assigned to this shard. */
10780
+ tests: {
10781
+ /** @description Playwright test id (`pw_test_id`) assigned to this shard. */
10782
+ id: string;
10783
+ /** @description Scheduled test line (`[project] › file › suite › title`). Not stored yet; the server-written run manifest is its consumer. */
10784
+ name: string;
10785
+ }[];
10786
+ }[];
10787
+ /** @description How the partition was chosen, stored verbatim for provenance (e.g. `equal split over the canonical listing`). */
10788
+ reason?: string;
10789
+ /** @description Modelled wall-clock of the slowest shard, in ms. */
10790
+ predicted_makespan_ms?: number;
10791
+ /** @description Modelled wall-clock at the ceiling — what the run would have done without the reduction, in ms. */
10792
+ baseline_makespan_ms?: number;
10793
+ /** @description Heaviest single schedulable unit, in ms. The floor no shard count can beat. */
10794
+ longest_unit_ms?: number;
10795
+ /** @description Fraction of planned tests that had a real historical duration. */
10796
+ coverage?: number;
10797
+ };
10672
10798
  SkipTestRunResponse: {
10673
10799
  data: {
10674
10800
  /** @description ID of the GitHub check run created as skipped, or null if no GitHub reporter app is installed for the repo. */
@@ -10731,6 +10857,8 @@ export interface components {
10731
10857
  last_commit_before_run_started_at: string | null;
10732
10858
  /** @description Snoozes matching this case at read time. */
10733
10859
  snooze_info: components["schemas"]["TestRunCaseSnoozeInfo"][];
10860
+ /** @description Attempts that never ran because an earlier member of this case's Playwright serial group failed on the same attempt. Null when the case is not in a snapshotted group or when nothing was blocked. */
10861
+ skipped_attempts: components["schemas"]["TestRunCaseSkippedAttempt"][] | null;
10734
10862
  };
10735
10863
  TestRunCaseRetryDetail: {
10736
10864
  /** @description Zero-based retry attempt index. */
@@ -10804,6 +10932,19 @@ export interface components {
10804
10932
  /** @description Environment the snooze is scoped to, if any. */
10805
10933
  scoped_to_environment_id: number | null;
10806
10934
  };
10935
+ TestRunCaseSkippedAttempt: {
10936
+ /** @description Attempt index this explains. */
10937
+ retry_index: number;
10938
+ /** @description The serial-group member that blocked this attempt. */
10939
+ blocked_by: {
10940
+ /** @description Playwright test id of the blocking test. */
10941
+ pw_test_id: string | null;
10942
+ /** @description Title of the blocking test. */
10943
+ name: string;
10944
+ /** @description The blocking test's outcome on this attempt. */
10945
+ status: string;
10946
+ };
10947
+ };
10807
10948
  GetTestRunCaseResponse: {
10808
10949
  /** @description Response payload. */
10809
10950
  data: {
@@ -10845,6 +10986,8 @@ export interface components {
10845
10986
  last_commit_before_run_started_at: string | null;
10846
10987
  /** @description Snoozes matching this case at read time. */
10847
10988
  snooze_info: components["schemas"]["TestRunCaseSnoozeInfo"][];
10989
+ /** @description Attempts that never ran because an earlier member of this case's Playwright serial group failed on the same attempt. Null when the case is not in a snapshotted group or when nothing was blocked. */
10990
+ skipped_attempts: components["schemas"]["TestRunCaseSkippedAttempt"][] | null;
10848
10991
  };
10849
10992
  };
10850
10993
  UiGetTestRunResponse: {
@@ -13007,6 +13150,51 @@ export interface operations {
13007
13150
  };
13008
13151
  };
13009
13152
  };
13153
+ createTestRunShardPlan: {
13154
+ parameters: {
13155
+ query?: never;
13156
+ header?: never;
13157
+ path: {
13158
+ /** @description External run_id of the test run. */
13159
+ id: number;
13160
+ };
13161
+ cookie?: never;
13162
+ };
13163
+ requestBody?: {
13164
+ content: {
13165
+ "application/json": components["schemas"]["PostShardPlanRequest"];
13166
+ };
13167
+ };
13168
+ responses: {
13169
+ /** @description The shard plan was stored. */
13170
+ 200: {
13171
+ headers: {
13172
+ [name: string]: unknown;
13173
+ };
13174
+ content: {
13175
+ "application/json": components["schemas"]["ShardPlanResponse"];
13176
+ };
13177
+ };
13178
+ /** @description The posted plan is not a valid partition. */
13179
+ 400: {
13180
+ headers: {
13181
+ [name: string]: unknown;
13182
+ };
13183
+ content: {
13184
+ "application/json": components["schemas"]["ErrorResponse"];
13185
+ };
13186
+ };
13187
+ /** @description Test run not found. */
13188
+ 404: {
13189
+ headers: {
13190
+ [name: string]: unknown;
13191
+ };
13192
+ content: {
13193
+ "application/json": components["schemas"]["ErrorResponse"];
13194
+ };
13195
+ };
13196
+ };
13197
+ };
13010
13198
  listTestRunShards: {
13011
13199
  parameters: {
13012
13200
  query?: never;
@@ -13039,6 +13227,49 @@ export interface operations {
13039
13227
  };
13040
13228
  };
13041
13229
  };
13230
+ getTestRunShardAssignedTests: {
13231
+ parameters: {
13232
+ query?: never;
13233
+ header?: never;
13234
+ path: {
13235
+ /** @description External run_id of the test run. */
13236
+ id: number;
13237
+ /** @description Zero-based shard index within the run. */
13238
+ shard_index: number | null;
13239
+ };
13240
+ cookie?: never;
13241
+ };
13242
+ requestBody?: never;
13243
+ responses: {
13244
+ /** @description The shard's assigned test-case ids. */
13245
+ 200: {
13246
+ headers: {
13247
+ [name: string]: unknown;
13248
+ };
13249
+ content: {
13250
+ "application/json": components["schemas"]["TestRunShardAssignedTestsResponse"];
13251
+ };
13252
+ };
13253
+ /** @description Test run not found. */
13254
+ 404: {
13255
+ headers: {
13256
+ [name: string]: unknown;
13257
+ };
13258
+ content: {
13259
+ "application/json": components["schemas"]["ErrorResponse"];
13260
+ };
13261
+ };
13262
+ /** @description No shard plan for this run or shard. */
13263
+ 417: {
13264
+ headers: {
13265
+ [name: string]: unknown;
13266
+ };
13267
+ content: {
13268
+ "application/json": components["schemas"]["ErrorResponse"];
13269
+ };
13270
+ };
13271
+ };
13272
+ };
13042
13273
  getTestRunShardResume: {
13043
13274
  parameters: {
13044
13275
  query?: never;
@@ -13202,6 +13433,47 @@ export interface operations {
13202
13433
  };
13203
13434
  };
13204
13435
  };
13436
+ getTestRunTestCaseDurations: {
13437
+ parameters: {
13438
+ query?: never;
13439
+ header?: never;
13440
+ path: {
13441
+ /** @description Test run identifier (database id or external run_id). */
13442
+ id: number;
13443
+ };
13444
+ cookie?: never;
13445
+ };
13446
+ requestBody?: never;
13447
+ responses: {
13448
+ /** @description The project's test-case duration history. */
13449
+ 200: {
13450
+ headers: {
13451
+ [name: string]: unknown;
13452
+ };
13453
+ content: {
13454
+ "application/json": components["schemas"]["TestRunTestCaseDurationsResponse"];
13455
+ };
13456
+ };
13457
+ /** @description Test run not found. */
13458
+ 404: {
13459
+ headers: {
13460
+ [name: string]: unknown;
13461
+ };
13462
+ content: {
13463
+ "application/json": components["schemas"]["ErrorResponse"];
13464
+ };
13465
+ };
13466
+ /** @description Analytics is unavailable. */
13467
+ 503: {
13468
+ headers: {
13469
+ [name: string]: unknown;
13470
+ };
13471
+ content: {
13472
+ "application/json": components["schemas"]["ErrorResponse"];
13473
+ };
13474
+ };
13475
+ };
13476
+ };
13205
13477
  createTestRunTriageSession: {
13206
13478
  parameters: {
13207
13479
  query?: never;
@@ -18748,8 +19020,8 @@ export interface operations {
18748
19020
  content: {
18749
19021
  "application/json": {
18750
19022
  message: string;
18751
- /** @enum {string|null} */
18752
- send_action?: "queue" | "stop" | "follow_up" | null;
19023
+ /** @enum {string} */
19024
+ send_action: "steer" | "follow_up" | "stop";
18753
19025
  created_by?: string | null;
18754
19026
  };
18755
19027
  };
@@ -19212,65 +19484,6 @@ export interface operations {
19212
19484
  };
19213
19485
  };
19214
19486
  };
19215
- createChatSessionSandboxTerminalSession: {
19216
- parameters: {
19217
- query?: never;
19218
- header?: never;
19219
- path: {
19220
- /** @description Chat session ID. */
19221
- id: number;
19222
- };
19223
- cookie?: never;
19224
- };
19225
- requestBody?: never;
19226
- responses: {
19227
- /** @description Terminal session connection details. */
19228
- 200: {
19229
- headers: {
19230
- [name: string]: unknown;
19231
- };
19232
- content: {
19233
- "application/json": components["schemas"]["SandboxTerminalSession"];
19234
- };
19235
- };
19236
- /** @description Invalid request. */
19237
- 400: {
19238
- headers: {
19239
- [name: string]: unknown;
19240
- };
19241
- content: {
19242
- "application/json": components["schemas"]["ErrorResponse"];
19243
- };
19244
- };
19245
- /** @description Forbidden. */
19246
- 403: {
19247
- headers: {
19248
- [name: string]: unknown;
19249
- };
19250
- content: {
19251
- "application/json": components["schemas"]["SandboxTerminalSession"];
19252
- };
19253
- };
19254
- /** @description Sandbox not found. */
19255
- 404: {
19256
- headers: {
19257
- [name: string]: unknown;
19258
- };
19259
- content: {
19260
- "application/json": components["schemas"]["SandboxTerminalSession"];
19261
- };
19262
- };
19263
- /** @description Failed to create terminal session. */
19264
- 500: {
19265
- headers: {
19266
- [name: string]: unknown;
19267
- };
19268
- content: {
19269
- "application/json": components["schemas"]["SandboxTerminalSession"];
19270
- };
19271
- };
19272
- };
19273
- };
19274
19487
  getChatSessionState: {
19275
19488
  parameters: {
19276
19489
  query?: {
@@ -19576,6 +19789,44 @@ export interface operations {
19576
19789
  };
19577
19790
  };
19578
19791
  };
19792
+ getChatSessionSandboxProtectedBranches: {
19793
+ parameters: {
19794
+ query?: never;
19795
+ header?: never;
19796
+ path?: never;
19797
+ cookie?: never;
19798
+ };
19799
+ requestBody?: never;
19800
+ responses: {
19801
+ /** @description Protected branches. */
19802
+ 200: {
19803
+ headers: {
19804
+ [name: string]: unknown;
19805
+ };
19806
+ content: {
19807
+ "application/json": components["schemas"]["SandboxProtectedBranches"];
19808
+ };
19809
+ };
19810
+ /** @description The caller is not a sandbox principal. */
19811
+ 400: {
19812
+ headers: {
19813
+ [name: string]: unknown;
19814
+ };
19815
+ content: {
19816
+ "application/json": components["schemas"]["SandboxErrorMessage"];
19817
+ };
19818
+ };
19819
+ /** @description Chat session not found. */
19820
+ 404: {
19821
+ headers: {
19822
+ [name: string]: unknown;
19823
+ };
19824
+ content: {
19825
+ "application/json": components["schemas"]["SandboxErrorMessage"];
19826
+ };
19827
+ };
19828
+ };
19829
+ };
19579
19830
  listChatSessionUsers: {
19580
19831
  parameters: {
19581
19832
  query?: {