rungate 0.2.0 → 0.2.1

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 (164) hide show
  1. package/package.json +14 -3
  2. package/.claude/agents/aditi.md +0 -47
  3. package/.claude/agents/marcus.md +0 -50
  4. package/.claude/agents/quinn.md +0 -58
  5. package/.claude/agents/rook.md +0 -47
  6. package/.claude/agents/serena.md +0 -46
  7. package/.claude/rungate.json +0 -11
  8. package/.fallowrc.json +0 -28
  9. package/.github/copilot-instructions.md +0 -20
  10. package/.rungate/conformity-findings.json +0 -648
  11. package/AGENTS.md +0 -106
  12. package/CODE-MAP.md +0 -50
  13. package/HARNESS.md +0 -88
  14. package/bun.lock +0 -26
  15. package/bunfig.toml +0 -2
  16. package/config/brief-policies.json +0 -28
  17. package/config/ceremony-profiles.json +0 -212
  18. package/config/consumer-cascade-map.json +0 -24
  19. package/config/doc-cascade-map.json +0 -24
  20. package/config/eval.json +0 -84
  21. package/config/profiles/account-plan.yaml +0 -36
  22. package/config/profiles/campaign.yaml +0 -94
  23. package/config/prove-evidence.schema.json +0 -65
  24. package/config/spec-policies.json +0 -36
  25. package/config/workflow-schema.json +0 -281
  26. package/gates/SCHEMA-GUIDE.md +0 -121
  27. package/gates/ac-quality.test.ts +0 -106
  28. package/gates/adversarial.test.ts +0 -274
  29. package/gates/brief-assembler.test.ts +0 -429
  30. package/gates/brief-assembler.ts +0 -334
  31. package/gates/bunfig.toml +0 -2
  32. package/gates/chain.test.ts +0 -91
  33. package/gates/e2e-smoke.test.ts +0 -234
  34. package/gates/error-classifier.test.ts +0 -249
  35. package/gates/error-classifier.ts +0 -89
  36. package/gates/orchestrator.test.ts +0 -950
  37. package/gates/orchestrator.ts +0 -569
  38. package/gates/preload.ts +0 -77
  39. package/gates/prompts/ac-adversary.md +0 -20
  40. package/gates/prompts/evidence-validator.md +0 -22
  41. package/gates/prompts/prove-reproducer.md +0 -53
  42. package/gates/prove.test.ts +0 -164
  43. package/gates/run-gate.ts +0 -936
  44. package/gates/schema-parity.test.ts +0 -197
  45. package/gates/schema.ts +0 -362
  46. package/gates/self-heal.test.ts +0 -511
  47. package/gates/self-heal.ts +0 -121
  48. package/gates/ship-orchestrator.test.ts +0 -379
  49. package/gates/ship-orchestrator.ts +0 -363
  50. package/gates/test-fixtures/broken-no-environments.json +0 -60
  51. package/gates/test-fixtures/valid-standard.json +0 -54
  52. package/gates/test-utils.ts +0 -43
  53. package/gates/witness.ts +0 -220
  54. package/gates/workflow.test.ts +0 -1053
  55. package/hooks/AgentBriefGuard.hook.ts +0 -586
  56. package/hooks/AgentVerdictCapture.hook.ts +0 -134
  57. package/hooks/AutoVerifyGate.hook.ts +0 -76
  58. package/hooks/GateEnforcement.hook.ts +0 -273
  59. package/hooks/IssueCloseGuard.hook.ts +0 -116
  60. package/hooks/MergeGuard.hook.ts +0 -55
  61. package/hooks/StaleTTLCleanup.hook.ts +0 -133
  62. package/hooks/VerifyPhaseLock.hook.ts +0 -81
  63. package/hooks/WorkflowStateGuard.hook.ts +0 -37
  64. package/hooks/lib/agentDetection.ts +0 -70
  65. package/hooks/lib/findWorkflow.ts +0 -101
  66. package/hooks/lib/parseStdin.ts +0 -37
  67. package/hooks/lib/paths.ts +0 -111
  68. package/hooks/lib/utils.ts +0 -81
  69. package/reference/migration-manifest.json +0 -554
  70. package/reference/prompts/agent-aditi.md +0 -38
  71. package/reference/prompts/agent-marcus.md +0 -38
  72. package/reference/prompts/agent-quinn.md +0 -38
  73. package/reference/prompts/agent-rook.md +0 -37
  74. package/reference/prompts/agent-serena.md +0 -37
  75. package/reference/prompts/council-skill.md +0 -170
  76. package/reference/prompts/goal-skill.md +0 -235
  77. package/reference/prompts/prove-skill.md +0 -283
  78. package/reference/prompts/quinn-standard.md +0 -246
  79. package/reference/prompts/ship-convergence.md +0 -65
  80. package/reference/prompts/ship-escalation.md +0 -43
  81. package/reference/prompts/ship-iteration.md +0 -382
  82. package/reference/prompts/ship-pending-patches.md +0 -246
  83. package/reference/prompts/ship-reference.md +0 -250
  84. package/reference/prompts/ship-skill.md +0 -347
  85. package/reference/prompts/ship-templates.md +0 -215
  86. package/reference/scripts/batch-status.sh +0 -68
  87. package/reference/scripts/chain-compat-check.sh +0 -67
  88. package/reference/scripts/context-audit.sh +0 -314
  89. package/reference/scripts/dead-export-check.sh +0 -61
  90. package/reference/scripts/generate-qc-tables.sh +0 -92
  91. package/reference/scripts/harness-init.sh +0 -111
  92. package/reference/scripts/pai-054-baseline-check.sh +0 -40
  93. package/reference/scripts/prove-smoke-test.sh +0 -112
  94. package/reference/scripts/setup-keychain-salt.sh +0 -12
  95. package/reference/scripts/skill-optimizer-friday.sh +0 -88
  96. package/reference/scripts/skill-qc-test.sh +0 -351
  97. package/reference/scripts/skill-synthesize-tonight.sh +0 -66
  98. package/reference/specs/HARNESS-EXTRACTION-SPEC.md +0 -263
  99. package/reference/specs/harness-v3-bash-deletion-plan.md +0 -65
  100. package/reference/specs/harness-v3-migration-plan.md +0 -188
  101. package/scripts/decision-reconcile.sh +0 -74
  102. package/scripts/decision-reconcile.ts +0 -152
  103. package/scripts/git-hooks/pre-commit +0 -76
  104. package/scripts/git-hooks/pre-push +0 -271
  105. package/scripts/harness-skill-check.sh +0 -52
  106. package/scripts/lib/gap-emit.sh +0 -65
  107. package/scripts/lib/jq-update.sh +0 -30
  108. package/scripts/lib/resolve-slug.sh +0 -30
  109. package/scripts/lib/verify-spec-compliance.sh +0 -102
  110. package/scripts/prove-backfill.sh +0 -87
  111. package/scripts/scaffold-rungate-config.ts +0 -91
  112. package/scripts/self-containment-check.sh +0 -109
  113. package/scripts/skill-qc-validator.sh +0 -402
  114. package/scripts/slug-resolver.sh +0 -14
  115. package/specs/BOOTSTRAP-DATA-FLOW-SPEC.md +0 -2493
  116. package/specs/BOOTSTRAP-TEST-PLAN.md +0 -571
  117. package/specs/HARNESS-GATES.md +0 -256
  118. package/specs/HARNESS-SKILL-CHAIN.md +0 -286
  119. package/specs/HARNESS-SKILL-CONTRACT.md +0 -93
  120. package/specs/HARNESS-STANDARD.md +0 -488
  121. package/specs/SPEC-TEMPLATE.md +0 -53
  122. package/specs/bootstrap-data-flow.png +0 -0
  123. package/specs/harness-automation-matrix.md +0 -314
  124. package/specs/harness-automation-matrix.rules.json +0 -64
  125. package/test/anti.test.ts +0 -80
  126. package/test/contract-negative.test.ts +0 -86
  127. package/test/contract.test.ts +0 -158
  128. package/test/external-deps.test.ts +0 -48
  129. package/test/fixtures/golden-project/.env.example +0 -3
  130. package/test/fixtures/golden-project/Makefile +0 -7
  131. package/test/fixtures/golden-project/docs/adr/ADR-001-framework.md +0 -23
  132. package/test/fixtures/golden-project/docs/setup-guide.md +0 -10
  133. package/test/fixtures/golden-project/package.json +0 -10
  134. package/test/fixtures/golden-project/specs/api-spec.md +0 -20
  135. package/test/fixtures/golden-project/src/auth.ts +0 -8
  136. package/test/fixtures/golden-project/src/db.ts +0 -11
  137. package/test/fixtures/golden-project/src/index.ts +0 -19
  138. package/test/fixtures/golden-project/src/utils/format.ts +0 -3
  139. package/test/fixtures/golden-project/test/auth.test.ts +0 -15
  140. package/test/fixtures/golden-project/tsconfig.json +0 -12
  141. package/test/meta-sc-coverage.test.ts +0 -159
  142. package/test/phase-0.test.ts +0 -846
  143. package/test/phase-1.test.ts +0 -617
  144. package/test/phase-2.test.ts +0 -620
  145. package/test/phase-3.test.ts +0 -99
  146. package/test/scaffold-conformity.test.ts +0 -8
  147. package/test/schema-canary.test.ts +0 -51
  148. package/test/spec-compliance-auto.test.ts +0 -64
  149. package/test/spec-compliance.test.ts +0 -295
  150. package/test/spec-discovery.test.ts +0 -68
  151. package/test/spec-drift.test.ts +0 -5
  152. package/test/structure.test.ts +0 -165
  153. package/test/unit/agent-brief-guard-ship.test.ts +0 -293
  154. package/test/unit/extract-constraints.test.ts +0 -145
  155. package/test/unit/issue-close-guard.test.ts +0 -204
  156. package/test/unit/scaffold-project.test.ts +0 -417
  157. package/test/unit/skill-cooccurrence.test.ts +0 -177
  158. package/test/unit/skill-sequence-logger.test.ts +0 -244
  159. package/test/unit/workflow-state-guard.test.ts +0 -95
  160. package/workflows/batch-ship.js +0 -295
  161. package/workflows/council.js +0 -481
  162. package/workflows/prove.js +0 -560
  163. package/workflows/ship.js +0 -789
  164. package/workflows/verify.js +0 -236
