@cnc-tools/storm 0.12.0 → 0.14.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.
Files changed (188) hide show
  1. package/dist/application.js +5 -1
  2. package/dist/bin/storm.js +6 -2
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/{chunk-FK4RLDEK.js → chunk-27P2QSIM.js} +1 -1
  5. package/dist/chunks/{chunk-ODQHQJLE.js → chunk-5ED3IDUJ.js} +749 -1121
  6. package/dist/chunks/{chunk-FSP3SJ35.js → chunk-5TMHYH7G.js} +16 -46
  7. package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-BFLYGMG3.js} +12 -7
  8. package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
  9. package/dist/chunks/{chunk-RYRJNHL7.js → chunk-HOKDKP5A.js} +3 -9
  10. package/dist/chunks/{chunk-SXW6XN4R.js → chunk-IVRRGGCD.js} +60 -20
  11. package/dist/chunks/{chunk-TMQQYHUX.js → chunk-QBR5VHJ7.js} +1 -1
  12. package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
  13. package/dist/chunks/{chunk-TEEZL3GA.js → chunk-RKONDLPS.js} +17 -71
  14. package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
  15. package/dist/chunks/{chunk-4XT5RC5T.js → chunk-XPCUINWS.js} +6 -42
  16. package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-YBPTMJUM.js} +123 -180
  17. package/dist/chunks/{chunk-ISGQJIQM.js → chunk-Z5OXOZD3.js} +125 -83
  18. package/dist/chunks/{chunk-7D6LC5JY.js → chunk-ZH5R7W4A.js} +7 -39
  19. package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-FBVWUUMT.js} +7 -7
  20. package/dist/commands/exec/command.d.ts +4 -90
  21. package/dist/commands/exec/command.js +15 -41
  22. package/dist/commands/exec/define-run-command.d.ts +19 -100
  23. package/dist/commands/exec/define-run-command.js +48 -15
  24. package/dist/commands/exec/driver-plan.d.ts +24 -16
  25. package/dist/commands/exec/driver-plan.js +34 -15
  26. package/dist/commands/exec/driver-refusals.js +7 -6
  27. package/dist/commands/exec/exec-words.d.ts +1 -1
  28. package/dist/commands/exec/exec-words.js +8 -2
  29. package/dist/commands/exec/final-results.d.ts +39 -0
  30. package/dist/commands/exec/final-results.js +29 -0
  31. package/dist/commands/exec/live-view.js +18 -22
  32. package/dist/commands/exec/metadata.js +1 -1
  33. package/dist/commands/exec/outcomes.d.ts +15 -109
  34. package/dist/commands/exec/outcomes.js +25 -39
  35. package/dist/commands/exec/plan-run.d.ts +11 -3
  36. package/dist/commands/exec/plan-run.js +3 -2
  37. package/dist/commands/exec/progress.d.ts +3 -19
  38. package/dist/commands/exec/progress.js +16 -60
  39. package/dist/commands/exec/run-command.d.ts +5 -24
  40. package/dist/commands/exec/run-command.js +32 -84
  41. package/dist/commands/exec/run-metadata.d.ts +0 -6
  42. package/dist/commands/exec/run-metadata.js +2 -8
  43. package/dist/commands/exec/snapshot-text.d.ts +7 -16
  44. package/dist/commands/exec/snapshot-text.js +9 -49
  45. package/dist/commands/exec/test-plan.d.ts +2 -1
  46. package/dist/commands/exec/test-plan.js +13 -4
  47. package/dist/commands/exec/tests-summary.d.ts +2 -2
  48. package/dist/commands/exec/view.js +2 -12
  49. package/dist/commands/exec/worker-chart.d.ts +1 -1
  50. package/dist/commands/playwright/command.d.ts +12 -97
  51. package/dist/commands/playwright/command.js +14 -14
  52. package/dist/commands/playwright/metadata.js +2 -2
  53. package/dist/commands/runs/facts.d.ts +1 -37
  54. package/dist/commands/runs/facts.js +4 -36
  55. package/dist/commands/runs/list/command.d.ts +0 -72
  56. package/dist/commands/runs/list/command.js +6 -6
  57. package/dist/commands/runs/list/outcomes.d.ts +0 -36
  58. package/dist/commands/runs/logs/command.js +6 -6
  59. package/dist/commands/runs/show/command.d.ts +2 -74
  60. package/dist/commands/runs/show/command.js +16 -43
  61. package/dist/commands/runs/show/metadata.js +1 -1
  62. package/dist/commands/runs/show/outcomes.d.ts +1 -37
  63. package/dist/commands/runs/show/outcomes.js +8 -42
  64. package/dist/commands/snapshots/build/command.d.ts +14 -411
  65. package/dist/commands/snapshots/build/command.js +59 -234
  66. package/dist/commands/snapshots/build/metadata.js +10 -7
  67. package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
  68. package/dist/commands/snapshots/build/outcomes.js +29 -196
  69. package/dist/commands/snapshots/list/command.d.ts +2 -36
  70. package/dist/commands/snapshots/list/command.js +20 -56
  71. package/dist/commands/snapshots/list/metadata.js +1 -1
  72. package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
  73. package/dist/commands/snapshots/list/outcomes.js +13 -53
  74. package/dist/commands/vitest/command.d.ts +14 -98
  75. package/dist/commands/vitest/command.js +14 -14
  76. package/dist/commands/vitest/metadata.js +2 -2
  77. package/dist/config/resolve.d.ts +1 -1
  78. package/dist/config/resolve.js +2 -1
  79. package/dist/config/schema.d.ts +8 -0
  80. package/dist/config/schema.js +5 -4
  81. package/dist/core/events.d.ts +5 -6
  82. package/dist/core/run-state.d.ts +7 -29
  83. package/dist/core/run-state.js +3 -26
  84. package/dist/core/run.d.ts +6 -14
  85. package/dist/core/run.js +17 -28
  86. package/dist/extensions/playwright/driver.js +17 -10
  87. package/dist/extensions/testserver/commands/pool/create/command.js +4 -4
  88. package/dist/extensions/testserver/commands/pool/list/command.js +2 -2
  89. package/dist/extensions/testserver/definition.d.ts +1 -1
  90. package/dist/extensions/testserver/extension.d.ts +1 -1
  91. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  92. package/dist/extensions/testserver/options/rules.js +5 -5
  93. package/dist/extensions/testserver/resource.d.ts +1 -1
  94. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -0
  95. package/dist/extensions/testserver/vercel-cli/index.js +1 -0
  96. package/dist/extensions/testserver/vercel-cli/report.js +5 -2
  97. package/dist/extensions/testserver/vercel-cli/session-id.d.ts +8 -0
  98. package/dist/extensions/testserver/vercel-cli/session-id.js +16 -0
  99. package/dist/extensions/testserver/vitest/config.d.ts +2 -2
  100. package/dist/extensions/testserver/vitest/config.js +2 -2
  101. package/dist/extensions/testserver/vitest/container-scope.d.ts +25 -16
  102. package/dist/extensions/testserver/vitest/container-scope.js +32 -13
  103. package/dist/extensions/testserver/vitest/diagnostics.d.ts +5 -4
  104. package/dist/extensions/testserver/vitest/diagnostics.js +15 -8
  105. package/dist/extensions/testserver/vitest/fixtures.d.ts +10 -1
  106. package/dist/extensions/testserver/vitest/fixtures.js +36 -10
  107. package/dist/extensions/testserver/vitest/types.d.ts +9 -0
  108. package/dist/extensions/vitest/driver.js +28 -14
  109. package/dist/extensions/vitest/plan/gateways.d.ts +28 -5
  110. package/dist/extensions/vitest/plan/gateways.js +2 -2
  111. package/dist/extensions/vitest/plan/list-output.d.ts +5 -0
  112. package/dist/extensions/vitest/plan/list-output.js +23 -9
  113. package/dist/extensions/vitest/plan/live/list-gateway.d.ts +3 -2
  114. package/dist/extensions/vitest/plan/live/list-gateway.js +77 -64
  115. package/dist/extensions/vitest/plan/plan-over.d.ts +19 -7
  116. package/dist/extensions/vitest/plan/plan-over.js +18 -7
  117. package/dist/extensions/vitest/plan/plan.d.ts +14 -5
  118. package/dist/extensions/vitest/plan/plan.js +23 -9
  119. package/dist/extensions.d.ts +2 -2
  120. package/dist/run-directory/index.d.ts +1 -1
  121. package/dist/run-directory/index.js +0 -1
  122. package/dist/run-directory/plan.d.ts +3 -2
  123. package/dist/run-directory/plan.js +6 -3
  124. package/dist/run-directory/recording.js +2 -2
  125. package/dist/run-directory/run-record.d.ts +18 -135
  126. package/dist/run-directory/run-record.js +8 -68
  127. package/dist/runner/build-snapshots.d.ts +50 -114
  128. package/dist/runner/build-snapshots.js +70 -159
  129. package/dist/runner/events.d.ts +4 -88
  130. package/dist/runner/gateways.d.ts +5 -23
  131. package/dist/runner/index.d.ts +5 -6
  132. package/dist/runner/index.js +1 -1
  133. package/dist/runner/live/snapshot-records.js +7 -18
  134. package/dist/runner/prepare.d.ts +11 -22
  135. package/dist/runner/prepare.js +6 -17
  136. package/dist/runner/ready.d.ts +16 -45
  137. package/dist/runner/ready.js +34 -59
  138. package/dist/runner/recipe.d.ts +5 -45
  139. package/dist/runner/recipe.js +0 -41
  140. package/dist/runner/sandboxed-command.d.ts +5 -3
  141. package/dist/runner/sandboxed-command.js +10 -4
  142. package/dist/runner/scope.d.ts +8 -25
  143. package/dist/runner/scope.js +4 -8
  144. package/dist/runner/session.d.ts +18 -65
  145. package/dist/runner/session.js +15 -83
  146. package/dist/runner/snapshot-build.d.ts +2 -2
  147. package/dist/runner/snapshot-cache.d.ts +22 -74
  148. package/dist/runner/snapshot-cache.js +15 -107
  149. package/dist/runner/snapshot-inspect.d.ts +9 -13
  150. package/dist/runner/snapshot-inspect.js +48 -57
  151. package/dist/runner/snapshot-key.d.ts +9 -14
  152. package/dist/runner/snapshot-key.js +15 -22
  153. package/dist/sdk/extension/driver.d.ts +32 -6
  154. package/dist/sdk/extension/driver.js +12 -2
  155. package/dist/sdk/extension/index.d.ts +1 -1
  156. package/dist/sdk/extension/index.js +2 -1
  157. package/dist/sdk/extension/resource-definition.d.ts +6 -5
  158. package/dist/vendor/testserver-sdk/container/api-request.d.ts +2 -3
  159. package/dist/vendor/testserver-sdk/container/api-request.js +2 -3
  160. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -2
  161. package/dist/vendor/testserver-sdk/container/container.js +10 -7
  162. package/dist/vendor/testserver-sdk/container/recorder.d.ts +29 -7
  163. package/dist/vendor/testserver-sdk/container/recorder.js +26 -14
  164. package/dist/vendor/testserver-sdk/index.d.ts +1 -1
  165. package/dist/vendor/testserver-sdk/index.js +1 -1
  166. package/dist/vendor/testserver-sdk/proxy/exchange.d.ts +24 -5
  167. package/dist/vendor/testserver-sdk/proxy/exchange.js +43 -25
  168. package/dist/vendor/testserver-sdk/proxy/faulted-exchange.js +15 -10
  169. package/dist/vendor/testserver-sdk/proxy/faults.d.ts +6 -5
  170. package/dist/vendor/testserver-sdk/proxy/proxy.d.ts +10 -1
  171. package/dist/vendor/testserver-sdk/proxy/proxy.js +5 -3
  172. package/dist/vendor/testserver-sdk/proxy/records.d.ts +17 -17
  173. package/dist/vendor/testserver-sdk/proxy/records.js +18 -17
  174. package/dist/vendor/testserver-sdk/records/body.d.ts +7 -9
  175. package/dist/vendor/testserver-sdk/records/body.js +10 -15
  176. package/dist/vendor/testserver-sdk/records/headers.d.ts +79 -0
  177. package/dist/vendor/testserver-sdk/records/headers.js +162 -0
  178. package/dist/vendor/testserver-sdk/records/index.d.ts +2 -1
  179. package/dist/vendor/testserver-sdk/records/index.js +4 -2
  180. package/dist/vendor/testserver-sdk/records/records.d.ts +19 -10
  181. package/package.json +5 -4
  182. package/skills/overview.md +5 -5
  183. package/skills/read-run-output.md +8 -9
  184. package/dist/runner/snapshot-save.d.ts +0 -70
  185. package/dist/runner/snapshot-save.js +0 -160
  186. package/dist/runner/snapshot-start.d.ts +0 -25
  187. package/dist/runner/snapshot-start.js +0 -16
  188. package/skills/testserver-builds.md +0 -82
