@gfdelarue/testkit 0.4.5 → 0.6.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 (787) hide show
  1. package/README.md +724 -495
  2. package/bin/testkit-windows-owner-arm64.exe +0 -0
  3. package/bin/testkit-windows-owner-x64.exe +0 -0
  4. package/dist/app/bugs/ci-report.js +2 -2
  5. package/dist/app/bugs/ci-summary.js +3 -3
  6. package/dist/app/bugs/draft.js +3 -3
  7. package/dist/app/bugs/file.js +1 -1
  8. package/dist/app/bugs/gate.js +1 -1
  9. package/dist/app/bugs/guide.js +3 -3
  10. package/dist/app/bugs/issue.js +4 -4
  11. package/dist/app/bugs/known-failures.js +1 -1
  12. package/dist/app/bugs/record.js +1 -1
  13. package/dist/app/bugs/run-reading.js +1 -1
  14. package/dist/app/bugs/supplied-reproduce.js +1 -0
  15. package/dist/app/campaigns/campaign.js +1 -1
  16. package/dist/app/campaigns/index.js +2 -2
  17. package/dist/app/cleanup/index.js +1 -1
  18. package/dist/app/db-schema/prepare.js +1 -1
  19. package/dist/app/destroy/index.js +1 -1
  20. package/dist/app/discover/index.js +2 -2
  21. package/dist/app/doctor/index.js +1 -1
  22. package/dist/app/environments/config-driven.js +1 -1
  23. package/dist/app/environments/environment-file.js +1 -0
  24. package/dist/app/environments/file-setup.js +1 -0
  25. package/dist/app/environments/routing.js +1 -1
  26. package/dist/app/environments/static-values.js +1 -0
  27. package/dist/app/environments/supplied-input.js +1 -0
  28. package/dist/app/environments/supplied.js +1 -1
  29. package/dist/app/environments/task-databases.js +2 -0
  30. package/dist/app/inspect/artifacts.js +1 -1
  31. package/dist/app/inspect/index.js +1 -1
  32. package/dist/app/lint/index.js +1 -1
  33. package/dist/app/lint/native.js +1 -1
  34. package/dist/app/lint/options.js +1 -1
  35. package/dist/app/lint/rules/engine-imports.js +1 -1
  36. package/dist/app/lint/rules/syntax.js +1 -1
  37. package/dist/app/lint/rules/unit.js +1 -1
  38. package/dist/app/reports/prepare.js +1 -1
  39. package/dist/app/run/caller-redaction.js +1 -0
  40. package/dist/app/run/engine-execution-failures.js +1 -1
  41. package/dist/app/run/engine-execution-reporting.js +1 -1
  42. package/dist/app/run/engine-execution.js +1 -1
  43. package/dist/app/run/engine-orchestration.js +1 -1
  44. package/dist/app/run/environment.js +1 -1
  45. package/dist/app/run/failure-details.js +1 -1
  46. package/dist/app/run/live-run.js +1 -1
  47. package/dist/app/run/orchestrator.js +1 -1
  48. package/dist/app/run/planning.js +1 -1
  49. package/dist/app/run/request.js +1 -1
  50. package/dist/app/run/results.js +1 -1
  51. package/dist/app/run/run-events.js +1 -1
  52. package/dist/app/run/run-finalization.js +1 -1
  53. package/dist/app/run/scheduler/estimates.js +1 -1
  54. package/dist/app/run/scheduler/identity.js +1 -1
  55. package/dist/app/run/scheduler/index.js +1 -1
  56. package/dist/app/run/setup/runtime-node-setup-protocol.js +1 -1
  57. package/dist/app/run/setup/runtime-node-setup-worker.js +1 -1
  58. package/dist/app/run/setup/runtime-node-setup.js +2 -2
  59. package/dist/app/run/task-batches.js +1 -1
  60. package/dist/app/run/worker-loop.js +1 -1
  61. package/dist/app/status/model.js +1 -1
  62. package/dist/app/status/runs.js +1 -1
  63. package/dist/app/typecheck/index.js +4 -4
  64. package/dist/cli/command-catalog.js +1 -1
  65. package/dist/cli/command-flags.js +1 -1
  66. package/dist/cli/commands/artifacts.js +2 -2
  67. package/dist/cli/commands/bug/file.js +2 -2
  68. package/dist/cli/commands/bug/record.js +2 -2
  69. package/dist/cli/commands/discover.js +1 -1
  70. package/dist/cli/commands/guard/unsafe-entrypoint.js +1 -1
  71. package/dist/cli/commands/run.js +2 -2
  72. package/dist/cli/commands/typecheck.js +1 -1
  73. package/dist/cli/commands/workspace.js +1 -1
  74. package/dist/cli/framework/errors.js +1 -1
  75. package/dist/cli/framework/execute.js +7 -6
  76. package/dist/cli/framework/parser.js +1 -1
  77. package/dist/cli/operations/run/operation.js +2 -2
  78. package/dist/cli/renderers/bug/text.js +1 -1
  79. package/dist/cli/renderers/discover/report.js +1 -1
  80. package/dist/cli/renderers/run/events.js +2 -2
  81. package/dist/cli/renderers/run/formatting.js +1 -1
  82. package/dist/cli/renderers/run/status.js +1 -1
  83. package/dist/cli/renderers/run/text-reporter.js +24 -22
  84. package/dist/cli/terminal/colors.js +1 -1
  85. package/dist/cli/terminal/layout.js +2 -2
  86. package/dist/config/authoring/database-fixture-discovery.js +1 -0
  87. package/dist/config/authoring/http-methods.js +1 -1
  88. package/dist/config/authoring/index.js +1 -1
  89. package/dist/config/loader/config-loader.js +1 -1
  90. package/dist/config/loader/decode-discovery.js +1 -1
  91. package/dist/config/loader/decode-execution.js +1 -1
  92. package/dist/config/loader/dependencies.js +1 -1
  93. package/dist/config/loader/discover-tests.js +1 -1
  94. package/dist/config/loader/discovery-summary.js +1 -1
  95. package/dist/config/loader/discovery.js +2 -2
  96. package/dist/config/loader/env.js +1 -1
  97. package/dist/config/loader/file-metadata.js +1 -1
  98. package/dist/config/loader/groups.js +2 -1
  99. package/dist/config/loader/index.js +1 -1
  100. package/dist/config/loader/load.js +1 -1
  101. package/dist/config/loader/managed-configs.js +1 -1
  102. package/dist/config/loader/owned-discovery.js +1 -0
  103. package/dist/config/loader/path-policy.js +1 -1
  104. package/dist/config/loader/runtime-isolation.js +1 -1
  105. package/dist/config/loader/runtime.js +1 -1
  106. package/dist/config/loader/skip-config.js +1 -1
  107. package/dist/config/loader/task-policy.js +1 -0
  108. package/dist/config/loader/test-selection.js +1 -1
  109. package/dist/config/loader/validation.js +1 -1
  110. package/dist/database/admin.js +2 -2
  111. package/dist/database/bindings.js +1 -0
  112. package/dist/database/cleanup.js +1 -1
  113. package/dist/database/configured-steps.js +1 -1
  114. package/dist/database/docker-metadata.js +3 -3
  115. package/dist/database/docker.js +3 -3
  116. package/dist/database/index.js +1 -1
  117. package/dist/database/local-postgres.js +1 -1
  118. package/dist/database/naming.js +1 -1
  119. package/dist/database/postgres/connection-check.js +1 -0
  120. package/dist/database/postgres/protocol.js +2 -0
  121. package/dist/database/schema-operations.js +1 -1
  122. package/dist/database/schema-source.js +3 -3
  123. package/dist/database/source-schema-env.js +1 -0
  124. package/dist/database/state-files.js +1 -1
  125. package/dist/database/state.js +1 -1
  126. package/dist/database/steps.js +3 -3
  127. package/dist/domain/file-timeout.js +1 -1
  128. package/dist/domain/identifiers.js +1 -1
  129. package/dist/domain/retired-test-types.js +1 -0
  130. package/dist/domain/runtime-isolation-contract.js +1 -1
  131. package/dist/domain/suite-selection.js +1 -1
  132. package/dist/domain/test-types.js +1 -1
  133. package/dist/engines/adapters/evidence-files.js +1 -1
  134. package/dist/engines/adapters/execution.js +1 -1
  135. package/dist/engines/adapters/json-bounds.js +2 -0
  136. package/dist/engines/adapters/native-report.js +1 -1
  137. package/dist/engines/api/execution.js +1 -1
  138. package/dist/engines/api/index.js +1 -1
  139. package/dist/engines/api/runtime-artifact.js +1 -1
  140. package/dist/engines/catalog.js +1 -1
  141. package/dist/engines/contracts/environment-values.js +1 -0
  142. package/dist/engines/definitions.js +1 -1
  143. package/dist/engines/environment/handles.js +1 -0
  144. package/dist/engines/environment/index.js +1 -0
  145. package/dist/engines/factory.js +1 -1
  146. package/dist/engines/installations/node-vitest.js +1 -1
  147. package/dist/engines/installations/package-resolution.js +1 -1
  148. package/dist/engines/installations/playwright.js +1 -1
  149. package/dist/engines/managed-module-resolution.js +8 -4
  150. package/dist/engines/manager.js +1 -1
  151. package/dist/engines/node-vitest/adapter/adapter.js +1 -1
  152. package/dist/engines/node-vitest/adapter/driver.js +2 -0
  153. package/dist/engines/node-vitest/adapter/evidence.js +2 -2
  154. package/dist/engines/node-vitest/adapter/failure-details.js +4 -2
  155. package/dist/engines/node-vitest/adapter/reporter.js +1 -1
  156. package/dist/engines/node-vitest/adapter/workspace.js +17 -195
  157. package/dist/engines/node-vitest/inventory/index.js +2 -0
  158. package/dist/engines/node-vitest/inventory/list-files.js +3 -0
  159. package/dist/engines/node-vitest/runtime/data/index.js +1 -1
  160. package/dist/engines/node-vitest/runtime/data/report.js +5 -6
  161. package/dist/engines/node-vitest/runtime/data/scenario.js +2 -2
  162. package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
  163. package/dist/engines/node-vitest/selection.js +1 -0
  164. package/dist/engines/playwright/adapter/adapter.js +1 -1
  165. package/dist/engines/playwright/adapter/config.js +3 -3
  166. package/dist/engines/playwright/adapter/evidence-validation.js +1 -1
  167. package/dist/engines/playwright/adapter/evidence.js +1 -1
  168. package/dist/engines/playwright/adapter/reporter.js +1 -1
  169. package/dist/engines/playwright/runtime/config-file.js +1 -1
  170. package/dist/engines/playwright/runtime/config.js +1 -1
  171. package/dist/engines/playwright/runtime/managed-test.js +1 -0
  172. package/dist/engines/playwright/runtime/runtime-input.js +29 -10
  173. package/dist/engines/runtime-input-file.js +1 -1
  174. package/dist/environment/lifecycle-controller.js +1 -1
  175. package/dist/environment/lifecycle.js +1 -1
  176. package/dist/environment/ready-environment.js +1 -1
  177. package/dist/environment/run-environment.js +1 -1
  178. package/dist/environment/run-stopping.js +1 -1
  179. package/dist/environment/runtime-contexts.js +1 -1
  180. package/dist/environment/runtime-manager.js +1 -1
  181. package/dist/environment/runtime-planning.js +1 -1
  182. package/dist/environment/runtime-preparation.js +1 -1
  183. package/dist/environment/services.js +3 -3
  184. package/dist/environment/template.js +1 -1
  185. package/dist/evidence/artifact-config.js +1 -1
  186. package/dist/evidence/artifacts.js +2 -2
  187. package/dist/evidence/bundles.js +1 -1
  188. package/dist/evidence/environment-record.js +1 -1
  189. package/dist/evidence/index.js +1 -1
  190. package/dist/evidence/maintenance.js +1 -0
  191. package/dist/evidence/read-run.js +1 -1
  192. package/dist/evidence/reading.js +1 -1
  193. package/dist/evidence/redaction.js +4 -0
  194. package/dist/evidence/reporting.js +1 -1
  195. package/dist/evidence/run-model.js +1 -0
  196. package/dist/evidence/storage.js +2 -2
  197. package/dist/evidence/timing.js +1 -1
  198. package/dist/kernel/error-serialization.js +1 -1
  199. package/dist/kernel/known-keys.js +1 -0
  200. package/dist/kernel/redaction-targets.js +1 -0
  201. package/dist/kernel/redaction.js +4 -1
  202. package/dist/kernel/unknown-values.js +1 -1
  203. package/dist/process/environment.js +1 -1
  204. package/dist/process/execa-bundle.json +3 -3
  205. package/dist/process/files/json-file.js +1 -1
  206. package/dist/process/host/platform.js +1 -1
  207. package/dist/process/host-process.js +1 -1
  208. package/dist/process/index.js +1 -1
  209. package/dist/process/locks.js +4 -4
  210. package/dist/process/port-listener.js +2 -0
  211. package/dist/process/process-group.js +1 -1
  212. package/dist/process/process.js +32 -32
  213. package/dist/process/readiness.js +1 -1
  214. package/dist/process/ready-deadline.js +1 -0
  215. package/dist/process/runs/ownership.js +1 -1
  216. package/dist/process/runs/stop.js +1 -1
  217. package/dist/process/service-processes.js +1 -1
  218. package/dist/process/windows-cli-owner.js +3 -3
  219. package/dist/process/windows-native.js +1 -1
  220. package/dist/repo/fingerprint-policy.js +1 -1
  221. package/dist/repo/managed-git.js +1 -1
  222. package/dist/repo/physical-tree.js +1 -1
  223. package/dist/repo/state.js +4 -4
  224. package/dist/steps/build-config.js +1 -1
  225. package/dist/steps/configured-step-testkit-modules.js +1 -1
  226. package/dist/steps/configured-steps.js +1 -1
  227. package/dist/steps/environment.js +1 -1
  228. package/dist/steps/index.js +1 -1
  229. package/dist/toolchains/index.js +3 -3
  230. package/dist/toolchains/semver.js +1 -1
  231. package/dist/toolchains/vitest/index.js +1 -1
  232. package/dist/tracker/redaction.js +1 -2
  233. package/dist/{config/runtime/build-assets.d.ts → types/config-build-assets.d.ts} +5 -3
  234. package/dist/{database/steps.d.ts → types/config-database-steps.d.ts} +7 -7
  235. package/dist/{config/runtime/next-runtime-tsconfig.d.ts → types/config-next-runtime-tsconfig.d.ts} +5 -3
  236. package/dist/types/config.d.ts +422 -0
  237. package/dist/types/drizzle.d.ts +13 -0
  238. package/dist/{config/runtime/env/index.d.ts → types/env.d.ts} +22 -20
  239. package/dist/types/environment.d.ts +46 -0
  240. package/dist/types/index.d.ts +21 -0
  241. package/dist/types/node-vitest-data.d.ts +191 -0
  242. package/dist/types/playwright.d.ts +130 -0
  243. package/dist/types/tooling-vitest.d.ts +13 -0
  244. package/dist/types/workspace.d.ts +633 -0
  245. package/docs/bug-records.md +35 -40
  246. package/docs/engines.md +259 -0
  247. package/docs/release-notes.md +2116 -0
  248. package/docs/test-types.md +37 -85
  249. package/package.json +22 -32
  250. package/testkit-config-schema.md +391 -260
  251. package/dist/app/bugs/areas.d.ts +0 -38
  252. package/dist/app/bugs/assessment.d.ts +0 -9
  253. package/dist/app/bugs/categories.d.ts +0 -41
  254. package/dist/app/bugs/ci-report.d.ts +0 -21
  255. package/dist/app/bugs/ci-summary.d.ts +0 -13
  256. package/dist/app/bugs/draft.d.ts +0 -70
  257. package/dist/app/bugs/facts.d.ts +0 -49
  258. package/dist/app/bugs/file.d.ts +0 -45
  259. package/dist/app/bugs/gate.d.ts +0 -22
  260. package/dist/app/bugs/guide.d.ts +0 -20
  261. package/dist/app/bugs/issue.d.ts +0 -18
  262. package/dist/app/bugs/known-failures.d.ts +0 -49
  263. package/dist/app/bugs/record.d.ts +0 -14
  264. package/dist/app/bugs/run-reading.d.ts +0 -51
  265. package/dist/app/bugs/store.d.ts +0 -34
  266. package/dist/app/campaigns/brief.d.ts +0 -7
  267. package/dist/app/campaigns/campaign.d.ts +0 -14
  268. package/dist/app/campaigns/index.d.ts +0 -38
  269. package/dist/app/campaigns/store.d.ts +0 -5
  270. package/dist/app/campaigns/summary.d.ts +0 -13
  271. package/dist/app/cleanup/index.d.ts +0 -52
  272. package/dist/app/db-schema/prepare.d.ts +0 -11
  273. package/dist/app/db-schema/refresh.d.ts +0 -17
  274. package/dist/app/db-schema/verify.d.ts +0 -11
  275. package/dist/app/destroy/index.d.ts +0 -16
  276. package/dist/app/discover/index.d.ts +0 -8
  277. package/dist/app/doctor/index.d.ts +0 -17
  278. package/dist/app/environments/config-driven.d.ts +0 -5
  279. package/dist/app/environments/routing.d.ts +0 -6
  280. package/dist/app/environments/supplied.d.ts +0 -3
  281. package/dist/app/file-selection.d.ts +0 -1
  282. package/dist/app/inspect/artifacts.d.ts +0 -30
  283. package/dist/app/inspect/index.d.ts +0 -112
  284. package/dist/app/lint/index.d.ts +0 -28
  285. package/dist/app/lint/native.d.ts +0 -10
  286. package/dist/app/lint/options.d.ts +0 -66
  287. package/dist/app/lint/policy.d.ts +0 -21
  288. package/dist/app/lint/rules/data.d.ts +0 -3
  289. package/dist/app/lint/rules/data.js +0 -1
  290. package/dist/app/lint/rules/engine-imports.d.ts +0 -3
  291. package/dist/app/lint/rules/syntax.d.ts +0 -4
  292. package/dist/app/lint/rules/unit.d.ts +0 -3
  293. package/dist/app/lint/shared.d.ts +0 -34
  294. package/dist/app/package-inspection.d.ts +0 -20
  295. package/dist/app/reports/files.d.ts +0 -13
  296. package/dist/app/reports/prepare.d.ts +0 -20
  297. package/dist/app/reports/publish.d.ts +0 -21
  298. package/dist/app/run/endpoint-readiness.d.ts +0 -43
  299. package/dist/app/run/endpoint-readiness.js +0 -1
  300. package/dist/app/run/engine-evidence-persistence.d.ts +0 -39
  301. package/dist/app/run/engine-execution-cleanup.d.ts +0 -8
  302. package/dist/app/run/engine-execution-cleanup.js +0 -1
  303. package/dist/app/run/engine-execution-failures.d.ts +0 -41
  304. package/dist/app/run/engine-execution-observer.d.ts +0 -21
  305. package/dist/app/run/engine-execution-reporting.d.ts +0 -17
  306. package/dist/app/run/engine-execution.d.ts +0 -65
  307. package/dist/app/run/engine-failure-stack.d.ts +0 -1
  308. package/dist/app/run/engine-orchestration.d.ts +0 -30
  309. package/dist/app/run/environment.d.ts +0 -33
  310. package/dist/app/run/failure-details.d.ts +0 -37
  311. package/dist/app/run/live-run.d.ts +0 -29
  312. package/dist/app/run/operation-progress.d.ts +0 -13
  313. package/dist/app/run/orchestrator.d.ts +0 -75
  314. package/dist/app/run/planning-types.d.ts +0 -68
  315. package/dist/app/run/planning.d.ts +0 -14
  316. package/dist/app/run/request.d.ts +0 -30
  317. package/dist/app/run/results.d.ts +0 -161
  318. package/dist/app/run/run-events.d.ts +0 -144
  319. package/dist/app/run/run-finalization.d.ts +0 -56
  320. package/dist/app/run/run-guards.d.ts +0 -3
  321. package/dist/app/run/runtime-failures.d.ts +0 -18
  322. package/dist/app/run/runtime-fixtures.d.ts +0 -2
  323. package/dist/app/run/runtime-task-types.d.ts +0 -20
  324. package/dist/app/run/scheduler/estimates.d.ts +0 -32
  325. package/dist/app/run/scheduler/identity.d.ts +0 -9
  326. package/dist/app/run/scheduler/index.d.ts +0 -124
  327. package/dist/app/run/scheduler/locks.d.ts +0 -6
  328. package/dist/app/run/scheduler/observations.d.ts +0 -20
  329. package/dist/app/run/selection.d.ts +0 -9
  330. package/dist/app/run/setup/runtime-node-setup-errors.d.ts +0 -13
  331. package/dist/app/run/setup/runtime-node-setup-protocol.d.ts +0 -85
  332. package/dist/app/run/setup/runtime-node-setup-worker.d.ts +0 -1
  333. package/dist/app/run/setup/runtime-node-setup.d.ts +0 -48
  334. package/dist/app/run/task-batches.d.ts +0 -23
  335. package/dist/app/run/task-leases.d.ts +0 -15
  336. package/dist/app/run/worker-loop.d.ts +0 -66
  337. package/dist/app/setup/playwright.d.ts +0 -22
  338. package/dist/app/status/index.d.ts +0 -9
  339. package/dist/app/status/model.d.ts +0 -29
  340. package/dist/app/status/runs.d.ts +0 -99
  341. package/dist/app/stop/index.d.ts +0 -14
  342. package/dist/app/tracker/index.d.ts +0 -13
  343. package/dist/app/tracker/remote.d.ts +0 -13
  344. package/dist/app/tracker/token.d.ts +0 -7
  345. package/dist/app/typecheck/index.d.ts +0 -63
  346. package/dist/cli/command-catalog.d.ts +0 -156
  347. package/dist/cli/command-flags.d.ts +0 -19
  348. package/dist/cli/command-registry.d.ts +0 -3
  349. package/dist/cli/commands/artifacts.d.ts +0 -48
  350. package/dist/cli/commands/bug/file.d.ts +0 -16
  351. package/dist/cli/commands/bug/guide.d.ts +0 -5
  352. package/dist/cli/commands/bug/record.d.ts +0 -9
  353. package/dist/cli/commands/campaign/finish.d.ts +0 -10
  354. package/dist/cli/commands/campaign/start.d.ts +0 -7
  355. package/dist/cli/commands/campaign/status.d.ts +0 -13
  356. package/dist/cli/commands/ci/report.d.ts +0 -15
  357. package/dist/cli/commands/cleanup.d.ts +0 -13
  358. package/dist/cli/commands/db/schema/refresh.d.ts +0 -2
  359. package/dist/cli/commands/db/schema/verify.d.ts +0 -2
  360. package/dist/cli/commands/destroy.d.ts +0 -9
  361. package/dist/cli/commands/discover.d.ts +0 -2
  362. package/dist/cli/commands/doctor.d.ts +0 -2
  363. package/dist/cli/commands/guard/unsafe-entrypoint.d.ts +0 -2
  364. package/dist/cli/commands/lint.d.ts +0 -2
  365. package/dist/cli/commands/report/prepare.d.ts +0 -12
  366. package/dist/cli/commands/report/publish.d.ts +0 -13
  367. package/dist/cli/commands/run/status.d.ts +0 -5
  368. package/dist/cli/commands/run/stop.d.ts +0 -7
  369. package/dist/cli/commands/run.d.ts +0 -9
  370. package/dist/cli/commands/setup/playwright.d.ts +0 -2
  371. package/dist/cli/commands/status.d.ts +0 -5
  372. package/dist/cli/commands/stop.d.ts +0 -12
  373. package/dist/cli/commands/typecheck.d.ts +0 -2
  374. package/dist/cli/commands/workspace.d.ts +0 -2
  375. package/dist/cli/entrypoint.d.ts +0 -1
  376. package/dist/cli/framework/command.d.ts +0 -21
  377. package/dist/cli/framework/definitions.d.ts +0 -100
  378. package/dist/cli/framework/errors.d.ts +0 -6
  379. package/dist/cli/framework/execute.d.ts +0 -14
  380. package/dist/cli/framework/help.d.ts +0 -11
  381. package/dist/cli/framework/index.d.ts +0 -3
  382. package/dist/cli/framework/parser.d.ts +0 -6
  383. package/dist/cli/index.d.ts +0 -4
  384. package/dist/cli/json-errors.d.ts +0 -3
  385. package/dist/cli/operations/db/schema/refresh/operation.d.ts +0 -7
  386. package/dist/cli/operations/db/schema/verify/operation.d.ts +0 -7
  387. package/dist/cli/operations/run/operation.d.ts +0 -26
  388. package/dist/cli/process-signal.d.ts +0 -1
  389. package/dist/cli/renderers/bug/text.d.ts +0 -8
  390. package/dist/cli/renderers/campaign/text.d.ts +0 -2
  391. package/dist/cli/renderers/ci/text.d.ts +0 -2
  392. package/dist/cli/renderers/cleanup/format.d.ts +0 -14
  393. package/dist/cli/renderers/db-schema/text.d.ts +0 -4
  394. package/dist/cli/renderers/destroy/text.d.ts +0 -4
  395. package/dist/cli/renderers/discover/report.d.ts +0 -7
  396. package/dist/cli/renderers/discover/text.d.ts +0 -3
  397. package/dist/cli/renderers/doctor/text.d.ts +0 -2
  398. package/dist/cli/renderers/lint/text.d.ts +0 -2
  399. package/dist/cli/renderers/run/events.d.ts +0 -8
  400. package/dist/cli/renderers/run/failure.d.ts +0 -8
  401. package/dist/cli/renderers/run/formatting.d.ts +0 -79
  402. package/dist/cli/renderers/run/status.d.ts +0 -6
  403. package/dist/cli/renderers/run/text-reporter.d.ts +0 -19
  404. package/dist/cli/renderers/status/text.d.ts +0 -2
  405. package/dist/cli/renderers/stop/text.d.ts +0 -7
  406. package/dist/cli/renderers/typecheck/text.d.ts +0 -2
  407. package/dist/cli/terminal/colors.d.ts +0 -10
  408. package/dist/cli/terminal/layout.d.ts +0 -11
  409. package/dist/cli/version-drift.d.ts +0 -25
  410. package/dist/config/authoring/build-config-contract.d.ts +0 -27
  411. package/dist/config/authoring/configured-step-contract.d.ts +0 -18
  412. package/dist/config/authoring/http-execution-contract.d.ts +0 -70
  413. package/dist/config/authoring/http-methods.d.ts +0 -18
  414. package/dist/config/authoring/index.d.ts +0 -372
  415. package/dist/config/authoring/preset-env.d.ts +0 -19
  416. package/dist/config/authoring/runtime.d.ts +0 -64
  417. package/dist/config/authoring/runtime.js +0 -1
  418. package/dist/config/loader/bugs.d.ts +0 -15
  419. package/dist/config/loader/config-loader.d.ts +0 -9
  420. package/dist/config/loader/database-materialization.d.ts +0 -19
  421. package/dist/config/loader/database-roles.d.ts +0 -2
  422. package/dist/config/loader/database.d.ts +0 -55
  423. package/dist/config/loader/decode-discovery.d.ts +0 -5
  424. package/dist/config/loader/decode-execution.d.ts +0 -7
  425. package/dist/config/loader/dependencies.d.ts +0 -7
  426. package/dist/config/loader/discover-tests.d.ts +0 -111
  427. package/dist/config/loader/discovery-summary.d.ts +0 -29
  428. package/dist/config/loader/discovery.d.ts +0 -53
  429. package/dist/config/loader/env.d.ts +0 -4
  430. package/dist/config/loader/execution-model.d.ts +0 -15
  431. package/dist/config/loader/file-metadata.d.ts +0 -19
  432. package/dist/config/loader/groups.d.ts +0 -33
  433. package/dist/config/loader/index.d.ts +0 -10
  434. package/dist/config/loader/load.d.ts +0 -89
  435. package/dist/config/loader/managed-configs.d.ts +0 -23
  436. package/dist/config/loader/path-policy.d.ts +0 -9
  437. package/dist/config/loader/paths.d.ts +0 -5
  438. package/dist/config/loader/runtime-isolation.d.ts +0 -44
  439. package/dist/config/loader/runtime.d.ts +0 -16
  440. package/dist/config/loader/skip-config.d.ts +0 -44
  441. package/dist/config/loader/test-selection.d.ts +0 -15
  442. package/dist/config/loader/validation.d.ts +0 -15
  443. package/dist/config/loader/values.d.ts +0 -3
  444. package/dist/config/loader/values.js +0 -1
  445. package/dist/database/activity-gate.d.ts +0 -22
  446. package/dist/database/admin.d.ts +0 -31
  447. package/dist/database/cleanup.d.ts +0 -36
  448. package/dist/database/configured-steps.d.ts +0 -27
  449. package/dist/database/constants.d.ts +0 -11
  450. package/dist/database/docker-metadata.d.ts +0 -3
  451. package/dist/database/docker.d.ts +0 -65
  452. package/dist/database/drizzle/index.d.ts +0 -13
  453. package/dist/database/fingerprint.d.ts +0 -12
  454. package/dist/database/index.d.ts +0 -39
  455. package/dist/database/lifecycle-cleanup.d.ts +0 -8
  456. package/dist/database/local-postgres.d.ts +0 -71
  457. package/dist/database/naming.d.ts +0 -17
  458. package/dist/database/postgres/index.d.ts +0 -71
  459. package/dist/database/progress.d.ts +0 -6
  460. package/dist/database/roles.d.ts +0 -19
  461. package/dist/database/runtime-config.d.ts +0 -16
  462. package/dist/database/runtime-reservations.d.ts +0 -19
  463. package/dist/database/schema-operations.d.ts +0 -18
  464. package/dist/database/schema-source.d.ts +0 -96
  465. package/dist/database/source-refresh-lock.d.ts +0 -8
  466. package/dist/database/source-url.d.ts +0 -21
  467. package/dist/database/state-files.d.ts +0 -13
  468. package/dist/database/state.d.ts +0 -26
  469. package/dist/database/template-steps.d.ts +0 -39
  470. package/dist/domain/file-timeout.d.ts +0 -25
  471. package/dist/domain/identifiers.d.ts +0 -9
  472. package/dist/domain/operation-display.d.ts +0 -10
  473. package/dist/domain/operation-reason.d.ts +0 -5
  474. package/dist/domain/postgres-route.d.ts +0 -4
  475. package/dist/domain/runtime-identity.d.ts +0 -1
  476. package/dist/domain/runtime-isolation-contract.d.ts +0 -5
  477. package/dist/domain/service-name.d.ts +0 -2
  478. package/dist/domain/suite-selection.d.ts +0 -20
  479. package/dist/domain/test-outcomes.d.ts +0 -2
  480. package/dist/domain/test-types.d.ts +0 -16
  481. package/dist/engines/adapters/evidence-files.d.ts +0 -32
  482. package/dist/engines/adapters/evidence-identity.d.ts +0 -12
  483. package/dist/engines/adapters/execution.d.ts +0 -41
  484. package/dist/engines/adapters/native-report.d.ts +0 -25
  485. package/dist/engines/adapters/node-startup-cache.d.ts +0 -8
  486. package/dist/engines/adapters/workspace.d.ts +0 -4
  487. package/dist/engines/api/capabilities.d.ts +0 -21
  488. package/dist/engines/api/capabilities.js +0 -1
  489. package/dist/engines/api/evidence.d.ts +0 -38
  490. package/dist/engines/api/execution-observer.d.ts +0 -8
  491. package/dist/engines/api/execution-scope.d.ts +0 -17
  492. package/dist/engines/api/execution.d.ts +0 -101
  493. package/dist/engines/api/index.d.ts +0 -5
  494. package/dist/engines/api/k6-runtime-input.d.ts +0 -26
  495. package/dist/engines/api/k6-runtime-input.js +0 -1
  496. package/dist/engines/api/runtime-artifact.d.ts +0 -19
  497. package/dist/engines/bundle-cache.d.ts +0 -32
  498. package/dist/engines/catalog.d.ts +0 -27
  499. package/dist/engines/contracts/fixture-manifest.d.ts +0 -34
  500. package/dist/engines/contracts/json-bounds.d.ts +0 -36
  501. package/dist/engines/contracts/json-bounds.js +0 -2
  502. package/dist/engines/contracts/k6-repository-configuration.d.ts +0 -12
  503. package/dist/engines/contracts/k6-repository-configuration.js +0 -1
  504. package/dist/engines/contracts/test-context.d.ts +0 -15
  505. package/dist/engines/contracts/test-context.js +0 -1
  506. package/dist/engines/definitions.d.ts +0 -23
  507. package/dist/engines/factory.d.ts +0 -6
  508. package/dist/engines/generated-performance.d.ts +0 -1
  509. package/dist/engines/installation-catalog.d.ts +0 -27
  510. package/dist/engines/installation-catalog.js +0 -1
  511. package/dist/engines/installations/k6.d.ts +0 -98
  512. package/dist/engines/installations/k6.js +0 -1
  513. package/dist/engines/installations/node-vitest.d.ts +0 -33
  514. package/dist/engines/installations/package-requirements.d.ts +0 -28
  515. package/dist/engines/installations/package-resolution.d.ts +0 -51
  516. package/dist/engines/installations/playwright-resolution-child.d.ts +0 -1
  517. package/dist/engines/installations/playwright.d.ts +0 -75
  518. package/dist/engines/installations/types.d.ts +0 -10
  519. package/dist/engines/k6/adapter/bundle.d.ts +0 -25
  520. package/dist/engines/k6/adapter/bundle.js +0 -112
  521. package/dist/engines/k6/adapter/evidence.d.ts +0 -15
  522. package/dist/engines/k6/adapter/evidence.js +0 -4
  523. package/dist/engines/k6/adapter/executor.d.ts +0 -13
  524. package/dist/engines/k6/adapter/executor.js +0 -1
  525. package/dist/engines/k6/adapter/index.d.ts +0 -1
  526. package/dist/engines/k6/adapter/index.js +0 -1
  527. package/dist/engines/k6/adapter/input.d.ts +0 -21
  528. package/dist/engines/k6/adapter/input.js +0 -1
  529. package/dist/engines/k6/adapter/native-summary.d.ts +0 -11
  530. package/dist/engines/k6/adapter/native-summary.js +0 -1
  531. package/dist/engines/k6/adapter/repository-configuration.d.ts +0 -2
  532. package/dist/engines/k6/adapter/repository-configuration.js +0 -1
  533. package/dist/engines/k6/authoring-type-paths.d.ts +0 -3
  534. package/dist/engines/k6/authoring-type-paths.js +0 -1
  535. package/dist/engines/k6/runtime/ambient-types/bundle-manifest.json +0 -146
  536. package/dist/engines/k6/runtime/ambient-types/k6/LICENSE +0 -21
  537. package/dist/engines/k6/runtime/ambient-types/k6/browser/index.d.ts +0 -6332
  538. package/dist/engines/k6/runtime/ambient-types/k6/crypto/index.d.ts +0 -218
  539. package/dist/engines/k6/runtime/ambient-types/k6/data/index.d.ts +0 -16
  540. package/dist/engines/k6/runtime/ambient-types/k6/encoding/index.d.ts +0 -46
  541. package/dist/engines/k6/runtime/ambient-types/k6/execution/index.d.ts +0 -127
  542. package/dist/engines/k6/runtime/ambient-types/k6/experimental/csv/index.d.ts +0 -96
  543. package/dist/engines/k6/runtime/ambient-types/k6/experimental/fs/index.d.ts +0 -104
  544. package/dist/engines/k6/runtime/ambient-types/k6/experimental/redis/index.d.ts +0 -821
  545. package/dist/engines/k6/runtime/ambient-types/k6/experimental/streams/index.d.ts +0 -198
  546. package/dist/engines/k6/runtime/ambient-types/k6/global.d.ts +0 -83
  547. package/dist/engines/k6/runtime/ambient-types/k6/html/index.d.ts +0 -1325
  548. package/dist/engines/k6/runtime/ambient-types/k6/http/index.d.ts +0 -806
  549. package/dist/engines/k6/runtime/ambient-types/k6/index.d.ts +0 -126
  550. package/dist/engines/k6/runtime/ambient-types/k6/metrics/index.d.ts +0 -66
  551. package/dist/engines/k6/runtime/ambient-types/k6/net/grpc/index.d.ts +0 -247
  552. package/dist/engines/k6/runtime/ambient-types/k6/options/index.d.ts +0 -459
  553. package/dist/engines/k6/runtime/ambient-types/k6/package.json +0 -79
  554. package/dist/engines/k6/runtime/ambient-types/k6/secrets/index.d.ts +0 -36
  555. package/dist/engines/k6/runtime/ambient-types/k6/timers/index.d.ts +0 -47
  556. package/dist/engines/k6/runtime/ambient-types/k6/websockets/index.d.ts +0 -324
  557. package/dist/engines/k6/runtime/ambient-types/k6/ws/index.d.ts +0 -283
  558. package/dist/engines/k6/runtime/ambient-types/xk6-sql/LICENSE +0 -201
  559. package/dist/engines/k6/runtime/ambient-types/xk6-sql/index.d.ts +0 -397
  560. package/dist/engines/k6/runtime/ambient-types/xk6-sql/package.json +0 -15
  561. package/dist/engines/k6/runtime/artifacts.d.ts +0 -2
  562. package/dist/engines/k6/runtime/artifacts.js +0 -1
  563. package/dist/engines/k6/runtime/checks.d.ts +0 -17
  564. package/dist/engines/k6/runtime/checks.js +0 -1
  565. package/dist/engines/k6/runtime/dal-fixtures.d.ts +0 -24
  566. package/dist/engines/k6/runtime/dal-fixtures.js +0 -1
  567. package/dist/engines/k6/runtime/dal-suite.d.ts +0 -24
  568. package/dist/engines/k6/runtime/dal-suite.js +0 -1
  569. package/dist/engines/k6/runtime/dal.d.ts +0 -10
  570. package/dist/engines/k6/runtime/dal.js +0 -1
  571. package/dist/engines/k6/runtime/fixtures.d.ts +0 -3
  572. package/dist/engines/k6/runtime/fixtures.js +0 -1
  573. package/dist/engines/k6/runtime/http-assertions.d.ts +0 -19
  574. package/dist/engines/k6/runtime/http-assertions.js +0 -1
  575. package/dist/engines/k6/runtime/http-checks.d.ts +0 -19
  576. package/dist/engines/k6/runtime/http-checks.js +0 -1
  577. package/dist/engines/k6/runtime/http-suite-runtime.d.ts +0 -103
  578. package/dist/engines/k6/runtime/http-suite-runtime.js +0 -1
  579. package/dist/engines/k6/runtime/http.d.ts +0 -15
  580. package/dist/engines/k6/runtime/http.js +0 -1
  581. package/dist/engines/k6/runtime/index.d.ts +0 -11
  582. package/dist/engines/k6/runtime/index.js +0 -1
  583. package/dist/engines/k6/runtime/input.d.ts +0 -3
  584. package/dist/engines/k6/runtime/input.js +0 -1
  585. package/dist/engines/k6/runtime/k6-repository-configuration.d.ts +0 -9
  586. package/dist/engines/k6/runtime/k6-repository-configuration.js +0 -1
  587. package/dist/engines/k6/runtime/node-setup.d.ts +0 -13
  588. package/dist/engines/k6/runtime/node-setup.js +0 -1
  589. package/dist/engines/k6/runtime/runtime-globals.d.ts +0 -10
  590. package/dist/engines/k6/runtime/runtime.d.ts +0 -54
  591. package/dist/engines/k6/runtime/runtime.js +0 -1
  592. package/dist/engines/k6/runtime/shared/assertion-details.d.ts +0 -19
  593. package/dist/engines/k6/runtime/shared/assertion-details.js +0 -2
  594. package/dist/engines/k6/runtime/shared/db-normalization.d.ts +0 -19
  595. package/dist/engines/k6/runtime/shared/db-normalization.js +0 -1
  596. package/dist/engines/k6/runtime/shared/error-body.d.ts +0 -3
  597. package/dist/engines/k6/runtime/shared/error-body.js +0 -1
  598. package/dist/engines/k6/runtime/shared/file-data.d.ts +0 -1
  599. package/dist/engines/k6/runtime/shared/file-data.js +0 -1
  600. package/dist/engines/k6/runtime/shared/fixture-engine.d.ts +0 -8
  601. package/dist/engines/k6/runtime/shared/fixture-engine.js +0 -2
  602. package/dist/engines/k6/runtime/shared/http-check-plan.d.ts +0 -29
  603. package/dist/engines/k6/runtime/shared/http-check-plan.js +0 -1
  604. package/dist/engines/k6/runtime/shared/http-parsing.d.ts +0 -10
  605. package/dist/engines/k6/runtime/shared/http-parsing.js +0 -3
  606. package/dist/engines/k6/runtime/shared/ordering.d.ts +0 -2
  607. package/dist/engines/k6/runtime/shared/ordering.js +0 -1
  608. package/dist/engines/k6/runtime/shared/properties.d.ts +0 -1
  609. package/dist/engines/k6/runtime/shared/properties.js +0 -1
  610. package/dist/engines/k6/runtime/suite.d.ts +0 -4
  611. package/dist/engines/k6/runtime/suite.js +0 -1
  612. package/dist/engines/k6/runtime/types.d.ts +0 -244
  613. package/dist/engines/k6/runtime/types.js +0 -1
  614. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.d.ts +0 -7
  615. package/dist/engines/k6/runtime/xk6-sql-driver-postgres.js +0 -1
  616. package/dist/engines/managed-module-resolution-policy-input.d.ts +0 -8
  617. package/dist/engines/managed-module-resolution-policy.d.ts +0 -25
  618. package/dist/engines/managed-module-resolution.d.ts +0 -13
  619. package/dist/engines/manager.d.ts +0 -25
  620. package/dist/engines/node-vitest/adapter/adapter.d.ts +0 -16
  621. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.d.ts +0 -17
  622. package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +0 -3
  623. package/dist/engines/node-vitest/adapter/evidence.d.ts +0 -33
  624. package/dist/engines/node-vitest/adapter/failure-details.d.ts +0 -3
  625. package/dist/engines/node-vitest/adapter/index.d.ts +0 -1
  626. package/dist/engines/node-vitest/adapter/reporter.d.ts +0 -7
  627. package/dist/engines/node-vitest/adapter/resolution.d.ts +0 -12
  628. package/dist/engines/node-vitest/adapter/resolution.js +0 -1
  629. package/dist/engines/node-vitest/adapter/workspace.d.ts +0 -19
  630. package/dist/engines/node-vitest/runtime/contract/index.d.ts +0 -64
  631. package/dist/engines/node-vitest/runtime/contract/index.js +0 -1
  632. package/dist/engines/node-vitest/runtime/data/http.d.ts +0 -4
  633. package/dist/engines/node-vitest/runtime/data/http.js +0 -1
  634. package/dist/engines/node-vitest/runtime/data/index.d.ts +0 -8
  635. package/dist/engines/node-vitest/runtime/data/primitives.d.ts +0 -1
  636. package/dist/engines/node-vitest/runtime/data/report.d.ts +0 -3
  637. package/dist/engines/node-vitest/runtime/data/runner.d.ts +0 -4
  638. package/dist/engines/node-vitest/runtime/data/runner.js +0 -1
  639. package/dist/engines/node-vitest/runtime/data/scenario.d.ts +0 -11
  640. package/dist/engines/node-vitest/runtime/data/types.d.ts +0 -384
  641. package/dist/engines/node-vitest/runtime/runtime-input.d.ts +0 -64
  642. package/dist/engines/playwright/adapter/adapter.d.ts +0 -18
  643. package/dist/engines/playwright/adapter/attachments.d.ts +0 -26
  644. package/dist/engines/playwright/adapter/config.d.ts +0 -45
  645. package/dist/engines/playwright/adapter/evidence-validation.d.ts +0 -9
  646. package/dist/engines/playwright/adapter/evidence.d.ts +0 -32
  647. package/dist/engines/playwright/adapter/failure-details.d.ts +0 -2
  648. package/dist/engines/playwright/adapter/index.d.ts +0 -3
  649. package/dist/engines/playwright/adapter/reporter.d.ts +0 -12
  650. package/dist/engines/playwright/runtime/config-file.d.ts +0 -2
  651. package/dist/engines/playwright/runtime/config.d.ts +0 -24
  652. package/dist/engines/playwright/runtime/index.d.ts +0 -4
  653. package/dist/engines/playwright/runtime/runtime-input.d.ts +0 -36
  654. package/dist/engines/playwright/runtime/sandbox.d.ts +0 -84
  655. package/dist/engines/runtime-input-file.d.ts +0 -27
  656. package/dist/environment/lifecycle-artifacts.d.ts +0 -7
  657. package/dist/environment/lifecycle-controller.d.ts +0 -60
  658. package/dist/environment/lifecycle.d.ts +0 -32
  659. package/dist/environment/maintenance.d.ts +0 -68
  660. package/dist/environment/planning-types.d.ts +0 -33
  661. package/dist/environment/ports.d.ts +0 -10
  662. package/dist/environment/ready-environment.d.ts +0 -16
  663. package/dist/environment/run-environment.d.ts +0 -39
  664. package/dist/environment/run-stopping.d.ts +0 -13
  665. package/dist/environment/runtime-contexts.d.ts +0 -37
  666. package/dist/environment/runtime-manager.d.ts +0 -87
  667. package/dist/environment/runtime-planning.d.ts +0 -16
  668. package/dist/environment/runtime-preparation.d.ts +0 -30
  669. package/dist/environment/runtime-service.d.ts +0 -12
  670. package/dist/environment/services.d.ts +0 -56
  671. package/dist/environment/state.d.ts +0 -15
  672. package/dist/environment/status-runtime.d.ts +0 -53
  673. package/dist/environment/template.d.ts +0 -164
  674. package/dist/evidence/artifact-config.d.ts +0 -14
  675. package/dist/evidence/artifact-validation.d.ts +0 -4
  676. package/dist/evidence/artifacts.d.ts +0 -75
  677. package/dist/evidence/bundles.d.ts +0 -27
  678. package/dist/evidence/ci-provenance.d.ts +0 -9
  679. package/dist/evidence/contracts.d.ts +0 -154
  680. package/dist/evidence/environment-record.d.ts +0 -22
  681. package/dist/evidence/file-evidence.d.ts +0 -23
  682. package/dist/evidence/finalization.d.ts +0 -9
  683. package/dist/evidence/index.d.ts +0 -8
  684. package/dist/evidence/logs.d.ts +0 -31
  685. package/dist/evidence/operation-timings.d.ts +0 -60
  686. package/dist/evidence/read-bundle.d.ts +0 -4
  687. package/dist/evidence/read-fields.d.ts +0 -21
  688. package/dist/evidence/read-provenance.d.ts +0 -2
  689. package/dist/evidence/read-redaction.d.ts +0 -2
  690. package/dist/evidence/read-retention.d.ts +0 -2
  691. package/dist/evidence/read-run.d.ts +0 -2
  692. package/dist/evidence/reading.d.ts +0 -28
  693. package/dist/evidence/reporting-types.d.ts +0 -349
  694. package/dist/evidence/reporting.d.ts +0 -3
  695. package/dist/evidence/secure-file-copy.d.ts +0 -24
  696. package/dist/evidence/setup-progress.d.ts +0 -63
  697. package/dist/evidence/step-output.d.ts +0 -16
  698. package/dist/evidence/storage-inventory.d.ts +0 -27
  699. package/dist/evidence/storage.d.ts +0 -25
  700. package/dist/evidence/timing.d.ts +0 -23
  701. package/dist/file.d.ts +0 -11
  702. package/dist/index.d.ts +0 -4
  703. package/dist/kernel/error-serialization.d.ts +0 -40
  704. package/dist/kernel/redaction.d.ts +0 -2
  705. package/dist/kernel/unknown-values.d.ts +0 -11
  706. package/dist/kernel/work-metrics.d.ts +0 -6
  707. package/dist/process/capture-output.d.ts +0 -7
  708. package/dist/process/command-shell.d.ts +0 -1
  709. package/dist/process/environment-overlay.d.ts +0 -17
  710. package/dist/process/environment.d.ts +0 -33
  711. package/dist/process/files/contained-path.d.ts +0 -8
  712. package/dist/process/files/directory-status.d.ts +0 -14
  713. package/dist/process/files/dotenv.d.ts +0 -2
  714. package/dist/process/files/file-snapshot.d.ts +0 -34
  715. package/dist/process/files/json-file.d.ts +0 -11
  716. package/dist/process/files/paths.d.ts +0 -3
  717. package/dist/process/files/product-dir.d.ts +0 -1
  718. package/dist/process/files/temp-dir.d.ts +0 -11
  719. package/dist/process/host/metadata.d.ts +0 -6
  720. package/dist/process/host/platform.d.ts +0 -57
  721. package/dist/process/host-command.d.ts +0 -4
  722. package/dist/process/host-inspection-command.d.ts +0 -13
  723. package/dist/process/host-process.d.ts +0 -19
  724. package/dist/process/index.d.ts +0 -9
  725. package/dist/process/lifecycle-fence.d.ts +0 -10
  726. package/dist/process/locks.d.ts +0 -28
  727. package/dist/process/process-contracts.d.ts +0 -78
  728. package/dist/process/process-group.d.ts +0 -12
  729. package/dist/process/process-identity.d.ts +0 -27
  730. package/dist/process/process-limits.d.ts +0 -6
  731. package/dist/process/process.d.ts +0 -12
  732. package/dist/process/readiness.d.ts +0 -43
  733. package/dist/process/recovery.d.ts +0 -3
  734. package/dist/process/runs/inspection.d.ts +0 -5
  735. package/dist/process/runs/manifest.d.ts +0 -86
  736. package/dist/process/runs/ownership.d.ts +0 -11
  737. package/dist/process/runs/product-state.d.ts +0 -2
  738. package/dist/process/runs/schema.d.ts +0 -3
  739. package/dist/process/runs/stop.d.ts +0 -19
  740. package/dist/process/runtime-socket.d.ts +0 -4
  741. package/dist/process/service-processes.d.ts +0 -13
  742. package/dist/process/shutdown.d.ts +0 -10
  743. package/dist/process/stoppable-settlement.d.ts +0 -26
  744. package/dist/process/url-redaction.d.ts +0 -1
  745. package/dist/process/windows-cli-owner.d.ts +0 -2
  746. package/dist/process/windows-native.d.ts +0 -12
  747. package/dist/process/windows-process-identity.d.ts +0 -4
  748. package/dist/repo/ci-environment.d.ts +0 -7
  749. package/dist/repo/fingerprint-policy.d.ts +0 -13
  750. package/dist/repo/git-path.d.ts +0 -2
  751. package/dist/repo/history.d.ts +0 -17
  752. package/dist/repo/managed-git.d.ts +0 -10
  753. package/dist/repo/metadata.d.ts +0 -3
  754. package/dist/repo/physical-tree.d.ts +0 -37
  755. package/dist/repo/publish-directory.d.ts +0 -20
  756. package/dist/repo/remote.d.ts +0 -6
  757. package/dist/repo/state.d.ts +0 -26
  758. package/dist/repo/tree-listing.d.ts +0 -10
  759. package/dist/steps/build-config.d.ts +0 -34
  760. package/dist/steps/configured-step-testkit-modules.d.ts +0 -19
  761. package/dist/steps/configured-steps.d.ts +0 -51
  762. package/dist/steps/environment.d.ts +0 -82
  763. package/dist/steps/index.d.ts +0 -2
  764. package/dist/steps/module-runner.d.ts +0 -1
  765. package/dist/steps/run.d.ts +0 -36
  766. package/dist/toolchains/archive.d.ts +0 -53
  767. package/dist/toolchains/esbuild.d.ts +0 -9
  768. package/dist/toolchains/host-node-support.d.ts +0 -3
  769. package/dist/toolchains/index.d.ts +0 -114
  770. package/dist/toolchains/managed-node-releases.d.ts +0 -28
  771. package/dist/toolchains/node-cache.d.ts +0 -20
  772. package/dist/toolchains/node-integrity.d.ts +0 -18
  773. package/dist/toolchains/node-provisioning.d.ts +0 -29
  774. package/dist/toolchains/semver.d.ts +0 -13
  775. package/dist/toolchains/shared-operation.d.ts +0 -11
  776. package/dist/toolchains/timeouts.d.ts +0 -1
  777. package/dist/toolchains/vitest/index.d.ts +0 -13
  778. package/dist/tracker/gitea.d.ts +0 -14
  779. package/dist/tracker/github.d.ts +0 -14
  780. package/dist/tracker/http.d.ts +0 -33
  781. package/dist/tracker/index.d.ts +0 -4
  782. package/dist/tracker/redaction.d.ts +0 -4
  783. package/dist/tracker/requests.d.ts +0 -17
  784. package/dist/tracker/responses.d.ts +0 -24
  785. package/dist/tracker/types.d.ts +0 -51
  786. package/docs/engine-architecture.md +0 -682
  787. /package/dist/engines/{k6/runtime/runtime-globals.js → api/profiles.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{classifyRuntimeNodeSetupFailure as R,createSetupFailure as o,createSetupCleanupError as D,createSetupCleanupTimeoutError as y,createUnacknowledgedSetupCleanupError as b,withSetupCleanupFailures as h}from"./runtime-node-setup-errors.js";export{classifyRuntimeNodeSetupFailure,getRuntimeNodeSetupCleanupFailures}from"./runtime-node-setup-errors.js";import _ from"node:fs";import{randomUUID as F}from"node:crypto";import a from"node:path";import{Worker as j}from"node:worker_threads";import{isEngineTaskDeadlineExceededReason as x}from"../../../engines/api/index.js";import{readRuntimeNodeSetupWorkerMessage as M,serializeRuntimeNodeSetupError as A}from"./runtime-node-setup-protocol.js";const E=100,N=5e3;export const MAX_RUNTIME_NODE_SETUP_CLEANUP_TIMEOUT_MS=6e4;class C{#o;#m;#i;#w;#c=$();#d;#a;#R=!1;#k=null;#r=null;#s=null;#u=0;#h=null;#f=null;#$=!1;#t="starting";#v=!1;#e=null;#g=null;constructor(e,t,r){this.#w=e,this.#d=t,this.#m=e.deadlineMs,this.#i=e.moduleRelativePath,this.#o=r,this.#a=new j(new URL("./runtime-node-setup-worker.js",import.meta.url),{name:"testkit-runtime-node-setup",workerData:e}),this.#a.on("message",s=>{this.#j(s).catch(n=>{this.#T(o("infra",`Runtime node setup worker for "${this.#i}" sent an invalid message`,n))})}),this.#a.once("error",s=>{this.#T(o("infra",`Runtime node setup worker failed for "${this.#i}"`,s))}),this.#a.once("exit",s=>{this.#$||this.#T(o("infra",`Runtime node setup worker for "${this.#i}" exited unexpectedly with code ${s.toString()}`))}),this.#d.addEventListener("abort",this.#S,{once:!0}),this.#_()}start(){return this.#d.aborted?this.#p(m(this.#d.reason,this.#i)):Date.now()>=this.#m&&this.#p(c(this.#m,this.#i)),this.#c.promise}cleanup=()=>{if(this.#r!==null)return this.#r.promise;const e=$();if(this.#r=e,this.#e!==null&&this.#t==="cleaning")return e.promise;if(this.#e!==null||this.#t==="terminated")return this.#L(),e.promise;if(this.#t!=="ready")return this.#E(o("infra",`Runtime node setup cleanup is invalid during phase "${this.#t}"`)),e.promise;this.#t="cleaning",this.#h=setTimeout(()=>{this.#E(this.#O())},this.#o);try{this.#a.postMessage({sessionId:this.#w.sessionId,type:"cleanup"})}catch(t){this.#E(o("infra",`Could not request runtime node setup cleanup for "${this.#i}"`,t))}return e.promise};#S=()=>{this.#p(m(this.#d.reason,this.#i))};async#j(e){const t=M(e);if(t===null||t.sessionId!==this.#w.sessionId){this.#n(`Runtime node setup worker for "${this.#i}" sent an invalid message`);return}switch(t.type){case"abort-acknowledged":this.#x();return;case"cleanup-started":this.#M(t.owners);return;case"cleanup-progress":this.#A(t.owner,t.remainingCallbacks);return;case"ready":this.#N(t);return;case"setup-error":await this.#C(t);return;case"cleanup-complete":await this.#I(t);return;case"aborted":await this.#P(t.cleanupFailures)}}#x(){if(this.#e===null||this.#t==="terminated"){this.#n(`Runtime node setup worker acknowledged an unexpected abort during phase "${this.#t}"`);return}if(this.#R){this.#n("Runtime node setup worker acknowledged abort more than once");return}this.#R=!0,this.#y(this.#s!==null?this.#o:E)}#M(e){if(this.#s!==null||this.#t!=="starting"&&this.#t!=="cleaning"){this.#n(this.#s!==null?"Runtime node setup worker started cleanup more than once":`Runtime node setup worker started cleanup during phase "${this.#t}"`);return}this.#s=[...e],this.#u=0,this.#e!==null&&this.#y(this.#o)}#A(e,t){const r=this.#s?.[this.#u],s=(this.#s?.length??0)-this.#u;if(this.#s===null||this.#t!=="starting"&&this.#t!=="cleaning"||r!==e||s!==t){this.#n(`Runtime node setup worker reported invalid cleanup progress during phase "${this.#t}"`);return}this.#u+=1}#N(e){if(this.#t!=="starting"||this.#e!==null||this.#s!==null){this.#e!==null?this.#p(this.#e):this.#n(this.#s!==null?"Runtime node setup worker became ready after starting cleanup":`Runtime node setup worker became ready during phase "${this.#t}"`);return}const t=e.setupData,r=e.sidecars.map(s=>({...s}));l(this.#f),this.#f=null,this.#t="ready",this.#c.resolve({artifacts:[{name:"node-setup",kind:"testkit.node-setup",summary:`node setup ${this.#i}`,contentType:"application/json",data:{module:this.#i,sidecars:r,setupData:t},emittedAt:new Date().toISOString()}],cleanup:this.cleanup,setupData:t})}async#C(e){if(this.#t!=="starting"){this.#n(`Runtime node setup worker reported setup failure during phase "${this.#t}"`);return}if(!this.#b()){this.#n("Runtime node setup worker reported setup failure before acknowledging cleanup completion");return}const t=p(e.cleanupFailures),r=P(e.error,e.kind,this.#i,t),s=this.#e===null?r:h(this.#e,t);this.#e=s,await this.#l(),this.#c.reject(this.#e)}async#I(e){if(this.#t!=="cleaning"||this.#r===null||!this.#b()){this.#n(`Runtime node setup worker reported cleanup during phase "${this.#t}"`);return}const t=p(e.cleanupFailures);l(this.#h),this.#h=null,t.length>0&&(this.#e=this.#e===null?D(t):h(this.#e,t)),await this.#l(),this.#e!==null?this.#r.reject(this.#e):this.#r.resolve(void 0)}async#P(e){if(!this.#b()){this.#n("Runtime node setup worker reported abort completion before acknowledging cleanup completion");return}const t=p(e),r=h(this.#e??o("infra",`Runtime node setup worker for "${this.#i}" aborted unexpectedly`),t);this.#e=r,await this.#l();const s=this.#e;this.#c.reject(s),this.#r?.reject(s)}#p(e,t=!1){if(this.#t==="terminated")return;if(t){if(this.#v)return;this.#v=!0}if(this.#e!==null){t&&(this.#e=h(this.#e,[{error:e,owner:"testkit"}]));return}const r=this.#t==="ready",s=r||this.#t==="cleaning"?this.#o:E;this.#e=e,r&&(this.#t="cleaning"),this.#F(),l(this.#h),this.#h=null;try{this.#a.postMessage({error:A(e),kind:R(e),sessionId:this.#w.sessionId,type:"abort"})}catch{this.#D();return}this.#y(s)}async#D(){const e=this.#e??o("infra",`Runtime node setup worker for "${this.#i}" was terminated`),t=this.#U();this.#e=h(e,[t]),await this.#l();const r=this.#e;this.#c.reject(r),this.#r?.reject(r)}#y(e){l(this.#k),this.#k=setTimeout(()=>{this.#D()},e)}#U(){if(this.#s!==null){const e=this.#s.at(Math.max(0,this.#u-1))??"testkit";return{error:y(this.#o,e),owner:e}}return{error:b(this.#R),owner:"testkit"}}#O(){return this.#s===null?b(!1):y(this.#o,this.#s.at(Math.max(0,this.#u-1))??"testkit")}#b(){return this.#s!==null&&this.#u===this.#s.length}#n(e){this.#p(o("infra",e),!0)}async#L(){await this.#l();const e=this.#e??o("infra",`Runtime node setup worker for "${this.#i}" is unavailable during cleanup`);this.#r?.reject(e)}async#E(e){this.#e??=e,await this.#l(),this.#r?.reject(this.#e)}#T(e){this.#e===null&&(this.#e=e),this.#l().then(()=>{this.#c.reject(this.#e),this.#r?.reject(this.#e)})}#_(){const e=this.#m-Date.now();if(e<=0){this.#p(c(this.#m,this.#i));return}this.#f=setTimeout(()=>{this.#_()},Math.min(e,2147483647))}#F(){l(this.#f),this.#f=null,this.#d.removeEventListener("abort",this.#S)}#l(){return this.#g!==null?this.#g:(this.#$=!0,this.#t="terminated",this.#F(),l(this.#k),l(this.#h),this.#k=null,this.#h=null,this.#g=this.#a.terminate().then(()=>{}).catch(e=>{const t=o("infra",`Failed to terminate runtime node setup worker for "${this.#i}"`,e);this.#e=this.#e===null?t:h(this.#e,[{error:t,owner:"testkit"}])}),this.#g)}}export async function runRuntimeNodeSetup({cleanupTimeoutMs:i,deadlineMs:e,targetConfig:t,task:r,signal:s,lease:n,runtimeEnv:w={}}){const d=Math.min(i??N,MAX_RUNTIME_NODE_SETUP_CLEANUP_TIMEOUT_MS),u=findRuntimeNodeSetupFile(t.productDir,r.file);if(s.aborted)throw m(s.reason,u?f(t.productDir,u):r.file);if(Date.now()>=e)throw c(e,u?f(t.productDir,u):r.file);if(!u)return I();const k=f(t.productDir,u),v={deadlineMs:e,leaseDir:n?.leaseDir??null,modulePath:u,moduleRelativePath:k,productDir:t.productDir,runtimeEnv:w,serviceName:t.name.trim(),sessionId:F(),testFile:r.file.trim()};let g;try{g=new C(v,s,d)}catch(S){throw o("infra",`Could not start runtime node setup worker for "${k}"`,S)}return g.start()}export function findRuntimeNodeSetupFile(i,e){const t=a.resolve(i),r=a.resolve(t,e),s=a.relative(t,r);if(s===".."||s.startsWith(`..${a.sep}`)||a.isAbsolute(s))throw new Error("Runtime node setup test file must be inside productDir");const n=a.parse(r);return[a.join(n.dir,`${n.name}.setup.mjs`),a.join(n.dir,`${n.name}.setup.js`),a.join(n.dir,"__setup__",`${n.name}.mjs`),a.join(n.dir,"__setup__",`${n.name}.js`)].find(d=>_.existsSync(d))??null}function I(){const i=Promise.resolve();return{artifacts:[],cleanup:()=>i,setupData:{}}}function P(i,e,t,r){const s=T(i),n=o(e,`Runtime node setup "${t}" failed: ${s.message}`,s);return s.stack&&(n.stack=`${n.stack??n.message}
1
+ import{classifyRuntimeNodeSetupFailure as R,createSetupFailure as o,createSetupCleanupError as _,createSetupCleanupTimeoutError as y,createUnacknowledgedSetupCleanupError as b,withSetupCleanupFailures as h}from"./runtime-node-setup-errors.js";export{classifyRuntimeNodeSetupFailure,getRuntimeNodeSetupCleanupFailures}from"./runtime-node-setup-errors.js";import F from"node:fs";import{randomUUID as j}from"node:crypto";import a from"node:path";import{Worker as x}from"node:worker_threads";import{isEngineTaskDeadlineExceededReason as M}from"../../../engines/api/index.js";import{readRuntimeNodeSetupWorkerMessage as A,serializeRuntimeNodeSetupError as N}from"./runtime-node-setup-protocol.js";const E=100,C=5e3;export const MAX_RUNTIME_NODE_SETUP_CLEANUP_TIMEOUT_MS=6e4;class I{#o;#m;#i;#$;#w;#c=$();#d;#a;#R=!1;#k=null;#r=null;#s=null;#u=0;#h=null;#f=null;#v=!1;#t="starting";#S=!1;#e=null;#g=null;constructor(e,t,s,r){this.#$=r,this.#w=e,this.#d=t,this.#m=e.deadlineMs,this.#i=e.moduleRelativePath,this.#o=s,this.#a=new x(new URL("./runtime-node-setup-worker.js",import.meta.url),{name:"testkit-runtime-node-setup",workerData:e}),this.#a.on("message",n=>{this.#x(n).catch(c=>{this.#T(o("infra",`Runtime node setup worker for "${this.#i}" sent an invalid message`,c))})}),this.#a.once("error",n=>{this.#T(o("infra",`Runtime node setup worker failed for "${this.#i}"`,n))}),this.#a.once("exit",n=>{this.#v||this.#T(o("infra",`Runtime node setup worker for "${this.#i}" exited unexpectedly with code ${n.toString()}`))}),this.#d.addEventListener("abort",this.#D,{once:!0}),this.#F()}start(){return this.#d.aborted?this.#p(f(this.#d.reason,this.#i)):Date.now()>=this.#m&&this.#p(d(this.#m,this.#i)),this.#c.promise}cleanup=()=>{if(this.#r!==null)return this.#r.promise;const e=$();if(this.#r=e,this.#e!==null&&this.#t==="cleaning")return e.promise;if(this.#e!==null||this.#t==="terminated")return this.#W(),e.promise;if(this.#t!=="ready")return this.#E(o("infra",`Runtime node setup cleanup is invalid during phase "${this.#t}"`)),e.promise;this.#t="cleaning",this.#h=setTimeout(()=>{this.#E(this.#L())},this.#o);try{this.#a.postMessage({sessionId:this.#w.sessionId,type:"cleanup"})}catch(t){this.#E(o("infra",`Could not request runtime node setup cleanup for "${this.#i}"`,t))}return e.promise};#D=()=>{this.#p(f(this.#d.reason,this.#i))};async#x(e){const t=A(e);if(t===null||t.sessionId!==this.#w.sessionId){this.#n(`Runtime node setup worker for "${this.#i}" sent an invalid message`);return}switch(t.type){case"abort-acknowledged":this.#M();return;case"cleanup-started":this.#A(t.owners);return;case"cleanup-progress":this.#N(t.owner,t.remainingCallbacks);return;case"ready":this.#C(t);return;case"sidecar-started":this.#$(t.sidecar);return;case"setup-error":await this.#I(t);return;case"cleanup-complete":await this.#P(t);return;case"aborted":await this.#U(t.cleanupFailures)}}#M(){if(this.#e===null||this.#t==="terminated"){this.#n(`Runtime node setup worker acknowledged an unexpected abort during phase "${this.#t}"`);return}if(this.#R){this.#n("Runtime node setup worker acknowledged abort more than once");return}this.#R=!0,this.#y(this.#s!==null?this.#o:E)}#A(e){if(this.#s!==null||this.#t!=="starting"&&this.#t!=="cleaning"){this.#n(this.#s!==null?"Runtime node setup worker started cleanup more than once":`Runtime node setup worker started cleanup during phase "${this.#t}"`);return}this.#s=[...e],this.#u=0,this.#e!==null&&this.#y(this.#o)}#N(e,t){const s=this.#s?.[this.#u],r=(this.#s?.length??0)-this.#u;if(this.#s===null||this.#t!=="starting"&&this.#t!=="cleaning"||s!==e||r!==t){this.#n(`Runtime node setup worker reported invalid cleanup progress during phase "${this.#t}"`);return}this.#u+=1}#C(e){if(this.#t!=="starting"||this.#e!==null||this.#s!==null){this.#e!==null?this.#p(this.#e):this.#n(this.#s!==null?"Runtime node setup worker became ready after starting cleanup":`Runtime node setup worker became ready during phase "${this.#t}"`);return}const t=e.setupData,s=e.sidecars.map(r=>({...r}));l(this.#f),this.#f=null,this.#t="ready",this.#c.resolve({artifacts:[{name:"node-setup",kind:"testkit.node-setup",summary:`node setup ${this.#i}`,contentType:"application/json",data:{module:this.#i,sidecars:s,setupData:t},emittedAt:new Date().toISOString()}],cleanup:this.cleanup,setupData:t,sidecars:s})}async#I(e){if(this.#t!=="starting"){this.#n(`Runtime node setup worker reported setup failure during phase "${this.#t}"`);return}if(!this.#b()){this.#n("Runtime node setup worker reported setup failure before acknowledging cleanup completion");return}const t=m(e.cleanupFailures),s=U(e.error,e.kind,this.#i,t),r=this.#e===null?s:h(this.#e,t);this.#e=r,await this.#l(),this.#c.reject(this.#e)}async#P(e){if(this.#t!=="cleaning"||this.#r===null||!this.#b()){this.#n(`Runtime node setup worker reported cleanup during phase "${this.#t}"`);return}const t=m(e.cleanupFailures);l(this.#h),this.#h=null,t.length>0&&(this.#e=this.#e===null?_(t):h(this.#e,t)),await this.#l(),this.#e!==null?this.#r.reject(this.#e):this.#r.resolve(void 0)}async#U(e){if(!this.#b()){this.#n("Runtime node setup worker reported abort completion before acknowledging cleanup completion");return}const t=m(e),s=h(this.#e??o("infra",`Runtime node setup worker for "${this.#i}" aborted unexpectedly`),t);this.#e=s,await this.#l();const r=this.#e;this.#c.reject(r),this.#r?.reject(r)}#p(e,t=!1){if(this.#t==="terminated")return;if(t){if(this.#S)return;this.#S=!0}if(this.#e!==null){t&&(this.#e=h(this.#e,[{error:e,owner:"testkit"}]));return}const s=this.#t==="ready",r=s||this.#t==="cleaning"?this.#o:E;this.#e=e,s&&(this.#t="cleaning"),this.#j(),l(this.#h),this.#h=null;try{this.#a.postMessage({error:N(e),kind:R(e),sessionId:this.#w.sessionId,type:"abort"})}catch{this.#_();return}this.#y(r)}async#_(){const e=this.#e??o("infra",`Runtime node setup worker for "${this.#i}" was terminated`),t=this.#O();this.#e=h(e,[t]),await this.#l();const s=this.#e;this.#c.reject(s),this.#r?.reject(s)}#y(e){l(this.#k),this.#k=setTimeout(()=>{this.#_()},e)}#O(){if(this.#s!==null){const e=this.#s.at(Math.max(0,this.#u-1))??"testkit";return{error:y(this.#o,e),owner:e}}return{error:b(this.#R),owner:"testkit"}}#L(){return this.#s===null?b(!1):y(this.#o,this.#s.at(Math.max(0,this.#u-1))??"testkit")}#b(){return this.#s!==null&&this.#u===this.#s.length}#n(e){this.#p(o("infra",e),!0)}async#W(){await this.#l();const e=this.#e??o("infra",`Runtime node setup worker for "${this.#i}" is unavailable during cleanup`);this.#r?.reject(e)}async#E(e){this.#e??=e,await this.#l(),this.#r?.reject(this.#e)}#T(e){this.#e===null&&(this.#e=e),this.#l().then(()=>{this.#c.reject(this.#e),this.#r?.reject(this.#e)})}#F(){const e=this.#m-Date.now();if(e<=0){this.#p(d(this.#m,this.#i));return}this.#f=setTimeout(()=>{this.#F()},Math.min(e,2147483647))}#j(){l(this.#f),this.#f=null,this.#d.removeEventListener("abort",this.#D)}#l(){return this.#g!==null?this.#g:(this.#v=!0,this.#t="terminated",this.#j(),l(this.#k),l(this.#h),this.#k=null,this.#h=null,this.#g=this.#a.terminate().then(()=>{}).catch(e=>{const t=o("infra",`Failed to terminate runtime node setup worker for "${this.#i}"`,e);this.#e=this.#e===null?t:h(this.#e,[{error:t,owner:"testkit"}])}),this.#g)}}export async function runRuntimeNodeSetup({cleanupTimeoutMs:i,deadlineMs:e,targetConfig:t,task:s,signal:r,lease:n,onSidecar:c=()=>{},runtimeEnv:p={}}){const v=Math.min(i??C,MAX_RUNTIME_NODE_SETUP_CLEANUP_TIMEOUT_MS),u=findRuntimeNodeSetupFile(t.productDir,s.file);if(r.aborted)throw f(r.reason,u?w(t.productDir,u):s.file);if(Date.now()>=e)throw d(e,u?w(t.productDir,u):s.file);if(!u)return P();const k=w(t.productDir,u),S={deadlineMs:e,leaseDir:n?.leaseDir??null,modulePath:u,moduleRelativePath:k,productDir:t.productDir,runtimeEnv:p,serviceName:t.name.trim(),sessionId:j(),testFile:s.file.trim()};let g;try{g=new I(S,r,v,c)}catch(D){throw o("infra",`Could not start runtime node setup worker for "${k}"`,D)}return g.start()}export function findRuntimeNodeSetupFile(i,e){const t=a.resolve(i),s=a.resolve(t,e),r=a.relative(t,s);if(r===".."||r.startsWith(`..${a.sep}`)||a.isAbsolute(r))throw new Error("Runtime node setup test file must be inside productDir");const n=a.parse(s);return[a.join(n.dir,`${n.name}.setup.mjs`),a.join(n.dir,`${n.name}.setup.js`),a.join(n.dir,"__setup__",`${n.name}.mjs`),a.join(n.dir,"__setup__",`${n.name}.js`)].find(p=>F.existsSync(p))??null}function P(){const i=Promise.resolve();return{artifacts:[],cleanup:()=>i,setupData:{},sidecars:[]}}function U(i,e,t,s){const r=T(i),n=o(e,`Runtime node setup "${t}" failed: ${r.message}`,r);return r.stack&&(n.stack=`${n.stack??n.message}
2
2
  Remote stack:
3
- ${s.stack}`),h(n,r)}function T(i){const e=new Error(i.message);return e.name=i.name,i.stack&&(e.stack=i.stack),e}function p(i){return i.map(e=>({error:T(e.error),owner:e.owner}))}function m(i,e){return R(i)==="deadline"&&i instanceof Error?i:x(i)?c(i.deadlineMs,e):o("cancelled","Runtime node setup was cancelled",i)}function c(i,e){return o("deadline",`Runtime node setup exceeded its deadline ${i.toString()}${e?` for "${e}"`:""}`)}function f(i,e){return a.relative(i,e).split(a.sep).join("/")}function $(){let i,e;return{promise:new Promise((r,s)=>{i=r,e=s}),resolve:i,reject:e}}function l(i){i!==null&&clearTimeout(i)}
3
+ ${r.stack}`),h(n,s)}function T(i){const e=new Error(i.message);return e.name=i.name,i.stack&&(e.stack=i.stack),e}function m(i){return i.map(e=>({error:T(e.error),owner:e.owner}))}function f(i,e){return R(i)==="deadline"&&i instanceof Error?i:M(i)?d(i.deadlineMs,e):o("cancelled","Runtime node setup was cancelled",i)}function d(i,e){return o("deadline",`Runtime node setup exceeded its deadline ${i.toString()}${e?` for "${e}"`:""}`)}function w(i,e){return a.relative(i,e).split(a.sep).join("/")}function $(){let i,e;return{promise:new Promise((s,r)=>{i=s,e=r}),resolve:i,reject:e}}function l(i){i!==null&&clearTimeout(i)}
@@ -1 +1 @@
1
- import{resolveEngineProfile as p}from"../../engines/catalog.js";export const DEFAULT_COMPATIBLE_BATCH_MAX_FILES=25;export function claimCompatibleTaskBatch(e,t,o={}){const r=o.maxFiles??DEFAULT_COMPATIBLE_BATCH_MAX_FILES,i=[t];if(!isBatchableEngineTask(t)||r<=1)return i;for(let n=0;n<e.length&&i.length<r;){const l=e[n];if(!isCompatibleEngineBatchTask(t,l)){n+=1;continue}i.push(l),e.splice(n,1)}return i}export function buildTaskBatch(e){if(e.length<=1)return e[0]??null;const t=e[0];return{...t,batchId:c(e),batchTasks:[t,e[1],...e.slice(2)],batchFiles:e.map(o=>o.file)}}export function expandTaskResultOutcomes(e){return e?e.outcomes!==void 0?[...e.outcomes]:[e]:[]}export function isBatchableEngineTask(e){return p(e.testType,e.engineId).capabilities.taskBatching==="compatible"&&e.runtimeIsolation==="shared"&&e.resourceCost===1&&e.locks.length===0}export function isCompatibleEngineBatchTask(e,t){return!isBatchableEngineTask(e)||!isBatchableEngineTask(t)?!1:t.graphKey===e.graphKey&&t.targetName===e.targetName&&t.serviceName===e.serviceName&&t.testType===e.testType&&t.engineId===e.engineId&&t.profileId===e.profileId}function c(e){return`${e[0].engineId}-batch-${e.map(t=>t.id).join("-")}`}
1
+ import{resolveExecutionProfile as c}from"../../engines/catalog.js";export const DEFAULT_COMPATIBLE_BATCH_MAX_FILES=25;export function claimCompatibleTaskBatch(e,t,n={}){const r=n.maxFiles??DEFAULT_COMPATIBLE_BATCH_MAX_FILES,o=[t],l=p(t);if(l?f(t):!isBatchableEngineTask(t)||r<=1)return o;for(let u=0;u<e.length&&(l||o.length<r);){const i=e[u];if(l?i.engineId!==t.engineId||i.profileId!==t.profileId||f(i)||!m(t,i,n.environmentKeys):!isCompatibleEngineBatchTask(t,i)){u+=1;continue}o.push(i),e.splice(u,1)}return o}export function buildTaskBatch(e){if(e.length<=1)return e[0]??null;const t=e[0];return{...t,batchId:g(e),batchTasks:[t,e[1],...e.slice(2)],batchFiles:e.map(n=>n.file)}}export function expandTaskResultOutcomes(e){return e?e.outcomes!==void 0?[...e.outcomes]:[e]:[]}export function isBatchableEngineTask(e){return c(e).taskBatching==="compatible"&&e.resourceCost===1&&!f(e)}function f(e){return e.hasSetup||e.locks.length>0||e.runtimeIsolation!=="shared"}export function isCompatibleEngineBatchTask(e,t){return!isBatchableEngineTask(e)||!isBatchableEngineTask(t)?!1:t.graphKey===e.graphKey&&t.targetName===e.targetName&&t.serviceName===e.serviceName&&t.testType===e.testType&&t.engineId===e.engineId&&t.profileId===e.profileId}function m(e,t,n=new Map){if(t.targetName===e.targetName)return!0;const r=n.get(e.targetName);return r!==void 0&&r===n.get(t.targetName)}function p(e){return c(e).taskBatching==="selection"}function g(e){return`${e[0].engineId}-batch-${e.map(t=>t.id).join("-")}`}
@@ -1 +1 @@
1
- import{EngineExecutionBridgeError as b,executeEngineTask as N}from"./engine-execution.js";import{formatError as P,toError as C}from"../../kernel/error-serialization.js";import{formatEngineInvocationStack as j}from"./engine-failure-stack.js";import{DEFAULT_ENGINE_REPORTER_CALLBACK_TIMEOUT_MS as U,invokeBoundedReporterCallback as z}from"./engine-execution-reporting.js";import{drainRuntimeFailedTasks as J}from"./runtime-failures.js";import{buildTimingObservation as H}from"./scheduler/observations.js";import{buildTaskBatch as Q,claimCompatibleTaskBatch as V,expandTaskResultOutcomes as X}from"./task-batches.js";export function createWorker(e,i){return{workerId:e,productDir:i,currentGraphKey:null,graphSwitches:0,taskCount:0}}export async function runWorker(e,i,t,r,a,c,l,h,d,m=null){const y=Date.now(),k=[],x=[];try{for(;!t.isStopRequested();){const u=l(i,e.currentGraphKey,n=>t.locks.available(n.locks)&&t.environments.canAcquire(n));if(!u){const n=J(i,t.environments);if(n.length>0){const o=Date.now(),s=new Set;for(const g of n)h(a,g.task,{status:"not_run",reason:g.reason,durationMs:0,startedAt:o,finishedAt:o,error:null,infraFailed:g.infraFailed,blockedByRuntime:g.blockedByRuntime,failureDetails:g.failureDetails}),s.has(g.graph.key)||(d(a,g.graph,g.message,o,{classification:"infra"}),s.add(g.graph.key));e.taskCount+=n.length;continue}if(i.length===0)break;await ae(10);continue}const w=t.leases.allocate(u);t.locks.acquire(u.locks,w.id);let v=null,T=[u],I=u,S=!1,B=null,$="acquire",R=[],F=null;try{T=V(i,u),I=Q(T)??u,e.currentGraphKey!==null&&e.currentGraphKey!==u.graphKey&&(e.graphSwitches+=1),e.currentGraphKey=u.graphKey,v=await t.environments.acquire(I,w),t.leases.create(w),$="execute";const n=await N(r,{environment:v.environment,lease:w,nativeConfigDirectory:v.nativeConfigDirectory,request:t.request,task:I},t,m);$="mapping";const o=X(n);R=resolveWorkerOutcomeMappings(T,o),R.some(({outcome:s})=>s.infraFailed&&s.blockedByRuntime)&&(S=!0)}catch(n){const o=$==="acquire"?ie(n,t):te(n);B={disposition:o,error:n},S=v!==null&&o.runtimeImpact!=="none"}finally{F=await Z(t.leases,v,w,S),t.locks.release(u.locks,w.id)}const f=[];let E=null;const D=()=>{if(E!==null)return E;try{E=ne(t.environments,u)}catch(n){f.push(M("Runtime failure graph resolution failed",n)),E=W(u)}return E};if(B===null){for(const{outcome:o,task:s}of R)await A({operationErrors:f,outcome:o,recordTaskOutcome:h,recordTiming:!0,reporter:m,reportTaskFinished:!1,task:s,timingUpdates:c,trackers:a});e.taskCount+=R.length;const n=R.filter(({outcome:o})=>o.infraFailed&&o.blockedByRuntime);if(n.length>0){const o=n.map(({outcome:s})=>s.reason??s.error??"Runtime readiness failed before engine execution").join("; ");k.push(o),await O(f,"Runtime error reporter failed",()=>m?.runtimeError?.(u,o)),await p(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(u.graphKey,o)}),await p(f,"Result graph error recording failed",()=>{d(a,D(),o,Date.now(),{classification:"infra"})})}}else{const{disposition:n,error:o}=B,s=P(o),g=Y(T,o);n.status!=="cancelled"&&k.push(s),n.notifyRuntimeError&&await O(f,"Runtime error reporter failed",()=>m?.runtimeError?.(g,s)),n.status!=="cancelled"&&(n.runtimeImpact==="fail-graph"&&await p(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(u.graphKey,s)}),await p(f,"Result graph error recording failed",()=>{d(a,D(),s,Date.now(),{classification:n.classification??"product"})}));const q=Date.now();for(const K of T){const _=o instanceof b&&o.completedOutcomesByTaskId.has(String(K.id)),L=ee(K,I,o,n,s,q);await A({operationErrors:f,outcome:L,recordTaskOutcome:h,recordTiming:_,reporter:m,reportTaskFinished:!_,task:K,timingUpdates:c,trackers:a})}e.taskCount+=T.length}if(F!==null){const n=F.message;k.push(n),await O(f,"Runtime error reporter failed",()=>m?.runtimeError?.(u,n)),F.recovered||await p(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(u.graphKey,n)}),await p(f,"Result graph error recording failed",()=>{d(a,D(),n,Date.now(),{classification:"infra"})})}if(f.length>0){const n=[...f];for(const s of n)k.push(s.message);const o=n.map(s=>s.message).join("; ");await p(f,"Result graph error recording failed while reporting a Testkit operation failure",()=>{d(a,D(),o,Date.now(),{classification:"infra"})});for(const s of f.slice(n.length))k.push(s.message);f.length>n.length&&x.push(...n.map(s=>s.message),...f.slice(n.length).map(s=>s.message))}}}finally{e.currentGraphKey=null}return{workerId:e.workerId,failed:k.length>0,durationMs:Date.now()-y,taskCount:e.taskCount,graphSwitches:e.graphSwitches,errors:k,unpersistedErrors:x}}async function A({operationErrors:e,outcome:i,recordTaskOutcome:t,recordTiming:r,reporter:a,reportTaskFinished:c,task:l,timingUpdates:h,trackers:d}){await p(e,`Task outcome recording failed for ${l.file}`,()=>{t(d,l,i)}),c&&await O(e,`Task-finished reporter failed for ${l.file}`,()=>a?.taskFinished?.(l,i)),r&&await p(e,`Task timing recording failed for ${l.file}`,()=>{const m=H(l,i);m&&h.push(m)})}async function p(e,i,t){try{await t()}catch(r){e.push(M(i,r))}}async function O(e,i,t){await p(e,i,()=>z(i,t,{timeoutMs:U}))}function M(e,i){const t=C(i);return new Error(`${e}: ${t.message}`,{cause:t})}function Y(e,i){const t=e[0];if(!(i instanceof b))return t;if(i.failingTaskId!==null){const r=e.find(a=>String(a.id)===i.failingTaskId);if(r!==void 0)return r}return e.find(r=>!i.completedOutcomesByTaskId.has(String(r.id)))??t}function W(e){return{key:e.graphKey,targetNames:[e.targetName]}}async function Z(e,i,t,r){const a=async c=>{await i?.release({invalidate:c}),e.remove(t)};try{return await a(r),null}catch(c){const l=C(c);try{return await a(!0),{message:`Runtime lease release failed but recovered on idempotent retry: ${l.message}`,recovered:!0}}catch(h){const d=C(h);return{message:`Runtime lease release failed: ${l.message}; idempotent retry also failed: ${d.message}`,recovered:!1}}}}function ee(e,i,t,r,a,c){const l=j(t),h={kind:"engine-invocation",key:"engine_invocation_failed",title:"Engine invocation failed",count:1,...r.classification===void 0?{}:{classification:r.classification},message:a,...l===void 0?{}:{stack:l}},d=t instanceof b?t.completedOutcomesByTaskId.get(String(e.id)):void 0;if(d!==void 0)return d;const m=t instanceof b?t.artifactReferencesByTaskId.get(String(e.id))??[]:[];return{task:e,status:r.status,error:r.status==="failed"?a:null,reason:r.status==="failed"?null:a,infraFailed:r.classification==="infra",blockedByRuntime:r.status==="not_run",durationMs:0,startedAt:c,finishedAt:c,artifacts:[...m],failureDetails:r.status==="cancelled"?[]:[h],checkDetails:[],..."batchTasks"in i?{runtimeBatch:{id:i.batchId,index:i.batchTasks.findIndex(y=>y.id===e.id&&y.file===e.file),fileCount:i.batchTasks.length,files:i.batchTasks.map(y=>y.file)}}:{}}}function te(e){return e instanceof b?e.disposition:{classification:"infra",notifyRuntimeError:!0,runtimeImpact:"none",status:"not_run"}}function ie(e,i){return i.signal.aborted&&e===i.signal.reason?{classification:void 0,notifyRuntimeError:!1,runtimeImpact:"none",status:"cancelled"}:{classification:"infra",notifyRuntimeError:!0,runtimeImpact:"fail-graph",status:"not_run"}}export function resolveWorkerOutcomeMappings(e,i){const t=new Map;for(const a of e){const c=G(a);if(t.has(c))throw new Error(`Worker claimed duplicate task ${a.id.toString()} (${a.file})`);t.set(c,a)}const r=new Map;for(const a of i){const c=G(a.task),l=t.get(c);if(!l)throw new Error(`Task runner returned an outcome for unclaimed task ${a.task.id.toString()} (${a.task.file})`);if(r.has(c))throw new Error(`Task runner returned duplicate outcomes for claimed task ${l.id.toString()} (${l.file})`);r.set(c,{outcome:a,task:l})}for(const a of e)if(!r.has(G(a)))throw new Error(`Task runner did not return an outcome for claimed task ${a.id.toString()} (${a.file})`);return[...r.values()]}function G(e){return JSON.stringify([typeof e.id,e.id,e.file])}function ne(e,i){return e.getGraph(i.graphKey)??W(i)}function ae(e){return new Promise(i=>setTimeout(i,e))}
1
+ import{buildTaskDeadline as U,createDeadlineSignal as J,EngineExecutionBridgeError as I,executeEngineTask as H,normalizeTimeoutMs as Q}from"./engine-execution.js";import{preparationFailure as V,settlePreparedTask as X,taskStartedFailure as Y}from"./engine-execution-failures.js";import{GroupDefaultConflictError as N}from"./environment.js";import{formatError as Z,toError as x}from"../../kernel/error-serialization.js";import{formatEngineInvocationStack as ee}from"./engine-failure-stack.js";import{DEFAULT_ENGINE_REPORTER_CALLBACK_TIMEOUT_MS as _,invokeBoundedReporterCallback as te,invokeEngineReporterCallback as L}from"./engine-execution-reporting.js";import{drainRuntimeFailedTasks as ie}from"./runtime-failures.js";import{buildTimingObservation as ae}from"./scheduler/observations.js";import{buildTaskBatch as ne,claimCompatibleTaskBatch as re,expandTaskResultOutcomes as se}from"./task-batches.js";export function createWorker(e,a){return{workerId:e,productDir:a,currentGraphKey:null,graphSwitches:0,taskCount:0}}export async function runWorker(e,a,t,l,n,u,c,k,g,m=null){const v=Date.now(),w=[],q=[];try{for(;!t.isStopRequested();){const o=c(a,e.currentGraphKey,i=>t.locks.available(i.locks)&&t.environments.canAcquire(i));if(!o){const i=ie(a,t.environments);if(i.length>0){const s=Date.now(),r=new Set;for(const p of i)k(n,p.task,{status:"not_run",reason:p.reason,durationMs:0,startedAt:s,finishedAt:s,error:null,infraFailed:p.infraFailed,blockedByRuntime:p.blockedByRuntime,failureDetails:p.failureDetails}),r.has(p.graph.key)||(g(n,p.graph,p.message,s,{classification:"infra"}),r.add(p.graph.key));e.taskCount+=i.length;continue}if(a.length===0)break;await pe(10);continue}const E=t.leases.allocate(o);t.locks.acquire(o.locks,E.id);let M=null,T=[o],D=o,O=!1,R=null;const d={phase:"acquire",prepared:null};let C=[],F=[],B=null;try{T=re(a,o,{environmentKeys:t.environmentKeys}),D=ne(T)??o,e.currentGraphKey!==null&&e.currentGraphKey!==o.graphKey&&(e.graphSwitches+=1),e.currentGraphKey=o.graphKey;const i=await t.environments.acquire(D,E);M=i,t.leases.create(E),d.phase="execute";const s=await l.withEngine(o.engineId,t.signal,async r=>{let p=null;if(T.length===1){d.phase="start",await L("taskStarted",()=>m?.taskStarted?.(o,{name:o.targetName}),{signal:t.signal,timeoutMs:_}),d.phase="prepare";const $=Q(t.request.fileTimeoutSeconds),y=U(Date.now(),$),b=J(t.signal,y);try{d.prepared=await i.prepare(o,{deadlineMs:y,signal:b.signal,timeoutMs:$})}finally{b.dispose()}p={deadlineMs:y,prepared:d.prepared===null?null:{artifacts:d.prepared.artifacts,handles:d.prepared.handles,setupData:d.prepared.setupData},taskId:String(o.id)},d.phase="execute"}return H(r,{environment:d.prepared?.environment??i.environment,lease:E,request:t.request,started:p,task:D},t,m)});d.phase="mapping",C=se(s),F=resolveWorkerOutcomeMappings(T,C),F.some(({outcome:r})=>r.infraFailed&&r.blockedByRuntime)&&(O=!0)}catch(i){const s=d.phase==="start"?Y(i,String(o.id)):d.phase==="prepare"?V(i,String(o.id)):i,r=d.phase==="acquire"?fe(i,t):ue(s);R={disposition:r,error:s},O=M!==null&&r.runtimeImpact!=="none"}finally{if(d.prepared!==null){const i=await d.prepared.release(),s=await X(R===null?{outcomes:C}:{error:R.error},i,String(o.id),r=>L("taskFinished",()=>m?.taskFinished?.(o,r),{signal:t.signal,timeoutMs:_}));s!==null&&(R={disposition:s.disposition,error:s},O||=s.disposition.runtimeImpact!=="none")}B=await le(t.leases,M,E,O),t.locks.release(o.locks,E.id)}const f=[];let S=null;const K=()=>{if(S!==null)return S;try{S=de(t.environments,o)}catch(i){f.push(j("Runtime failure graph resolution failed",i)),S=A(o)}return S};if(R===null){for(const{outcome:s,task:r}of F)await P({operationErrors:f,outcome:s,recordTaskOutcome:k,recordTiming:!0,reporter:m,reportTaskFinished:!1,task:r,timingUpdates:u,trackers:n});e.taskCount+=F.length;const i=F.filter(({outcome:s})=>s.infraFailed&&s.blockedByRuntime);if(i.length>0){const s=i.map(({outcome:r})=>r.reason??r.error??"Runtime readiness failed before engine execution").join("; ");w.push(s),await G(f,"Runtime error reporter failed",()=>m?.runtimeError?.(o,s)),await h(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(o.graphKey,s)}),await h(f,"Result graph error recording failed",()=>{g(n,K(),s,Date.now(),{classification:"infra"})})}}else{const{disposition:i,error:s}=R,r=Z(s),p=oe(T,s);if(i.status!=="cancelled"&&w.push(r),i.notifyRuntimeError&&await G(f,"Runtime error reporter failed",()=>m?.runtimeError?.(p,r)),i.status!=="cancelled"){i.runtimeImpact==="fail-graph"&&await h(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(o.graphKey,r)});const y=s instanceof N?A(o):K();await h(f,"Result graph error recording failed",()=>{g(n,y,r,Date.now(),{classification:i.classification??"product"})})}const $=Date.now();for(const y of T){const b=s instanceof I&&s.completedOutcomesByTaskId.has(String(y.id)),z=ce(y,D,s,i,r,$);await P({operationErrors:f,outcome:z,recordTaskOutcome:k,recordTiming:b,reporter:m,reportTaskFinished:!b,task:y,timingUpdates:u,trackers:n})}e.taskCount+=T.length}if(B!==null){const i=B.message;w.push(i),await G(f,"Runtime error reporter failed",()=>m?.runtimeError?.(o,i)),B.recovered||await h(f,"Runtime graph failure recording failed",()=>{t.environments.markGraphFailed(o.graphKey,i)}),await h(f,"Result graph error recording failed",()=>{g(n,K(),i,Date.now(),{classification:"infra"})})}if(f.length>0){const i=[...f];for(const r of i)w.push(r.message);const s=i.map(r=>r.message).join("; ");await h(f,"Result graph error recording failed while reporting a Testkit operation failure",()=>{g(n,K(),s,Date.now(),{classification:"infra"})});for(const r of f.slice(i.length))w.push(r.message);f.length>i.length&&q.push(...i.map(r=>r.message),...f.slice(i.length).map(r=>r.message))}}}finally{e.currentGraphKey=null}return{workerId:e.workerId,failed:w.length>0,durationMs:Date.now()-v,taskCount:e.taskCount,graphSwitches:e.graphSwitches,errors:w,unpersistedErrors:q}}async function P({operationErrors:e,outcome:a,recordTaskOutcome:t,recordTiming:l,reporter:n,reportTaskFinished:u,task:c,timingUpdates:k,trackers:g}){await h(e,`Task outcome recording failed for ${c.file}`,()=>{t(g,c,a)}),u&&await G(e,`Task-finished reporter failed for ${c.file}`,()=>n?.taskFinished?.(c,a)),l&&await h(e,`Task timing recording failed for ${c.file}`,()=>{const m=ae(c,a);m&&k.push(m)})}async function h(e,a,t){try{await t()}catch(l){e.push(j(a,l))}}async function G(e,a,t){await h(e,a,()=>te(a,t,{timeoutMs:_}))}function j(e,a){const t=x(a);return new Error(`${e}: ${t.message}`,{cause:t})}function oe(e,a){const t=e[0];if(!(a instanceof I))return t;if(a.failingTaskId!==null){const l=e.find(n=>String(n.id)===a.failingTaskId);if(l!==void 0)return l}return e.find(l=>!a.completedOutcomesByTaskId.has(String(l.id)))??t}function A(e){return{key:e.graphKey,targetNames:[e.targetName]}}async function le(e,a,t,l){const n=async u=>{await a?.release({invalidate:u}),e.remove(t)};try{return await n(l),null}catch(u){const c=x(u);try{return await n(!0),{message:`Runtime lease release failed but recovered on idempotent retry: ${c.message}`,recovered:!0}}catch(k){const g=x(k);return{message:`Runtime lease release failed: ${c.message}; idempotent retry also failed: ${g.message}`,recovered:!1}}}}function ce(e,a,t,l,n,u){const c=ee(t),k={kind:"engine-invocation",key:"engine_invocation_failed",title:"Engine invocation failed",count:1,...l.classification===void 0?{}:{classification:l.classification},message:n,...c===void 0?{}:{stack:c}},g=t instanceof I?t.completedOutcomesByTaskId.get(String(e.id)):void 0;if(g!==void 0)return g;const m=t instanceof I?t.artifactReferencesByTaskId.get(String(e.id))??[]:[];return{task:e,status:l.status,error:l.status==="failed"?n:null,reason:l.status==="failed"?null:n,infraFailed:l.classification==="infra",blockedByRuntime:l.status==="not_run",durationMs:0,startedAt:u,finishedAt:u,artifacts:[...m],failureDetails:l.status==="cancelled"?[]:[k],..."batchTasks"in a?{runtimeBatch:{id:a.batchId,index:a.batchTasks.findIndex(v=>v.id===e.id&&v.file===e.file),fileCount:a.batchTasks.length,files:a.batchTasks.map(v=>v.file)}}:{}}}function ue(e){return e instanceof I?e.disposition:{classification:"infra",notifyRuntimeError:!0,runtimeImpact:"none",status:"not_run"}}function fe(e,a){return a.signal.aborted&&e===a.signal.reason?{classification:void 0,notifyRuntimeError:!1,runtimeImpact:"none",status:"cancelled"}:{classification:"infra",notifyRuntimeError:!0,runtimeImpact:e instanceof N?"none":"fail-graph",status:"not_run"}}export function resolveWorkerOutcomeMappings(e,a){const t=new Map;for(const n of e){const u=W(n);if(t.has(u))throw new Error(`Worker claimed duplicate task ${n.id.toString()} (${n.file})`);t.set(u,n)}const l=new Map;for(const n of a){const u=W(n.task),c=t.get(u);if(!c)throw new Error(`Task runner returned an outcome for unclaimed task ${n.task.id.toString()} (${n.task.file})`);if(l.has(u))throw new Error(`Task runner returned duplicate outcomes for claimed task ${c.id.toString()} (${c.file})`);l.set(u,{outcome:n,task:c})}for(const n of e)if(!l.has(W(n)))throw new Error(`Task runner did not return an outcome for claimed task ${n.id.toString()} (${n.file})`);return[...l.values()]}function W(e){return JSON.stringify([typeof e.id,e.id,e.file])}function de(e,a){return e.getGraph(a.graphKey)??A(a)}function pe(e){return new Promise(a=>setTimeout(a,e))}
@@ -1 +1 @@
1
- import{createEnvironmentMaintenance as l}from"../../environment/maintenance.js";import{runtimePlanning as p}from"../../environment/runtime-planning.js";import{collectBundleCacheStatus as d}from"../../engines/bundle-cache.js";import{collectDirectorySummary as h}from"../../process/files/directory-status.js";export function collectStatusModel(t,{allConfigs:e=[t]}={}){const n=t.productDir,i=p.collectDesiredRuntimeGraphs(e),{runtimeGraphs:r,runs:o}=l(n).inspect(i,t.name),u=h(t.stateDir),s=d(n,t.name),a=S({runtimeGraphs:r,bundles:s}),m=u.exists||r.some(c=>c.exists)||o.total>0||s.exists;return{schemaVersion:1,name:t.name,product:{dir:n,configFile:t.configFile||null,services:e.map(c=>c.name).sort(),selectedService:t.name,dependencies:[...t.testkit.dependsOn].sort()},hasState:m,runs:o,serviceState:u,runtimeGraphs:r,caches:{bundles:s},warnings:a}}function S({runtimeGraphs:t,bundles:e}){const n=[],i=t.reduce((r,o)=>r+o.staleRuntimeDirs.length,0);if(i>0&&n.push(`${i.toString()} stale runtime ${i===1?"directory":"directories"} found outside the configured runtime set.`),e.duplicatedSourceCount>0&&n.push(`${e.duplicatedSourceCount.toString()} source file${e.duplicatedSourceCount===1?"":"s"} have duplicate bundle versions.`),e.unmanagedFileCount>0&&n.push(`${e.unmanagedFileCount.toString()} bundle cache file${e.unmanagedFileCount===1?"":"s"} are unmanaged by the manifest.`),(e.sourcemapFileCount??0)>0||e.sourcemapStatus==="detected"){const r=e.sourcemapFileCount==null?"Bundle files":`${e.sourcemapFileCount.toString()} bundle file${e.sourcemapFileCount===1?"":"s"}`;n.push(`${r} contain inline sourcemaps.`)}return n}
1
+ import{createEnvironmentMaintenance as l}from"../../environment/maintenance.js";import{runtimePlanning as d}from"../../environment/runtime-planning.js";import{collectBundleCacheStatus as p}from"../../engines/bundle-cache.js";import{collectDirectorySummary as h}from"../../process/files/directory-status.js";import{readRunMaintenance as f}from"../../evidence/maintenance.js";import{formatError as S}from"../../kernel/error-serialization.js";export function collectStatusModel(t,{allConfigs:e=[t]}={}){const n=t.productDir,o=d.collectDesiredRuntimeGraphs(e),{runtimeGraphs:r,runs:i}=l(n).inspect(o,t.name),s=h(t.stateDir),a=p(n,t.name),u=[...$({runtimeGraphs:r,bundles:a}),...C(n)],m=s.exists||r.some(c=>c.exists)||i.total>0||a.exists;return{schemaVersion:1,name:t.name,product:{dir:n,configFile:t.configFile||null,services:e.map(c=>c.name).sort(),selectedService:t.name,dependencies:[...t.testkit.dependsOn].sort()},hasState:m,runs:i,serviceState:s,runtimeGraphs:r,caches:{bundles:a},warnings:u}}function $({runtimeGraphs:t,bundles:e}){const n=[],o=t.reduce((r,i)=>r+i.staleRuntimeDirs.length,0);if(o>0&&n.push(`${o.toString()} stale runtime ${o===1?"directory":"directories"} found outside the configured runtime set.`),e.duplicatedSourceCount>0&&n.push(`${e.duplicatedSourceCount.toString()} source file${e.duplicatedSourceCount===1?"":"s"} have duplicate bundle versions.`),e.unmanagedFileCount>0&&n.push(`${e.unmanagedFileCount.toString()} bundle cache file${e.unmanagedFileCount===1?"":"s"} are unmanaged by the manifest.`),(e.sourcemapFileCount??0)>0||e.sourcemapStatus==="detected"){const r=e.sourcemapFileCount==null?"Bundle files":`${e.sourcemapFileCount.toString()} bundle file${e.sourcemapFileCount===1?"":"s"}`;n.push(`${r} contain inline sourcemaps.`)}return n}function C(t){try{const e=f(t);return e?.status!=="failed"?[]:[`Run ${e.runId}'s post-run maintenance failed: ${e.error??"unknown error"}`]}catch(e){return[`The last run's maintenance record could not be read: ${S(e)}`]}}
@@ -1 +1 @@
1
- import c from"node:fs";import f from"node:path";import{inspectRunManifests as d}from"../../process/runs/inspection.js";import{resolveProductDir as m}from"../../process/files/product-dir.js";import{asUnknownRecord as o,displayString as l,isUnknownRecord as p,optionalString as i}from"../../kernel/unknown-values.js";export async function collectRunStatus(t){if(t.runId){const e=m(process.cwd(),t.dir);if(!c.statSync(e).isDirectory())throw new Error(`Product directory is not a directory: ${e}`);return buildRunStatus({productDir:e},t)}const{loadConfigContext:r}=await import("../../config/loader/index.js"),n=await r({dir:t.dir});return buildRunStatus(n,t)}export function buildRunStatus(t,r={}){const n=d(t.productDir,r.runId||void 0),e=S(f.join(t.productDir,".testkit","results","live.json"));if(r.full)return Promise.resolve({productDir:t.productDir,mode:"full",runs:n,live:e});const s={productDir:t.productDir,mode:"summary",runs:n.map(A),live:b(e)};return s.live&&(s.live.state=describeLiveArtifactState(s)),Promise.resolve(s)}export function latestOperation(t){if(!Array.isArray(t))return null;const r=t.filter(p);return[...r].reverse().find(n=>n.status==="running")??r.at(-1)??null}export function describeLiveArtifactState(t){const r=o(t.live),n=o(r?.run),e=l(n?.id,"unknown"),s=l(n?.status,"unknown"),a=y(t,e);return s==="running"&&!a?{runId:e,status:"stale",reason:"no active run matches this live artifact"}:{runId:e,status:s,reason:i(n?.interruptReason)}}function y(t,r){if(!r||r==="unknown")return!1;for(const n of t.runs??[])if(n.active&&v(r,n.runId))return!0;return!1}function v(t,r){if(!r)return!1;const n=typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?r.toString():null;return n?n===t||n.startsWith(`${t}:`):!1}function A(t){const r=g(t.status);return{runId:t.runId,pid:t.pid,status:t.status||"unknown",startedAt:t.startedAt||null,heartbeatAt:t.heartbeatAt||null,interruptReason:t.interruptReason||null,active:t.active,terminal:r,stale:!t.active&&!r,session:h(t.session)}}function g(t){return typeof t=="string"&&["finished","failed","interrupted"].includes(t)}function h(t){const r=o(t);return r?{kind:i(r.kind),status:i(r.status),stage:i(r.stage)}:null}function b(t){const r=o(t);if(!r)return null;const e=o(r.timings)?.operations??[],s=Array.isArray(e)?e:[],a=o(r.product),u=o(r.run);return{present:!0,schemaVersion:k(r.schemaVersion),generatedAt:i(r.generatedAt),product:a?{name:i(a.name),directory:i(a.directory)}:null,run:u?{id:i(u.id),status:i(u.status),startedAt:i(u.startedAt),finishedAt:i(u.finishedAt),durationMs:w(u.durationMs),interruptReason:i(u.interruptReason),testkitVersion:i(u.testkitVersion)}:null,summary:r.summary??null,operation:latestOperation(s),operationCount:s.length,artifactRef:".testkit/results/live.json",truncated:!0}}function w(t){const r=Number(t);return Number.isFinite(r)?r:null}function k(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function S(t){try{return JSON.parse(c.readFileSync(t,"utf8"))}catch{return null}}
1
+ import c from"node:fs";import f from"node:path";import{inspectRunManifests as d}from"../../process/runs/inspection.js";import{resolveProductDir as m}from"../../process/files/product-dir.js";import{asUnknownRecord as o,displayString as l,isUnknownRecord as p,optionalString as i}from"../../kernel/unknown-values.js";export async function collectRunStatus(t){if(t.runId){const e=m(process.cwd(),t.dir);if(!c.statSync(e).isDirectory())throw new Error(`Product directory is not a directory: ${e}`);return buildRunStatus({productDir:e},t)}const{loadConfigContext:r}=await import("../../config/loader/index.js"),n=await r({dir:t.dir,allowUnmigratedServices:!0,plain:!1,retired:[]});return buildRunStatus(n,t)}export function buildRunStatus(t,r={}){const n=d(t.productDir,r.runId||void 0),e=k(f.join(t.productDir,".testkit","results","live.json"));if(r.full)return Promise.resolve({productDir:t.productDir,mode:"full",runs:n,live:e});const s={productDir:t.productDir,mode:"summary",runs:n.map(g),live:w(e)};return s.live&&(s.live.state=describeLiveArtifactState(s)),Promise.resolve(s)}export function latestOperation(t){if(!Array.isArray(t))return null;const r=t.filter(p);return[...r].reverse().find(n=>n.status==="running")??r.at(-1)??null}export function describeLiveArtifactState(t){const r=o(t.live),n=o(r?.run),e=l(n?.id,"unknown"),s=l(n?.status,"unknown"),a=y(t,e);return s==="running"&&!a?{runId:e,status:"stale",reason:"no active run matches this live artifact"}:{runId:e,status:s,reason:i(n?.interruptReason)}}function y(t,r){if(!r||r==="unknown")return!1;for(const n of t.runs??[])if(n.active&&v(r,n.runId))return!0;return!1}function v(t,r){if(!r)return!1;const n=typeof r=="string"?r:typeof r=="number"&&Number.isFinite(r)?r.toString():null;return n?n===t||n.startsWith(`${t}:`):!1}function g(t){const r=A(t.status);return{runId:t.runId,pid:t.pid,status:t.status||"unknown",startedAt:t.startedAt||null,heartbeatAt:t.heartbeatAt||null,interruptReason:t.interruptReason||null,active:t.active,terminal:r,stale:!t.active&&!r,session:h(t.session)}}function A(t){return typeof t=="string"&&["finished","failed","interrupted"].includes(t)}function h(t){const r=o(t);return r?{kind:i(r.kind),status:i(r.status),stage:i(r.stage)}:null}function w(t){const r=o(t);if(!r)return null;const e=o(r.timings)?.operations??[],s=Array.isArray(e)?e:[],a=o(r.product),u=o(r.run);return{present:!0,schemaVersion:S(r.schemaVersion),generatedAt:i(r.generatedAt),product:a?{name:i(a.name),directory:i(a.directory)}:null,run:u?{id:i(u.id),status:i(u.status),startedAt:i(u.startedAt),finishedAt:i(u.finishedAt),durationMs:b(u.durationMs),interruptReason:i(u.interruptReason),testkitVersion:i(u.testkitVersion)}:null,summary:r.summary??null,operation:latestOperation(s),operationCount:s.length,artifactRef:".testkit/results/live.json",truncated:!0}}function b(t){const r=Number(t);return Number.isFinite(r)?r:null}function S(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function k(t){try{return JSON.parse(c.readFileSync(t,"utf8"))}catch{return null}}
@@ -1,4 +1,4 @@
1
- import{attachErrorDiagnostics as S}from"../../kernel/error-serialization.js";import{isPathWithin as T}from"../../process/files/paths.js";import d from"fs";import i from"path";import{createHash as j}from"crypto";import{createRequire as _}from"module";import{fileURLToPath as C}from"url";import{NODE_VITEST_PACKAGE_REQUIREMENTS as O}from"../../engines/installations/package-requirements.js";import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as $}from"../../engines/installations/package-requirements.js";import{hasDiscoveryErrors as R,buildDiscoveryErrorFromDiagnostics as A,detectNextApp as M,loadDiscoveredConfigContext as I,resolveServiceCwd as F}from"../../config/loader/index.js";import{K6_POSTGRES_DRIVER_SPECIFIER as N,K6_POSTGRES_DRIVER_TYPE_FILE as D,K6_RUNTIME_GLOBAL_TYPE_FILE as L}from"../../engines/k6/authoring-type-paths.js";import{managedHostProcessInfrastructureError as G,runManagedHostProcess as U}from"../../process/index.js";import{CONFIGURED_STEP_TESTKIT_MODULE_DIST_PATHS as K}from"../../steps/configured-step-testkit-modules.js";import{findPlaywrightConfigFile as z}from"../../engines/playwright/runtime/config-file.js";import{isUnknownRecord as k}from"../../kernel/unknown-values.js";const J=600*1e3,h=i.resolve(i.dirname(C(import.meta.url)),"..","..",".."),x=_(i.join(h,"package.json")),E=()=>x("typescript"),q={...B(["@gfdelarue/testkit","@gfdelarue/testkit/config","@gfdelarue/testkit/config/build-assets","@gfdelarue/testkit/config/next-runtime-tsconfig","@gfdelarue/testkit/config/database-steps","@gfdelarue/testkit/drizzle","@gfdelarue/testkit/env","@gfdelarue/testkit/tooling/vitest"]),"@gfdelarue/testkit/k6":["engines","k6","runtime","index.d.ts"],"@gfdelarue/testkit/playwright":["engines","playwright","runtime","index.d.ts"],"@gfdelarue/testkit/node-vitest/data":["engines","node-vitest","runtime","data","index.d.ts"],"@gfdelarue/testkit/node-vitest/contract":["engines","node-vitest","runtime","contract","index.d.ts"],"@gfdelarue/testkit/workspace":["app","inspect","index.d.ts"]};function B(e){return Object.fromEntries(e.map(n=>{const t=K[n],s=t[t.length-1];return[n,[...t.slice(0,-1),`${s}.d.ts`]]}))}export class TestkitTypecheckError extends Error{result;results;constructor(n,t,s){super(`testkit typecheck failed for ${n}`),this.result=t,this.results=s,S(this,{result:t,results:s})}}export async function runTestkitTypecheck(e={}){b(e.timeoutMs);const{context:n,discovery:t}=await I({dir:e.dir});return runTestkitTypecheckForContext(n,t,e)}export async function runTestkitTypecheckForContext(e,n,t={}){const s=b(t.timeoutMs);if(R(e.discovery.diagnostics))throw A(e.discovery.diagnostics);const o=e.productDir,r=i.join(o,".testkit","_typecheck");d.mkdirSync(r,{recursive:!0});const a=[];if(e.configFile){const p=H({productDir:o,configFile:e.configFile,outputDir:r});a.push({label:"config",cwd:o,tsconfigPath:p})}const c=n.files.map(p=>({engineId:p.engineId,path:p.path})),u=new Set(n.files.filter(p=>p.engineId==="playwright").map(p=>p.service));for(const p of e.configs){if(!u.has(p.name))continue;const y=z(F(o,p.testkit.local?.cwd));y&&c.push({engineId:"playwright",path:y})}const f=W(o,c);for(const p of f){const y=Y({...p,outputDir:r,productDir:o});a.push({label:X(p.engineId,p.scopeName),cwd:p.cwd,tsconfigPath:y})}const g=[];for(const p of a){const y=await ne(p,s,t.signal);if(g.push(y),!y.ok)throw new TestkitTypecheckError(p.label,y,g)}return{ok:!0,productDir:o,results:g}}function H({productDir:e,configFile:n,outputDir:t}){const s=i.join(t,"config.tsconfig.json"),o=P(e),r={...o?{extends:l(s,o)}:{},compilerOptions:buildTypecheckCompilerOptions({tsconfigPath:s,extendsPath:o,libs:["ES2022"],rootDir:l(s,e),types:["node"]}),files:[l(s,n)],include:[],exclude:[m(s,e,"node_modules"),m(s,e,"dist"),m(s,e,".testkit")]};return d.writeFileSync(s,`${JSON.stringify(r,null,2)}
2
- `),s}function Y({productDir:e,cwd:n,engineId:t,extendsPath:s,files:o,outputDir:r,scopeName:a}){const c=i.join(r,`${t}.${te(a)}.tsconfig.json`),u=t==="playwright",f=u&&M(n),g={...s?{extends:l(c,s)}:{},compilerOptions:{...buildTypecheckCompilerOptions({engineId:t,tsconfigPath:c,extendsPath:s,libs:Z(t),...f?{extraPaths:nextRuntimeTypePaths({tsconfigPath:c,serviceDir:n})}:{},types:Q(t)}),...u?{allowJs:!0,checkJs:!1}:{}},files:[...ae(t,c),...o.map(p=>l(c,p))],include:f?[...d.existsSync(i.join(n,"next-env.d.ts"))?[l(c,i.join(n,"next-env.d.ts"))]:[],m(c,n,"tests/playwright-fixtures/**/*.ts"),m(c,n,"tests/playwright-fixtures/**/*.tsx"),m(c,n,"tests/playwright-fixtures/**/*.mts"),m(c,n,".next/types/**/*.ts"),m(c,n,".next/dev/types/**/*.ts"),m(c,e,".next-testkit/**/dist/types/**/*.ts"),m(c,e,".next-testkit/**/dist/dev/types/**/*.ts")]:[],exclude:["node_modules",".next/cache",".next/dev"]};return d.writeFileSync(c,`${JSON.stringify(g,null,2)}
3
- `),c}function W(e,n){const t=new Map,s=new Map;for(const o of n){const r=i.resolve(e,o.path),a=[o.engineId,r].join("\0");s.set(a,{...o,path:r})}for(const o of s.values()){const r=o.path,a=o.engineId==="playwright"?w(i.dirname(r),e,["tsconfig.playwright.json"]):null,c=a??w(i.dirname(r),e),u=c?i.dirname(c):e,f=ee(e,u),g=`${o.engineId}\0${c??""}\0${f}`,p=t.get(g);if(p){p.files.push(r);continue}t.set(g,{cwd:u,engineId:o.engineId,extendsPath:c,files:[r,...a?V(a):[]],scopeName:f})}return[...t.values()].map(o=>({...o,files:[...new Set(o.files)].sort((r,a)=>r.localeCompare(a))})).sort((o,r)=>v(o.engineId)-v(r.engineId)||o.scopeName.localeCompare(r.scopeName))}function V(e){const n=E(),t=o=>{throw new Error(`${e}: ${n.flattenDiagnosticMessageText(o.messageText,`
4
- `)}`)},s=n.getParsedCommandLineOfConfigFile(e,{},{...n.sys,onUnRecoverableConfigFileDiagnostic:t});for(const o of s?.errors??[])o.code!==18002&&o.code!==18003&&t(o);return s?.fileNames??[]}function Q(e){switch(e){case"k6":return["k6","xk6-sql"];case"node-vitest":case"playwright":return["node"]}}function Z(e){return e==="playwright"?["ES2022","DOM","DOM.Iterable"]:["ES2022"]}function v(e){return["k6","node-vitest","playwright"].indexOf(e)}function X(e,n){return n==="repo"?e:`${e}:${n}`}function ee(e,n){const t=i.relative(e,n);return t===""?"repo":t.split(i.sep).join("/")}function te(e){const n=e.replace(/[^a-zA-Z0-9_-]+/g,"-");if(n===e)return e;const t=j("sha256").update(e).digest("hex").slice(0,12);return`${n}-${t}`}function ne({label:e,cwd:n,tsconfigPath:t},s,o){const r=se(n);return U({args:[...r.args,"--noEmit","-p",t],cwd:n,displayLabel:`Testkit typecheck ${e}`,env:process.env,executable:r.command,signal:o,timeoutMs:s}).then(a=>{const c=G(`Testkit typecheck ${e}`,a);if(c)throw c;return{label:e,tsconfigPath:t,ok:a.exitCode===0,exitCode:a.exitCode,stdout:a.stdout,stderr:a.stderr}})}function b(e){const n=e??J;if(!Number.isSafeInteger(n)||n<=0)throw new Error("Testkit typecheck timeout must be a positive safe integer in milliseconds");return n}function se(e){let n=e;for(;;){const s=i.join(n,"node_modules","typescript","bin","tsc");if(d.existsSync(s))return{command:process.execPath,args:[s]};const o=i.dirname(n);if(o===n)break;n=o}const t=i.join(h,"node_modules","typescript","bin","tsc");if(d.existsSync(t))return{command:process.execPath,args:[t]};throw new Error(`TypeScript compiler not found from ${e} upward`)}function P(e,n=["tsconfig.json","tsconfig.build.json"]){for(const t of n){const s=i.join(e,t);if(d.existsSync(s))return s}return null}function w(e,n,t){const s=i.resolve(n);let o=i.resolve(e);for(;;){if(!T(s,o))return null;const r=P(o,t);if(r)return r;if(o===s)return null;const a=i.dirname(o);if(a===o)return null;o=a}}function l(e,n){const t=i.relative(i.dirname(e),n).split(i.sep).join("/");return t.startsWith("../")||i.isAbsolute(t)?t:`./${t}`}function m(e,n,t){return i.join(l(e,n),t).split(i.sep).join("/")}function oe(e){const n={};for(const[t,s]of Object.entries(q))n[t]=[l(e,i.join(h,"dist",...s))];return n}const re=Object.freeze({packages:Object.freeze(O.filter(({authoringResolution:e})=>e==="package-exports").map(({packageName:e})=>Object.freeze({name:e}))),supportedExports:"exact-manifest-exports"}),ie=Object.freeze({packages:Object.freeze($.map(({packageName:e})=>Object.freeze({name:e}))),supportedExports:"exact-manifest-exports"});function ce(e,n){const t=ue(e);if(t===null)return{};const s={},o=l(n,i.join(h,"dist","app","typecheck","unavailable.d.ts"));for(const r of t.packages){const a=le(r.name),c=fe(r.name,a);s[`${r.name}/*`]=[o];for(const u of Object.keys(c).sort()){if(u!=="."&&!u.startsWith("./")||u.includes("*"))continue;const f=u==="."?r.name:`${r.name}${u.slice(1)}`,g=ge(f,r.name,a);s[f]=[g===null?o:l(n,g)]}}return s}function ae(e,n){return e==="k6"?[l(n,i.join(h,"dist",...L))]:[]}function pe(e,n){return e==="k6"?{[N]:[l(n,i.join(h,"dist",...D))]}:{}}function ue(e){switch(e){case"node-vitest":return re;case"playwright":return ie;case"k6":case void 0:return null}}function le(e){const n=de(e);let t;try{t=x.resolve(`${e}/package.json`)}catch(r){throw new Error(`Testkit typecheck requires managed public package ${e}`,{cause:r})}const s=d.realpathSync.native(i.dirname(t)),o=JSON.parse(d.readFileSync(i.join(s,"package.json"),"utf8"));return requireManagedPublicPackageIdentity(o,e,n),s}export function requireManagedPublicPackageIdentity(e,n,t){if(!k(e)||e.name!==n||e.version!==t)throw new Error(`Testkit managed public package has invalid identity: expected ${n}@${t}`)}function de(e){const n=JSON.parse(d.readFileSync(i.join(h,"package.json"),"utf8"));if(!k(n)||!k(n.dependencies))throw new Error("Testkit package has invalid dependency metadata");const t=n.dependencies[e];if(typeof t!="string"||!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(t))throw new Error(`Testkit managed public package ${e} must be an exact root dependency`);return t}function fe(e,n){const t=JSON.parse(d.readFileSync(i.join(n,"package.json"),"utf8"));if(typeof t!="object"||t===null||Array.isArray(t)||!("name"in t)||t.name!==e||!("exports"in t)||typeof t.exports!="object"||t.exports===null||Array.isArray(t.exports))throw new Error(`Testkit managed public package has invalid exports: ${e}`);return t.exports}function ge(e,n,t){const s=E(),o=s.resolveModuleName(e,i.join(h,"__testkit_managed_public_types__.ts"),{module:s.ModuleKind.ESNext,moduleResolution:s.ModuleResolutionKind.Bundler,resolveJsonModule:!0,target:s.ScriptTarget.ES2022},s.sys).resolvedModule;if(o===void 0)return null;const r=d.realpathSync.native(o.resolvedFileName);if(!T(t,r))throw new Error(`Managed public package type ${e} resolved outside ${n}`);return r}export function buildTypecheckCompilerOptions({engineId:e,tsconfigPath:n,extendsPath:t,rootDir:s,extraPaths:o={},libs:r,types:a}){const u={...t?ye({tsconfigPath:n,extendsPath:t}):{},...o,...oe(n),...ce(e,n),...pe(e,n)};return{baseUrl:null,lib:[...r],module:"ESNext",moduleResolution:"Bundler",noEmit:!0,...s?{rootDir:s}:{},target:"ES2022",typeRoots:me(a,n),types:[...a],paths:u}}function me(e,n){const t=new Set;for(const s of e){if(s==="k6"||s==="xk6-sql"){const c=i.join(h,"dist","engines","k6","runtime","ambient-types");if(!d.existsSync(i.join(c,s,"index.d.ts")))throw new Error(`Testkit typecheck requires bundled ${s} authoring types; rebuild the installed Testkit package`);t.add(c);continue}const o=he(s);let r;try{r=x.resolve(`${o}/package.json`)}catch(c){throw new Error(`Testkit typecheck requires installed type package ${o}`,{cause:c})}const a=i.dirname(r);t.add(i.dirname(a))}return[...t].map(s=>l(n,s))}function he(e){return e==="node"||e==="k6"?`@types/${e}`:e}function ye({tsconfigPath:e,extendsPath:n}){const t=E(),s=t.getParsedCommandLineOfConfigFile(n,{},{...t.sys,onUnRecoverableConfigFileDiagnostic:()=>{}}),o=s?.options.paths;if(!o||Object.keys(o).length===0)return{};const r=s.options.baseUrl||(typeof s.options.pathsBasePath=="string"?s.options.pathsBasePath:i.dirname(n)),a={};for(const[c,u]of Object.entries(o))a[c]=u.map(f=>l(e,i.resolve(r,f)));return a}export function nextRuntimeTypePaths({tsconfigPath:e,serviceDir:n}){const t=ke(n,[i.join("next","types.d.ts"),i.join("next","types.js")]);if(!t)return{};const s=l(e,t);return{"next/types":[s],"next/types.js":[s]}}function ke(e,n){let t=i.resolve(e);for(;;){for(const o of n){const r=i.join(t,"node_modules",o);if(d.existsSync(r))return r}const s=i.dirname(t);if(s===t)return null;t=s}}
1
+ import{attachErrorDiagnostics as F}from"../../kernel/error-serialization.js";import{isPathWithin as b}from"../../process/files/paths.js";import{resolveProductDir as _}from"../../process/files/product-dir.js";import f from"fs";import i from"path";import{createHash as M}from"crypto";import{createRequire as O}from"module";import{fileURLToPath as A}from"url";import{resolveVitestSelection as R}from"../../engines/catalog.js";import{NODE_VITEST_PACKAGE_REQUIREMENTS as I}from"../../engines/installations/package-requirements.js";import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as N}from"../../engines/installations/package-requirements.js";import{hasDiscoveryErrors as D,buildDiscoveryErrorFromDiagnostics as G,detectNextApp as L,loadDiscoveredConfigContext as U}from"../../config/loader/index.js";import{managedHostProcessInfrastructureError as J,runManagedHostProcess as z}from"../../process/index.js";import{findNearestPlaywrightConfigFile as B}from"../../engines/playwright/runtime/config-file.js";import{isUnknownRecord as x}from"../../kernel/unknown-values.js";const j=/\.[cm]?tsx?$/u,K=600*1e3,k=i.resolve(i.dirname(A(import.meta.url)),"..","..",".."),v=O(i.join(k,"package.json")),P=()=>v("typescript");export class TestkitTypecheckError extends Error{result;results;constructor(t,n,s){super(`testkit typecheck failed for ${t}`),this.result=n,this.results=s,F(this,{result:n,results:s})}}export async function runTestkitTypecheck(e={}){T(e.timeoutMs);const t=_(process.cwd(),e.dir),n=R(e.vitest??{},t),{context:s,discovery:o}=await U({dir:t,group:e.group,vitest:n});return runTestkitTypecheckForContext(s,o,e)}export async function runTestkitTypecheckForContext(e,t,n={}){const s=T(n.timeoutMs);if(D(e.discovery.diagnostics))throw G(e.discovery.diagnostics);const o=e.productDir,r=i.join(o,".testkit","_typecheck");f.mkdirSync(r,{recursive:!0});const c=[];if(e.configFile){const p=q({productDir:o,configFile:e.configFile,outputDir:r});c.push({label:"config",cwd:o,tsconfigPath:p})}const u=Y(e),l=t.files.filter(p=>j.test(p.path)).flatMap(p=>(u.get(p.path)??[[]]).map(g=>({engineId:p.engineId,path:p.path,setupFiles:g}))),a=new Set(t.files.filter(p=>p.engineId==="playwright").map(p=>p.group));for(const p of e.groups){if(!a.has(p.name))continue;const g=B(o,p.roots);g&&l.push({engineId:"playwright",path:g,setupFiles:[]})}const m=W(o,l);for(const p of m){const g=H({...p,outputDir:r,productDir:o});c.push({label:Z(p,o),cwd:p.cwd,tsconfigPath:g})}const y=[];for(const p of c){const g=await te(p,s,n.signal);if(y.push(g),!g.ok)throw new TestkitTypecheckError(p.label,g,y)}return{ok:!0,productDir:o,results:y}}function q({productDir:e,configFile:t,outputDir:n}){const s=i.join(n,"config.tsconfig.json"),o=S(e),r={...o?{extends:d(s,o)}:{},compilerOptions:buildTypecheckCompilerOptions({tsconfigPath:s,extendsPath:o,libs:["ES2022"],rootDir:d(s,e),types:["node"]}),files:[d(s,t)],include:[],exclude:[h(s,e,"node_modules"),h(s,e,"dist"),h(s,e,".testkit")]};return f.writeFileSync(s,`${JSON.stringify(r,null,2)}
2
+ `),s}function H({productDir:e,cwd:t,engineId:n,extendsPath:s,files:o,outputDir:r,scopeName:c,setupFiles:u}){const l=u.length===0?"":`.setup-${w(u)}`,a=i.join(r,`${n}.${ee(c)}${l}.tsconfig.json`),m=n==="playwright",y=m&&L(t),p={...s?{extends:d(a,s)}:{},compilerOptions:{...buildTypecheckCompilerOptions({engineId:n,tsconfigPath:a,extendsPath:s,libs:Q(n,s),...y?{extraPaths:nextRuntimeTypePaths({tsconfigPath:a,serviceDir:t})}:{},types:["node"]}),...m?{allowJs:!0,checkJs:!1}:{}},files:o.map(g=>d(a,g)),include:y?[...f.existsSync(i.join(t,"next-env.d.ts"))?[d(a,i.join(t,"next-env.d.ts"))]:[],h(a,t,"tests/playwright-fixtures/**/*.ts"),h(a,t,"tests/playwright-fixtures/**/*.tsx"),h(a,t,"tests/playwright-fixtures/**/*.mts"),h(a,t,".next/types/**/*.ts"),h(a,t,".next/dev/types/**/*.ts"),h(a,e,".next-testkit/**/dist/types/**/*.ts"),h(a,e,".next-testkit/**/dist/dev/types/**/*.ts")]:[],exclude:["node_modules",".next/cache",".next/dev"]};return f.writeFileSync(a,`${JSON.stringify(p,null,2)}
3
+ `),a}function W(e,t){const n=new Map,s=new Map;for(const o of t){const r=i.resolve(e,o.path),c=[o.engineId,r,...o.setupFiles].join("\0");s.set(c,{...o,path:r})}for(const o of s.values()){const r=o.path,c=o.engineId==="playwright"?C(i.dirname(r),e,["tsconfig.playwright.json"]):null,u=c??C(i.dirname(r),e),l=u?i.dirname(u):e,a=X(e,l),m=[o.engineId,u??"",a,...o.setupFiles].join("\0"),y=n.get(m);if(y){y.files.push(r);continue}n.set(m,{cwd:l,engineId:o.engineId,extendsPath:u,files:[r,...o.setupFiles,...c?V(c):[]],scopeName:a,setupFiles:o.setupFiles})}return[...n.values()].map(o=>({...o,files:[...new Set(o.files)].sort((r,c)=>r.localeCompare(c))})).sort((o,r)=>E(o.engineId)-E(r.engineId)||o.scopeName.localeCompare(r.scopeName)||o.setupFiles.join("\0").localeCompare(r.setupFiles.join("\0")))}function Y(e){const t=new Map;for(const{file:n,setupFiles:s}of e.plainFiles){const o=[...new Set(s.filter(c=>j.test(c)))].sort((c,u)=>c.localeCompare(u)),r=t.get(n)??[];r.some(c=>c.join("\0")===o.join("\0"))||r.push(o),t.set(n,r)}return t}function V(e){const t=P(),n=o=>{throw new Error(`${e}: ${t.flattenDiagnosticMessageText(o.messageText,`
4
+ `)}`)},s=t.getParsedCommandLineOfConfigFile(e,{},{...t.sys,onUnRecoverableConfigFileDiagnostic:n});for(const o of s?.errors??[])o.code!==18002&&o.code!==18003&&n(o);return s?.fileNames??[]}function Q(e,t){return e==="playwright"?["ES2022","DOM","DOM.Iterable"]:t?void 0:["ES2022"]}function E(e){return["node-vitest","playwright"].indexOf(e)}function Z({engineId:e,scopeName:t,setupFiles:n},s){const o=t==="repo"?e:`${e}:${t}`;if(n.length===0)return o;const r=n.map(c=>i.relative(s,c).split(i.sep).join("/"));return`${o} with ${r.join(", ")}`}function X(e,t){const n=i.relative(e,t);return n===""?"repo":n.split(i.sep).join("/")}function ee(e){const t=e.replace(/[^a-zA-Z0-9_-]+/g,"-");return t===e?e:`${t}-${w([e])}`}function w(e){return M("sha256").update(e.join("\0")).digest("hex").slice(0,12)}function te({label:e,cwd:t,tsconfigPath:n},s,o){const r=ne(t);return z({args:[...r.args,"--noEmit","-p",n],cwd:t,displayLabel:`Testkit typecheck ${e}`,env:process.env,executable:r.command,signal:o,timeoutMs:s}).then(c=>{const u=J(`Testkit typecheck ${e}`,c);if(u)throw u;return{label:e,tsconfigPath:n,ok:c.exitCode===0,exitCode:c.exitCode,stdout:c.stdout,stderr:c.stderr}})}function T(e){const t=e??K;if(!Number.isSafeInteger(t)||t<=0)throw new Error("Testkit typecheck timeout must be a positive safe integer in milliseconds");return t}function ne(e){let t=e;for(;;){const s=i.join(t,"node_modules","typescript","bin","tsc");if(f.existsSync(s))return{command:process.execPath,args:[s]};const o=i.dirname(t);if(o===t)break;t=o}const n=i.join(k,"node_modules","typescript","bin","tsc");if(f.existsSync(n))return{command:process.execPath,args:[n]};throw new Error(`TypeScript compiler not found from ${e} upward`)}function S(e,t=["tsconfig.json","tsconfig.build.json"]){for(const n of t){const s=i.join(e,n);if(f.existsSync(s))return s}return null}function C(e,t,n){const s=i.resolve(t);let o=i.resolve(e);for(;;){if(!b(s,o))return null;const r=S(o,n);if(r)return r;if(o===s)return null;const c=i.dirname(o);if(c===o)return null;o=c}}function d(e,t){const n=i.relative(i.dirname(e),t).split(i.sep).join("/");return n.startsWith("../")||i.isAbsolute(n)?n:`./${n}`}function h(e,t,n){return i.join(d(e,t),n).split(i.sep).join("/")}function oe(e){const t={};for(const[n,s]of Object.entries($("@gfdelarue/testkit",k)))!x(s)||typeof s.types!="string"||(t[`@gfdelarue/testkit${n.slice(1)}`]=[d(e,i.join(k,s.types))]);return t}const se=Object.freeze({packages:Object.freeze(I.filter(({authoringResolution:e})=>e==="package-exports").map(({packageName:e})=>Object.freeze({name:e}))),supportedExports:"exact-manifest-exports"}),re=Object.freeze({packages:Object.freeze(N.map(({packageName:e})=>Object.freeze({name:e}))),supportedExports:"exact-manifest-exports"});function ie(e,t){const n=ce(e);if(n===null)return{};const s={},o=d(t,i.join(k,"dist","app","typecheck","unavailable.d.ts"));for(const r of n.packages){const c=ae(r.name),u=$(r.name,c);s[`${r.name}/*`]=[o];for(const l of Object.keys(u).sort()){if(l!=="."&&!l.startsWith("./")||l.includes("*"))continue;const a=l==="."?r.name:`${r.name}${l.slice(1)}`,m=ue(a,r.name,c);s[a]=[m===null?o:d(t,m)]}}return s}function ce(e){switch(e){case"node-vitest":return se;case"playwright":return re;case void 0:return null}}function ae(e){const t=pe(e);let n;try{n=v.resolve(`${e}/package.json`)}catch(r){throw new Error(`Testkit typecheck requires managed public package ${e}`,{cause:r})}const s=f.realpathSync.native(i.dirname(n)),o=JSON.parse(f.readFileSync(i.join(s,"package.json"),"utf8"));return requireManagedPublicPackageIdentity(o,e,t),s}export function requireManagedPublicPackageIdentity(e,t,n){if(!x(e)||e.name!==t||e.version!==n)throw new Error(`Testkit managed public package has invalid identity: expected ${t}@${n}`)}function pe(e){const t=JSON.parse(f.readFileSync(i.join(k,"package.json"),"utf8"));if(!x(t)||!x(t.dependencies))throw new Error("Testkit package has invalid dependency metadata");const n=t.dependencies[e];if(typeof n!="string"||!/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/u.test(n))throw new Error(`Testkit managed public package ${e} must be an exact root dependency`);return n}function $(e,t){const n=JSON.parse(f.readFileSync(i.join(t,"package.json"),"utf8"));if(typeof n!="object"||n===null||Array.isArray(n)||!("name"in n)||n.name!==e||!("exports"in n)||typeof n.exports!="object"||n.exports===null||Array.isArray(n.exports))throw new Error(`Testkit managed public package has invalid exports: ${e}`);return n.exports}function ue(e,t,n){const s=P(),o=s.resolveModuleName(e,i.join(k,"__testkit_managed_public_types__.ts"),{module:s.ModuleKind.ESNext,moduleResolution:s.ModuleResolutionKind.Bundler,resolveJsonModule:!0,target:s.ScriptTarget.ES2022},s.sys).resolvedModule;if(o===void 0)return null;const r=f.realpathSync.native(o.resolvedFileName);if(!b(n,r))throw new Error(`Managed public package type ${e} resolved outside ${t}`);return r}export function buildTypecheckCompilerOptions({engineId:e,tsconfigPath:t,extendsPath:n,rootDir:s,extraPaths:o={},libs:r,types:c}){const l={...n?de({tsconfigPath:t,extendsPath:n}):{},...o,...oe(t),...ie(e,t)};return{baseUrl:null,...r?{lib:[...r]}:{},module:"ESNext",moduleResolution:"Bundler",noEmit:!0,...s?{rootDir:s}:{},target:"ES2022",typeRoots:le(c,t),types:[...c],paths:l}}function le(e,t){const n=new Set;for(const s of e){const o=fe(s);let r;try{r=v.resolve(`${o}/package.json`)}catch(u){throw new Error(`Testkit typecheck requires installed type package ${o}`,{cause:u})}const c=i.dirname(r);n.add(i.dirname(c))}return[...n].map(s=>d(t,s))}function fe(e){return e==="node"?`@types/${e}`:e}function de({tsconfigPath:e,extendsPath:t}){const n=P(),s=n.getParsedCommandLineOfConfigFile(t,{},{...n.sys,onUnRecoverableConfigFileDiagnostic:()=>{}}),o=s?.options.paths;if(!o||Object.keys(o).length===0)return{};const r=s.options.baseUrl||(typeof s.options.pathsBasePath=="string"?s.options.pathsBasePath:i.dirname(t)),c={};for(const[u,l]of Object.entries(o))c[u]=l.map(a=>d(e,i.resolve(r,a)));return c}export function nextRuntimeTypePaths({tsconfigPath:e,serviceDir:t}){const n=ge(t,[i.join("next","types.d.ts"),i.join("next","types.js")]);if(!n)return{};const s=d(e,n);return{"next/types":[s],"next/types.js":[s]}}function ge(e,t){let n=i.resolve(e);for(;;){for(const o of t){const r=i.join(n,"node_modules",o);if(f.existsSync(r))return r}const s=i.dirname(n);if(s===n)return null;n=s}}
@@ -1 +1 @@
1
- import{Args as i,Flags as e}from"./framework/definitions.js";import{defineCommand as t}from"./framework/command.js";import{sharedFlags as r,runFlags as a}from"./command-flags.js";import{publicTestTypeList as n,publicTestTypeListText as s}from"../domain/test-types.js";export const commandCatalog=Object.freeze({artifacts:t({summary:"List, verify, or inspect artifacts from immutable Testkit runs",enableJsonFlag:!0,args:{file:i.string({description:"Optional test file selector",required:!1})},flags:{...r,kind:e.string({description:"Limit artifacts to one kind"}),format:e.string({description:"Output format",options:["list","text"],default:"list"}),run:e.string({description:"Read one immutable run ID instead of latest"}),list:e.boolean({description:"List retained immutable runs",default:!1}),verify:e.boolean({description:"Verify the selected run manifest and checksums",default:!1})}}),"bug file":t({summary:"Run a recorded bug's test and file the bug as an issue",enableJsonFlag:!0,args:{id:i.string({description:"Draft id that `testkit bug record` printed",required:!0})},flags:{dir:e.string({description:"Product directory"})}}),"bug guide":t({summary:"Print the bug record format, the severities, and the category lists",enableJsonFlag:!0}),"bug record":t({summary:"Record a confirmed bug as a local draft",enableJsonFlag:!0,args:{file:i.string({description:"Bug record JSON file, or - to read standard input",required:!0})},flags:{dir:e.string({description:"Product directory"})}}),"campaign finish":t({summary:"Finish the active campaign and write its pull request summary",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"campaign start":t({summary:"Start a bug-hunting campaign and print the agent's brief",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),id:e.string({description:"Campaign id, instead of one made from the target and the date"}),target:e.string({description:"What the agent should hunt, in one line of at most 200 characters",required:!0})}}),"campaign status":t({summary:"Show the active campaign, its recorded bugs, and the area map coverage",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"ci report":t({summary:"Post the last run as a commit status, a step summary, and one pull request comment",enableJsonFlag:!0,flags:{context:e.string({description:"Commit status context, instead of testkit"}),dir:e.string({description:"Product directory"})}}),cleanup:t({summary:"Clean stale local testkit state",enableJsonFlag:!0,flags:{...r,"dry-run":e.boolean({description:"Show cleanup actions without deleting state",default:!1}),cache:e.string({description:"Clean cache state: runtime, bundles, or all",multiple:!0,options:["runtime","bundles","all"]}),resources:e.boolean({description:"Clean Testkit-owned Docker resources that are stale or orphaned",default:!1})}}),"db schema refresh":t({summary:"Refresh a source database schema cache",enableJsonFlag:!0,flags:r}),"db schema verify":t({summary:"Verify local schema replay against the source database schema",enableJsonFlag:!0,flags:{...r,"skip-schema-source-verify":e.boolean({description:"Skip the check that local schema replay matches the source database schema",default:!1})}}),destroy:t({summary:"Destroy local testkit state",enableJsonFlag:!0,flags:r}),discover:t({summary:"Discover managed tests and report their metadata",enableJsonFlag:!0,flags:{...r,type:e.string({char:"t",multiple:!0,description:`Filter by suite type(s): ${s({includeAll:!0})}`}),suite:e.string({char:"s",multiple:!0,description:"Filter by suite selector(s)"}),file:e.string({char:"f",multiple:!0,description:"Filter by exact file path(s)"}),"runnable-only":e.boolean({description:"Show only files not skipped by repo rules",default:!1}),strict:e.boolean({description:"Fail instead of reporting discovery/config diagnostics",default:!1}),output:e.string({description:"Write machine-readable discovery JSON to a file"}),"output-mode":e.string({description:"Human-readable output mode",options:["compact","verbose"],default:"compact"})}}),doctor:t({summary:"Run built-in config, discovery, and hygiene checks",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),typecheck:e.boolean({description:"Include generated TypeScript checks",default:!0,allowNo:!0})}}),"guard unsafe-entrypoint":t({summary:"Fail a local script that must be run through Testkit",flags:{command:e.string({char:"c",description:"Disabled command name shown in the error message",required:!0}),use:e.string({char:"u",description:"Replacement command shown in the error message",required:!0})}}),lint:t({summary:"Run built-in Testkit repository hygiene checks",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"report prepare":t({summary:"Prepare a local report with optional template, bug records, and selected run evidence",enableJsonFlag:!0,args:{directory:i.string({description:"New bundle directory",required:!0})},flags:{dir:e.string({description:"Product directory containing bug records and runs"}),template:e.string({description:"Copy this file unchanged to report.md"}),instructions:e.string({description:"Print this repository-owned drafting guide for the author"}),bug:e.string({description:"Include this recorded bug ID as context",multiple:!0}),run:e.string({description:"Immutable run ID containing the selected artifacts"}),artifact:e.string({description:"Exact artifact ref.path from testkit artifacts --json",multiple:!0})}}),"report publish":t({summary:"Publish a prepared directory at one Git revision without changing your checkout",enableJsonFlag:!0,args:{directory:i.string({description:"Directory containing only the files to publish",required:!0})},flags:{dir:e.string({description:"Product directory used to resolve provider credentials"}),repository:e.string({description:"Destination GitHub or Gitea repository URL, or owner/name",required:!0}),branch:e.string({description:"Destination branch",required:!0}),path:e.string({description:"Bundle directory within the destination repository",required:!0}),message:e.string({description:"Publication commit message"})}}),"run status":t({summary:"Show active Testkit run progress",enableJsonFlag:!0,flags:{...r,run:e.string({description:"Specific run id to show"}),full:e.boolean({description:"Include the full live status payload in JSON output"})}}),"run stop":t({summary:"Stop active Testkit run work",enableJsonFlag:!0,flags:{...r,run:e.string({description:"Specific run id to stop; defaults to the newest active run"}),all:e.boolean({description:"Stop all active runs for this product",default:!1}),reason:e.string({description:"Operator-visible reason recorded with cancelled runs and dirty slots"})}}),run:t({summary:"Run test suites",enableJsonFlag:!0,args:{type:i.string({description:`Optional suite type shortcut: ${s({includeAll:!0})}`,required:!1,options:n({includeAll:!0})})},flags:a}),"setup playwright":t({summary:"Install the managed Playwright Chromium runtime",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),force:e.boolean({default:!1,description:"Force Playwright to repair the browser installation"}),"with-deps":e.boolean({default:!1,description:"Install required host dependencies with Chromium"})}}),status:t({summary:"Show local testkit state",enableJsonFlag:!0,flags:r}),stop:t({summary:"Stop all Testkit-owned runs",enableJsonFlag:!0,flags:{...r,reason:e.string({description:"Operator-visible reason recorded with cancelled runs"})}}),typecheck:t({summary:"Typecheck testkit config, helpers, and suites",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),workspace:t({summary:"Inspect Testkit workstation data for a product",enableJsonFlag:!0,flags:{...r,"target-limit":e.integer({description:"Maximum number of quick-run target previews",default:24}),"no-status":e.boolean({description:"Skip runtime status collection",default:!1})}})});
1
+ import{Args as i,Flags as e}from"./framework/definitions.js";import{defineCommand as t}from"./framework/command.js";import{runArgs as n,runFlags as o,sharedFlags as r,suppliedEnvironmentFlags as l,testSelectionFlags as s,vitestSelectionFlags as a}from"./command-flags.js";import{publicTestTypeListText as u}from"../domain/test-types.js";export const commandCatalog=Object.freeze({artifacts:t({summary:"List, verify, or inspect artifacts from immutable Testkit runs",enableJsonFlag:!0,args:{file:i.string({description:"Optional test file selector",required:!1})},flags:{...s,kind:e.string({description:"Limit artifacts to one kind"}),format:e.string({description:"Output format",options:["list","text"],default:"list"}),run:e.string({description:"Read one immutable run ID instead of latest"}),list:e.boolean({description:"List retained immutable runs",default:!1}),verify:e.boolean({description:"Verify the selected run manifest and checksums",default:!1})}}),"bug file":t({summary:"Run a recorded bug's test and file the bug as an issue",enableJsonFlag:!0,args:{id:i.string({description:"Draft id that `testkit bug record` printed",required:!0})},flags:{dir:e.string({description:"Product directory"}),...l,...a}}),"bug guide":t({summary:"Print the bug record format, the severities, and the category lists",enableJsonFlag:!0}),"bug record":t({summary:"Record a confirmed bug as a local draft",enableJsonFlag:!0,args:{file:i.string({description:"Bug record JSON file, or - to read standard input",required:!0})},flags:{dir:e.string({description:"Product directory"}),...a}}),"campaign finish":t({summary:"Finish the active campaign and write its pull request summary",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"campaign start":t({summary:"Start a bug-hunting campaign and print the agent's brief",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),id:e.string({description:"Campaign id, instead of one made from the target and the date"}),target:e.string({description:"What the agent should hunt, in one line of at most 200 characters",required:!0})}}),"campaign status":t({summary:"Show the active campaign, its recorded bugs, and the area map coverage",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"ci report":t({summary:"Post the last run as a commit status, a step summary, and one pull request comment",enableJsonFlag:!0,flags:{context:e.string({description:"Commit status context, instead of testkit"}),dir:e.string({description:"Product directory"})}}),cleanup:t({summary:"Clean stale local testkit state",enableJsonFlag:!0,flags:{...r,"dry-run":e.boolean({description:"Show cleanup actions without deleting state",default:!1}),cache:e.string({description:"Clean cache state: runtime, bundles, or all",multiple:!0,options:["runtime","bundles","all"]}),resources:e.boolean({description:"Clean Testkit-owned Docker resources that are stale or orphaned",default:!1})}}),"db schema refresh":t({summary:"Refresh a source database schema cache",enableJsonFlag:!0,flags:r}),"db schema verify":t({summary:"Verify local schema replay against the source database schema",enableJsonFlag:!0,flags:{...r,"skip-schema-source-verify":e.boolean({description:"Skip the check that local schema replay matches the source database schema",default:!1})}}),destroy:t({summary:"Remove runtime state, databases, and Docker resources; run results and other .testkit files stay",enableJsonFlag:!0,flags:r}),discover:t({summary:"Discover managed tests and report their metadata",enableJsonFlag:!0,flags:{...s,...a,type:e.string({char:"t",multiple:!0,description:`Filter by suite type(s): ${u({includeAll:!0})}`}),suite:e.string({char:"s",multiple:!0,description:"Filter by suite selector(s)"}),file:e.string({char:"f",multiple:!0,description:"Filter by exact file path(s)"}),"runnable-only":e.boolean({description:"Show only files not skipped by repo rules",default:!1}),strict:e.boolean({description:"Fail instead of reporting discovery/config diagnostics",default:!1}),output:e.string({description:"Write machine-readable discovery JSON to a file"}),"output-mode":e.string({description:"Human-readable output mode",options:["compact","verbose"],default:"compact"})}}),doctor:t({summary:"Run built-in config, discovery, and hygiene checks",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),typecheck:e.boolean({description:"Include generated TypeScript checks",default:!0,allowNo:!0})}}),"guard unsafe-entrypoint":t({summary:"Fail a local script that must be run through Testkit",flags:{command:e.string({char:"c",description:"Disabled command name shown in the error message",required:!0}),use:e.string({char:"u",description:"Replacement command shown in the error message",required:!0})}}),lint:t({summary:"Run built-in Testkit repository hygiene checks",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"})}}),"report prepare":t({summary:"Prepare a local report with optional template, bug records, and selected run evidence",enableJsonFlag:!0,args:{directory:i.string({description:"New bundle directory",required:!0})},flags:{dir:e.string({description:"Product directory containing bug records and runs"}),template:e.string({description:"Copy this file unchanged to report.md"}),instructions:e.string({description:"Print this repository-owned drafting guide for the author"}),bug:e.string({description:"Include this recorded bug ID as context",multiple:!0}),run:e.string({description:"Immutable run ID containing the selected artifacts"}),artifact:e.string({description:"Exact artifact ref.path from testkit artifacts --json",multiple:!0})}}),"report publish":t({summary:"Publish a prepared directory at one Git revision without changing your checkout",enableJsonFlag:!0,args:{directory:i.string({description:"Directory containing only the files to publish",required:!0})},flags:{dir:e.string({description:"Product directory used to resolve provider credentials"}),repository:e.string({description:"Destination GitHub or Gitea repository URL, or owner/name",required:!0}),branch:e.string({description:"Destination branch",required:!0}),path:e.string({description:"Bundle directory within the destination repository",required:!0}),message:e.string({description:"Publication commit message"})}}),"run status":t({summary:"Show active Testkit run progress",enableJsonFlag:!0,flags:{...r,run:e.string({description:"Specific run id to show"}),full:e.boolean({description:"Include the full live status payload in JSON output"})}}),"run stop":t({summary:"Stop active Testkit run work",enableJsonFlag:!0,flags:{...r,run:e.string({description:"Specific run id to stop; defaults to the newest active run"}),all:e.boolean({description:"Stop all active runs for this product",default:!1}),reason:e.string({description:"Operator-visible reason recorded with cancelled runs and dirty slots"})}}),run:t({summary:"Run test suites",enableJsonFlag:!0,args:n,flags:o}),"setup playwright":t({summary:"Install the managed Playwright Chromium runtime",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),force:e.boolean({default:!1,description:"Force Playwright to repair the browser installation"}),"with-deps":e.boolean({default:!1,description:"Install required host dependencies with Chromium"})}}),status:t({summary:"Show local testkit state",enableJsonFlag:!0,flags:r}),stop:t({summary:"Stop all Testkit-owned runs",enableJsonFlag:!0,flags:{...r,reason:e.string({description:"Operator-visible reason recorded with cancelled runs"})}}),typecheck:t({summary:"Typecheck testkit config, helpers, and suites",enableJsonFlag:!0,flags:{dir:e.string({description:"Product directory"}),group:s.group,...a}}),workspace:t({summary:"Inspect Testkit workstation data for a product",enableJsonFlag:!0,flags:{...s,"target-limit":e.integer({description:"Maximum number of quick-run target previews",default:24}),"no-status":e.boolean({description:"Skip runtime status collection",default:!1})}})});
@@ -1 +1 @@
1
- import{publicTestTypeListText as t}from"../domain/test-types.js";import{Flags as e}from"./framework/index.js";export const sharedFlags={dir:e.string({description:"Explicit product directory"}),service:e.string({description:"Limit the operation to one service"})},runFlags={...sharedFlags,type:e.string({char:"t",multiple:!0,description:`Run specific suite type(s): ${t({includeAll:!0})}`}),suite:e.string({char:"s",multiple:!0,description:"Run specific suite(s)"}),file:e.string({char:"f",multiple:!0,description:"Run specific file(s)"}),"task-concurrency":e.string({description:"Maximum number of concurrent test tasks for the whole run"}),workers:e.string({description:"Deprecated alias for --task-concurrency; removed in 0.3.0"}),"file-timeout-seconds":e.string({description:"Per-file wall-clock timeout in seconds"}),"allow-empty":e.boolean({description:"Permit a successful run when no runnable files execute",default:!1}),"ignore-skip-rules":e.boolean({description:"Run files even if testkit.config.ts marks them skipped",default:!1}),"skip-schema-source-verify":e.boolean({description:"Skip the check that local schema replay matches the source database schema",default:!1}),"output-mode":e.string({description:"Reporter mode",options:["compact","debug","events"]}),debug:e.boolean({description:"Alias for --output-mode debug",default:!1})};
1
+ import{RETIRED_TEST_TYPES as s,rejectRetiredTestType as n}from"../domain/retired-test-types.js";import{publicTestTypeList as o,publicTestTypeListText as r}from"../domain/test-types.js";import{CliUsageError as p}from"./framework/errors.js";import{Args as c,Flags as e}from"./framework/index.js";export const sharedFlags={dir:e.string({description:"Explicit product directory"}),service:e.string({description:"Limit the operation to one service"})},testSelectionFlags={dir:sharedFlags.dir,group:e.string({description:"Limit the operation to one test group"}),service:e.string({description:"Removed in 0.6.0; use --group"})};export function selectedGroup(t){if(t.service!==void 0)throw new p(`Testkit 0.6.0 removed --service from run, discover, artifacts, and workspace; use --group ${t.service}`);return t.group??null}export const vitestSelectionFlags={"vitest-config":e.string({description:"Run plain test files with this Vitest config, relative to the product directory"}),"vitest-project":e.string({description:"Run plain test files from this Vitest project only"}),"vitest-runner":e.string({description:"Run plain test files with the repository's Vitest (repo) or Testkit's own (managed)",options:["repo","managed"]})},suppliedEnvironmentFlags={"base-url":e.string({description:"Supply the default endpoint, BASE_URL, instead of provisioning it"}),endpoint:e.string({multiple:!0,description:"Supply a named endpoint as NAME=URL"}),database:e.string({multiple:!0,description:"Supply a named PostgreSQL database as NAME=URL"}),env:e.string({multiple:!0,description:"Supply an environment value as NAME=VALUE"}),"env-from":e.string({multiple:!0,description:"Supply an environment value from a host variable as NAME=HOST_KEY"}),"environment-file":e.string({description:"Supply values, prepared setup data and handle descriptors from a version 1 environment file"})};export function runTypeArgument(t=s){return c.string({check:i=>{n(i,`Type "${i}"`,t)},description:`Optional suite type shortcut: ${r({includeAll:!0})}`,required:!1,options:o({includeAll:!0})})}export const runArgs={type:runTypeArgument()},runFlags={...testSelectionFlags,...suppliedEnvironmentFlags,...vitestSelectionFlags,type:e.string({char:"t",multiple:!0,description:`Run specific suite type(s): ${r({includeAll:!0})}`}),suite:e.string({char:"s",multiple:!0,description:"Run specific suite(s)"}),file:e.string({char:"f",multiple:!0,description:"Run specific file(s)"}),"task-concurrency":e.string({description:"Maximum number of concurrent test tasks for the whole run"}),workers:e.string({description:"Deprecated alias for --task-concurrency"}),"file-timeout-seconds":e.string({description:"Per-file wall-clock timeout in seconds"}),"allow-empty":e.boolean({description:"Permit a successful run when no runnable files execute",default:!1}),"ignore-skip-rules":e.boolean({description:"Run files even if testkit.config.ts marks them skipped",default:!1}),"skip-schema-source-verify":e.boolean({description:"Skip the check that local schema replay matches the source database schema",default:!1}),"output-mode":e.string({description:"Reporter mode",options:["compact","debug","events"]}),debug:e.boolean({description:"Alias for --output-mode debug",default:!1})};
@@ -1,3 +1,3 @@
1
- import{asUnknownRecord as c}from"../../kernel/unknown-values.js";import s from"node:fs";import{inspectArtifacts as d}from"../../app/inspect/artifacts.js";export default function l({args:i,flags:e,json:n,log:o}){const r=d({dir:e.dir,mode:e.list?"runs":e.verify?"verify":"artifacts",file:i.file||null,runId:e.run||null,service:e.service||null,kind:e.kind,includePayload:n||e.format==="text"});if(r.mode==="runs"){const{runs:t}=r;if(n)return{ok:!0,runs:t};t.length===0&&o("No immutable Testkit runs found.");for(const u of t)o(`${u.runId} ${u.status||"unknown"} ${u.finishedAt||u.startedAt||"unknown-time"}`);return{ok:!0,count:t.length}}const a=r.runId;if(r.mode==="verify"){const{verification:t}=r;return t.ok||(process.exitCode=1),n?{ok:t.ok,verification:t}:(o(t.ok?`Verified ${a??"unknown"}: ${String(t.checkedFiles)} files (${t.manifestDigest??"unknown-digest"})`:`Integrity verification failed for ${a??"unknown"}: ${t.errors.join("; ")}`),{ok:t.ok,verification:t})}const{entries:f}=r;if(n)return{ok:!0,runId:a,artifacts:f.map(t=>({file:t.file.path,service:t.service.name,suite:{engineId:t.suite.engineId,name:t.suite.name,profileId:t.suite.profileId,testType:t.suite.testType},ref:t.artifactRef,payload:t.payload}))};if(e.format==="text")o(p(f));else for(const t of m(f))o(t);return{ok:!0,runId:a,count:f.length}}function m(i){if(i.length===0)return["No artifacts matched."];const e=[];for(const n of i)e.push(`${n.artifactRef.name}${n.artifactRef.kind?` [${n.artifactRef.kind}]`:""}`),n.artifactRef.summary&&e.push(` ${n.artifactRef.summary}`),e.push(` ${n.artifactRef.path}`);return e}function p(i){return i.length===0?"No artifacts matched.":i.map(e=>k(e)).join(`
1
+ import{asUnknownRecord as s}from"../../kernel/unknown-values.js";import d from"node:fs";import{inspectArtifacts as c}from"../../app/inspect/artifacts.js";import{selectedGroup as p}from"../command-flags.js";export default function l({args:i,flags:e,json:n,log:o}){const r=c({dir:e.dir,mode:e.list?"runs":e.verify?"verify":"artifacts",file:i.file||null,runId:e.run||null,group:p(e),kind:e.kind,includePayload:n||e.format==="text"});if(r.mode==="runs"){const{runs:t}=r;if(n)return{ok:!0,runs:t};t.length===0&&o("No immutable Testkit runs found.");for(const u of t)o(`${u.runId} ${u.status||"unknown"} ${u.finishedAt||u.startedAt||"unknown-time"}`);return{ok:!0,count:t.length}}const a=r.runId;if(r.mode==="verify"){const{verification:t}=r;return t.ok||(process.exitCode=1),n?{ok:t.ok,verification:t}:(o(t.ok?`Verified ${a??"unknown"}: ${String(t.checkedFiles)} files (${t.manifestDigest??"unknown-digest"})`:`Integrity verification failed for ${a??"unknown"}: ${t.errors.join("; ")}`),{ok:t.ok,verification:t})}const{entries:f}=r;if(n)return{ok:!0,runId:a,artifacts:f.map(t=>({file:t.file.path,group:t.group.name,suite:{engineId:t.suite.engineId,name:t.suite.name,profileId:t.suite.profileId,testType:t.suite.testType},ref:t.artifactRef,payload:t.payload}))};if(e.format==="text")o(k(f));else for(const t of m(f))o(t);return{ok:!0,runId:a,count:f.length}}function m(i){if(i.length===0)return["No artifacts matched."];const e=[];for(const n of i)e.push(`${n.artifactRef.name}${n.artifactRef.kind?` [${n.artifactRef.kind}]`:""}`),n.artifactRef.summary&&e.push(` ${n.artifactRef.summary}`),e.push(` ${n.artifactRef.path}`);return e}function k(i){return i.length===0?"No artifacts matched.":i.map(e=>h(e)).join(`
2
2
 
3
- `)}function k(i){if(typeof i.payload?.text=="string")return i.payload.text.trimEnd();const e=c(i.payload?.data);return typeof e?.text=="string"?e.text.trimEnd():i.artifactRef.contentType==="application/json"&&s.existsSync(i.absolutePath)?s.readFileSync(i.absolutePath,"utf8").trimEnd():JSON.stringify(i.payload?.data??i.payload??null,null,2)}
3
+ `)}function h(i){if(typeof i.payload?.text=="string")return i.payload.text.trimEnd();const e=s(i.payload?.data);return typeof e?.text=="string"?e.text.trimEnd():i.artifactRef.contentType==="application/json"&&d.existsSync(i.absolutePath)?d.readFileSync(i.absolutePath,"utf8").trimEnd():JSON.stringify(i.payload?.data??i.payload??null,null,2)}
@@ -1,2 +1,2 @@
1
- import{fileBug as d,prepareBugFiling as n}from"../../../app/bugs/file.js";import{readRun as c}from"../../../app/bugs/run-reading.js";import{buildRunRequest as f}from"../../../app/run/request.js";import{executeRunRequest as l}from"../../operations/run/operation.js";import{renderAlreadyFiledBug as p,renderBugFileResult as m,renderBugFileRun as R}from"../../renderers/bug/text.js";export default async function w({args:a,flags:i,json:r,log:t}){const e=await n({dir:i.dir,env:process.env,id:a.id});if(e.status==="already-filed")return r||t(p(e.issue)),{ok:!0,created:!1,draft:e.draft,issue:e.issue};r||t(R(e));const s=await f({allowEmpty:!1,dir:i.dir,file:[e.testFile],ignoreSkipRules:!1,skipSchemaSourceVerify:!1},null,process.cwd(),process.cwd()),o=await l(s,{json:r,outputMode:"compact"}),u=await d(e,c(o.runArtifact,e.checkout.productPath));return r||t(m(u).join(`
2
- `)),{ok:!0,created:!0,...u}}
1
+ import{bugRerun as c,fileBug as p,prepareBugFiling as f}from"../../../app/bugs/file.js";import{readRunArtifact as l}from"../../../app/bugs/run-reading.js";import{buildRunRequest as m}from"../../../app/run/request.js";import{executeRunRequest as v}from"../../operations/run/operation.js";import{renderAlreadyFiledBug as w,renderBugFileResult as R,renderBugFileRun as y}from"../../renderers/bug/text.js";export default async function b({args:o,flags:e,json:t,log:i}){const n={baseUrl:e["base-url"],database:e.database,endpoint:e.endpoint,env:e.env,envFrom:e["env-from"],environmentFile:e["environment-file"]},r=await f({cwd:process.cwd(),dir:e.dir,env:process.env,id:o.id,supplied:n});if(r.status==="already-filed")return t||i(w(r.issue)),{ok:!0,created:!1,draft:r.draft,issue:r.issue};t||i(y(r));const u=await c(r,e,n),d=await m({allowEmpty:!1,dir:e.dir,file:u.files,ignoreSkipRules:!1,skipSchemaSourceVerify:!1,supplied:n,vitest:u.ready.draft.vitest},null,process.cwd(),process.cwd(),process.env),s=await v(d,{json:t,outputMode:"compact"}),a=await p(u.ready,l(s.runArtifact,r.checkout.productPath));return t||i(R(a).join(`
2
+ `)),{ok:!0,created:!0,...a}}
@@ -1,2 +1,2 @@
1
- import{recordBug as n}from"../../../app/bugs/record.js";import{renderBugRecordResult as u}from"../../renderers/bug/text.js";export default async function f({args:e,flags:o,json:t,log:i}){const r=await n({dir:o.dir,file:e.file});return t||i(u(r).join(`
2
- `)),{ok:!0,...r}}
1
+ import{recordBug as n}from"../../../app/bugs/record.js";import{renderBugRecordResult as u}from"../../renderers/bug/text.js";export default async function d({args:t,flags:r,json:i,log:o}){const e=await n({dir:r.dir,file:t.file,vitest:r});return i||o(u(e).join(`
2
+ `)),{ok:!0,...e}}
@@ -1 +1 @@
1
- import{executeDiscoverOperation as u}from"../../app/discover/index.js";import{renderDiscoverResult as n}from"../renderers/discover/text.js";export default async function c({flags:e,json:r,log:o}){const t=await u({diagnostics:e.strict?"error":"report",dir:e.dir,file:e.file||[],output:e.output,runnableOnly:e["runnable-only"],service:e.service||null,suite:e.suite||[],type:e.type||[]},process.cwd());if(!r)for(const i of n(t,{outputMode:e["output-mode"]}))o(i);return t}
1
+ import{executeDiscoverOperation as i}from"../../app/discover/index.js";import{renderDiscoverResult as n}from"../renderers/discover/text.js";import{selectedGroup as p}from"../command-flags.js";export default async function c({flags:t,json:r,log:o}){const e=await i({diagnostics:t.strict?"error":"report",dir:t.dir,file:t.file||[],group:p(t),output:t.output,runnableOnly:t["runnable-only"],suite:t.suite||[],type:t.type||[],vitest:t},process.cwd());if(!r)for(const u of n(e,{outputMode:t["output-mode"]}))o(u);return e}
@@ -1,2 +1,2 @@
1
- export default function t({flags:e}){throw Object.assign(new Error(`${e.command} is disabled because DB-touching tests must run through the isolated testkit harness.
1
+ export default function t({flags:e}){throw Object.assign(new Error(`${e.command} is disabled because this repository runs its tests through Testkit.
2
2
  Use ${e.use} instead.`),{exitCode:1})}
@@ -1,2 +1,2 @@
1
- import{applyKnownFailures as s,loadBugPolicy as d}from"../../app/bugs/gate.js";import{buildRunRequest as l}from"../../app/run/request.js";import{executeRunRequest as a}from"../operations/run/operation.js";import{renderKnownFailures as m}from"../renderers/bug/text.js";export default async function w({args:i,flags:e,json:u,log:n,setExitCode:c}){const r=await l({dir:e.dir,service:e.service,taskConcurrency:e["task-concurrency"],workers:e.workers,fileTimeoutSeconds:e["file-timeout-seconds"],type:e.type,suite:e.suite,file:e.file,allowEmpty:e["allow-empty"],ignoreSkipRules:e["ignore-skip-rules"],skipSchemaSourceVerify:e["skip-schema-source-verify"]},i.type||null,process.cwd(),process.cwd()),p=await d(r.productDir),o=await a(r,{outputMode:e["output-mode"]||"compact",json:u,debug:e.debug}),t=await s({env:process.env,exitCode:o.exitCode,failedOutsideTests:o.failure!==void 0,policy:p,productDir:r.productDir,run:o.runArtifact});return t.knownFailures!==null&&(o.outputMode==="compact"||o.outputMode==="debug")&&n(m(t.knownFailures).join(`
2
- `)),c(t.exitCode),t.knownFailures===null?o:{...o,...t}}
1
+ import{applyKnownFailures as a,loadBugPolicy as m}from"../../app/bugs/gate.js";import{buildRunRequest as l}from"../../app/run/request.js";import{selectedGroup as w}from"../command-flags.js";import{executeRunRequest as y}from"../operations/run/operation.js";import{renderKnownFailures as k}from"../renderers/bug/text.js";export default async function v({args:r,flags:e,json:i,log:u,notice:c,setExitCode:d}){const p=w(e),t=await l({dir:e.dir,group:p??void 0,taskConcurrency:e["task-concurrency"],workers:e.workers,fileTimeoutSeconds:e["file-timeout-seconds"],type:e.type,suite:e.suite,file:e.file,allowEmpty:e["allow-empty"],ignoreSkipRules:e["ignore-skip-rules"],skipSchemaSourceVerify:e["skip-schema-source-verify"],supplied:{baseUrl:e["base-url"],database:e.database,endpoint:e.endpoint,env:e.env,envFrom:e["env-from"],environmentFile:e["environment-file"]},vitest:e},r.type||null,process.cwd(),process.cwd()),s=await m(t.productDir),n=await y(t,{outputMode:e["output-mode"]||"compact",json:i,debug:e.debug}),o=await a({env:process.env,exitCode:n.exitCode,failedOutsideTests:n.failure!==void 0,policy:s,productDir:t.productDir,run:n.runArtifact});return o.knownFailures!==null&&(n.outputMode==="compact"||n.outputMode==="debug")&&u(k(o.knownFailures).join(`
2
+ `)),n.maintenance?.status==="failed"&&c(`Post-run maintenance failed: ${n.maintenance.error??"unknown error"}. The run's result is unchanged.`),d(o.exitCode),o.knownFailures===null?n:{...n,...o}}
@@ -1 +1 @@
1
- import{runTestkitTypecheck as n,TestkitTypecheckError as s}from"../../app/typecheck/index.js";import{runWithCliProcessSignal as f}from"../process-signal.js";import{renderTypecheckResult as u}from"../renderers/typecheck/text.js";export default async function m({flags:c,json:r,log:i}){const e=await f(t=>n({dir:c.dir,signal:t})).catch(t=>{if(!r&&t instanceof s)for(const o of[t.result.stdout,t.result.stderr])o.trim()&&i(o.trimEnd());throw t});if(!r)for(const t of u(e))i(t);return e}
1
+ import{runTestkitTypecheck as n,TestkitTypecheckError as u}from"../../app/typecheck/index.js";import{runWithCliProcessSignal as s}from"../process-signal.js";import{renderTypecheckResult as f}from"../renderers/typecheck/text.js";export default async function p({flags:r,json:i,log:e}){const o=await s(t=>n({dir:r.dir,group:r.group,signal:t,vitest:r})).catch(t=>{if(!i&&t instanceof u)for(const c of[t.result.stdout,t.result.stderr])c.trim()&&e(c.trimEnd());throw t});if(!i)for(const t of f(o))e(t);return o}
@@ -1 +1 @@
1
- import{inspectWorkspace as n}from"../../app/inspect/index.js";export default async function a({flags:e,json:i,log:t}){const s=await n({dir:e.dir,service:e.service||null,status:!e["no-status"],targetLimit:e["target-limit"]});if(!i&&(t(`${s.product.name} \xB7 Testkit workspace`),s.discovery&&t(` ${String(s.discovery.summary.services)} services \xB7 ${String(s.discovery.summary.suites)} suites \xB7 ${String(s.discovery.summary.files)} files`),s.runs.live?t(` live ${s.runs.live.status} \xB7 ${String(s.runs.live.files.passed)}/${String(s.runs.live.files.total)} files complete`):s.runs.latest&&t(` latest ${s.runs.latest.status} \xB7 ${String(s.runs.latest.files.passed)}/${String(s.runs.latest.files.total)} files passed`),s.warnings.length>0))for(const r of s.warnings)t(` warning: ${r}`);return s}
1
+ import{inspectWorkspace as n}from"../../app/inspect/index.js";import{selectedGroup as a}from"../command-flags.js";export default async function u({flags:i,json:r,log:t}){const s=await n({dir:i.dir,group:a(i),status:!i["no-status"],targetLimit:i["target-limit"]});if(!r&&(t(`${s.product.name} \xB7 Testkit workspace`),s.discovery&&t(` ${String(s.discovery.summary.groups)} groups \xB7 ${String(s.discovery.summary.suites)} suites \xB7 ${String(s.discovery.summary.files)} files`),s.runs.live?t(` live ${s.runs.live.status} \xB7 ${String(s.runs.live.files.passed)}/${String(s.runs.live.files.total)} files complete`):s.runs.latest&&t(` latest ${s.runs.latest.status} \xB7 ${String(s.runs.latest.files.passed)}/${String(s.runs.latest.files.total)} files passed`),s.warnings.length>0))for(const e of s.warnings)t(` warning: ${e}`);return s}
@@ -1 +1 @@
1
- export class CliUsageError extends Error{exitCode=2;constructor(t){super(t),this.name="CliUsageError"}}export function commandExitCode(e){if(!n(e))return 1;const t=Reflect.get(e,"exitCode");return typeof t=="number"&&Number.isSafeInteger(t)&&t>=0&&t<=255?t:1}export function errorMessage(e){if(n(e)){const t=Reflect.get(e,"message");if(typeof t=="string"&&t.length>0)return t}return String(e)}function n(e){return typeof e=="object"&&e!==null||typeof e=="function"}
1
+ import{isPropertyContainer as r}from"../../kernel/unknown-values.js";export class CliUsageError extends Error{exitCode=2;constructor(e){super(e),this.name="CliUsageError"}}export function commandExitCode(t){if(!r(t))return 1;const e=Reflect.get(t,"exitCode");return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0&&e<=255?e:1}export function errorMessage(t){if(r(t)){const e=Reflect.get(t,"message");if(typeof e=="string"&&e.length>0)return e}return String(t)}
@@ -1,6 +1,7 @@
1
- import{serializeCliError as g,writeStandardOutput as m}from"../json-errors.js";import{CliUsageError as d,commandExitCode as w,errorMessage as p}from"./errors.js";import{renderCommandHelp as h,renderRootHelp as C,renderTopicHelp as x,renderVersion as O}from"./help.js";import{parseCommandArguments as S}from"./parser.js";export async function executeCliArguments(t,i){const e=H;if(t.length===1&&l(t[0])){await e.writeStandardOutput(C(i.identity,i.registrations));return}if(t.length===1&&y(t[0])){await e.writeStandardOutput(O(i.identity));return}let r;try{r=E(t,i)}catch(n){const s=F(t,i.registrations);if(s){await e.writeStandardOutput(x(s,i.registrations));return}await c(n,!1,e);return}if(u(r.argv,l)){await e.writeStandardOutput(h(r.registration,i.registrations));return}const a=r.registration.enableJsonFlag===!0&&u(r.argv,n=>n==="--json");try{const n=S(r.argv,r.registration.flags,r.registration.args,r.registration.enableJsonFlag===!0);await i.beforeAction?.(r.registration.id);const o=await(await r.registration.load()).default({...n,json:a,log(f=""){e.writeStandardOutput(`${f}
2
- `)},setExitCode:e.setExitCode});a&&o!==void 0&&await e.writeStandardOutput(`${JSON.stringify(o,null,2)}
3
- `)}catch(n){await c(n,a,e)}}function E(t,{registrations:i,removedCommands:e}){const a=i.filter(n=>n.id.every((s,o)=>t[o]===s)).sort((n,s)=>s.id.length-n.id.length).at(0);if(!a){const n=t.filter(s=>!s.startsWith("-")).at(0);throw n?new d(e?.get(n)??`Unknown command: ${n}`):new d("A Testkit command is required")}return{registration:a,argv:t.slice(a.id.length)}}async function c(t,i,e){const r=w(t);if(i){await e.writeStandardOutput(`${JSON.stringify({error:g(t)},null,2)}
4
- `),e.setExitCode(r);return}e.setExitCode(r);const a=t instanceof d?`
5
- Run "testkit --help" to see available commands and options.`:"";e.writeStandardError(`Error: ${p(t)}${a}
6
- `)}function l(t){return t==="--help"||t==="-h"}function y(t){return t==="--version"||t==="-v"}function F(t,i){const e=t.findIndex(l);if(e<1)return null;const r=t.slice(0,e);return i.some(a=>a.id.length>r.length&&r.every((n,s)=>a.id[s]===n))?r:null}function u(t,i){const e=t.indexOf("--");return(e<0?t:t.slice(0,e)).some(i)}const H={setExitCode(t){process.exitCode=t},writeStandardError(t){process.stderr.write(t)},writeStandardOutput:m};
1
+ import{serializeCliError as g,writeStandardOutput as m}from"../json-errors.js";import{CliUsageError as c,commandExitCode as p,errorMessage as h}from"./errors.js";import{renderCommandHelp as C,renderRootHelp as x,renderTopicHelp as S,renderVersion as E}from"./help.js";import{parseCommandArguments as O}from"./parser.js";export async function executeCliArguments(t,i){const e=H;if(t.length===1&&l(t[0])){await e.writeStandardOutput(x(i.identity,i.registrations));return}if(t.length===1&&$(t[0])){await e.writeStandardOutput(E(i.identity));return}let r;try{r=y(t,i)}catch(n){const o=F(t,i.registrations);if(o){await e.writeStandardOutput(S(o,i.registrations));return}await f(n,!1,e);return}if(w(r.argv,l)){await e.writeStandardOutput(C(r.registration,i.registrations));return}const a=r.registration.enableJsonFlag===!0&&w(r.argv,n=>n==="--json");try{const n=O(r.argv,r.registration.flags,r.registration.args,r.registration.enableJsonFlag===!0);await i.beforeAction?.(r.registration.id);const o=await r.registration.load(),d=new Set,u=await o.default({...n,json:a,log(s=""){e.writeStandardOutput(`${s}
2
+ `)},notice(s){d.has(s)||(d.add(s),e.writeStandardError(`Notice: ${s}
3
+ `))},setExitCode:e.setExitCode});a&&u!==void 0&&await e.writeStandardOutput(`${JSON.stringify(u,null,2)}
4
+ `)}catch(n){await f(n,a,e)}}function y(t,{registrations:i,removedCommands:e}){const a=i.filter(n=>n.id.every((o,d)=>t[d]===o)).sort((n,o)=>o.id.length-n.id.length).at(0);if(!a){const n=t.filter(o=>!o.startsWith("-")).at(0);throw n?new c(e?.get(n)??`Unknown command: ${n}`):new c("A Testkit command is required")}return{registration:a,argv:t.slice(a.id.length)}}async function f(t,i,e){const r=p(t);if(i){await e.writeStandardOutput(`${JSON.stringify({error:g(t)},null,2)}
5
+ `),e.setExitCode(r);return}e.setExitCode(r);const a=t instanceof c?`
6
+ Run "testkit --help" to see available commands and options.`:"";e.writeStandardError(`Error: ${h(t)}${a}
7
+ `)}function l(t){return t==="--help"||t==="-h"}function $(t){return t==="--version"||t==="-v"}function F(t,i){const e=t.findIndex(l);if(e<1)return null;const r=t.slice(0,e);return i.some(a=>a.id.length>r.length&&r.every((n,o)=>a.id[o]===n))?r:null}function w(t,i){const e=t.indexOf("--");return(e<0?t:t.slice(0,e)).some(i)}const H={setExitCode(t){process.exitCode=t},writeStandardError(t){process.stderr.write(t)},writeStandardOutput:m};
@@ -1 +1 @@
1
- import"./definitions.js";import{CliUsageError as l}from"./errors.js";export function parseCommandArguments(n,t,e,i){const r=t??{},o=y(r),a=q(r),s=new Set,f=[];let c=!1;for(let u=0;u<n.length;u+=1){const d=n[u];if(c){f.push(d);continue}if(d==="--"){c=!0;continue}if(d==="--json"){if(!i)throw g(d);continue}if(d.startsWith("--")){u=m(n,u,{aliases:o,definitions:r,flags:a,seenFlags:s});continue}if(d.startsWith("-")&&d!=="-"){u=v(n,u,{aliases:o,definitions:r,flags:a,seenFlags:s});continue}f.push(d)}return E(r,a),{args:j(f,e??{}),flags:a}}function m(n,t,e){const i=n[t],r=i.indexOf("="),o=i.slice(2,r<0?void 0:r),a=k(o,e.definitions);if(!a)throw g(`--${o}`);const{definition:s,name:f,negated:c}=a;if(s.kind==="boolean"){if(r>=0)throw new l(`Boolean flag --${o} does not take a value`);if(c&&!s.allowNo)throw g(`--${o}`);return h(f,s,e.seenFlags),e.flags[f]=!c,t}if(c)throw g(`--${o}`);const w=r<0?null:i.slice(r+1),u=p(n,t,`--${f}`,w,s);return h(f,s,e.seenFlags),$(e.flags,f,s,u.values),u.index}function v(n,t,e){const i=n[t],r=i.slice(1,2),o=e.aliases.get(r);if(!o)throw g(`-${r}`);const a=e.definitions[o],s=i.slice(2);if(a.kind==="boolean"){if(s.startsWith("="))throw new l(`Boolean flag -${r} does not take a value`);if(s.length>0)throw g(i);return h(o,a,e.seenFlags),e.flags[o]=!0,t}const f=s.length===0?null:s.startsWith("=")?s.slice(1):s,c=p(n,t,`-${r}`,f,a);return h(o,a,e.seenFlags),$(e.flags,o,a,c.values),c.index}function p(n,t,e,i,r){const o=[];let a=t;if(i!==null){if(i.length===0)throw new l(`Flag ${e} requires a value`);o.push(i)}else{const s=n.at(t+1);if(s===void 0||F(s,r))throw new l(`Flag ${e} requires a value`);o.push(s),a+=1}if(r.multiple)for(;;){const s=n.at(a+1);if(s===void 0||F(s,r))break;o.push(s),a+=1}return{index:a,values:o}}function $(n,t,e,i){if(e.multiple){const o=n[t];if(o!==void 0&&!Array.isArray(o))throw new Error(`Invalid internal default for multiple flag --${t}`);const a=o??[];for(const s of i)a.push(b(t,e,s));n[t]=a;return}const r=i.at(0);if(r===void 0)throw new Error(`Missing parsed value for --${t}`);n[t]=b(t,e,r)}function k(n,t){if(Object.hasOwn(t,n))return{definition:t[n],name:n,negated:!1};if(!n.startsWith("no-"))return null;const e=n.slice(3);return Object.hasOwn(t,e)?{definition:t[e],name:e,negated:!0}:null}function h(n,t,e){if(!t.multiple&&e.has(n))throw new l(`Flag --${n} can only be specified once`);e.add(n)}function F(n,t){return n==="-"||t.kind==="integer"&&/^-\d+$/u.test(n)?!1:n.startsWith("-")}function b(n,t,e){if(t.kind==="integer"){if(!/^-?\d+$/u.test(e))throw new l(`Expected --${n} to be an integer; received ${JSON.stringify(e)}`);const i=Number(e);if(!Number.isSafeInteger(i))throw new l(`Expected --${n} to be a safe integer; received ${JSON.stringify(e)}`);return i}return O(e,t.options,`--${n}`),e}function j(n,t){const e=Object.entries(t);if(n.length>e.length)throw new l(`Unexpected argument ${JSON.stringify(n[e.length])}`);const i={};for(const[r,[o,a]]of e.entries()){const s=n.at(r);if(s===void 0){if(a.required)throw new l(`Missing required argument ${o}`);i[o]=void 0;continue}O(s,a.options,o),i[o]=s}return i}function O(n,t,e){if(!(!t||t.includes(n)))throw new l(`Expected ${e} to be one of: ${t.join(", ")}; received ${JSON.stringify(n)}`)}function q(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i.default;return t}function y(n){const t=new Map;for(const[e,i]of Object.entries(n)){if(!i.char)continue;if(!/^[A-Za-z0-9]$/u.test(i.char))throw new Error(`Invalid short flag alias for --${e}: ${i.char}`);const r=t.get(i.char);if(r)throw new Error(`Duplicate short flag alias -${i.char} for --${r} and --${e}`);t.set(i.char,e)}return t}function E(n,t){const e=Object.entries(n).filter(([i,r])=>r.required&&t[i]===void 0).map(([i])=>`--${i}`);if(e.length>0)throw new l(`Missing required flag${e.length===1?"":"s"}: ${e.join(", ")}`)}function g(n){return new l(`Unknown flag: ${n}`)}
1
+ import"./definitions.js";import{CliUsageError as l}from"./errors.js";export function parseCommandArguments(n,t,e,i){const s=t??{},o=y(s),a=q(s),r=new Set,f=[];let c=!1;for(let u=0;u<n.length;u+=1){const d=n[u];if(c){f.push(d);continue}if(d==="--"){c=!0;continue}if(d==="--json"){if(!i)throw g(d);continue}if(d.startsWith("--")){u=m(n,u,{aliases:o,definitions:s,flags:a,seenFlags:r});continue}if(d.startsWith("-")&&d!=="-"){u=v(n,u,{aliases:o,definitions:s,flags:a,seenFlags:r});continue}f.push(d)}return E(s,a),{args:j(f,e??{}),flags:a}}function m(n,t,e){const i=n[t],s=i.indexOf("="),o=i.slice(2,s<0?void 0:s),a=k(o,e.definitions);if(!a)throw g(`--${o}`);const{definition:r,name:f,negated:c}=a;if(r.kind==="boolean"){if(s>=0)throw new l(`Boolean flag --${o} does not take a value`);if(c&&!r.allowNo)throw g(`--${o}`);return h(f,r,e.seenFlags),e.flags[f]=!c,t}if(c)throw g(`--${o}`);const w=s<0?null:i.slice(s+1),u=p(n,t,`--${f}`,w,r);return h(f,r,e.seenFlags),$(e.flags,f,r,u.values),u.index}function v(n,t,e){const i=n[t],s=i.slice(1,2),o=e.aliases.get(s);if(!o)throw g(`-${s}`);const a=e.definitions[o],r=i.slice(2);if(a.kind==="boolean"){if(r.startsWith("="))throw new l(`Boolean flag -${s} does not take a value`);if(r.length>0)throw g(i);return h(o,a,e.seenFlags),e.flags[o]=!0,t}const f=r.length===0?null:r.startsWith("=")?r.slice(1):r,c=p(n,t,`-${s}`,f,a);return h(o,a,e.seenFlags),$(e.flags,o,a,c.values),c.index}function p(n,t,e,i,s){const o=[];let a=t;if(i!==null){if(i.length===0)throw new l(`Flag ${e} requires a value`);o.push(i)}else{const r=n.at(t+1);if(r===void 0||F(r,s))throw new l(`Flag ${e} requires a value`);o.push(r),a+=1}if(s.multiple)for(;;){const r=n.at(a+1);if(r===void 0||F(r,s))break;o.push(r),a+=1}return{index:a,values:o}}function $(n,t,e,i){if(e.multiple){const o=n[t];if(o!==void 0&&!Array.isArray(o))throw new Error(`Invalid internal default for multiple flag --${t}`);const a=o??[];for(const r of i)a.push(b(t,e,r));n[t]=a;return}const s=i.at(0);if(s===void 0)throw new Error(`Missing parsed value for --${t}`);n[t]=b(t,e,s)}function k(n,t){if(Object.hasOwn(t,n))return{definition:t[n],name:n,negated:!1};if(!n.startsWith("no-"))return null;const e=n.slice(3);return Object.hasOwn(t,e)?{definition:t[e],name:e,negated:!0}:null}function h(n,t,e){if(!t.multiple&&e.has(n))throw new l(`Flag --${n} can only be specified once`);e.add(n)}function F(n,t){return n==="-"||t.kind==="integer"&&/^-\d+$/u.test(n)?!1:n.startsWith("-")}function b(n,t,e){if(t.kind==="integer"){if(!/^-?\d+$/u.test(e))throw new l(`Expected --${n} to be an integer; received ${JSON.stringify(e)}`);const i=Number(e);if(!Number.isSafeInteger(i))throw new l(`Expected --${n} to be a safe integer; received ${JSON.stringify(e)}`);return i}return O(e,t.options,`--${n}`),e}function j(n,t){const e=Object.entries(t);if(n.length>e.length)throw new l(`Unexpected argument ${JSON.stringify(n[e.length])}`);const i={};for(const[s,[o,a]]of e.entries()){const r=n.at(s);if(r===void 0){if(a.required)throw new l(`Missing required argument ${o}`);i[o]=void 0;continue}a.check?.(r),O(r,a.options,o),i[o]=r}return i}function O(n,t,e){if(!(!t||t.includes(n)))throw new l(`Expected ${e} to be one of: ${t.join(", ")}; received ${JSON.stringify(n)}`)}function q(n){const t={};for(const[e,i]of Object.entries(n))t[e]=i.default;return t}function y(n){const t=new Map;for(const[e,i]of Object.entries(n)){if(!i.char)continue;if(!/^[A-Za-z0-9]$/u.test(i.char))throw new Error(`Invalid short flag alias for --${e}: ${i.char}`);const s=t.get(i.char);if(s)throw new Error(`Duplicate short flag alias -${i.char} for --${s} and --${e}`);t.set(i.char,e)}return t}function E(n,t){const e=Object.entries(n).filter(([i,s])=>s.required&&t[i]===void 0).map(([i])=>`--${i}`);if(e.length>0)throw new l(`Missing required flag${e.length===1?"":"s"}: ${e.join(", ")}`)}function g(n){return new l(`Unknown flag: ${n}`)}
@@ -1,2 +1,2 @@
1
- import{runAll as p}from"../../../app/run/orchestrator.js";export async function executeRunRequest(t,{outputMode:u="compact",json:e=!1,debug:s=!1,environments:r,terminal:a={}}={}){const o=a.stdout||process.stdout,n=resolveRunOutputMode(u,e,s),f=n==="json"?()=>{}:n==="events"?(await import("../../renderers/run/events.js")).createRunEventsListener({stdout:o}):(await import("../../renderers/run/text-reporter.js")).createRunTextListener({outputMode:n,stdout:o}),c=await p(t.configs,t.typeValues,t.suiteSelectors,{debug:n==="debug",onEvent:f,...r===void 0?{}:{environments:r},...t.runOptions},t.allConfigs),i=c.runArtifact.archive.runId;return(n==="compact"||n==="debug")&&o.write(`Run ID: ${i}
2
- `),{outputMode:n,runId:i,...c}}export function resolveRunOutputMode(t,u,e){return u?"json":e?"debug":t==="debug"||t==="events"||t==="json"?t:"compact"}
1
+ import{runAll as l}from"../../../app/run/orchestrator.js";export async function executeRunRequest(n,{outputMode:e="compact",json:u=!1,debug:c=!1,environments:o,terminal:a={}}={}){const r=a.stdout||process.stdout,t=resolveRunOutputMode(e,u,c),d=t==="json"?()=>{}:t==="events"?(await import("../../renderers/run/events.js")).createRunEventsListener({stdout:r}):(await import("../../renderers/run/text-reporter.js")).createRunTextListener({outputMode:t,stdout:r});if(n.supplied!==null&&o?.supplied!==void 0)throw new Error("Supplied values came from both the run request and its caller; pass them in one place");const i=n.supplied===null?o:{...o,supplied:n.supplied},p=await l(n.groups,n.typeValues,n.suiteSelectors,{debug:t==="debug",onEvent:d,productDir:n.productDir,...i===void 0?{}:{environments:i},...n.runOptions},n.services),s=p.runArtifact.archive.runId;return(t==="compact"||t==="debug")&&r.write(`Run ID: ${s}
2
+ `),{outputMode:t,runId:s,...p}}export function resolveRunOutputMode(n,e,u){return e?"json":u?"debug":n==="debug"||n==="events"||n==="json"?n:"compact"}
@@ -1 +1 @@
1
- import{describeUnnamedFailure as s}from"../../../app/bugs/known-failures.js";import{formatShare as d}from"../../../app/campaigns/brief.js";const i=12,a=20;export function renderBugRecordResult(e){return[`Recorded ${e.draft.id}`,`Draft: ${e.path}`,...e.redactedFields.length===0?[]:[`Redacted secrets in: ${e.redactedFields.join(", ")}`],...e.replaced?["Replaced the earlier draft for this test."]:[],...e.unreadableDrafts.map(n=>`Testkit cannot read ${n.file}: ${n.problem}`),`Next: commit and push the test, then run \`testkit bug file ${e.draft.id}\`.`]}export function renderAlreadyFiledBug(e){return`Already filed as #${String(e.number)}: ${e.url}`}export function renderBugFileRun(e){return`Running ${e.draft.test.file} at ${e.filing.foundAt.slice(0,i)}. Testkit files the bug when the test fails.`}export function renderBugFileResult(e){return[`Filed #${String(e.issue.number)}: ${e.issue.url}`,...e.covers==="file"?[`Covers: the whole script ${e.draft.test.file}, not one test. While the issue is open, every named failure in that file and its script failure are known.`]:[],e.area===null?"Area: none, because testkit.config.ts has no areas":`Area: ${e.area.id}, ${d(e.area.share)} of source bytes`,e.introducedBy===null?"Introduced by: unknown, because this shallow clone stops before the commit that wrote the faulty lines":`Introduced by: ${e.introducedBy.slice(0,i)}`,`Draft: ${e.path}`]}export function renderKnownFailures(e){const n=e.known.length,r=n-a;return[...e.trackerProblem===null?[]:[`Testkit could not read the open bugs, so every failure counts as new: ${e.trackerProblem}`],e.new.length===0?`Known failures: ${String(n)}. Every failing test has an open bug, so the run passes.`:`New failures: ${String(e.new.length)}. Known failures: ${String(n)}. The run fails on the new failures.`,...e.known.slice(0,a).map(({failure:t,issue:o})=>` #${String(o.issue)} ${t.file}: ${t.title??s(t)}`),...r>0?[` and ${String(r)} more`]:[]]}
1
+ import{formatShare as s}from"../../../app/campaigns/brief.js";const i=12,a=20;export function renderBugRecordResult(e){return[`Recorded ${e.draft.id}`,`Draft: ${e.path}`,...e.redactedFields.length===0?[]:[`Redacted secrets in: ${e.redactedFields.join(", ")}`],...e.replaced?["Replaced the earlier draft for this test."]:[],...e.unreadableDrafts.map(n=>`Testkit cannot read ${n.file}: ${n.problem}`),`Next: commit and push the test, then run \`testkit bug file ${e.draft.id}\`.`]}export function renderAlreadyFiledBug(e){return`Already filed as #${String(e.number)}: ${e.url}`}export function renderBugFileRun(e){return`Running ${e.draft.test.file} at ${e.filing.foundAt.slice(0,i)}. Testkit files the bug when the test fails.`}export function renderBugFileResult(e){return[`Filed #${String(e.issue.number)}: ${e.issue.url}`,e.area===null?"Area: none, because testkit.config.ts has no areas":`Area: ${e.area.id}, ${s(e.area.share)} of source bytes`,e.introducedBy===null?"Introduced by: unknown, because this shallow clone stops before the commit that wrote the faulty lines":`Introduced by: ${e.introducedBy.slice(0,i)}`,`Draft: ${e.path}`]}export function renderKnownFailures(e){const n=e.known.length,t=n-a;return[...e.trackerProblem===null?[]:[`Testkit could not read the open bugs, so every failure counts as new: ${e.trackerProblem}`],e.new.length===0?`Known failures: ${String(n)}. Every failing test has an open bug, so the run passes.`:`New failures: ${String(e.new.length)}. Known failures: ${String(n)}. The run fails on the new failures.`,...e.known.slice(0,a).map(({failure:r,issue:o})=>` #${String(o.issue)} ${r.file}: ${r.title??"failed without naming a test"}`),...t>0?[` and ${String(t)} more`]:[]]}
@@ -1 +1 @@
1
- import{TEST_TYPE_ORDER as P,formatTestTypeLabel as _}from"../../../domain/test-types.js";import{bold as w,colorDiagnosticSeverity as D,colorHeading as m,colorService as I,colorTypeBadge as j,muted as h,statusLabel as M}from"../../terminal/colors.js";const E=P,y="\u251C\u2500\u2500 ",S="\u2514\u2500\u2500 ",R="\u2502 ",b=" ";export function buildDiscoveryReportLines(s,e={}){return(e.outputMode||"compact")==="verbose"?H(s):A(s)}function A(s){const e=[];e.push(`${o(m("Summary"))} ${String(s.summary.files)} files \xB7 ${String(s.summary.activeFiles)} active \xB7 ${String(s.summary.skippedFiles)} skipped \xB7 ${String(s.summary.suites)} suites \xB7 ${String(s.summary.services)} services`),B(e,s.diagnostics);const t=Y(s.suites),n=G(s.files);for(const i of s.services){e.push(""),e.push(`${o(I(i.name))} ${o(h(`(${String(i.fileCount)} files${i.dependsOn.length>0?` \xB7 depends on ${i.dependsOn.join(", ")}`:""})`))}`);const p=t.get(i.name)||new Map,c=J([...p.keys()]);for(let r=0;r<c.length;r+=1){const l=c[r],v=r===c.length-1,F=v?S:y,T=v?b:R,d=p.get(l)||[];e.push(`${F}${o(j(l.toUpperCase()))} ${_(l)}`);for(let a=0;a<d.length;a+=1){const u=d[a],C=a===d.length-1,O=C?S:y,x=C?b:R;e.push(`${T}${O}${o(w(u.groupLabel))} ${o(h(`(${String(u.fileCount)} files \xB7 ${u.engineId} \xB7 ${u.profileId})`))}`);const $=n.get(u.id)||[];for(let f=0;f<$.length;f+=1){const g=$[f],N=f===$.length-1?S:y,k=g.skipped?`${o(M("SKIP"))} ${g.skipReason||""}`:"";e.push(`${T}${x}${N}${g.displayName}${k?` ${k}`:""}`)}}}}return e}function H(s){const e=[];e.push(`${o(m("Summary"))} ${JSON.stringify(s.summary)}`),s.configFile&&e.push(`config ${s.configFile}`),B(e,s.diagnostics);for(const t of s.services){e.push(""),e.push(o(I(t.name))),e.push(` cwd ${t.localCwd}`),t.dependsOn.length>0&&e.push(` dependsOn ${t.dependsOn.join(", ")}`),e.push(` files ${String(t.fileCount)} \xB7 active ${String(t.activeFileCount)} \xB7 skipped ${String(t.skippedFileCount)}`);const n=s.suites.filter(i=>i.service===t.name).sort(L);for(const i of n){e.push(` suite ${i.testType}:${i.name} engine=${i.engineId} profile=${i.profileId} ${o(h(`${String(i.fileCount)} files`))}`),i.locks.length>0&&e.push(` locks ${i.locks.join(", ")}`);for(const p of s.files.filter(c=>c.service===t.name&&c.suiteName===i.name&&c.testType===i.testType&&c.engineId===i.engineId&&c.profileId===i.profileId))e.push(` ${p.displayName}`),e.push(` path ${p.path}`),e.push(` id ${p.id}`),e.push(` status ${p.skipped?"skipped":"active"}`),p.skipReason&&e.push(` skipReason ${p.skipReason}`),p.locks.length>0&&e.push(` locks ${p.locks.join(", ")}`)}}return e}function B(s,e=[]){if(e.length!==0){s.push(""),s.push(o(m("Diagnostics")));for(const t of e){const n=t.path?` ${t.path}`:"";s.push(` ${o(D(t.severity))} ${t.code}${n}`),s.push(` ${t.message}`)}}}function Y(s){const e=new Map;for(const t of s){let n=e.get(t.service);n||(n=new Map,e.set(t.service,n));const i=n.get(t.testType)||[];i.push(t),n.set(t.testType,i.sort(L))}return e}function G(s){const e=new Map;for(const t of s){const n=[t.service,t.testType,t.engineId,t.profileId,t.suiteName].join("|"),i=e.get(n)||[];i.push(t),e.set(n,i.sort(K))}return e}function J(s){return[...s].sort((e,t)=>E.indexOf(e)-E.indexOf(t))}function L(s,e){return s.groupLabel.localeCompare(e.groupLabel)||s.name.localeCompare(e.name)}function K(s,e){return s.displayName.localeCompare(e.displayName)||s.path.localeCompare(e.path)}function o(s){return String(s)}
1
+ import{TEST_TYPE_ORDER as j,formatTestTypeLabel as D}from"../../../domain/test-types.js";import{bold as l,colorDiagnosticSeverity as M,colorService as R,colorTypeBadge as N,statusLabel as w,dim as d}from"../../terminal/colors.js";const B=j,m="\u251C\u2500\u2500 ",y="\u2514\u2500\u2500 ",L="\u2502 ",b=" ";export function buildDiscoveryReportLines(s,e={}){return(e.outputMode||"compact")==="verbose"?O(s):A(s)}function A(s){const e=[];e.push(`${i(l("Summary"))} ${String(s.summary.files)} files \xB7 ${String(s.summary.activeFiles)} active \xB7 ${String(s.summary.skippedFiles)} skipped \xB7 ${String(s.summary.suites)} suites \xB7 ${String(s.summary.groups)} groups`),P(e,s.diagnostics);const t=G(s.suites),n=new Map(s.files.map(o=>[o.path,o]));for(const o of s.groups){e.push(""),e.push(`${i(R(o.name))} ${i(d(`(${String(o.fileCount)} files${o.uses.length>0?` \xB7 uses ${o.uses.join(", ")}`:""})`))}`);const u=t.get(o.name)||new Map,r=H([...u.keys()]);for(let c=0;c<r.length;c+=1){const S=r[c],T=c===r.length-1,F=T?y:m,k=T?b:L,$=u.get(S)||[];e.push(`${F}${V(S)}`);for(let f=0;f<$.length;f+=1){const a=$[f],C=f===$.length-1,I=C?y:m,x=C?b:L;e.push(`${k}${I}${i(l(a.suiteLabel))} ${i(d(`(${String(a.fileCount)} files \xB7 ${a.engineId} \xB7 ${a.profileId})`))}`);const g=a.filePaths.flatMap(p=>n.get(p)??[]).sort(Y);for(let p=0;p<g.length;p+=1){const h=g[p],_=p===g.length-1?y:m,E=h.skipped?`${i(w("SKIP"))} ${h.skipReason||""}`:"";e.push(`${k}${x}${_}${h.displayName}${E?` ${E}`:""}`)}}}}return e}function O(s){const e=[];e.push(`${i(l("Summary"))} ${JSON.stringify(s.summary)}`),s.configFile&&e.push(`config ${s.configFile}`),P(e,s.diagnostics);for(const t of s.groups){e.push(""),e.push(i(R(t.name))),e.push(` roots ${t.roots.join(", ")}`),t.uses.length>0&&e.push(` uses ${t.uses.join(", ")}`),e.push(` files ${String(t.fileCount)} \xB7 active ${String(t.activeFileCount)} \xB7 skipped ${String(t.skippedFileCount)}`);const n=s.suites.filter(o=>o.group===t.name).sort(v);for(const o of n){e.push(` suite ${[o.testType,o.name].filter(Boolean).join(":")} engine=${o.engineId} profile=${o.profileId} ${i(d(`${String(o.fileCount)} files`))}`),o.locks.length>0&&e.push(` locks ${o.locks.join(", ")}`);for(const u of s.files.filter(r=>o.filePaths.includes(r.path)))e.push(` ${u.displayName}`),e.push(` path ${u.path}`),e.push(` id ${u.id}`),e.push(` status ${u.skipped?"skipped":"active"}`),u.skipReason&&e.push(` skipReason ${u.skipReason}`),u.locks.length>0&&e.push(` locks ${u.locks.join(", ")}`)}}return e}function P(s,e=[]){if(e.length!==0){s.push(""),s.push(i(l("Diagnostics")));for(const t of e){const n=t.path?` ${t.path}`:"";s.push(` ${i(M(t.severity))} ${t.code}${n}`),s.push(` ${t.message}`)}}}function G(s){const e=new Map;for(const t of s){let n=e.get(t.group);n||(n=new Map,e.set(t.group,n));const o=n.get(t.testType)||[];o.push(t),n.set(t.testType,o.sort(v))}return e}function H(s){const e=t=>t===void 0?B.length:B.indexOf(t);return[...s].sort((t,n)=>e(t)-e(n))}function V(s){return s===void 0?"Vitest":`${i(N(s.toUpperCase()))} ${D(s)}`}function v(s,e){return s.suiteLabel.localeCompare(e.suiteLabel)||s.name.localeCompare(e.name)}function Y(s,e){return s.displayName.localeCompare(e.displayName)||s.path.localeCompare(e.path)}function i(s){return String(s)}
@@ -1,2 +1,2 @@
1
- export function createRunEventsListener(e={}){const{stdout:a=process.stdout}=e;function s(r,u){const i=JSON.stringify({...u,type:r});if(typeof i!="string")throw new Error(`Unable to serialize run event ${r}`);a.write(`${i}
2
- `)}return r=>{switch(r.type){case"run.service_plans":s(r.type,{services:r.services});return;case"run.total_files":s(r.type,{total:r.total});return;case"run.phase_started":s(r.type,{label:r.label});return;case"run.toolchain_resolved":s(r.type,{service:r.service,runtimeLabel:r.runtimeLabel,summary:r.summary});return;case"run.setup_finished":s(r.type,{service:r.operation.serviceName,stage:r.operation.stage,status:r.operation.status,summary:r.operation.summary||null,durationMs:r.operation.durationMs??null,error:r.operation.error||null});return;case"run.operation_finished":case"run.operation_progress":case"run.operation_started":s(r.type,{operation:r.operation});return;case"run.local_service_starting":s(r.type,{service:r.service,runtimeLabel:r.runtimeLabel,command:r.command});return;case"run.service_skipped":s(r.type,{service:r.service,reason:r.reason});return;case"run.task_planned_skip":s(r.type,{service:r.service,file:r.file,testType:r.testType,engineId:r.engineId,profileId:r.profileId,reason:r.reason});return;case"run.task_started":s(r.type,{service:r.service,file:r.file,suite:r.suite,testType:r.testType,engineId:r.engineId,profileId:r.profileId});return;case"run.task_finished":s(r.type,{service:r.service,file:r.file,suite:r.suite,testType:r.testType,engineId:r.engineId,profileId:r.profileId,outcome:r.outcome});return;case"run.runtime_error":s(r.type,{service:r.service,file:r.file,message:r.message});return;case"run.debug":s(r.type,{line:r.line});return;case"run.summary":s(r.type,{results:r.results,durationMs:r.durationMs,runStatus:r.runStatus});return;case"run.warning":return}}}
1
+ export function createRunEventsListener(a={}){const{stdout:o=process.stdout}=a;function s(r,i){const u=JSON.stringify({...i,type:r});if(typeof u!="string")throw new Error(`Unable to serialize run event ${r}`);o.write(`${u}
2
+ `)}return r=>{switch(r.type){case"run.group_plans":s(r.type,{groups:r.groups});return;case"run.total_files":s(r.type,{total:r.total});return;case"run.phase_started":s(r.type,{label:r.label});return;case"run.toolchain_resolved":s(r.type,{service:r.service,runtimeLabel:r.runtimeLabel,summary:r.summary});return;case"run.setup_finished":s(r.type,{service:r.operation.serviceName,stage:r.operation.stage,status:r.operation.status,summary:r.operation.summary||null,durationMs:r.operation.durationMs??null,error:r.operation.error||null});return;case"run.operation_finished":case"run.operation_progress":case"run.operation_started":s(r.type,{operation:r.operation});return;case"run.local_service_starting":s(r.type,{service:r.service,runtimeLabel:r.runtimeLabel,command:r.command});return;case"run.group_skipped":s(r.type,{group:r.group,reason:r.reason});return;case"run.task_planned_skip":s(r.type,{group:r.group,file:r.file,testType:r.testType,engineId:r.engineId,profileId:r.profileId,reason:r.reason});return;case"run.task_started":s(r.type,{group:r.group,file:r.file,suite:r.suite,testType:r.testType,engineId:r.engineId,profileId:r.profileId});return;case"run.task_finished":s(r.type,{group:r.group,file:r.file,suite:r.suite,testType:r.testType,engineId:r.engineId,profileId:r.profileId,outcome:r.outcome});return;case"run.error":s(r.type,{message:r.message});return;case"run.runtime_error":s(r.type,{group:r.group,file:r.file,message:r.message});return;case"run.debug":s(r.type,{line:r.line});return;case"run.summary":s(r.type,{results:r.results,durationMs:r.durationMs,runStatus:r.runStatus});return;case"run.warning":return}}}