@@ -1,950 +0,0 @@
1
- import { test, expect, describe, beforeEach, afterEach } from "bun:test";
2
- import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync, statSync } from "fs";
3
- import { join } from "path";
4
- import {
5
- writeGateResult,
6
- generateHmac,
7
- runConvergence,
8
- generateShipEvidence,
9
- writeGateSummary,
10
- writeWorkflowState,
11
- initWorkflow,
12
- writeACs,
13
- markCommandlessACsAsSkip,
14
- initBatchPlan,
15
- recordBatchShipped,
16
- recordBatchSkipped,
17
- validateBatchComplete,
18
- } from "./orchestrator";
19
-
20
- const TMP_DIR = `/tmp/orchestrator-test-${process.pid}`;
21
- const SF = join(TMP_DIR, "workflow-state.json");
22
- const PROFILE = join(TMP_DIR, "ceremony-profiles.json");
23
- const PENDING = join(process.env.HOME || "", ".claude", "MEMORY", "STATE", "gate-pending.json");
24
-
25
- function makeState(overrides: Record<string, any> = {}): any {
26
- return {
27
- schemaVersion: 2,
28
- issue: 432,
29
- slug: "test-orch",
30
- phase: "SCOPE",
31
- issueGoal: "Port orchestrator",
32
- acs: [
33
- {
34
- id: "SC-1",
35
- statement: "orchestrator.ts file exists on disk and is valid",
36
- threshold: { op: "==", value: "true" },
37
- evidenceMethod: { type: "FILE_EXISTS" },
38
- evidence: null,
39
- },
40
- ],
41
- gates: {},
42
- changelog: [],
43
- sizing: { predicted: "M", ceremonyTier: "STANDARD" },
44
- phaseTimings: {},
45
- ...overrides,
46
- };
47
- }
48
-
49
- function makeProfile(): any {
50
- return {
51
- tiers: {
52
- LIGHT: { maxIterations: 3, checks: { scope: [], verify: [], ship: [] } },
53
- STANDARD: { maxIterations: 5, checks: { scope: [], verify: [], ship: [] } },
54
- THOROUGH: { maxIterations: 8, checks: { scope: [], verify: [], ship: [] } },
55
- },
56
- };
57
- }
58
-
59
- beforeEach(() => {
60
- mkdirSync(TMP_DIR, { recursive: true });
61
- writeFileSync(SF, JSON.stringify(makeState(), null, 2));
62
- writeFileSync(PROFILE, JSON.stringify(makeProfile(), null, 2));
63
- });
64
-
65
- afterEach(() => {
66
- rmSync(TMP_DIR, { recursive: true, force: true });
67
- try { rmSync(PENDING, { force: true }); } catch {}
68
- });
69
-
70
- // ═══ writeGateResult ═══════════════════════════════════════════════════
71
-
72
- describe("writeGateResult", () => {
73
- test("writes correct gate result to workflow state", () => {
74
- const results = [
75
- { check: "acs-exist", result: "PASS" as const, detail: "3 ACs" },
76
- { check: "sizing", result: "PASS" as const, detail: "size=M" },
77
- ];
78
- const { resultVal, attempt } = writeGateResult(SF, "scope", 2, 0, 0, results);
79
-
80
- expect(resultVal).toBe("PASS");
81
- expect(attempt).toBe(1);
82
-
83
- const state = JSON.parse(readFileSync(SF, "utf-8"));
84
- expect(state.gates.scope.result).toBe("PASS");
85
- expect(state.gates.scope.attempt).toBe(1);
86
- expect(state.gates.scope.failures).toEqual([]);
87
- expect(state.gates.scope.ts).toBeTruthy();
88
- expect(state.gates.scope.commitSha).toBeTruthy();
89
- });
90
-
91
- test("records failures when checks fail", () => {
92
- const results = [
93
- { check: "acs-exist", result: "FAIL" as const, detail: "no ACs" },
94
- { check: "sizing", result: "PASS" as const, detail: "size=M" },
95
- ];
96
- const { resultVal } = writeGateResult(SF, "scope", 1, 1, 0, results);
97
-
98
- expect(resultVal).toBe("FAIL");
99
-
100
- const state = JSON.parse(readFileSync(SF, "utf-8"));
101
- expect(state.gates.scope.result).toBe("FAIL");
102
- expect(state.gates.scope.failures).toHaveLength(1);
103
- expect(state.gates.scope.failures[0].check).toBe("acs-exist");
104
- });
105
-
106
- test("advances phase on PASS: scope->BUILD", () => {
107
- const results = [{ check: "acs-exist", result: "PASS" as const, detail: "ok" }];
108
- writeGateResult(SF, "scope", 1, 0, 0, results);
109
-
110
- const state = JSON.parse(readFileSync(SF, "utf-8"));
111
- expect(state.phase).toBe("BUILD");
112
- expect(state.phaseTimings.BUILD).toHaveLength(1);
113
- expect(state.phaseTimings.BUILD[0].enteredTs).toBeTruthy();
114
- });
115
-
116
- test("advances phase on PASS: verify->SHIP", () => {
117
- writeFileSync(SF, JSON.stringify(makeState({ phase: "VERIFY" }), null, 2));
118
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
119
- writeGateResult(SF, "verify", 1, 0, 0, results);
120
-
121
- const state = JSON.parse(readFileSync(SF, "utf-8"));
122
- expect(state.phase).toBe("SHIP");
123
- });
124
-
125
- test("advances phase on PASS: ship->DONE", () => {
126
- writeFileSync(SF, JSON.stringify(makeState({ phase: "SHIP" }), null, 2));
127
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
128
- writeGateResult(SF, "ship", 1, 0, 0, results);
129
-
130
- const state = JSON.parse(readFileSync(SF, "utf-8"));
131
- expect(state.phase).toBe("DONE");
132
- expect(state.mergeCommitSha).toBeTruthy();
133
- });
134
-
135
- test("does NOT advance phase on FAIL", () => {
136
- const results = [{ check: "acs-exist", result: "FAIL" as const, detail: "none" }];
137
- writeGateResult(SF, "scope", 0, 1, 0, results);
138
-
139
- const state = JSON.parse(readFileSync(SF, "utf-8"));
140
- expect(state.phase).toBe("SCOPE");
141
- });
142
-
143
- // #514 SC-1: Phase cannot advance to DONE when non-OUTCOME AC has verdict FAIL
144
- test("blocks ship→DONE when non-OUTCOME AC has FAIL verdict", () => {
145
- writeFileSync(SF, JSON.stringify(makeState({
146
- phase: "SHIP",
147
- acs: [
148
- {
149
- id: "SC-1", type: "CODE",
150
- statement: "function exists and is callable from CLI",
151
- threshold: { op: "==", value: "true" },
152
- evidenceMethod: { type: "GREP_CHECK" },
153
- evidence: { type: "command-output", content: "false" },
154
- verdict: "FAIL",
155
- },
156
- ],
157
- }), null, 2));
158
-
159
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
160
- const { resultVal } = writeGateResult(SF, "ship", 1, 0, 0, results);
161
-
162
- expect(resultVal).toBe("FAIL");
163
- const state = JSON.parse(readFileSync(SF, "utf-8"));
164
- expect(state.phase).not.toBe("DONE");
165
- });
166
-
167
- test("blocks verify→SHIP when non-OUTCOME AC has FAIL verdict", () => {
168
- writeFileSync(SF, JSON.stringify(makeState({
169
- phase: "VERIFY",
170
- acs: [
171
- {
172
- id: "SC-1", type: "CODE",
173
- statement: "function exists and is callable from CLI",
174
- threshold: { op: "==", value: "true" },
175
- evidenceMethod: { type: "GREP_CHECK" },
176
- evidence: { type: "command-output", content: "false" },
177
- verdict: "FAIL",
178
- },
179
- ],
180
- }), null, 2));
181
-
182
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
183
- const { resultVal } = writeGateResult(SF, "verify", 1, 0, 0, results);
184
-
185
- expect(resultVal).toBe("FAIL");
186
- const state = JSON.parse(readFileSync(SF, "utf-8"));
187
- expect(state.phase).not.toBe("SHIP");
188
- });
189
-
190
- test("allows ship→DONE when OUTCOME AC has FAIL (OUTCOME exemption)", () => {
191
- writeFileSync(SF, JSON.stringify(makeState({
192
- phase: "SHIP",
193
- acs: [
194
- {
195
- id: "SC-1", type: "OUTCOME",
196
- statement: "batch completes with success message visible",
197
- threshold: { op: "==", value: "true" },
198
- evidenceMethod: { type: "PLAYWRIGHT" },
199
- evidence: null,
200
- verdict: "FAIL",
201
- },
202
- ],
203
- }), null, 2));
204
-
205
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
206
- const { resultVal } = writeGateResult(SF, "ship", 1, 0, 0, results);
207
-
208
- expect(resultVal).toBe("PASS");
209
- const state = JSON.parse(readFileSync(SF, "utf-8"));
210
- expect(state.phase).toBe("DONE");
211
- });
212
-
213
- test("allows advance when all ACs are PASS or SKIP", () => {
214
- writeFileSync(SF, JSON.stringify(makeState({
215
- phase: "SHIP",
216
- acs: [
217
- {
218
- id: "SC-1", type: "CODE",
219
- statement: "function exists and is callable from CLI",
220
- threshold: { op: "==", value: "true" },
221
- evidenceMethod: { type: "GREP_CHECK", command: "echo true" },
222
- evidence: { type: "command-output", content: "true" },
223
- verdict: "PASS",
224
- },
225
- {
226
- id: "SC-2", type: "CODE",
227
- statement: "file includes the expected configuration value",
228
- threshold: { op: "==", value: "true" },
229
- evidenceMethod: { type: "FILE_EXISTS" },
230
- evidence: { type: "manual-attestation", content: "No command" },
231
- verdict: "SKIP",
232
- },
233
- ],
234
- }), null, 2));
235
-
236
- const results = [{ check: "all-pass", result: "PASS" as const, detail: "ok" }];
237
- const { resultVal } = writeGateResult(SF, "ship", 1, 0, 0, results);
238
-
239
- expect(resultVal).toBe("PASS");
240
- const state = JSON.parse(readFileSync(SF, "utf-8"));
241
- expect(state.phase).toBe("DONE");
242
- });
243
-
244
- // #514 SC-2: Ship gate failure resets phase to VERIFY
245
- test("ship gate FAIL resets phase to VERIFY", () => {
246
- writeFileSync(SF, JSON.stringify(makeState({ phase: "SHIP" }), null, 2));
247
- const results = [{ check: "code-committed", result: "FAIL" as const, detail: "not committed" }];
248
- writeGateResult(SF, "ship", 0, 1, 0, results);
249
-
250
- const state = JSON.parse(readFileSync(SF, "utf-8"));
251
- expect(state.phase).toBe("VERIFY");
252
- const regression = state.changelog.find((e: any) => e.event === "ship-fail-regression");
253
- expect(regression).toBeTruthy();
254
- });
255
-
256
- test("increments attempt number", () => {
257
- const results = [{ check: "x", result: "FAIL" as const, detail: "d" }];
258
- writeGateResult(SF, "scope", 0, 1, 0, results);
259
- writeGateResult(SF, "scope", 0, 1, 0, results);
260
-
261
- const state = JSON.parse(readFileSync(SF, "utf-8"));
262
- expect(state.gates.scope.attempt).toBe(2);
263
- });
264
- });
265
-
266
- // ═══ generateHmac ══════════════════════════════════════════════════════
267
-
268
- describe("generateHmac", () => {
269
- test("computes hash and writes to workflow state", () => {
270
- writeFileSync(SF, JSON.stringify(makeState({
271
- phase: "SHIP",
272
- gates: { ship: { result: "PASS", attempt: 1, failures: [], ts: "t" } },
273
- }), null, 2));
274
-
275
- const hash = generateHmac(SF, "test-orch", 432);
276
- expect(hash).toHaveLength(16);
277
- expect(/^[0-9a-f]{16}$/.test(hash)).toBe(true);
278
-
279
- const state = JSON.parse(readFileSync(SF, "utf-8"));
280
- expect(state.gates.ship.hash).toBe(hash);
281
- });
282
-
283
- test("salt file has chmod 600", () => {
284
- const saltPath = join(process.env.HOME || "", ".claude", "hooks", "lib", ".gate-salt");
285
- generateHmac(SF, "test-orch", 432);
286
-
287
- const perms = statSync(saltPath).mode & 0o777;
288
- expect(perms).toBe(0o600);
289
- });
290
- });
291
-
292
- // ═══ runConvergence ════════════════════════════════════════════════════
293
-
294
- describe("runConvergence", () => {
295
- test("skips when gate != verify or result != FAIL", () => {
296
- const r1 = runConvergence(SF, "scope", "FAIL", PROFILE);
297
- expect(r1.action).toBe("skip");
298
-
299
- const r2 = runConvergence(SF, "verify", "PASS", PROFILE);
300
- expect(r2.action).toBe("skip");
301
- });
302
-
303
- test("fires circuit breaker at maxIterations", () => {
304
- const changelog = Array.from({ length: 4 }, (_, i) => ({
305
- ts: "t",
306
- event: "iteration-loopback",
307
- detail: `iteration ${i + 1}`,
308
- failureHash: `fail-${i}`,
309
- actor: "gate-runner",
310
- }));
311
-
312
- writeFileSync(SF, JSON.stringify(makeState({
313
- phase: "VERIFY",
314
- changelog,
315
- gates: { verify: { result: "FAIL", failures: [{ check: "x", result: "FAIL", detail: "d" }] } },
316
- }), null, 2));
317
-
318
- const result = runConvergence(SF, "verify", "FAIL", PROFILE);
319
- expect(result.action).toBe("circuit-break");
320
- expect(result.iteration).toBe(5);
321
-
322
- const state = JSON.parse(readFileSync(SF, "utf-8"));
323
- expect(state.phase).toBe("CIRCUIT_BREAK");
324
- });
325
-
326
- test("detects stall: same failureHash in consecutive iterations", () => {
327
- const changelog = [
328
- {
329
- ts: "t",
330
- event: "iteration-loopback",
331
- detail: "iteration 1",
332
- failureHash: "x",
333
- actor: "gate-runner",
334
- },
335
- ];
336
-
337
- writeFileSync(SF, JSON.stringify(makeState({
338
- phase: "VERIFY",
339
- changelog,
340
- gates: { verify: { result: "FAIL", failures: [{ check: "x", result: "FAIL", detail: "d" }] } },
341
- }), null, 2));
342
-
343
- const result = runConvergence(SF, "verify", "FAIL", PROFILE);
344
- expect(result.action).toBe("stall");
345
-
346
- const state = JSON.parse(readFileSync(SF, "utf-8"));
347
- const councilEvents = state.changelog.filter((e: any) => e.event === "council-recommended");
348
- expect(councilEvents.length).toBe(1);
349
- });
350
-
351
- test("preserves read-before-append ordering", () => {
352
- writeFileSync(SF, JSON.stringify(makeState({
353
- phase: "VERIFY",
354
- changelog: [],
355
- gates: { verify: { result: "FAIL", failures: [{ check: "a", result: "FAIL", detail: "d" }] } },
356
- }), null, 2));
357
-
358
- // First iteration — no previous hash to compare
359
- const r1 = runConvergence(SF, "verify", "FAIL", PROFILE);
360
- expect(r1.action).toBe("loop-back");
361
-
362
- // Second iteration with different failures — should NOT be stall
363
- const state2 = JSON.parse(readFileSync(SF, "utf-8"));
364
- state2.gates.verify.failures = [{ check: "b", result: "FAIL", detail: "d" }];
365
- writeFileSync(SF, JSON.stringify(state2, null, 2));
366
-
367
- const r2 = runConvergence(SF, "verify", "FAIL", PROFILE);
368
- expect(r2.action).toBe("loop-back");
369
-
370
- const finalState = JSON.parse(readFileSync(SF, "utf-8"));
371
- const loopbacks = finalState.changelog.filter((e: any) => e.event === "iteration-loopback");
372
- expect(loopbacks).toHaveLength(2);
373
- expect(loopbacks[0].failureHash).not.toBe(loopbacks[1].failureHash);
374
- });
375
-
376
- test("loops back to BUILD phase", () => {
377
- writeFileSync(SF, JSON.stringify(makeState({
378
- phase: "VERIFY",
379
- gates: { verify: { result: "FAIL", failures: [{ check: "x", result: "FAIL", detail: "d" }] } },
380
- }), null, 2));
381
-
382
- runConvergence(SF, "verify", "FAIL", PROFILE);
383
-
384
- const state = JSON.parse(readFileSync(SF, "utf-8"));
385
- expect(state.phase).toBe("BUILD");
386
- expect(state.phaseTimings.BUILD).toHaveLength(1);
387
- });
388
- });
389
-
390
- // ═══ generateShipEvidence ══════════════════════════════════════════════
391
-
392
- describe("generateShipEvidence", () => {
393
- test("writes valid ship-evidence.json", () => {
394
- writeFileSync(SF, JSON.stringify(makeState({
395
- phase: "SHIP",
396
- acs: [
397
- {
398
- id: "SC-1",
399
- statement: "file exists on disk and is accessible",
400
- verdict: "PASS",
401
- evidence: { type: "file-citation", content: "found" },
402
- threshold: { op: "==", value: "true" },
403
- evidenceMethod: { type: "FILE_EXISTS" },
404
- },
405
- ],
406
- }), null, 2));
407
-
408
- const path = generateShipEvidence(SF, TMP_DIR, 432, "", 1, 0, 0);
409
-
410
- expect(existsSync(path)).toBe(true);
411
- const evidence = JSON.parse(readFileSync(path, "utf-8"));
412
- expect(evidence.contractVersion).toBe("1.0");
413
- expect(evidence.issueNumber).toBe(432);
414
- expect(evidence.gateOut.status).toBe("PASS");
415
- expect(evidence.gateOut.evidence).toHaveLength(1);
416
- expect(evidence.mergeCommitSha).toBeTruthy();
417
- expect(evidence.capturedAt).toBeTruthy();
418
- expect(evidence.iterationCount).toBeGreaterThanOrEqual(1);
419
- expect(evidence.sizing.predicted).toBe("M");
420
- });
421
- });
422
-
423
- // ═══ writeGateSummary ══════════════════════════════════════════════════
424
-
425
- describe("writeGateSummary", () => {
426
- test("writes gate-pending.json on FAIL", () => {
427
- const results = [
428
- { check: "acs-exist", result: "FAIL" as const, detail: "no ACs" },
429
- ];
430
-
431
- const outcome = writeGateSummary("scope", 0, 1, 0, results, 432, "test", "sess-1");
432
-
433
- expect(outcome).toBe("BLOCKED");
434
- expect(existsSync(PENDING)).toBe(true);
435
-
436
- const pending = JSON.parse(readFileSync(PENDING, "utf-8"));
437
- expect(pending.gate).toBe("scope");
438
- expect(pending.issue).toBe(432);
439
- expect(pending.failures).toHaveLength(1);
440
- expect(pending.failures[0].check).toBe("acs-exist");
441
- expect(pending.strike_count).toBe(0);
442
- expect(pending.max_strikes).toBe(3);
443
- });
444
-
445
- test("deletes gate-pending.json on PASS", () => {
446
- // Create a pending file first
447
- mkdirSync(join(process.env.HOME || "", ".claude", "MEMORY", "STATE"), { recursive: true });
448
- writeFileSync(PENDING, JSON.stringify({ gate: "old" }));
449
- expect(existsSync(PENDING)).toBe(true);
450
-
451
- const results = [
452
- { check: "acs-exist", result: "PASS" as const, detail: "3 ACs" },
453
- ];
454
- const outcome = writeGateSummary("scope", 1, 0, 0, results, 432, "test", "sess-1");
455
-
456
- expect(outcome).toBe("ALL CLEAR");
457
- expect(existsSync(PENDING)).toBe(false);
458
- });
459
- });
460
-
461
- // ═══ writeWorkflowState ══════════════════════════════════════════════════
462
-
463
- describe("writeWorkflowState", () => {
464
- test("writes valid state to disk", () => {
465
- const state = makeState();
466
- writeWorkflowState(SF, state);
467
- const written = JSON.parse(readFileSync(SF, "utf-8"));
468
- expect(written.schemaVersion).toBe(2);
469
- expect(written.phase).toBe("SCOPE");
470
- expect(written.slug).toBe("test-orch");
471
- });
472
-
473
- test("throws on invalid phase enum", () => {
474
- const state = makeState({ phase: "INVALID_PHASE" });
475
- expect(() => writeWorkflowState(SF, state)).toThrow(/expected/i);
476
- });
477
-
478
- test("throws on invalid threshold op 'eq'", () => {
479
- const state = makeState({
480
- acs: [{
481
- id: "SC-1",
482
- statement: "test fixture validates gate behavior correctly",
483
- threshold: { op: "eq", value: "true" },
484
- evidenceMethod: { type: "GREP_CHECK" },
485
- evidence: null,
486
- }],
487
- });
488
- expect(() => writeWorkflowState(SF, state)).toThrow(/expected/i);
489
- });
490
-
491
- test("error message includes valid enum values", () => {
492
- const state = makeState({ phase: "BOGUS" });
493
- try {
494
- writeWorkflowState(SF, state);
495
- throw new Error("should have thrown");
496
- } catch (err: any) {
497
- expect(err.message).toContain("GOAL");
498
- expect(err.message).toContain("BUILD");
499
- expect(err.message).toContain("VERIFY");
500
- }
501
- });
502
-
503
- test("passes through extra fields via passthrough()", () => {
504
- const state = { ...makeState(), customField: "preserved" };
505
- writeWorkflowState(SF, state);
506
- const written = JSON.parse(readFileSync(SF, "utf-8"));
507
- expect(written.customField).toBe("preserved");
508
- });
509
- });
510
-
511
- // ═══ initWorkflow ════════════════════════════════════════════════════════
512
-
513
- describe("initWorkflow", () => {
514
- test("creates workflow-state.json with correct initial structure", () => {
515
- const target = join(TMP_DIR, "sub", "workflow-state.json");
516
- initWorkflow(target, {
517
- issue: 453,
518
- repo: "hornjason/pai-config",
519
- projectRoot: "/tmp/test",
520
- slug: "write-time-validation",
521
- issueGoal: "Add Zod write-time validation",
522
- });
523
-
524
- expect(existsSync(target)).toBe(true);
525
- const state = JSON.parse(readFileSync(target, "utf-8"));
526
- expect(state.schemaVersion).toBe(2);
527
- expect(state.phase).toBe("GOAL");
528
- expect(state.acs).toEqual([]);
529
- expect(state.gates).toEqual({});
530
- expect(state.changelog).toEqual([]);
531
- expect(state.issue).toBe(453);
532
- expect(state.slug).toBe("write-time-validation");
533
- expect(state.issueGoal).toBe("Add Zod write-time validation");
534
- });
535
-
536
- test("sets issueRepo to opts.issueRepo when provided", () => {
537
- const target = join(TMP_DIR, "init-test-1.json");
538
- initWorkflow(target, {
539
- issue: 453,
540
- repo: "hornjason/pai-config",
541
- issueRepo: "hornjason/asaCommandCenter",
542
- projectRoot: "/tmp/test",
543
- slug: "test",
544
- issueGoal: "test goal",
545
- });
546
-
547
- const state = JSON.parse(readFileSync(target, "utf-8"));
548
- expect(state.issueRepo).toBe("hornjason/asaCommandCenter");
549
- });
550
-
551
- test("defaults issueRepo to opts.repo when not provided", () => {
552
- const target = join(TMP_DIR, "init-test-2.json");
553
- initWorkflow(target, {
554
- issue: 453,
555
- repo: "hornjason/pai-config",
556
- projectRoot: "/tmp/test",
557
- slug: "test",
558
- issueGoal: "test goal",
559
- });
560
-
561
- const state = JSON.parse(readFileSync(target, "utf-8"));
562
- expect(state.issueRepo).toBe("hornjason/pai-config");
563
- });
564
-
565
- test("creates parent directory if it doesn't exist", () => {
566
- const target = join(TMP_DIR, "deep", "nested", "dir", "workflow-state.json");
567
- initWorkflow(target, {
568
- issue: 453,
569
- repo: "hornjason/pai-config",
570
- projectRoot: "/tmp/test",
571
- slug: "test",
572
- issueGoal: "test goal",
573
- });
574
-
575
- expect(existsSync(target)).toBe(true);
576
- });
577
-
578
- test("includes optional fields when provided", () => {
579
- const target = join(TMP_DIR, "init-opts.json");
580
- initWorkflow(target, {
581
- issue: 453,
582
- repo: "hornjason/pai-config",
583
- projectRoot: "/tmp/test",
584
- slug: "test",
585
- issueGoal: "test goal",
586
- sizing: { predicted: "M", ceremonyTier: "STANDARD" },
587
- sourceSpecs: [{ path: "spec.md", citedInDiscovery: true }],
588
- bootstrappedFrom: "session-abc",
589
- });
590
-
591
- const state = JSON.parse(readFileSync(target, "utf-8"));
592
- expect(state.sizing.predicted).toBe("M");
593
- expect(state.sourceSpecs).toHaveLength(1);
594
- expect(state.bootstrappedFrom).toBe("session-abc");
595
- });
596
- });
597
-
598
- // ═══ writeACs ════════════════════════════════════════════════════════════
599
-
600
- describe("writeACs", () => {
601
- test("writes ACs with evidence null and verdict PENDING", () => {
602
- writeFileSync(SF, JSON.stringify(makeState(), null, 2));
603
- writeACs(SF, [
604
- {
605
- id: "SC-1",
606
- type: "CODE",
607
- statement: "writeWorkflowState function exists and is callable",
608
- threshold: { op: "==", value: "true" },
609
- evidenceMethod: { type: "GREP_CHECK" },
610
- },
611
- {
612
- id: "SC-2",
613
- type: "OUTCOME",
614
- statement: "invalid enum value throws validation error",
615
- threshold: { op: ">=", value: "2" },
616
- evidenceMethod: { type: "BUN_TEST" },
617
- },
618
- ]);
619
-
620
- const state = JSON.parse(readFileSync(SF, "utf-8"));
621
- expect(state.acs).toHaveLength(2);
622
- expect(state.acs[0].evidence).toBeNull();
623
- expect(state.acs[0].verdict).toBe("PENDING");
624
- expect(state.acs[1].evidence).toBeNull();
625
- expect(state.acs[1].verdict).toBe("PENDING");
626
- });
627
-
628
- test("throws on invalid AC type enum", () => {
629
- writeFileSync(SF, JSON.stringify(makeState(), null, 2));
630
- expect(() => writeACs(SF, [
631
- {
632
- id: "SC-1",
633
- type: "INVALID_TYPE" as any,
634
- statement: "test fixture validates gate behavior correctly",
635
- threshold: { op: "==", value: "true" },
636
- evidenceMethod: { type: "GREP_CHECK" },
637
- },
638
- ])).toThrow();
639
- });
640
-
641
- test("throws on invalid threshold op", () => {
642
- writeFileSync(SF, JSON.stringify(makeState(), null, 2));
643
- expect(() => writeACs(SF, [
644
- {
645
- id: "SC-1",
646
- statement: "test fixture validates gate behavior correctly",
647
- threshold: { op: "eq" as any, value: "true" },
648
- evidenceMethod: { type: "GREP_CHECK" },
649
- },
650
- ])).toThrow();
651
- });
652
-
653
- test("preserves existing state fields", () => {
654
- writeFileSync(SF, JSON.stringify(makeState({
655
- phase: "BUILD",
656
- gates: { scope: { result: "PASS", attempt: 1 } },
657
- }), null, 2));
658
-
659
- writeACs(SF, [
660
- {
661
- id: "SC-1",
662
- statement: "test fixture validates gate behavior correctly",
663
- threshold: { op: "==", value: "true" },
664
- evidenceMethod: { type: "GREP_CHECK" },
665
- },
666
- ]);
667
-
668
- const state = JSON.parse(readFileSync(SF, "utf-8"));
669
- expect(state.phase).toBe("BUILD");
670
- expect(state.gates.scope.result).toBe("PASS");
671
- expect(state.acs).toHaveLength(1);
672
- });
673
- });
674
-
675
- // ═══ AFK Batch Plan (#468) ═══════════════════════════════════════════
676
-
677
- describe("initBatchPlan", () => {
678
- test("creates valid afk-batch.json with planned issues", () => {
679
- const batchDir = join(TMP_DIR, "batch");
680
- initBatchPlan(batchDir, [100, 101, 102]);
681
-
682
- const fp = join(batchDir, "afk-batch.json");
683
- expect(existsSync(fp)).toBe(true);
684
-
685
- const plan = JSON.parse(readFileSync(fp, "utf-8"));
686
- expect(plan.planned).toEqual([100, 101, 102]);
687
- expect(plan.shipped).toEqual([]);
688
- expect(plan.skipped).toEqual([]);
689
- expect(plan.inProgress).toBeNull();
690
- expect(plan.approvedAt).toBeTruthy();
691
- });
692
-
693
- test("creates parent directory if needed", () => {
694
- const batchDir = join(TMP_DIR, "deep", "nested", "batch");
695
- initBatchPlan(batchDir, [200]);
696
-
697
- expect(existsSync(join(batchDir, "afk-batch.json"))).toBe(true);
698
- });
699
- });
700
-
701
- describe("recordBatchShipped", () => {
702
- test("moves issue to shipped array", () => {
703
- const batchDir = join(TMP_DIR, "batch-ship");
704
- initBatchPlan(batchDir, [100, 101, 102]);
705
- recordBatchShipped(batchDir, 100);
706
-
707
- const plan = JSON.parse(readFileSync(join(batchDir, "afk-batch.json"), "utf-8"));
708
- expect(plan.shipped).toEqual([100]);
709
- expect(plan.planned).toEqual([100, 101, 102]);
710
- });
711
-
712
- test("does not duplicate if called twice", () => {
713
- const batchDir = join(TMP_DIR, "batch-ship-dup");
714
- initBatchPlan(batchDir, [100]);
715
- recordBatchShipped(batchDir, 100);
716
- recordBatchShipped(batchDir, 100);
717
-
718
- const plan = JSON.parse(readFileSync(join(batchDir, "afk-batch.json"), "utf-8"));
719
- expect(plan.shipped).toEqual([100]);
720
- });
721
-
722
- test("clears inProgress when shipped issue matches", () => {
723
- const batchDir = join(TMP_DIR, "batch-ship-ip");
724
- initBatchPlan(batchDir, [100, 101]);
725
-
726
- // Manually set inProgress
727
- const fp = join(batchDir, "afk-batch.json");
728
- const plan = JSON.parse(readFileSync(fp, "utf-8"));
729
- plan.inProgress = 100;
730
- writeFileSync(fp, JSON.stringify(plan, null, 2));
731
-
732
- recordBatchShipped(batchDir, 100);
733
-
734
- const updated = JSON.parse(readFileSync(fp, "utf-8"));
735
- expect(updated.inProgress).toBeNull();
736
- });
737
- });
738
-
739
- describe("recordBatchSkipped", () => {
740
- test("rejects 'needs investigation' as skip reason", () => {
741
- const batchDir = join(TMP_DIR, "batch-skip-reject");
742
- initBatchPlan(batchDir, [100]);
743
-
744
- expect(() => recordBatchSkipped(batchDir, 100, "needs investigation")).toThrow(/Rejected skip reason/);
745
- });
746
-
747
- test("rejects 'needs browser testing' as skip reason", () => {
748
- const batchDir = join(TMP_DIR, "batch-skip-reject2");
749
- initBatchPlan(batchDir, [100]);
750
-
751
- expect(() => recordBatchSkipped(batchDir, 100, "needs browser testing")).toThrow(/Rejected skip reason/);
752
- });
753
-
754
- test("rejects 'can't do from here' as skip reason", () => {
755
- const batchDir = join(TMP_DIR, "batch-skip-reject3");
756
- initBatchPlan(batchDir, [100]);
757
-
758
- expect(() => recordBatchSkipped(batchDir, 100, "can't do from here")).toThrow(/Rejected skip reason/);
759
- });
760
-
761
- test("accepts valid skip reason with delegation action", () => {
762
- const batchDir = join(TMP_DIR, "batch-skip-valid");
763
- initBatchPlan(batchDir, [100, 101]);
764
-
765
- recordBatchSkipped(batchDir, 100, "spawned Quinn, awaiting results", "Quinn QA pass pending");
766
-
767
- const plan = JSON.parse(readFileSync(join(batchDir, "afk-batch.json"), "utf-8"));
768
- expect(plan.skipped).toHaveLength(1);
769
- expect(plan.skipped[0].issue).toBe(100);
770
- expect(plan.skipped[0].reason).toBe("spawned Quinn, awaiting results");
771
- expect(plan.skipped[0].delegationAction).toBe("Quinn QA pass pending");
772
- });
773
-
774
- test("accepts 'closed as by-design with evidence' as skip reason", () => {
775
- const batchDir = join(TMP_DIR, "batch-skip-bydesign");
776
- initBatchPlan(batchDir, [100]);
777
-
778
- recordBatchSkipped(batchDir, 100, "closed as by-design with evidence");
779
-
780
- const plan = JSON.parse(readFileSync(join(batchDir, "afk-batch.json"), "utf-8"));
781
- expect(plan.skipped).toHaveLength(1);
782
- });
783
-
784
- test("clears inProgress when skipped issue matches", () => {
785
- const batchDir = join(TMP_DIR, "batch-skip-ip");
786
- initBatchPlan(batchDir, [100]);
787
-
788
- const fp = join(batchDir, "afk-batch.json");
789
- const plan = JSON.parse(readFileSync(fp, "utf-8"));
790
- plan.inProgress = 100;
791
- writeFileSync(fp, JSON.stringify(plan, null, 2));
792
-
793
- recordBatchSkipped(batchDir, 100, "closed as by-design with evidence");
794
-
795
- const updated = JSON.parse(readFileSync(fp, "utf-8"));
796
- expect(updated.inProgress).toBeNull();
797
- });
798
- });
799
-
800
- describe("validateBatchComplete", () => {
801
- test("returns complete when all planned issues are shipped", () => {
802
- const batchDir = join(TMP_DIR, "batch-complete");
803
- initBatchPlan(batchDir, [100, 101, 102]);
804
- recordBatchShipped(batchDir, 100);
805
- recordBatchShipped(batchDir, 101);
806
- recordBatchShipped(batchDir, 102);
807
-
808
- const result = validateBatchComplete(batchDir);
809
- expect(result.complete).toBe(true);
810
- expect(result.missing).toEqual([]);
811
- });
812
-
813
- test("returns complete when mix of shipped and skipped covers all planned", () => {
814
- const batchDir = join(TMP_DIR, "batch-complete-mix");
815
- initBatchPlan(batchDir, [100, 101, 102]);
816
- recordBatchShipped(batchDir, 100);
817
- recordBatchShipped(batchDir, 101);
818
- recordBatchSkipped(batchDir, 102, "closed as by-design with evidence");
819
-
820
- const result = validateBatchComplete(batchDir);
821
- expect(result.complete).toBe(true);
822
- expect(result.missing).toEqual([]);
823
- });
824
-
825
- test("returns incomplete with missing issues", () => {
826
- const batchDir = join(TMP_DIR, "batch-incomplete");
827
- initBatchPlan(batchDir, [100, 101, 102]);
828
- recordBatchShipped(batchDir, 100);
829
-
830
- const result = validateBatchComplete(batchDir);
831
- expect(result.complete).toBe(false);
832
- expect(result.missing).toEqual([101, 102]);
833
- });
834
-
835
- test("returns complete for empty plan", () => {
836
- const batchDir = join(TMP_DIR, "batch-empty");
837
- initBatchPlan(batchDir, []);
838
-
839
- const result = validateBatchComplete(batchDir);
840
- expect(result.complete).toBe(true);
841
- expect(result.missing).toEqual([]);
842
- });
843
- });
844
-
845
- // ═══ markCommandlessACsAsSkip (#513) ══════════════════════════════════
846
-
847
- describe("markCommandlessACsAsSkip", () => {
848
- test("marks ACs without evidenceMethod.command as SKIP", () => {
849
- writeFileSync(SF, JSON.stringify(makeState({
850
- acs: [
851
- {
852
- id: "SC-1",
853
- statement: "function exists and is callable from CLI",
854
- threshold: { op: "==", value: "true" },
855
- evidenceMethod: { type: "FILE_EXISTS" },
856
- evidence: null,
857
- verdict: "PENDING",
858
- },
859
- ],
860
- }), null, 2));
861
-
862
- const count = markCommandlessACsAsSkip(SF);
863
- expect(count).toBe(1);
864
-
865
- const state = JSON.parse(readFileSync(SF, "utf-8"));
866
- expect(state.acs[0].verdict).toBe("SKIP");
867
- expect(state.acs[0].evidence.content).toContain("No evidenceMethod.command");
868
- });
869
-
870
- test("does not touch ACs with a command", () => {
871
- writeFileSync(SF, JSON.stringify(makeState({
872
- acs: [
873
- {
874
- id: "SC-1",
875
- statement: "function exists and is callable from CLI",
876
- threshold: { op: "==", value: "true" },
877
- evidenceMethod: { type: "COMMAND", command: "echo true" },
878
- evidence: null,
879
- verdict: "PENDING",
880
- },
881
- ],
882
- }), null, 2));
883
-
884
- const count = markCommandlessACsAsSkip(SF);
885
- expect(count).toBe(0);
886
-
887
- const state = JSON.parse(readFileSync(SF, "utf-8"));
888
- expect(state.acs[0].verdict).toBe("PENDING");
889
- });
890
-
891
- test("skips ACs that already have non-PENDING verdict", () => {
892
- writeFileSync(SF, JSON.stringify(makeState({
893
- acs: [
894
- {
895
- id: "SC-1",
896
- statement: "function exists and is callable from CLI",
897
- threshold: { op: "==", value: "true" },
898
- evidenceMethod: { type: "FILE_EXISTS" },
899
- evidence: { type: "command-output", content: "true" },
900
- verdict: "PASS",
901
- },
902
- ],
903
- }), null, 2));
904
-
905
- const count = markCommandlessACsAsSkip(SF);
906
- expect(count).toBe(0);
907
-
908
- const state = JSON.parse(readFileSync(SF, "utf-8"));
909
- expect(state.acs[0].verdict).toBe("PASS");
910
- });
911
-
912
- test("handles mixed ACs — only marks commandless PENDING ones", () => {
913
- writeFileSync(SF, JSON.stringify(makeState({
914
- acs: [
915
- {
916
- id: "SC-1",
917
- statement: "function exists and is callable from CLI",
918
- threshold: { op: "==", value: "true" },
919
- evidenceMethod: { type: "COMMAND", command: "echo true" },
920
- evidence: null,
921
- verdict: "PENDING",
922
- },
923
- {
924
- id: "SC-2",
925
- statement: "file includes the expected configuration value",
926
- threshold: { op: "==", value: "true" },
927
- evidenceMethod: { type: "FILE_EXISTS" },
928
- evidence: null,
929
- verdict: "PENDING",
930
- },
931
- {
932
- id: "SC-3",
933
- statement: "output matches the expected formatting pattern",
934
- threshold: { op: "==", value: "true" },
935
- evidenceMethod: { type: "COMMAND", command: "echo true" },
936
- evidence: { type: "command-output", content: "true" },
937
- verdict: "PASS",
938
- },
939
- ],
940
- }), null, 2));
941
-
942
- const count = markCommandlessACsAsSkip(SF);
943
- expect(count).toBe(1);
944
-
945
- const state = JSON.parse(readFileSync(SF, "utf-8"));
946
- expect(state.acs[0].verdict).toBe("PENDING");
947
- expect(state.acs[1].verdict).toBe("SKIP");
948
- expect(state.acs[2].verdict).toBe("PASS");
949
- });
950
- });