package/dist/core/run.js CHANGED
@@ -28,9 +28,8 @@ import { acquireResources, announceAcquired, canceledStop, runInstances, release
28
28
  *
29
29
  * Release happens however the run ended, a throw included: once the command has stopped and, in a sandboxed run, the
30
30
  * runner session has closed its sandbox scope, each resource instance is released in reverse order, even when the
31
- * `cleanup-started` event can't be reported. A sandboxed run that saves the runner sandbox as a dev snapshot
32
- * releases them while the save runs, since the command is done with them. An unsandboxed run releases them in
33
- * `finally`; a sandboxed run's runner session does, as it finishes or closes.
31
+ * `cleanup-started` event can't be reported. An unsandboxed run releases them in `finally`; a sandboxed run's runner
32
+ * session does, as it finishes or closes.
34
33
  */
35
34
  export async function executeRun(definitionSet, context, resourceContexts, request, control, progress) {
36
35
  const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts, request.resources);
@@ -57,20 +56,20 @@ export async function executeRun(definitionSet, context, resourceContexts, reque
57
56
  // it ends.
58
57
  let cleanupStarted = false;
59
58
  // Said once, before the runner's sandboxes are stopped in a sandboxed run, else before the resources are released,
60
- // with what cleanup does with the runner sandbox (`runnerSandbox`). The first call's says it: a sandboxed run that
61
- // saves a dev snapshot calls `release` with its `save` before anything else starts cleanup.
62
- const startCleanup = async (runnerSandbox) => {
59
+ // with how long cleanup keeps the runner sandbox running, if the run has one.
60
+ const keepMs = request.runner === undefined ? null : request.runner.keepMs;
61
+ const startCleanup = async () => {
63
62
  if (cleanupStarted)
64
63
  return;
65
64
  cleanupStarted = true;
66
- await progress.emit({ kind: "cleanup-started", runnerSandbox, resources: releasedResources(instances) });
65
+ await progress.emit({ kind: "cleanup-started", keepMs, resources: releasedResources(instances) });
67
66
  };
68
67
  let resourceCleanup = {};
69
68
  let releasing;
70
69
  // Once: reporting cleanup's start can fail, and releasing what the acquires took must not depend on it.
71
- const release = (runnerSandbox) => (releasing ??= (async () => {
70
+ const release = () => (releasing ??= (async () => {
72
71
  try {
73
- await startCleanup(runnerSandbox);
72
+ await startCleanup();
74
73
  }
75
74
  finally {
76
75
  resourceCleanup = await releaseResources(instances, progress);
@@ -86,7 +85,7 @@ export async function executeRun(definitionSet, context, resourceContexts, reque
86
85
  }
87
86
  finally {
88
87
  // A no-op in a sandboxed run: its runner session released the resources once it closed its scope.
89
- await release(null);
88
+ await release();
90
89
  }
91
90
  await progress.emit({
92
91
  kind: "cleanup-finished",
@@ -180,23 +179,17 @@ function runnerStopped(outcome) {
180
179
  /**
181
180
  * In a sandboxed run, everything between the run's start and releasing its resources. It opens the run's runner session
182
181
  * (`openRunnerSession`) before the mint, which owns the runner's sandbox scope and the order its stages run in, runs
183
- * `runInSandbox` in it, and finishes the session, which closes the scope and releases the resources, saving the runner
184
- * sandbox as a dev snapshot beside the release when the run's plan says to. A run that throws closes the session in
185
- * `finally`, which closes the scope, then releases the resources. A sandboxed run always mints, whatever its resources
186
- * are, so its request names no credential source: the command layer refuses `--credential github-actions` with it.
182
+ * `runInSandbox` in it, and finishes the session, which closes the scope and releases the resources. A run that throws
183
+ * closes the session in `finally`, which closes the scope, then releases the resources. A sandboxed run always mints,
184
+ * whatever its resources are, so its request names no credential source: the command layer refuses
185
+ * `--credential github-actions` with it.
187
186
  */
188
187
  async function runSandboxed(context, request, instances, control, progress, cleanup) {
189
188
  const runnerProgress = { emit: (event) => progress.emit({ kind: "runner", event }) };
190
189
  const session = openRunnerSession(context, request.runner, { signal: control.signal, cleanup }, runnerProgress);
191
190
  try {
192
191
  const ended = await runInSandbox(context, request, instances, session, control, progress);
193
- const finished = await session.finish();
194
- return {
195
- ended: ended.kind === "command-ended"
196
- ? { ...ended, runner: { ...ended.runner, save: finished.save, noSave: finished.noSave } }
197
- : ended,
198
- runnerCleanup: finished.cleanup,
199
- };
192
+ return { ended, runnerCleanup: await session.finish() };
200
193
  }
201
194
  finally {
202
195
  // Memoized: a no-op once the session finished, and the cleanup when the run threw.
@@ -279,19 +272,15 @@ async function runInSandbox(context, request, instances, session, control, progr
279
272
  resources: resourcesRan(instances),
280
273
  command,
281
274
  runner: {
282
- snapshotId: ready.startedFrom.snapshotId,
283
- base: ready.startedFrom.base,
284
- snapshotBranch: ready.startedFrom.branch ?? null,
285
- snapshotHead: ready.startedFrom.head ?? null,
275
+ snapshotId: ready.snapshotId,
276
+ base: ready.base,
286
277
  built: ready.built,
287
- snapshot: ready.snapshot,
278
+ builtBehind: ready.builtBehind,
288
279
  uploadBytes: ready.uploadBytes,
289
280
  vcpus: ready.vcpus,
290
281
  region: ready.region,
291
282
  runtime: ready.runtime,
292
283
  buildMs: ready.buildMs,
293
- save: null,
294
- noSave: null,
295
284
  },
296
285
  };
297
286
  }
@@ -1,8 +1,9 @@
1
- // storm's Playwright driver: what the launcher knows of Playwright, the program `storm playwright`'s command starts.
2
- // It names the binary, builds the `playwright test` argv, counts the tests with `playwright test --list` through its
3
- // gateway (`plan/`), a test once per Playwright project that runs it, and holds the words that name Playwright:
4
- // `storm playwright`'s leaf help, what its run's summary says to do next, and what its two refusals say. The launcher
5
- // makes `storm playwright` from it (`defineRunCommand`), reaching it through the registry (`src/extensions.ts`).
1
+ // storm's Playwright driver: what the launcher knows of Playwright, the program `storm playwright`'s command starts. It
2
+ // names the binary, builds the `playwright test` argv, counts the tests, where `storm.config.ts` sets `testPlan`, with
3
+ // `playwright test --list` through its gateway (`plan/`), a test once per Playwright project that runs it, and holds
4
+ // the words that name Playwright: `storm playwright`'s leaf help, what its run's summary says to do next, and what its
5
+ // two refusals say. The launcher makes `storm playwright` from it (`defineRunCommand`), reaching it through the
6
+ // registry (`src/extensions.ts`).
6
7
  import { argsText, defineDriver } from "../../sdk/extension/index.js";
7
8
  import { describePlaywrightListFailure, livePlaywrightListGateway, planPlaywrightRun, playwrightRunArgv, } from "./plan/plan.js";
8
9
  export const playwrightDriver = defineDriver({
@@ -21,14 +22,14 @@ export const playwrightDriver = defineDriver({
21
22
  },
22
23
  help: {
23
24
  usage: "[<playwright test args>...] [-- <playwright dash options>...]",
24
- args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests.",
25
+ args: "What playwright test gets, unchanged and in order: every argument that isn't one of storm's flags, such as file filters, then everything after --, such as --project or --grep. Give file filters before --: Playwright reads each argument after --project as another project. playwright test --list gets the same arguments when it counts the tests, where storm.config.ts sets testPlan.",
25
26
  // Nothing storm brings a Playwright project reads the run payload's `verbose`: storm's Playwright reporter never
26
27
  // prints (`printsToStdio()` is false).
27
28
  verbose: "which test code can read; storm's Playwright reporter prints nothing either way",
28
29
  examples: [
29
30
  {
30
31
  argv: "",
31
- description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts, each resource that sizes itself sized from the test count.",
32
+ description: "Run every test in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts. Where it sets testPlan, storm counts the tests first, and each resource that sizes itself is sized from that count.",
32
33
  },
33
34
  {
34
35
  argv: "--unsandboxed tests/login.spec.ts -- --project chromium",
@@ -40,17 +41,23 @@ export const playwrightDriver = defineDriver({
40
41
  // No final result: the Playwright config doesn't list storm's Playwright reporter, or a `--reporter` on
41
42
  // Playwright's command line replaced it. A config lists a reporter as a tuple of its module name.
42
43
  noFinalResults: 'add ["@vercel/storm/playwright/reporter"] to the reporter list in playwright.config',
44
+ // storm's Playwright reporter prints nothing, so the steps keep a reporter a person reads beside it. The package may
45
+ // install storm under either of its npm names.
46
+ addReporter: [
47
+ 'In the Playwright config the run loads (playwright.config.ts, or the file --config names), set reporter to a list that holds ["@vercel/storm/playwright/reporter"], as in defineConfig({ reporter: [["list"], ["@vercel/storm/playwright/reporter"]] }). If reporter already names reporters, keep them and add ["@vercel/storm/playwright/reporter"] to the list. In a package that installs storm as @cnc-tools/storm, name "@cnc-tools/storm/playwright/reporter".',
48
+ "Remove any --reporter from the arguments given to playwright test, since it replaces the config's reporters, storm's among them. Then run the same storm playwright command again.",
49
+ ],
43
50
  },
44
51
  refusals: {
45
52
  noMatchingTests: {
46
- description: "playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
53
+ description: "storm.config.ts sets testPlan, and playwright test --list found no test for the arguments given to playwright test, so nothing was minted, acquired or started.",
47
54
  message: ({ args, cwd }) => `playwright test --list found no test for playwright test ${argsText(args)} in ${cwd}. The command didn't run.`,
48
55
  next: ({ args }) => `Change the arguments given to playwright test (${argsText(args)}), then retry. Put Playwright's own dash options after --.`,
49
56
  },
50
57
  planFailed: {
51
- description: "storm couldn't count the tests before the run: playwright wasn't found or failed to start, didn't finish within 120s, exited other than 0, or wrote something other than a list of tests. Nothing was minted, acquired or started.",
58
+ description: "storm couldn't plan the run: playwright wasn't found, or, where storm.config.ts sets testPlan, playwright test --list failed to start, didn't finish within 120s, exited other than 0, or wrote something other than a list of tests. Nothing was minted, acquired or started.",
52
59
  next: {
53
- "start-failed": "Install @playwright/test in the package, or run the command with storm exec, which counts nothing.",
60
+ "start-failed": "Install @playwright/test in the package, or run the command with storm exec, which needs no playwright.",
54
61
  "timed-out": "Check why playwright test --list doesn't finish, such as a config file that waits, then retry.",
55
62
  exited: "Fix what playwright test --list reports, then retry.",
56
63
  "unreadable-output": "Check that the package's playwright writes its list with --reporter=json to the file PLAYWRIGHT_JSON_OUTPUT_FILE names, then retry.",
@@ -6,7 +6,7 @@ import {
6
6
  rejectedCredentialShape,
7
7
  rejectedCredentialText,
8
8
  testserverPoolDefinition
9
- } from "../../../../../chunks/chunk-IYM44FUX.js";
9
+ } from "../../../../../chunks/chunk-UC6DULWY.js";
10
10
  import {
11
11
  CREATE_ATTEMPTS,
12
12
  DEFAULT_TTL_MINUTES,
@@ -19,13 +19,13 @@ import {
19
19
  parseTtl,
20
20
  resolvePrBuild,
21
21
  shortSha
22
- } from "../../../../../chunks/chunk-LQKNI3EG.js";
22
+ } from "../../../../../chunks/chunk-BRUIATTR.js";
23
23
  import {
24
24
  configErrors,
25
25
  credentialErrors,
26
26
  credentialSourceErrors
27
- } from "../../../../../chunks/chunk-ODQHQJLE.js";
28
- import "../../../../../chunks/chunk-YT5OROR7.js";
27
+ } from "../../../../../chunks/chunk-5ED3IDUJ.js";
28
+ import "../../../../../chunks/chunk-RA4L2ACU.js";
29
29
  import {
30
30
  testserverCommands
31
31
  } from "../../../../../chunks/chunk-GSC6SRTW.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  inspectPool
3
- } from "../../../../../chunks/chunk-LQKNI3EG.js";
4
- import "../../../../../chunks/chunk-YT5OROR7.js";
3
+ } from "../../../../../chunks/chunk-BRUIATTR.js";
4
+ import "../../../../../chunks/chunk-RA4L2ACU.js";
5
5
  import {
6
6
  testserverCommands
7
7
  } from "../../../../../chunks/chunk-GSC6SRTW.js";
@@ -20,7 +20,7 @@ export declare const testserverPoolDefinition: import("../../sdk/extension/resou
20
20
  readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
21
21
  readonly flag: {
22
22
  readonly valueLabel: "N";
23
- readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool.";
23
+ readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
24
24
  };
25
25
  };
26
26
  readonly build: {
@@ -10,7 +10,7 @@ export declare const testserverExtension: import("../../sdk/extension/commands.t
10
10
  readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
11
11
  readonly flag: {
12
12
  readonly valueLabel: "N";
13
- readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool.";
13
+ readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
14
14
  };
15
15
  };
16
16
  readonly build: {
@@ -6,15 +6,15 @@ import { type OptionSources, type PlannedRun, type ResolvedOptions } from "../..
6
6
  */
7
7
  export declare const testserverPoolRules: {
8
8
  /**
9
- * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or with `storm vitest` or `storm playwright` one
10
- * per 4 test files it counted, at most 8.
9
+ * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or one per 4 test files `storm vitest` or
10
+ * `storm playwright` counted, at most 8, for a run that counts (`testPlan`).
11
11
  */
12
12
  readonly sandboxes: {
13
13
  readonly schema: z.ZodNumber;
14
14
  readonly default: ({ testPlan }: PlannedRun) => number;
15
15
  readonly flag: {
16
16
  readonly valueLabel: "N";
17
- readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool.";
17
+ readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
18
18
  };
19
19
  };
20
20
  /**
@@ -35,17 +35,17 @@ const ttl = z.string(mustBe(TTL)).refine((value) => parseTtl(value) !== undefine
35
35
  */
36
36
  export const testserverPoolRules = {
37
37
  /**
38
- * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or with `storm vitest` or `storm playwright` one
39
- * per 4 test files it counted, at most 8.
38
+ * How many Testserver sandboxes a run gets: 1 to 32; by default 1, or one per 4 test files `storm vitest` or
39
+ * `storm playwright` counted, at most 8, for a run that counts (`testPlan`).
40
40
  */
41
41
  sandboxes: {
42
42
  schema: sandboxCount,
43
- // `storm vitest` and `storm playwright` size the run from its tests; a run that counts none, such as
44
- // `storm exec`'s, asks for one.
43
+ // `storm vitest` and `storm playwright` size the run from its test files where the config file sets `testPlan`; a
44
+ // run that counts none, such as `storm exec`'s, asks for one.
45
45
  default: ({ testPlan }) => testPlan.kind === "counted" ? sandboxesForTests(testPlan.files) : MIN_SANDBOXES,
46
46
  flag: {
47
47
  valueLabel: "N",
48
- description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool.",
48
+ description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.",
49
49
  },
50
50
  },
51
51
  /**
@@ -18,7 +18,7 @@ export declare const testserverPool: import("../../sdk/extension/resource-factor
18
18
  readonly default: ({ testPlan }: import("../../sdk/extension/resource-definition.ts").PlannedRun) => number;
19
19
  readonly flag: {
20
20
  readonly valueLabel: "N";
21
- readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or with storm vitest or storm playwright one per 4 test files it counted, at most 8. Gives the run the Testserver pool.";
21
+ readonly description: "How many Testserver sandboxes the command gets, 1 to 32, overriding resources.testserverPool.sandboxes in storm.config.ts; default 1, or one per 4 test files when storm vitest or storm playwright counts them (testPlan in storm.config.ts), at most 8. Gives the run the Testserver pool.";
22
22
  };
23
23
  };
24
24
  readonly build: {
@@ -8,3 +8,4 @@ export { type InvocationEnd, type NotStartedReason, REQUEST_SETTLE_MS, REQUEST_S
8
8
  export type { VercelKey } from "./keys.ts";
9
9
  export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.ts";
10
10
  export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.ts";
11
+ export { VERCEL_CLI_SESSION_ID_HEADER } from "./session-id.ts";
@@ -12,3 +12,4 @@ export { VercelCliError } from "./errors.js";
12
12
  export { REQUEST_SETTLE_MS, REQUEST_SETTLE_POLL_MS, STOP_GRACE_MS, WAIT_FOR_TIMEOUT_MS, } from "./invocation.js";
13
13
  export { readAuthConfig, readGlobalConfig, writeAuthConfig, writeGlobalConfig } from "./live/config-files.js";
14
14
  export { describeInvocation, describeInvocations, OUTPUT_REPORT_CHARS, STDIN_REPORT_CHARS } from "./report.js";
15
+ export { VERCEL_CLI_SESSION_ID_HEADER } from "./session-id.js";
@@ -2,6 +2,7 @@
2
2
  // them and unit tests can check them.
3
3
  import { isOpenRecord } from "../../../vendor/testserver-sdk/index.js";
4
4
  import { STOP_GRACE_MS } from "./invocation.js";
5
+ import { vercelCliSessionId } from "./session-id.js";
5
6
  /** The most characters of each of an invocation's stdout and stderr a report prints: the last ones. */
6
7
  export const OUTPUT_REPORT_CHARS = 4000;
7
8
  /** The most characters of an invocation's piped stdin text a report prints: the first ones. */
@@ -70,8 +71,10 @@ export function describeRequests(requests) {
70
71
  if (requests.length === 0)
71
72
  return "no proxy requests while it ran";
72
73
  const counts = new Map();
73
- for (const request of requests)
74
- counts.set(request.sessionId, (counts.get(request.sessionId) ?? 0) + 1);
74
+ for (const request of requests) {
75
+ const session = vercelCliSessionId(request.requestHeaders);
76
+ counts.set(session, (counts.get(session) ?? 0) + 1);
77
+ }
75
78
  const sessions = [...counts].map(([session, count]) => session === undefined ? `no session id (${count})` : `session ${session} (${count})`);
76
79
  const noun = requests.length === 1 ? "proxy request" : "proxy requests";
77
80
  const open = requests.filter(isOpenRecord).length;
@@ -0,0 +1,8 @@
1
+ import { type RecordedHeaders } from "../../../vendor/testserver-sdk/index.js";
2
+ /** The header the `vercel` CLI sends with the same id on every request of one invocation. */
3
+ export declare const VERCEL_CLI_SESSION_ID_HEADER = "x-vercel-cli-session-id";
4
+ /**
5
+ * The `vercel` CLI's session id a request record's `requestHeaders` hold, or `undefined` when it sent none or the
6
+ * record hides it, because its proxy's `recordHeaders` doesn't name the header.
7
+ */
8
+ export declare function vercelCliSessionId(requestHeaders: RecordedHeaders): string | undefined;
@@ -0,0 +1,16 @@
1
+ // The `vercel` CLI's session id, read from a request record's headers. The Vercel CLI invoker's failure report counts
2
+ // proxy records by it, and the Testserver Vitest fixtures' request lines name it. A record shows a header's value only
3
+ // when its proxy's `recordHeaders` names it, so the Testserver Vitest fixtures' `proxy` adds this one; a proxy that
4
+ // doesn't leaves every record without a session id. It belongs with the `vercel` CLI's own tests, and moves to
5
+ // vercel-internal with the invoker. It loads no other file at run time.
6
+ import { REDACTED_HEADER } from "../../../vendor/testserver-sdk/index.js";
7
+ /** The header the `vercel` CLI sends with the same id on every request of one invocation. */
8
+ export const VERCEL_CLI_SESSION_ID_HEADER = "x-vercel-cli-session-id";
9
+ /**
10
+ * The `vercel` CLI's session id a request record's `requestHeaders` hold, or `undefined` when it sent none or the
11
+ * record hides it, because its proxy's `recordHeaders` doesn't name the header.
12
+ */
13
+ export function vercelCliSessionId(requestHeaders) {
14
+ const sessionId = requestHeaders[VERCEL_CLI_SESSION_ID_HEADER];
15
+ return sessionId === REDACTED_HEADER ? undefined : sessionId;
16
+ }
@@ -8,8 +8,8 @@ export { WORKERS_PER_SANDBOX } from "../run/sandbox.ts";
8
8
  * container after a test whose factory call, API request or proxied request failed so, so the retry runs on a new
9
9
  * container, where a factory call that half-happened on the old one can't collide with it. vitest's own output marks
10
10
  * a test it rescued `(retry x1)`. Spread it to change the count: `retry: { ...testserverTransientRetry, count: 2 }`;
11
- * under Vitest before 5.0.4, only the first retry can start a container again after a failed start (the library's
12
- * `README.md`, `stormContainer`).
11
+ * under Vitest 4, and Vitest 5 before 5.0.4, only the first retry can start a container again after a failed start
12
+ * (the library's `README.md`, `stormContainer`), and under Vitest 5.0.4 and later each retry can.
13
13
  */
14
14
  export declare const testserverTransientRetry: {
15
15
  readonly count: number;
@@ -14,8 +14,8 @@ export { WORKERS_PER_SANDBOX } from "../run/sandbox.js";
14
14
  * container after a test whose factory call, API request or proxied request failed so, so the retry runs on a new
15
15
  * container, where a factory call that half-happened on the old one can't collide with it. vitest's own output marks
16
16
  * a test it rescued `(retry x1)`. Spread it to change the count: `retry: { ...testserverTransientRetry, count: 2 }`;
17
- * under Vitest before 5.0.4, only the first retry can start a container again after a failed start (the library's
18
- * `README.md`, `stormContainer`).
17
+ * under Vitest 4, and Vitest 5 before 5.0.4, only the first retry can start a container again after a failed start
18
+ * (the library's `README.md`, `stormContainer`), and under Vitest 5.0.4 and later each retry can.
19
19
  */
20
20
  export const testserverTransientRetry = {
21
21
  count: 1,
@@ -2,7 +2,7 @@ import { type Container, type ServiceWarmup, type TestserverServiceId } from "..
2
2
  /**
3
3
  * How long the Testserver Vitest fixtures' container lives: `'file'`, one container shared by a test file's tests and
4
4
  * replaced after a test that failed because of a Testserver failure (`endsSharedContainer`), for a test with different
5
- * feature flags, or for a test it reached after Testserver had stopped it, as Testserver's idle eviction does, or
5
+ * feature flags or a different `recordHeaders` list, or for a test it reached after Testserver had stopped it, as Testserver's idle eviction does, or
6
6
  * `'test'`, one per test.
7
7
  */
8
8
  export type ContainerScope = "file" | "test";
@@ -13,14 +13,23 @@ export type SharedContainer = Pick<Container, "testId" | "testserverUrl" | "feat
13
13
  /**
14
14
  * Where the container `FileContainer.acquire` hands out came from: `reused`, the file's running container; `new`,
15
15
  * one it started, or a start in flight it shared; `replaced`, one it started after ending the file's container,
16
- * which had different feature flags or which Testserver had stopped (`FileContainer.replaceStopped`).
16
+ * which had a different `ContainerKey` or which Testserver had stopped (`FileContainer.replaceStopped`).
17
17
  */
18
18
  export type ContainerOrigin = "new" | "reused" | "replaced";
19
+ /**
20
+ * What a file container is started for, which a test must match to share it: the canonical keys of the feature flags
21
+ * (`featureFlagsKey`) and of the `recordHeaders` list (`recordHeadersKey`) of the test that started it.
22
+ */
23
+ export interface ContainerKey {
24
+ readonly featureFlags: string;
25
+ readonly recordHeaders: string;
26
+ }
19
27
  /**
20
28
  * Why a new file container replaces the file's container: `feature-flags`, the file's had different feature flags;
21
- * `stopped`, Testserver had stopped the file's, as its idle eviction does.
29
+ * `record-headers`, it had a different `recordHeaders` list; `options`, it had both; `stopped`, Testserver had
30
+ * stopped the file's, as its idle eviction does.
22
31
  */
23
- export type ReplacedFor = "feature-flags" | "stopped";
32
+ export type ReplacedFor = "feature-flags" | "record-headers" | "options" | "stopped";
24
33
  /** The container `FileContainer.acquire` hands out, and where it came from. */
25
34
  export interface AcquiredContainer<C> {
26
35
  readonly container: C;
@@ -30,28 +39,28 @@ export interface AcquiredContainer<C> {
30
39
  export type StartFileContainer<C> = (replacing?: ReplacedFor) => Promise<C>;
31
40
  /**
32
41
  * A test file's container in `'file'` scope. It starts lazily, when the first test asks for it; concurrent
33
- * `acquire` calls with the same feature flags key share one start, and a failed start leaves nothing behind, so the
34
- * next `acquire` starts again. The container remembers the feature flags key it started with: a test with a
35
- * different one gets a new container, which replaces it.
42
+ * `acquire` calls with the same `ContainerKey` share one start, and a failed start leaves nothing behind, so the
43
+ * next `acquire` starts again. The container remembers the key it started with: a test with a different one gets a
44
+ * new container, which replaces it.
36
45
  */
37
46
  export declare class FileContainer<C extends SharedContainer> {
38
47
  #private;
39
48
  /** The file's running container, if one has started and not been discarded. */
40
49
  get current(): C | undefined;
41
50
  /**
42
- * The file's container for a test whose feature flags key is `key` (`featureFlagsKey`): the running one, or the
43
- * one starting, when either has the same key, or one `start` starts. A running container with a different key is
51
+ * The file's container for a test whose container key is `key`: the running one, or the one starting, when either
52
+ * has the same key, or one `start` starts. A running container with a different key is
44
53
  * forgotten and ended first, and the new one replaces it; when that end fails, rejects saying so, leaving no
45
54
  * container. A start in flight with a different key is waited for, its failure ignored, then treated the same way.
46
55
  * Throws after `close`.
47
56
  */
48
- acquire(start: StartFileContainer<C>, key: string): Promise<AcquiredContainer<C>>;
57
+ acquire(start: StartFileContainer<C>, key: ContainerKey): Promise<AcquiredContainer<C>>;
49
58
  /**
50
59
  * Replaces `stopped`, the file's container, which Testserver has stopped, with one `start` starts for a test whose
51
- * feature flags key is `key`: forgets it, ends it (Testserver answers the end of a stopped container's test id),
60
+ * container key is `key`: forgets it, ends it (Testserver answers the end of a stopped container's test id),
52
61
  * then starts the new one. When the end fails, rejects saying so, leaving no container. Throws after `close`.
53
62
  */
54
- replaceStopped(stopped: C, start: StartFileContainer<C>, key: string): Promise<AcquiredContainer<C>>;
63
+ replaceStopped(stopped: C, start: StartFileContainer<C>, key: ContainerKey): Promise<AcquiredContainer<C>>;
55
64
  /** Forgets `container` if it is the file's, then ends it. An end that fails throws, but it is forgotten all the same. */
56
65
  discard(container: C): Promise<void>;
57
66
  /**
@@ -79,9 +88,9 @@ export interface ContainerRequest<C extends SharedContainer> {
79
88
  * request a fault rule on the test's proxy forwarded, asked in the failure handler.
80
89
  */
81
90
  readonly testserverFailed: () => boolean;
82
- /** The canonical key of the test's feature flags (`featureFlagsKey`), which the file's container must match. */
83
- readonly featureFlagsKey: string;
84
- /** Starts the file's container, in `'file'` scope, saying whether it replaces one with other feature flags. */
91
+ /** The test's container key, its feature flags' and its `recordHeaders` list's, which the file's container must match. */
92
+ readonly containerKey: ContainerKey;
93
+ /** Starts the file's container, in `'file'` scope, saying why it replaces the file's container when it does. */
85
94
  readonly startShared: StartFileContainer<C>;
86
95
  /** Starts the test's own container, in `'test'` scope. */
87
96
  readonly startOwn: () => Promise<C>;
@@ -96,7 +105,7 @@ export interface ContainerRequest<C extends SharedContainer> {
96
105
  * container log read there, before the container ends; one that fails later is reported without it.
97
106
  *
98
107
  * In `'file'` scope, hands the test the file's container, starting it if need be, or replacing it when its feature
99
- * flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
108
+ * flags or its `recordHeaders` list differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
100
109
  * file's, for its next test. A test handed a container an earlier test used notes its container log's last record, so
101
110
  * its report can print only the records after it. When that note finds Testserver has stopped the container
102
111
  * (`container-stopped`), as its idle eviction does between tests, the test gets a new container in its place, before
@@ -3,11 +3,29 @@ import { activityCounts, activityFailed, activitySince, containerFailureReport,
3
3
  import { acquireOwned } from "../../../vitest/index.js";
4
4
  /** The default container scope: a test file's tests share one container. */
5
5
  export const CONTAINER_SCOPE = "file";
6
+ /** Why a container started for `current` can't serve a test that needs `wanted`, or `undefined` when it can. */
7
+ function replacedFor(current, wanted) {
8
+ const flags = current.featureFlags !== wanted.featureFlags;
9
+ const headers = current.recordHeaders !== wanted.recordHeaders;
10
+ if (flags && headers)
11
+ return "options";
12
+ if (flags)
13
+ return "feature-flags";
14
+ if (headers)
15
+ return "record-headers";
16
+ return undefined;
17
+ }
18
+ /** What differs between a test and the file's container, for the error of an end that failed to replace it. */
19
+ const DIFFERENT = {
20
+ "feature-flags": "different feature flags",
21
+ "record-headers": "a different recordHeaders list",
22
+ options: "different feature flags and a different recordHeaders list",
23
+ };
6
24
  /**
7
25
  * A test file's container in `'file'` scope. It starts lazily, when the first test asks for it; concurrent
8
- * `acquire` calls with the same feature flags key share one start, and a failed start leaves nothing behind, so the
9
- * next `acquire` starts again. The container remembers the feature flags key it started with: a test with a
10
- * different one gets a new container, which replaces it.
26
+ * `acquire` calls with the same `ContainerKey` share one start, and a failed start leaves nothing behind, so the
27
+ * next `acquire` starts again. The container remembers the key it started with: a test with a different one gets a
28
+ * new container, which replaces it.
11
29
  */
12
30
  export class FileContainer {
13
31
  #current;
@@ -18,8 +36,8 @@ export class FileContainer {
18
36
  return this.#current?.container;
19
37
  }
20
38
  /**
21
- * The file's container for a test whose feature flags key is `key` (`featureFlagsKey`): the running one, or the
22
- * one starting, when either has the same key, or one `start` starts. A running container with a different key is
39
+ * The file's container for a test whose container key is `key`: the running one, or the one starting, when either
40
+ * has the same key, or one `start` starts. A running container with a different key is
23
41
  * forgotten and ended first, and the new one replaces it; when that end fails, rejects saying so, leaving no
24
42
  * container. A start in flight with a different key is waited for, its failure ignored, then treated the same way.
25
43
  * Throws after `close`.
@@ -29,7 +47,8 @@ export class FileContainer {
29
47
  return Promise.reject(new Error("the test file's container was already closed"));
30
48
  const current = this.#current;
31
49
  if (current !== undefined) {
32
- if (current.key === key)
50
+ const replacing = replacedFor(current.key, key);
51
+ if (replacing === undefined)
33
52
  return Promise.resolve({ container: current.container, origin: "reused" });
34
53
  this.#current = undefined;
35
54
  return this.#begin(key, true, async () => {
@@ -37,14 +56,14 @@ export class FileContainer {
37
56
  await current.container.end();
38
57
  }
39
58
  catch (error) {
40
- throw new Error(`ending the file's container ${current.container.testId} to replace it for a test with different feature flags failed: ${messageOf(error)}`, { cause: error });
59
+ throw new Error(`ending the file's container ${current.container.testId} to replace it for a test with ${DIFFERENT[replacing]} failed: ${messageOf(error)}`, { cause: error });
41
60
  }
42
- return start("feature-flags");
61
+ return start(replacing);
43
62
  });
44
63
  }
45
64
  const starting = this.#starting;
46
65
  if (starting !== undefined) {
47
- if (starting.key === key)
66
+ if (replacedFor(starting.key, key) === undefined)
48
67
  return starting.promise.then((container) => ({ container, origin: "new" }));
49
68
  return starting.promise.then(() => this.acquire(start, key), () => this.acquire(start, key));
50
69
  }
@@ -52,7 +71,7 @@ export class FileContainer {
52
71
  }
53
72
  /**
54
73
  * Replaces `stopped`, the file's container, which Testserver has stopped, with one `start` starts for a test whose
55
- * feature flags key is `key`: forgets it, ends it (Testserver answers the end of a stopped container's test id),
74
+ * container key is `key`: forgets it, ends it (Testserver answers the end of a stopped container's test id),
56
75
  * then starts the new one. When the end fails, rejects saying so, leaving no container. Throws after `close`.
57
76
  */
58
77
  replaceStopped(stopped, start, key) {
@@ -114,7 +133,7 @@ export class FileContainer {
114
133
  * container log read there, before the container ends; one that fails later is reported without it.
115
134
  *
116
135
  * In `'file'` scope, hands the test the file's container, starting it if need be, or replacing it when its feature
117
- * flags differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
136
+ * flags or its `recordHeaders` list differ from the test's. A test that aborts while it is starting never gets it, but the container stays the
118
137
  * file's, for its next test. A test handed a container an earlier test used notes its container log's last record, so
119
138
  * its report can print only the records after it. When that note finds Testserver has stopped the container
120
139
  * (`container-stopped`), as its idle eviction does between tests, the test gets a new container in its place, before
@@ -145,14 +164,14 @@ export async function provideContainer(request) {
145
164
  'use test.override({ containerScope: "test" }) in the file or describe that runs tests concurrently');
146
165
  }
147
166
  const { fileContainer } = request;
148
- const acquired = await fileContainer.acquire(request.startShared, request.featureFlagsKey);
167
+ const acquired = await fileContainer.acquire(request.startShared, request.containerKey);
149
168
  if (signal.aborted)
150
169
  throw signal.reason;
151
170
  const noted = acquired.origin === "reused" ? await noteLog(acquired.container) : NEW;
152
171
  if (signal.aborted)
153
172
  throw signal.reason;
154
173
  const replaced = noted.kind === "stopped"
155
- ? await fileContainer.replaceStopped(acquired.container, request.startShared, request.featureFlagsKey)
174
+ ? await fileContainer.replaceStopped(acquired.container, request.startShared, request.containerKey)
156
175
  : undefined;
157
176
  if (signal.aborted)
158
177
  throw signal.reason;
@@ -1,4 +1,5 @@
1
1
  import { type ApiRequestRecord, type ContainerLogRecord, type ExternalCallRecord, type FactoryCall, type FeatureFlags, type FaultHandle, type RecordedBody, type ProxyRequestRecord, type ServiceWarmup, type SetupCall } from "../../../vendor/testserver-sdk/index.js";
2
+ import type { ReplacedFor } from "./container-scope.ts";
2
3
  /** The most characters of one body, input, response or container log line a failure report prints. */
3
4
  export declare const BODY_REPORT_CHARS = 1000;
4
5
  /** The most container log records a failure report prints, the last ones. */
@@ -8,8 +9,8 @@ export type Redact = (text: string) => string;
8
9
  /** A request record of any kind, as one line describes it. */
9
10
  type RequestLine = ProxyRequestRecord | ApiRequestRecord | ExternalCallRecord;
10
11
  /**
11
- * One request record as a line: its method, URL as sent, result, whether it carried `authorization`, duration and
12
- * any session id, such as `GET /v2/user → 200, authorization sent, 412ms, session 7f3a`; an external call's starts
12
+ * One request record as a line: its method, URL as sent, result, whether it carried an `authorization` header,
13
+ * duration and any `vercel` CLI session id (both read from its `requestHeaders`), such as `GET /v2/user → 200, authorization sent, 412ms, session 7f3a`; an external call's starts
13
14
  * with its external service, such as `external github POST /scenarios → 204, …`. A proxy record whose
14
15
  * exchange was still open reads `open`, its duration counted to the read. A proxy record of a request a fault rule
15
16
  * matched tags its result with the action and what Testserver answered, such as `500 (fault: replace, Testserver
@@ -149,7 +150,7 @@ export declare function proxyRequestReport(testId: string, request: ProxyRequest
149
150
  export declare function describeWarmup(warmup: ServiceWarmup, redact: Redact): string;
150
151
  /**
151
152
  * What a verbose run prints once a container has started: what it is for, whether it replaced the file's container,
152
- * because the feature flags differ or because Testserver had stopped it, how long it took, how many feature flags it
153
+ * because the feature flags, the `recordHeaders` lists, or both differ, or because Testserver had stopped it, how long it took, how many feature flags it
153
154
  * has, any warmup after it with the services that failed, and its test id, such as `storm: started a container for
154
155
  * the file a.test.ts in 812ms, 1 feature flag, warmed 3 services in 2140ms (1 failed: api-projects), test id ts-…`.
155
156
  */
@@ -160,7 +161,7 @@ export declare function containerStartReport(start: {
160
161
  readonly testId: string;
161
162
  readonly featureFlags?: FeatureFlags;
162
163
  /** Why it replaced the file's container, when it did. */
163
- readonly replaced?: "feature-flags" | "stopped";
164
+ readonly replaced?: ReplacedFor;
164
165
  readonly warmup?: {
165
166
  readonly ms: number;
166
167
  readonly warmup: ServiceWarmup;