@principles/pd-cli 1.152.12 → 1.152.13

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 (296) hide show
  1. package/package.json +13 -7
  2. package/CHANGELOG.md +0 -23
  3. package/dist/commands/__tests__/intent-flag-wiring.test.d.ts +0 -9
  4. package/dist/commands/__tests__/intent-flag-wiring.test.d.ts.map +0 -1
  5. package/dist/commands/__tests__/intent-flag-wiring.test.js +0 -237
  6. package/dist/commands/__tests__/intent-flag-wiring.test.js.map +0 -1
  7. package/dist/commands/__tests__/legacy-cleanup.test.d.ts +0 -18
  8. package/dist/commands/__tests__/legacy-cleanup.test.d.ts.map +0 -1
  9. package/dist/commands/__tests__/legacy-cleanup.test.js +0 -467
  10. package/dist/commands/__tests__/legacy-cleanup.test.js.map +0 -1
  11. package/dist/commands/__tests__/mvp-smoke.test.d.ts +0 -15
  12. package/dist/commands/__tests__/mvp-smoke.test.d.ts.map +0 -1
  13. package/dist/commands/__tests__/mvp-smoke.test.js +0 -262
  14. package/dist/commands/__tests__/mvp-smoke.test.js.map +0 -1
  15. package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.d.ts +0 -2
  16. package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.d.ts.map +0 -1
  17. package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.js +0 -60
  18. package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.js.map +0 -1
  19. package/dist/commands/__tests__/rulecode-flag-wiring.test.d.ts +0 -21
  20. package/dist/commands/__tests__/rulecode-flag-wiring.test.d.ts.map +0 -1
  21. package/dist/commands/__tests__/rulecode-flag-wiring.test.js +0 -186
  22. package/dist/commands/__tests__/rulecode-flag-wiring.test.js.map +0 -1
  23. package/dist/commands/__tests__/rulecode-handler.test.d.ts +0 -16
  24. package/dist/commands/__tests__/rulecode-handler.test.d.ts.map +0 -1
  25. package/dist/commands/__tests__/rulecode-handler.test.js +0 -285
  26. package/dist/commands/__tests__/rulecode-handler.test.js.map +0 -1
  27. package/dist/commands/__tests__/run-rulehost-flag-wiring.test.d.ts +0 -24
  28. package/dist/commands/__tests__/run-rulehost-flag-wiring.test.d.ts.map +0 -1
  29. package/dist/commands/__tests__/run-rulehost-flag-wiring.test.js +0 -232
  30. package/dist/commands/__tests__/run-rulehost-flag-wiring.test.js.map +0 -1
  31. package/dist/commands/__tests__/runtime-activation-nextaction.test.d.ts +0 -15
  32. package/dist/commands/__tests__/runtime-activation-nextaction.test.d.ts.map +0 -1
  33. package/dist/commands/__tests__/runtime-activation-nextaction.test.js +0 -73
  34. package/dist/commands/__tests__/runtime-activation-nextaction.test.js.map +0 -1
  35. package/dist/commands/__tests__/runtime-probe-config.test.d.ts +0 -20
  36. package/dist/commands/__tests__/runtime-probe-config.test.d.ts.map +0 -1
  37. package/dist/commands/__tests__/runtime-probe-config.test.js +0 -389
  38. package/dist/commands/__tests__/runtime-probe-config.test.js.map +0 -1
  39. package/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts +0 -9
  40. package/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts.map +0 -1
  41. package/dist/commands/__tests__/telemetry-flag-wiring.test.js +0 -76
  42. package/dist/commands/__tests__/telemetry-flag-wiring.test.js.map +0 -1
  43. package/dist/commands/__tests__/version.test.d.ts +0 -2
  44. package/dist/commands/__tests__/version.test.d.ts.map +0 -1
  45. package/dist/commands/__tests__/version.test.js +0 -238
  46. package/dist/commands/__tests__/version.test.js.map +0 -1
  47. package/dist/commands/runtime-uat.guard.test.d.ts +0 -2
  48. package/dist/commands/runtime-uat.guard.test.d.ts.map +0 -1
  49. package/dist/commands/runtime-uat.guard.test.js +0 -153
  50. package/dist/commands/runtime-uat.guard.test.js.map +0 -1
  51. package/dist/services/__tests__/cli-output.test.d.ts +0 -18
  52. package/dist/services/__tests__/cli-output.test.d.ts.map +0 -1
  53. package/dist/services/__tests__/cli-output.test.js +0 -103
  54. package/dist/services/__tests__/cli-output.test.js.map +0 -1
  55. package/dist/services/__tests__/evaluator-runner-deps.test.d.ts +0 -2
  56. package/dist/services/__tests__/evaluator-runner-deps.test.d.ts.map +0 -1
  57. package/dist/services/__tests__/evaluator-runner-deps.test.js +0 -343
  58. package/dist/services/__tests__/evaluator-runner-deps.test.js.map +0 -1
  59. package/dist/services/__tests__/rulehost-readiness.test.d.ts +0 -2
  60. package/dist/services/__tests__/rulehost-readiness.test.d.ts.map +0 -1
  61. package/dist/services/__tests__/rulehost-readiness.test.js +0 -311
  62. package/dist/services/__tests__/rulehost-readiness.test.js.map +0 -1
  63. package/dist/services/__tests__/runtime-adapter-resolver.test.d.ts +0 -18
  64. package/dist/services/__tests__/runtime-adapter-resolver.test.d.ts.map +0 -1
  65. package/dist/services/__tests__/runtime-adapter-resolver.test.js +0 -673
  66. package/dist/services/__tests__/runtime-adapter-resolver.test.js.map +0 -1
  67. package/dist/utils/production-workspace-guard.test.d.ts +0 -2
  68. package/dist/utils/production-workspace-guard.test.d.ts.map +0 -1
  69. package/dist/utils/production-workspace-guard.test.js +0 -137
  70. package/dist/utils/production-workspace-guard.test.js.map +0 -1
  71. package/scripts/llm-dogfood.ts +0 -456
  72. package/scripts/migrate-illegal-expected-decision.ts +0 -252
  73. package/src/commands/__tests__/intent-flag-wiring.test.ts +0 -282
  74. package/src/commands/__tests__/legacy-cleanup.test.ts +0 -602
  75. package/src/commands/__tests__/mvp-smoke.test.ts +0 -300
  76. package/src/commands/__tests__/pain-retry-maxTokens-flag.test.ts +0 -73
  77. package/src/commands/__tests__/rulecode-flag-wiring.test.ts +0 -237
  78. package/src/commands/__tests__/rulecode-handler.test.ts +0 -369
  79. package/src/commands/__tests__/run-rulehost-flag-wiring.test.ts +0 -292
  80. package/src/commands/__tests__/runtime-activation-nextaction.test.ts +0 -81
  81. package/src/commands/__tests__/runtime-probe-config.test.ts +0 -432
  82. package/src/commands/__tests__/telemetry-flag-wiring.test.ts +0 -84
  83. package/src/commands/__tests__/version.test.ts +0 -251
  84. package/src/commands/admission-gate.ts +0 -30
  85. package/src/commands/artifact.ts +0 -82
  86. package/src/commands/build-trajectory-evidence.ts +0 -298
  87. package/src/commands/candidate.ts +0 -1250
  88. package/src/commands/codex-ingest-catchup.ts +0 -114
  89. package/src/commands/codex-ingest-quarantine.ts +0 -127
  90. package/src/commands/codex-reconcile.ts +0 -84
  91. package/src/commands/codex-setup.ts +0 -476
  92. package/src/commands/codex-worker.ts +0 -185
  93. package/src/commands/command-helpers.ts +0 -24
  94. package/src/commands/config-doctor.ts +0 -193
  95. package/src/commands/console.ts +0 -797
  96. package/src/commands/context.ts +0 -72
  97. package/src/commands/demo-story-a.ts +0 -241
  98. package/src/commands/diagnose.ts +0 -756
  99. package/src/commands/errors-list.ts +0 -441
  100. package/src/commands/evolution-tasks-list.ts +0 -48
  101. package/src/commands/evolution-tasks-show.ts +0 -62
  102. package/src/commands/flow.ts +0 -60
  103. package/src/commands/health-codex.ts +0 -576
  104. package/src/commands/health.ts +0 -315
  105. package/src/commands/history.ts +0 -63
  106. package/src/commands/intent.ts +0 -457
  107. package/src/commands/legacy-cleanup.ts +0 -531
  108. package/src/commands/legacy-import.ts +0 -104
  109. package/src/commands/mvp-smoke.ts +0 -160
  110. package/src/commands/pain-evidence.ts +0 -226
  111. package/src/commands/pain-list.ts +0 -239
  112. package/src/commands/pain-record.ts +0 -612
  113. package/src/commands/pain-retry.ts +0 -916
  114. package/src/commands/principles-stats.ts +0 -700
  115. package/src/commands/proven-channel-baseline.ts +0 -115
  116. package/src/commands/quality-scorecard.ts +0 -272
  117. package/src/commands/remediation-output.ts +0 -66
  118. package/src/commands/rulecode.ts +0 -465
  119. package/src/commands/run.ts +0 -89
  120. package/src/commands/runtime-activation.ts +0 -1629
  121. package/src/commands/runtime-artifact-repair.ts +0 -524
  122. package/src/commands/runtime-canary.ts +0 -395
  123. package/src/commands/runtime-compatibility-scan.ts +0 -105
  124. package/src/commands/runtime-diagnostics-export.ts +0 -229
  125. package/src/commands/runtime-features.ts +0 -153
  126. package/src/commands/runtime-gfi-snapshot.ts +0 -135
  127. package/src/commands/runtime-health-snapshot.ts +0 -108
  128. package/src/commands/runtime-init.ts +0 -429
  129. package/src/commands/runtime-internalization-enqueue-successors.ts +0 -530
  130. package/src/commands/runtime-internalization-integrity-repair.ts +0 -79
  131. package/src/commands/runtime-internalization-integrity.ts +0 -107
  132. package/src/commands/runtime-internalization-queue.ts +0 -135
  133. package/src/commands/runtime-internalization-retry.ts +0 -191
  134. package/src/commands/runtime-internalization-run-once.ts +0 -791
  135. package/src/commands/runtime-internalization-run-rulehost.ts +0 -749
  136. package/src/commands/runtime-internalization-wake-once.ts +0 -87
  137. package/src/commands/runtime-pain-flood-simulation.ts +0 -121
  138. package/src/commands/runtime-pruning.ts +0 -438
  139. package/src/commands/runtime-recovery-failed-tasks.ts +0 -258
  140. package/src/commands/runtime-recovery.ts +0 -109
  141. package/src/commands/runtime-synthetic-baseline.ts +0 -70
  142. package/src/commands/runtime-uat.guard.test.ts +0 -175
  143. package/src/commands/runtime-uat.ts +0 -380
  144. package/src/commands/runtime.ts +0 -473
  145. package/src/commands/samples-list.ts +0 -39
  146. package/src/commands/samples-review.ts +0 -36
  147. package/src/commands/task.ts +0 -271
  148. package/src/commands/telemetry.ts +0 -349
  149. package/src/commands/trace.ts +0 -174
  150. package/src/commands/trajectory-db-unavailable.ts +0 -19
  151. package/src/commands/trajectory.ts +0 -64
  152. package/src/commands/version.ts +0 -49
  153. package/src/config-reader.ts +0 -122
  154. package/src/index.ts +0 -1276
  155. package/src/legacy/legacy-import.ts +0 -179
  156. package/src/legacy/session-history-import.ts +0 -203
  157. package/src/resolve-workspace.ts +0 -106
  158. package/src/services/__tests__/cli-output.test.ts +0 -130
  159. package/src/services/__tests__/evaluator-runner-deps.test.ts +0 -382
  160. package/src/services/__tests__/rulehost-readiness.test.ts +0 -363
  161. package/src/services/__tests__/runtime-adapter-resolver.test.ts +0 -793
  162. package/src/services/cli-output.ts +0 -95
  163. package/src/services/config-doctor.ts +0 -697
  164. package/src/services/console-launcher.ts +0 -537
  165. package/src/services/demo-rule-compiler.ts +0 -40
  166. package/src/services/demo-story-a-runner.ts +0 -471
  167. package/src/services/mainline-snapshot-assembler.ts +0 -579
  168. package/src/services/pain-flood-simulation-runner.ts +0 -462
  169. package/src/services/pd-config-loader.ts +0 -433
  170. package/src/services/proven-channel-baseline-runner.ts +0 -157
  171. package/src/services/quality-scorecard/data-extractor.ts +0 -150
  172. package/src/services/quality-scorecard/local-evaluator.ts +0 -142
  173. package/src/services/quality-scorecard/strong-model-gate.ts +0 -202
  174. package/src/services/resolve-runtime-from-pd-config.ts +0 -230
  175. package/src/services/rulehost-pipeline-runner.ts +0 -1214
  176. package/src/services/rulehost-readiness.ts +0 -326
  177. package/src/services/runtime-adapter-resolver.ts +0 -364
  178. package/src/services/synthetic-baseline-runner.ts +0 -400
  179. package/src/services/version-report.ts +0 -253
  180. package/src/services/workspace-tool-semantics.ts +0 -26
  181. package/src/utils/path-security.ts +0 -96
  182. package/src/utils/production-workspace-guard.test.ts +0 -157
  183. package/src/utils/production-workspace-guard.ts +0 -210
  184. package/tests/bdd/cli-contract.steps.ts +0 -346
  185. package/tests/bdd/principles-stats.steps.ts +0 -211
  186. package/tests/bdd/support/gherkin-loader.ts +0 -147
  187. package/tests/bdd/support/repo-root.ts +0 -62
  188. package/tests/bdd/support/vitest-bdd.ts +0 -179
  189. package/tests/commands/admission-gate-coverage.test.ts +0 -79
  190. package/tests/commands/build-trajectory-evidence.test.ts +0 -508
  191. package/tests/commands/candidate-audit-repair.test.ts +0 -421
  192. package/tests/commands/candidate-intake.test.ts +0 -732
  193. package/tests/commands/candidate-internalization-backfill.test.ts +0 -548
  194. package/tests/commands/candidate-internalize-lineage.test.ts +0 -628
  195. package/tests/commands/candidate-internalize.test.ts +0 -299
  196. package/tests/commands/candidate-route.test.ts +0 -329
  197. package/tests/commands/candidate-show.test.ts +0 -95
  198. package/tests/commands/cli-command-tree.test.ts +0 -144
  199. package/tests/commands/cli-help-snapshot.test.ts +0 -155
  200. package/tests/commands/cli-skill-contract.test.ts +0 -121
  201. package/tests/commands/codex-consent-reversibility.steps.test.ts +0 -299
  202. package/tests/commands/codex-ingest-quarantine.test.ts +0 -136
  203. package/tests/commands/codex-setup.test.ts +0 -297
  204. package/tests/commands/codex-worker-daemon.test.ts +0 -95
  205. package/tests/commands/codex-worker-registration.test.ts +0 -207
  206. package/tests/commands/config-doctor.test.ts +0 -336
  207. package/tests/commands/console-launcher-edge-cases.test.ts +0 -388
  208. package/tests/commands/console-open.test.ts +0 -1381
  209. package/tests/commands/context.test.ts +0 -114
  210. package/tests/commands/demo-story-a.test.ts +0 -318
  211. package/tests/commands/diagnose.test.ts +0 -1803
  212. package/tests/commands/errors-list.test.ts +0 -679
  213. package/tests/commands/evolution-tasks-list.test.ts +0 -41
  214. package/tests/commands/evolution-tasks-show.test.ts +0 -46
  215. package/tests/commands/health-codex.test.ts +0 -349
  216. package/tests/commands/health-host-wiring.test.ts +0 -76
  217. package/tests/commands/health-reliability.test.ts +0 -99
  218. package/tests/commands/health.test.ts +0 -413
  219. package/tests/commands/intent.test.ts +0 -321
  220. package/tests/commands/legacy-cleanup.test.ts +0 -148
  221. package/tests/commands/pain-evidence.test.ts +0 -518
  222. package/tests/commands/pain-list.test.ts +0 -219
  223. package/tests/commands/pain-record-async.test.ts +0 -335
  224. package/tests/commands/pain-record-session-parser.test.ts +0 -228
  225. package/tests/commands/pain-record.test.ts +0 -851
  226. package/tests/commands/pain-retry.test.ts +0 -1121
  227. package/tests/commands/plugin-config-resolution-cutover.test.ts +0 -229
  228. package/tests/commands/pri-393-runtime-config-unification.test.ts +0 -443
  229. package/tests/commands/principles-stats-wiring.test.ts +0 -135
  230. package/tests/commands/principles-stats.test.ts +0 -274
  231. package/tests/commands/product-path-regression.test.ts +0 -86
  232. package/tests/commands/proven-channel-baseline.test.ts +0 -441
  233. package/tests/commands/rulecode.test.ts +0 -177
  234. package/tests/commands/run-rulehost-handler.test.ts +0 -908
  235. package/tests/commands/runtime-activation-approve-flag-wiring.test.ts +0 -227
  236. package/tests/commands/runtime-activation-deactivate-flag-wiring.test.ts +0 -167
  237. package/tests/commands/runtime-activation-dispatch-flag-wiring.test.ts +0 -262
  238. package/tests/commands/runtime-activation-governance-audit.test.ts +0 -95
  239. package/tests/commands/runtime-activation-list-flag-wiring.test.ts +0 -193
  240. package/tests/commands/runtime-activation-promote-flag-wiring.test.ts +0 -248
  241. package/tests/commands/runtime-activation-shadow-telemetry.test.ts +0 -130
  242. package/tests/commands/runtime-activation.test.ts +0 -2052
  243. package/tests/commands/runtime-artifact-repair-registration.test.ts +0 -74
  244. package/tests/commands/runtime-artifact-repair.test.ts +0 -404
  245. package/tests/commands/runtime-canary.test.ts +0 -430
  246. package/tests/commands/runtime-compatibility-scan.test.ts +0 -146
  247. package/tests/commands/runtime-diagnostics-export.test.ts +0 -175
  248. package/tests/commands/runtime-features.test.ts +0 -249
  249. package/tests/commands/runtime-health-snapshot.test.ts +0 -358
  250. package/tests/commands/runtime-init-empty-workspace.test.ts +0 -252
  251. package/tests/commands/runtime-init.test.ts +0 -420
  252. package/tests/commands/runtime-internalization-enqueue-successors.test.ts +0 -782
  253. package/tests/commands/runtime-internalization-integrity-repair.test.ts +0 -239
  254. package/tests/commands/runtime-internalization-integrity.test.ts +0 -140
  255. package/tests/commands/runtime-internalization-queue.test.ts +0 -380
  256. package/tests/commands/runtime-internalization-retry-owner-authority.test.ts +0 -431
  257. package/tests/commands/runtime-internalization-run-once-evaluator-parity.test.ts +0 -269
  258. package/tests/commands/runtime-internalization-run-once-language.test.ts +0 -303
  259. package/tests/commands/runtime-internalization-run-once-real-config.test.ts +0 -237
  260. package/tests/commands/runtime-internalization-run-once-rollout-parity.test.ts +0 -706
  261. package/tests/commands/runtime-internalization-run-once.test.ts +0 -1791
  262. package/tests/commands/runtime-internalization-wake-once.test.ts +0 -171
  263. package/tests/commands/runtime-internalization.test.ts +0 -53
  264. package/tests/commands/runtime-pain-flood-simulation.test.ts +0 -418
  265. package/tests/commands/runtime-pruning.test.ts +0 -694
  266. package/tests/commands/runtime-recovery-failed-tasks.test.ts +0 -328
  267. package/tests/commands/runtime-recovery.test.ts +0 -120
  268. package/tests/commands/runtime-synthetic-baseline.test.ts +0 -249
  269. package/tests/commands/runtime-uat.test.ts +0 -397
  270. package/tests/commands/runtime.test.ts +0 -392
  271. package/tests/commands/samples-list.test.ts +0 -43
  272. package/tests/commands/samples-review.test.ts +0 -41
  273. package/tests/commands/task.test.ts +0 -153
  274. package/tests/commands/telemetry.test.ts +0 -190
  275. package/tests/commands/trace.test.ts +0 -316
  276. package/tests/config-reader.test.ts +0 -143
  277. package/tests/e2e/candidate-intake-e2e.test.ts +0 -338
  278. package/tests/e2e/cli-full-flow.test.ts +0 -233
  279. package/tests/e2e/cross-package-acceptance.test.ts +0 -635
  280. package/tests/helpers/pd-cli-path.ts +0 -5
  281. package/tests/pd-cli-smoke.test.ts +0 -13
  282. package/tests/resolve-workspace.test.ts +0 -196
  283. package/tests/services/config-doctor-signal-health.test.ts +0 -109
  284. package/tests/services/console-launcher.test.ts +0 -114
  285. package/tests/services/demo-rule-compiler.test.ts +0 -242
  286. package/tests/services/mainline-snapshot-assembler.test.ts +0 -572
  287. package/tests/services/pd-config-loader.test.ts +0 -505
  288. package/tests/services/proven-channel-baseline-runner.test.ts +0 -30
  289. package/tests/services/quality-scorecard/strong-model-gate.test.ts +0 -133
  290. package/tests/services/resolve-runtime-from-pd-config.test.ts +0 -485
  291. package/tests/services/rulehost-pipeline-e2e.test.ts +0 -538
  292. package/tests/services/rulehost-pipeline-runner.test.ts +0 -1242
  293. package/tests/services/workspace-tool-semantics.test.ts +0 -76
  294. package/tests/utils/path-security.test.ts +0 -180
  295. package/tsconfig.json +0 -26
  296. package/vitest.config.ts +0 -10
@@ -1,249 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
-
3
- const { mockRunSyntheticBaseline } = vi.hoisted(() => ({
4
- mockRunSyntheticBaseline: vi.fn(),
5
- }));
6
-
7
- vi.mock('../../src/services/synthetic-baseline-runner.js', () => ({
8
- runSyntheticBaseline: mockRunSyntheticBaseline,
9
- }));
10
-
11
- import * as fs from 'fs';
12
- import * as path from 'path';
13
- import * as os from 'os';
14
- import { handleRuntimeSyntheticBaseline } from '../../src/commands/runtime-synthetic-baseline.js';
15
-
16
- function makePassedSummary() {
17
- return {
18
- status: 'passed' as const,
19
- workspaceMode: 'temp' as const,
20
- generatedAt: new Date().toISOString(),
21
- stages: [
22
- { name: 'pain_intake' as const, status: 'passed' as const },
23
- { name: 'diagnostician_task_created' as const, status: 'passed' as const },
24
- { name: 'candidate_created' as const, status: 'passed' as const },
25
- { name: 'ledger_consistent' as const, status: 'passed' as const },
26
- { name: 'internalization_queue_ready' as const, status: 'passed' as const },
27
- { name: 'canary_health' as const, status: 'passed' as const },
28
- ],
29
- };
30
- }
31
-
32
- describe('handleRuntimeSyntheticBaseline (CLI handler)', () => {
33
- let tempDir = '';
34
- const originalExitCode = process.exitCode;
35
-
36
- beforeEach(() => {
37
- tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'pd-cli-synth-test-'));
38
- mockRunSyntheticBaseline.mockReset();
39
- process.exitCode = undefined as unknown as number;
40
- });
41
-
42
- afterEach(() => {
43
- try {
44
- fs.rmSync(tempDir, { recursive: true, force: true });
45
- } catch {
46
- // ignore
47
- }
48
- process.exitCode = originalExitCode;
49
- });
50
-
51
- it('uses temp workspace when no workspace specified', async () => {
52
- mockRunSyntheticBaseline.mockResolvedValue({
53
- ...makePassedSummary(),
54
- workspaceMode: 'temp',
55
- });
56
-
57
- await handleRuntimeSyntheticBaseline({});
58
-
59
- expect(mockRunSyntheticBaseline).toHaveBeenCalledWith(
60
- expect.objectContaining({ workspaceMode: 'temp' }),
61
- );
62
- const calledDir = mockRunSyntheticBaseline.mock.calls[0][0].workspaceDir;
63
- expect(calledDir).toContain('pd-synth-baseline-');
64
- });
65
-
66
- it('uses explicit workspace when --workspace is provided', async () => {
67
- mockRunSyntheticBaseline.mockResolvedValue({
68
- ...makePassedSummary(),
69
- workspaceMode: 'explicit_workspace',
70
- });
71
-
72
- await handleRuntimeSyntheticBaseline({ workspace: tempDir });
73
-
74
- expect(mockRunSyntheticBaseline).toHaveBeenCalledWith(
75
- expect.objectContaining({
76
- workspaceDir: tempDir,
77
- workspaceMode: 'explicit_workspace',
78
- }),
79
- );
80
- });
81
-
82
- it('--json output contains status, workspaceMode, generatedAt, stages', async () => {
83
- const summary = makePassedSummary();
84
- mockRunSyntheticBaseline.mockResolvedValue(summary);
85
-
86
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
87
-
88
- try {
89
- await handleRuntimeSyntheticBaseline({ json: true });
90
-
91
- expect(logSpy).toHaveBeenCalledTimes(1);
92
- const output = logSpy.mock.calls[0][0];
93
- const parsed = JSON.parse(output);
94
- expect(parsed).toHaveProperty('status');
95
- expect(parsed).toHaveProperty('workspaceMode');
96
- expect(parsed).toHaveProperty('generatedAt');
97
- expect(parsed).toHaveProperty('stages');
98
- } finally {
99
- logSpy.mockRestore();
100
- }
101
- });
102
-
103
- it('sets process.exitCode = 1 when status is failed', async () => {
104
- mockRunSyntheticBaseline.mockResolvedValue({
105
- ...makePassedSummary(),
106
- status: 'failed',
107
- stages: [
108
- { name: 'pain_intake', status: 'failed', reason: 'test failure' },
109
- { name: 'diagnostician_task_created', status: 'failed', reason: 'prerequisite' },
110
- { name: 'candidate_created', status: 'failed', reason: 'prerequisite' },
111
- { name: 'ledger_consistent', status: 'failed', reason: 'prerequisite' },
112
- { name: 'internalization_queue_ready', status: 'failed', reason: 'prerequisite' },
113
- { name: 'canary_health', status: 'failed', reason: 'prerequisite' },
114
- ],
115
- });
116
-
117
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
118
- const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
119
-
120
- try {
121
- await handleRuntimeSyntheticBaseline({ workspace: tempDir });
122
- expect(process.exitCode).toBe(1);
123
- } finally {
124
- logSpy.mockRestore();
125
- errorSpy.mockRestore();
126
- }
127
- });
128
-
129
- it('sets process.exitCode = 1 when status is degraded', async () => {
130
- mockRunSyntheticBaseline.mockResolvedValue({
131
- ...makePassedSummary(),
132
- status: 'degraded',
133
- });
134
-
135
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
136
- const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
137
-
138
- try {
139
- await handleRuntimeSyntheticBaseline({ workspace: tempDir });
140
- expect(process.exitCode).toBe(1);
141
- } finally {
142
- logSpy.mockRestore();
143
- errorSpy.mockRestore();
144
- }
145
- });
146
-
147
- it('cleans up temp workspace on success', async () => {
148
- mockRunSyntheticBaseline.mockResolvedValue(makePassedSummary());
149
-
150
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
151
-
152
- try {
153
- await handleRuntimeSyntheticBaseline({});
154
-
155
- const calledDir = mockRunSyntheticBaseline.mock.calls[0][0].workspaceDir;
156
- expect(fs.existsSync(calledDir)).toBe(false);
157
- } finally {
158
- logSpy.mockRestore();
159
- }
160
- });
161
-
162
- it('does not delete explicit workspace after run', async () => {
163
- fs.mkdirSync(path.join(tempDir, '.pd'), { recursive: true });
164
- fs.mkdirSync(path.join(tempDir, '.state'), { recursive: true });
165
-
166
- mockRunSyntheticBaseline.mockResolvedValue({
167
- ...makePassedSummary(),
168
- workspaceMode: 'explicit_workspace',
169
- });
170
-
171
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
172
-
173
- try {
174
- await handleRuntimeSyntheticBaseline({ workspace: tempDir });
175
- expect(fs.existsSync(tempDir)).toBe(true);
176
- } finally {
177
- logSpy.mockRestore();
178
- }
179
- });
180
-
181
- it('injected failure produces structured reason and recommendedNextIssue', async () => {
182
- mockRunSyntheticBaseline.mockResolvedValue({
183
- status: 'failed',
184
- workspaceMode: 'temp',
185
- generatedAt: new Date().toISOString(),
186
- stages: [
187
- { name: 'pain_intake', status: 'failed', reason: 'Injected failure: pain intake stage forced to fail' },
188
- { name: 'diagnostician_task_created', status: 'failed', reason: 'Prerequisite stage pain_intake failed' },
189
- ],
190
- recommendedNextIssue: 'PRI-207: Pain intake pipeline broken — check PainSignalBridge and DiagnosticianRunner',
191
- });
192
-
193
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
194
- const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
195
-
196
- try {
197
- await handleRuntimeSyntheticBaseline({ json: true });
198
- const output = logSpy.mock.calls[0][0];
199
- const parsed = JSON.parse(output);
200
- expect(parsed.status).toBe('failed');
201
- expect(parsed.recommendedNextIssue).toContain('PRI-207');
202
- expect(process.exitCode).toBe(1);
203
- } finally {
204
- logSpy.mockRestore();
205
- errorSpy.mockRestore();
206
- }
207
- });
208
-
209
- it('no RuleHost/autoCorrect evidence, case-insensitive', async () => {
210
- mockRunSyntheticBaseline.mockResolvedValue({
211
- ...makePassedSummary(),
212
- stages: [
213
- { name: 'pain_intake', status: 'passed', evidence: { painId: 'test', bridgeStatus: 'succeeded' } },
214
- { name: 'diagnostician_task_created', status: 'passed', evidence: { taskId: 't1', taskStatus: 'succeeded' } },
215
- { name: 'candidate_created', status: 'passed', evidence: { candidateCount: 1 } },
216
- { name: 'ledger_consistent', status: 'passed', evidence: { auditStatus: 'ok' } },
217
- { name: 'internalization_queue_ready', status: 'passed', evidence: { readyCount: 1 } },
218
- { name: 'canary_health', status: 'passed', evidence: { overallStatus: 'healthy' } },
219
- ],
220
- });
221
-
222
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
223
-
224
- try {
225
- await handleRuntimeSyntheticBaseline({ json: true });
226
- const output = logSpy.mock.calls[0][0];
227
- const parsed = JSON.parse(output);
228
- const evidenceStr = JSON.stringify(parsed.stages).toLowerCase();
229
- expect(evidenceStr).not.toContain('rulehost');
230
- expect(evidenceStr).not.toContain('autocorrect');
231
- } finally {
232
- logSpy.mockRestore();
233
- }
234
- });
235
-
236
- it('runner rejection propagates and temp workspace is still cleaned up', async () => {
237
- mockRunSyntheticBaseline.mockRejectedValue(new Error('EACCES: permission denied, mkdir'));
238
-
239
- const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
240
-
241
- try {
242
- await expect(handleRuntimeSyntheticBaseline({})).rejects.toThrow('EACCES');
243
- const calledDir = mockRunSyntheticBaseline.mock.calls[0][0].workspaceDir;
244
- expect(fs.existsSync(calledDir)).toBe(false);
245
- } finally {
246
- logSpy.mockRestore();
247
- }
248
- });
249
- });
@@ -1,397 +0,0 @@
1
- /**
2
- * pd runtime uat CLI unit tests.
3
- * Tests parseUatArgs, computeUatSummary, shouldExitWithError, runUatIteration.
4
- * Integration tests with real pd calls are done manually via
5
- * node scripts/uat/runtime-v2-chain-uat.mjs --workspace <path> --count 2 --json
6
- */
7
- import { describe, it, expect, vi, beforeEach } from 'vitest';
8
- import * as fs from 'fs';
9
- import * as path from 'path';
10
-
11
- // ── Mock child_process before importing the module under test ────────────────
12
-
13
- const { mockExecFileSync, mockExistsSync } = vi.hoisted(() => ({
14
- mockExecFileSync: vi.fn(),
15
- mockExistsSync: vi.fn(),
16
- }));
17
-
18
- vi.mock('child_process', () => ({
19
- execFileSync: mockExecFileSync,
20
- }));
21
-
22
- vi.mock('fs', () => ({
23
- existsSync: mockExistsSync,
24
- readFileSync: vi.fn(),
25
- }));
26
-
27
- vi.mock(process.execPath, '/mock/node', { spy: false });
28
-
29
- // ── Import after mock setup ─────────────────────────────────────────────────
30
-
31
- import {
32
- parseUatArgs,
33
- computeUatSummary,
34
- shouldExitWithError,
35
- type PainRecordResult,
36
- } from '../../src/commands/runtime-uat.js';
37
-
38
- // ── parseUatArgs ─────────────────────────────────────────────────────────────
39
-
40
- describe('parseUatArgs', () => {
41
- it('defaults count to 5 when not provided', () => {
42
- const result = parseUatArgs([]);
43
- expect(result.count).toBe(5);
44
- });
45
-
46
- it('parses --count', () => {
47
- const result = parseUatArgs(['--count', '10']);
48
- expect(result.count).toBe(10);
49
- });
50
-
51
- it('parses --workspace', () => {
52
- const result = parseUatArgs(['--workspace', '/tmp/ws']);
53
- expect(result.workspace).toBe('/tmp/ws');
54
- });
55
-
56
- it('parses --min-success-rate', () => {
57
- const result = parseUatArgs(['--min-success-rate', '0.8']);
58
- expect(result.minSuccessRate).toBe(0.8);
59
- });
60
-
61
- it('parses -w as alias for --workspace', () => {
62
- const result = parseUatArgs(['-w', '/custom/path']);
63
- expect(result.workspace).toBe('/custom/path');
64
- });
65
-
66
- it('clamps count to [1, 50]', () => {
67
- expect(parseUatArgs(['--count', '1']).count).toBe(1);
68
- expect(parseUatArgs(['--count', '50']).count).toBe(50);
69
- });
70
- });
71
-
72
- // ── computeUatSummary ────────────────────────────────────────────────────────
73
-
74
- describe('computeUatSummary', () => {
75
- const ws = '/tmp/test-workspace';
76
-
77
- it('computes successRate correctly', () => {
78
- const results: PainRecordResult[] = [
79
- makeResult(1, 'succeeded', ['c1'], ['l1']),
80
- makeResult(2, 'succeeded', ['c2'], ['l2']),
81
- makeResult(3, 'failed', ['c3'], ['l3']),
82
- ];
83
- const summary = computeUatSummary(results, ws);
84
- expect(summary.successRate).toBeCloseTo(0.67, 2);
85
- expect(summary.successful).toBe(2);
86
- expect(summary.failed).toBe(1);
87
- });
88
-
89
- it('computes failuresByCategory from failureCategory field', () => {
90
- const results: PainRecordResult[] = [
91
- { ...makeResult(1, 'failed', [], []), failureCategory: 'runtime_unavailable' },
92
- { ...makeResult(2, 'failed', [], []), failureCategory: 'runtime_unavailable' },
93
- { ...makeResult(3, 'failed', [], []), failureCategory: 'output_invalid' },
94
- ];
95
- const summary = computeUatSummary(results, ws);
96
- expect(summary.failuresByCategory).toEqual({
97
- runtime_unavailable: 2,
98
- output_invalid: 1,
99
- });
100
- });
101
-
102
- it('ledgerConsistencyOk true when all audits are ok', () => {
103
- const results: PainRecordResult[] = [
104
- makeResult(1, 'succeeded', ['c1'], ['l1'], 100, 'ok'),
105
- makeResult(2, 'succeeded', ['c2'], ['l2'], 100, 'ok'),
106
- ];
107
- const summary = computeUatSummary(results, ws);
108
- expect(summary.ledgerConsistencyOk).toBe(true);
109
- });
110
-
111
- it('ledgerConsistencyOk false when any audit fails', () => {
112
- const results: PainRecordResult[] = [
113
- makeResult(1, 'succeeded', ['c1'], ['l1'], 100, 'ok'),
114
- makeResult(2, 'succeeded', ['c2'], ['l2'], 100, 'error'),
115
- ];
116
- const summary = computeUatSummary(results, ws);
117
- expect(summary.ledgerConsistencyOk).toBe(false);
118
- });
119
-
120
- it('allHaveCandidates false when any candidateIds empty', () => {
121
- const results: PainRecordResult[] = [
122
- makeResult(1, 'succeeded', ['c1'], ['l1']),
123
- makeResult(2, 'succeeded', [], ['l2']),
124
- ];
125
- const summary = computeUatSummary(results, ws);
126
- expect(summary.allHaveCandidates).toBe(false);
127
- });
128
-
129
- it('allHaveLedger false when any ledgerEntryIds empty', () => {
130
- const results: PainRecordResult[] = [
131
- makeResult(1, 'succeeded', ['c1'], ['l1']),
132
- makeResult(2, 'succeeded', ['c2'], []),
133
- ];
134
- const summary = computeUatSummary(results, ws);
135
- expect(summary.allHaveLedger).toBe(false);
136
- });
137
-
138
- it('p50LatencyMs and p95LatencyMs computed from wallTimeMs', () => {
139
- const results: PainRecordResult[] = [
140
- makeResult(1, 'succeeded', ['c1'], ['l1'], 100),
141
- makeResult(2, 'succeeded', ['c2'], ['l2'], 200),
142
- makeResult(3, 'succeeded', ['c3'], ['l3'], 300),
143
- makeResult(4, 'succeeded', ['c4'], ['l4'], 400),
144
- ];
145
- const summary = computeUatSummary(results, ws);
146
- expect(summary.p50LatencyMs).toBeDefined();
147
- expect(summary.p95LatencyMs).toBeDefined();
148
- expect(summary.p50LatencyMs).toBeLessThanOrEqual(summary.p95LatencyMs!);
149
- });
150
-
151
- it('includes perRun in summary', () => {
152
- const results: PainRecordResult[] = [makeResult(1, 'succeeded', ['c1'], ['l1'])];
153
- const summary = computeUatSummary(results, ws);
154
- expect(summary.perRun).toHaveLength(1);
155
- expect(summary.perRun[0].iteration).toBe(1);
156
- });
157
-
158
- it('generatedAt is ISO string', () => {
159
- const summary = computeUatSummary([], ws);
160
- expect(summary.generatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/);
161
- });
162
- });
163
-
164
- // ── shouldExitWithError ─────────────────────────────────────────────────────
165
-
166
- describe('shouldExitWithError', () => {
167
- const ws = '/tmp/test-workspace';
168
-
169
- it('returns false when all checks pass and minSuccessRate=1.0', () => {
170
- const summary = makeSummary(ws, 5, 5, true, true, true);
171
- expect(shouldExitWithError(summary, 1.0)).toBe(false);
172
- });
173
-
174
- it('returns true when successRate below threshold', () => {
175
- const summary = makeSummary(ws, 5, 3, true, true, true);
176
- expect(shouldExitWithError(summary, 1.0)).toBe(true);
177
- expect(shouldExitWithError(summary, 0.5)).toBe(false);
178
- });
179
-
180
- it('returns true when ledgerConsistencyOk is false', () => {
181
- const summary = makeSummary(ws, 5, 5, false, true, true);
182
- expect(shouldExitWithError(summary, 1.0)).toBe(true);
183
- });
184
-
185
- it('returns true when allHaveCandidates is false', () => {
186
- const summary = makeSummary(ws, 5, 5, true, false, true);
187
- expect(shouldExitWithError(summary, 1.0)).toBe(true);
188
- });
189
-
190
- it('returns true when allHaveLedger is false', () => {
191
- const summary = makeSummary(ws, 5, 5, true, true, false);
192
- expect(shouldExitWithError(summary, 1.0)).toBe(true);
193
- });
194
-
195
- it('default minSuccessRate is 1.0', () => {
196
- const summary = makeSummary(ws, 5, 5, true, true, true);
197
- expect(shouldExitWithError(summary)).toBe(false);
198
- expect(shouldExitWithError(summary, 1.0)).toBe(false);
199
- });
200
- });
201
-
202
- // ── pd CLI invocation (Windows compatibility) ───────────────────────────────
203
-
204
- describe('pd CLI invocation (Windows compatibility)', () => {
205
- beforeEach(() => {
206
- vi.clearAllMocks();
207
- mockExecFileSync.mockReset();
208
- mockExistsSync.mockReset();
209
- mockExistsSync.mockReturnValue(true);
210
- mockExecFileSync.mockReturnValue(JSON.stringify({
211
- status: 'succeeded',
212
- painId: 'pain-test-1',
213
- taskId: 'task-001',
214
- runId: 'run-001',
215
- artifactId: 'art-001',
216
- candidateIds: ['c1'],
217
- ledgerEntryIds: ['l1'],
218
- latencyMs: 100,
219
- }));
220
- });
221
-
222
- it('uses process.execPath (not npx) to invoke pd CLI', async () => {
223
- vi.resetModules();
224
- mockExistsSync.mockImplementation((p: string) => String(p).endsWith('index.js'));
225
-
226
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
227
- runUatIteration({ iteration: 1, reason: 'test', workspace: '/test/ws' });
228
-
229
- // First call to execFileSync should use process.execPath, not 'npx'
230
- const firstCall = mockExecFileSync.mock.calls[0] as [string, string[]];
231
- expect(firstCall[0]).toBe(process.execPath);
232
- expect(firstCall[0]).not.toBe('npx');
233
- });
234
-
235
- it('passes --workspace after subcommand args', async () => {
236
- vi.resetModules();
237
- mockExistsSync.mockImplementation((p: string) => String(p).endsWith('index.js'));
238
-
239
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
240
- runUatIteration({ iteration: 1, reason: 'test', workspace: '/test/ws' });
241
-
242
- const firstCall = mockExecFileSync.mock.calls[0] as [string, string[]];
243
- const args = firstCall[1];
244
- // Format: [cliPath, 'pain', 'record', ..., '--workspace', '/test/ws']
245
- const wsIdx = args.indexOf('--workspace');
246
- const painIdx = args.indexOf('pain');
247
- expect(wsIdx).toBeGreaterThan(painIdx);
248
- expect(args[wsIdx + 1]).toBe('/test/ws');
249
- });
250
-
251
- it('captures stdout on error with non-zero exit', async () => {
252
- vi.resetModules();
253
- // Allow findPdCliPath to succeed (mock existsSync to return true)
254
- mockExistsSync.mockReturnValue(true);
255
- const error = new Error('pd CLI spawn error') as Error & { stdout?: string; stderr?: string; code?: string };
256
- error.stdout = '{"status":"failed","error":"command failed"}';
257
- error.code = 'ENOENT';
258
- mockExecFileSync.mockImplementation(() => { throw error; });
259
-
260
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
261
- const result = runUatIteration({ iteration: 1, reason: 'test', workspace: '/test/ws' });
262
-
263
- // ENOENT from spawn means "process not found" - findPdCliPath error is thrown
264
- // This is the correct behavior: if execFileSync can't spawn the process, findPdCliPath
265
- // threw first (meaning the CLI wasn't found at the expected path)
266
- expect(result.status).toBe('script_error');
267
- expect(result.error).toContain('not found');
268
- });
269
-
270
- it('throws when pd CLI binary not found', async () => {
271
- vi.resetModules();
272
- mockExistsSync.mockReturnValue(false);
273
-
274
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
275
- const result = runUatIteration({ iteration: 1, reason: 'test', workspace: '/test/ws' });
276
-
277
- expect(result.status).toBe('script_error');
278
- expect(result.error).toContain('not found');
279
- });
280
-
281
- it('passes CLI path as first argument to process.execPath', async () => {
282
- vi.resetModules();
283
- mockExistsSync.mockImplementation((p: string) => String(p).endsWith('index.js'));
284
-
285
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
286
- runUatIteration({ iteration: 1, reason: 'test', workspace: '/test/ws' });
287
-
288
- const firstCall = mockExecFileSync.mock.calls[0] as [string, string[]];
289
- const args = firstCall[1];
290
- expect(args[0]).toMatch(/index\.js$/);
291
- expect(firstCall[0]).toBe(process.execPath);
292
- });
293
-
294
- it('appends --workspace and workspace path to end of subcommand args', async () => {
295
- vi.resetModules();
296
- mockExistsSync.mockImplementation((p: string) => String(p).endsWith('index.js'));
297
-
298
- const { runUatIteration } = await import('../../src/commands/runtime-uat.js');
299
- runUatIteration({ iteration: 1, reason: 'test', workspace: '/custom/path' });
300
-
301
- const firstCall = mockExecFileSync.mock.calls[0] as [string, string[]];
302
- const args = firstCall[1];
303
- const wsIdx = args.lastIndexOf('--workspace');
304
- expect(wsIdx).toBe(args.length - 2);
305
- expect(args[wsIdx + 1]).toBe('/custom/path');
306
- });
307
- });
308
-
309
- // ── handleRuntimeUat guard rails ─────────────────────────────────────────────
310
-
311
- describe('handleRuntimeUat', () => {
312
- beforeEach(() => {
313
- vi.clearAllMocks();
314
- mockExecFileSync.mockReset();
315
- mockExistsSync.mockReturnValue(true);
316
- });
317
-
318
- it('exits 1 when --workspace is missing', async () => {
319
- const { handleRuntimeUat } = await import('../../src/commands/runtime-uat.js');
320
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(((code: number) => {
321
- throw new Error(`exit:${code}`);
322
- }) as (code: number) => never);
323
- const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
324
-
325
- await expect(handleRuntimeUat({})).rejects.toThrow('exit:1');
326
- expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('--workspace'));
327
-
328
- exitSpy.mockRestore();
329
- errorSpy.mockRestore();
330
- });
331
-
332
- it('exits 1 when MINIMAX_CN_API_KEY is not set', async () => {
333
- delete process.env.MINIMAX_CN_API_KEY;
334
- const { handleRuntimeUat } = await import('../../src/commands/runtime-uat.js');
335
- const exitSpy = vi.spyOn(process, 'exit').mockImplementation(((code: number) => {
336
- throw new Error(`exit:${code}`);
337
- }) as (code: number) => never);
338
- vi.spyOn(console, 'error').mockImplementation(() => {});
339
-
340
- await expect(handleRuntimeUat({ workspace: '/tmp/test-ws' })).rejects.toThrow('exit:1');
341
- exitSpy.mockRestore();
342
- });
343
- });
344
-
345
- // ── Helpers ──────────────────────────────────────────────────────────────────
346
-
347
- function makeResult(
348
- iteration: number,
349
- status: string,
350
- candidateIds: string[],
351
- ledgerEntryIds: string[],
352
- wallTimeMs = 1000,
353
- auditStatus = 'ok',
354
- failureCategory?: string,
355
- ): PainRecordResult {
356
- return {
357
- iteration,
358
- painId: status === 'succeeded' ? `pain-${iteration}` : undefined,
359
- taskId: status === 'succeeded' ? `task-${iteration}` : undefined,
360
- runId: status === 'succeeded' ? `run-${iteration}` : undefined,
361
- artifactId: status === 'succeeded' ? `art-${iteration}` : undefined,
362
- candidateIds,
363
- ledgerEntryIds,
364
- status,
365
- failureCategory,
366
- wallTimeMs,
367
- auditStatus,
368
- };
369
- }
370
-
371
- function makeSummary(
372
- workspace: string,
373
- totalRuns: number,
374
- successful: number,
375
- ledgerConsistencyOk: boolean,
376
- allHaveCandidates: boolean,
377
- allHaveLedger: boolean,
378
- ): import('../../src/commands/runtime-uat.js').UatSummary {
379
- const results: PainRecordResult[] = Array.from({ length: totalRuns }, (_, i) =>
380
- makeResult(i + 1, i < successful ? 'succeeded' : 'failed', ['c1'], ['l1'])
381
- );
382
- return {
383
- generatedAt: new Date().toISOString(),
384
- workspace,
385
- totalRuns,
386
- successful,
387
- failed: totalRuns - successful,
388
- successRate: Number((successful / totalRuns).toFixed(2)),
389
- p50LatencyMs: 500,
390
- p95LatencyMs: 900,
391
- failuresByCategory: {},
392
- ledgerConsistencyOk,
393
- allHaveCandidates,
394
- allHaveLedger,
395
- perRun: results,
396
- };
397
- }