@hxp-tools/godplans 0.0.0-stage → 2.0.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 (144) hide show
  1. package/CHANGELOG.md +1176 -0
  2. package/LICENSE +21 -0
  3. package/PROMPT.md +4006 -0
  4. package/README.md +201 -2
  5. package/assets/README.md +11 -0
  6. package/assets/hero.svg +44 -0
  7. package/assets/plan-loop.svg +62 -0
  8. package/assets/quest-map.svg +80 -0
  9. package/bin/godplans.js +93 -0
  10. package/docs/ARCHITECTURE.md +136 -0
  11. package/docs/RELEASING.md +107 -0
  12. package/evals/README.md +295 -0
  13. package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
  14. package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
  15. package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
  16. package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
  17. package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
  18. package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
  19. package/evals/cases/brownfield-cli/REQUEST.md +10 -0
  20. package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
  21. package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
  22. package/evals/cases/compliance-refusal/REQUEST.md +8 -0
  23. package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
  24. package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
  25. package/evals/cases/greenfield-saas/REQUEST.md +11 -0
  26. package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
  27. package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
  28. package/evals/cases/nested-pillars/REQUEST.md +11 -0
  29. package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
  30. package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
  31. package/evals/cases/observability-evidence/REQUEST.md +11 -0
  32. package/evals/cases/product-business/EXPECTATIONS +18 -0
  33. package/evals/cases/product-business/REQUEST.baseline.md +13 -0
  34. package/evals/cases/product-business/REQUEST.md +14 -0
  35. package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
  36. package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
  37. package/evals/cases/product-form-routing/REQUEST.md +11 -0
  38. package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
  39. package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
  40. package/evals/cases/prose-integrity/REQUEST.md +20 -0
  41. package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
  42. package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
  43. package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
  44. package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
  45. package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
  46. package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
  47. package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
  48. package/evals/cases/stale-prepublication/REQUEST.md +13 -0
  49. package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
  50. package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
  51. package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
  52. package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
  53. package/evals/cases/weekend-library/EXPECTATIONS +19 -0
  54. package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
  55. package/evals/cases/weekend-library/REQUEST.md +11 -0
  56. package/evals/cases-roster.txt +19 -0
  57. package/evals/external/GRADE.schema.json +39 -0
  58. package/evals/external/README.md +42 -0
  59. package/evals/external/RUBRIC.md +32 -0
  60. package/evals/metrics/context-cost.json +154 -0
  61. package/evals/outcomes/README.md +65 -0
  62. package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
  63. package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
  64. package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
  65. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
  66. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
  67. package/evals/runners/claude-baseline.sh +4 -0
  68. package/evals/runners/claude-grade.sh +3 -0
  69. package/evals/runners/claude.sh +4 -0
  70. package/evals/runners/codex-baseline.sh +181 -0
  71. package/evals/runners/codex-builder.sh +96 -0
  72. package/evals/runners/codex-godaudits.sh +84 -0
  73. package/evals/runners/codex.sh +147 -0
  74. package/evals/runners/gemini-baseline.sh +4 -0
  75. package/evals/runners/gemini-grade.sh +3 -0
  76. package/evals/runners/gemini.sh +4 -0
  77. package/evals/runners/vendor-cli.sh +257 -0
  78. package/evals/runners/vendor-grade.sh +82 -0
  79. package/install.sh +323 -0
  80. package/package.json +92 -4
  81. package/requirements/skills-ref.txt +2 -0
  82. package/scripts/build-catalog.js +114 -0
  83. package/scripts/build-prompt.sh +257 -0
  84. package/scripts/context-metrics.js +118 -0
  85. package/scripts/eval-external.js +226 -0
  86. package/scripts/eval-matrix.sh +172 -0
  87. package/scripts/eval-outcome.js +143 -0
  88. package/scripts/eval.sh +321 -0
  89. package/scripts/lint-parity.js +331 -0
  90. package/scripts/lint.sh +743 -0
  91. package/scripts/outcome-summary.js +126 -0
  92. package/scripts/release-check.sh +108 -0
  93. package/scripts/release-prepare.js +41 -0
  94. package/scripts/summarize-eval.js +91 -0
  95. package/scripts/summarize-matrix.js +101 -0
  96. package/scripts/version-sync.js +65 -0
  97. package/skills/godplans/SKILL.md +192 -0
  98. package/skills/godplans/references/agent-memory.md +168 -0
  99. package/skills/godplans/references/architecture.md +189 -0
  100. package/skills/godplans/references/build.md +130 -0
  101. package/skills/godplans/references/business.md +252 -0
  102. package/skills/godplans/references/code-quality.md +165 -0
  103. package/skills/godplans/references/compliance.md +59 -0
  104. package/skills/godplans/references/database.md +157 -0
  105. package/skills/godplans/references/deploy.md +146 -0
  106. package/skills/godplans/references/discovery.md +297 -0
  107. package/skills/godplans/references/doc-set.md +243 -0
  108. package/skills/godplans/references/exemplar.md +228 -0
  109. package/skills/godplans/references/launch.md +162 -0
  110. package/skills/godplans/references/llm.md +132 -0
  111. package/skills/godplans/references/observe.md +178 -0
  112. package/skills/godplans/references/plan-format.md +340 -0
  113. package/skills/godplans/references/product.md +130 -0
  114. package/skills/godplans/references/repo.md +184 -0
  115. package/skills/godplans/references/roadmap.md +158 -0
  116. package/skills/godplans/references/security.md +156 -0
  117. package/skills/godplans/references/seo.md +133 -0
  118. package/skills/godplans/references/stack.md +133 -0
  119. package/skills/godplans/references/style-genome.md +198 -0
  120. package/skills/godplans/references/ui.md +153 -0
  121. package/skills/godplans/references/ux.md +150 -0
  122. package/skills/godplans/schemas/PLAN.schema.json +275 -0
  123. package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
  124. package/skills/godplans/scripts/plan-halflife.sh +76 -0
  125. package/skills/godplans/scripts/style-stats.py +630 -0
  126. package/skills/godplans/scripts/validate-plan.sh +1709 -0
  127. package/skills/godplans/templates/PLAN.template.mdx +269 -0
  128. package/tests/agent-memory-guidance.sh +32 -0
  129. package/tests/build-catalog.sh +81 -0
  130. package/tests/codex-runner.sh +139 -0
  131. package/tests/eval-harness.sh +377 -0
  132. package/tests/evidence-harnesses.sh +243 -0
  133. package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
  134. package/tests/install-regression.sh +246 -0
  135. package/tests/lib/plan-schema-check.js +163 -0
  136. package/tests/lint-selftest.sh +582 -0
  137. package/tests/package-contents.sh +140 -0
  138. package/tests/portable-prompt.test.sh +261 -0
  139. package/tests/release-tooling.sh +204 -0
  140. package/tests/run.sh +14 -0
  141. package/tests/script-usage.sh +37 -0
  142. package/tests/style-stats.sh +170 -0
  143. package/tests/validate-plan.sh +1970 -0
  144. package/tests/vendor-runner.sh +291 -0
@@ -0,0 +1,377 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6
+ TMP="$(mktemp -d)"
7
+ trap 'rm -rf "$TMP"' EXIT
8
+
9
+ fail() {
10
+ echo "FAIL [eval-harness] $*" >&2
11
+ exit 1
12
+ }
13
+
14
+ test -x "$ROOT/scripts/eval.sh" || fail "scripts/eval.sh is not executable"
15
+ test -x "$ROOT/evals/runners/codex.sh" || fail "Codex runner is not executable"
16
+
17
+ # Global-skill isolation. A machine that runs these evals almost always has
18
+ # godplans installed globally (in ~/.codex/skills and ~/.agents/skills), which
19
+ # Codex discovers regardless of the workspace. Without isolation, BOTH arms
20
+ # load the skill and the control measures godplans against itself. Both Codex
21
+ # runners must isolate HOME and CODEX_HOME; only the skill runner may link the
22
+ # project-local skill.
23
+ for codex_runner in codex codex-baseline; do
24
+ runner_path="$ROOT/evals/runners/$codex_runner.sh"
25
+ bash -n "$runner_path"
26
+ grep -q 'HOME="\$ISO_HOME" CODEX_HOME="\$ISO_CODEX_HOME" codex' "$runner_path" \
27
+ || fail "$codex_runner.sh does not isolate HOME and CODEX_HOME from global skills"
28
+ done
29
+ grep -q 'ln -s' "$ROOT/evals/runners/codex.sh" || fail "skill runner no longer links the project skill"
30
+ if grep -q 'ln -s' "$ROOT/evals/runners/codex-baseline.sh"; then
31
+ fail "baseline runner links a skill into its workspace"
32
+ fi
33
+
34
+ # Neutral control request. The baseline runner must prefer REQUEST.baseline.md
35
+ # and must not hand the control the skill's own output path.
36
+ grep -q 'REQUEST.baseline.md' "$ROOT/evals/runners/codex-baseline.sh" \
37
+ || fail "baseline runner does not prefer REQUEST.baseline.md"
38
+ # The prompt handed to the control (the printf preamble lines) must not name
39
+ # the skill's output path. The candidate-search loop may still accept a plan
40
+ # the control writes to .godplans/, so scope this to printf lines; that loop's
41
+ # preference for PLAN.md over an unchanged INPUT fixture is exercised in
42
+ # tests/codex-runner.sh and tests/vendor-runner.sh.
43
+ if grep -E "printf.*\.godplans" "$ROOT/evals/runners/codex-baseline.sh"; then
44
+ fail "baseline runner names a .godplans path in the prompt handed to the control"
45
+ fi
46
+ for case_dir in "$ROOT"/evals/cases/*/; do
47
+ base_request="$case_dir/REQUEST.baseline.md"
48
+ [ -f "$base_request" ] || fail "case $(basename "$case_dir") is missing REQUEST.baseline.md for the control arm"
49
+ if grep -Eiq 'godplans|\.godplans|SKILL\.md|PLAN\.mdx|validator companion' "$base_request"; then
50
+ fail "REQUEST.baseline.md leaks the skill in $(basename "$case_dir")"
51
+ fi
52
+ done
53
+
54
+ help_output=$("$ROOT/scripts/eval.sh" --help)
55
+ printf '%s\n' "$help_output" | grep -q '^Usage:' || fail "help is missing a Usage line"
56
+ if printf '%s\n' "$help_output" | grep -q 'set -euo pipefail'; then
57
+ fail "help leaked shell implementation"
58
+ fi
59
+
60
+ "$ROOT/scripts/eval.sh" --check-cases >/dev/null
61
+ "$ROOT/scripts/eval-matrix.sh" --check >/dev/null
62
+
63
+ mkdir -p "$TMP/cases/plan-case" "$TMP/cases/refusal-case" "$TMP/bin"
64
+
65
+ printf '%s\n' '# plan request' > "$TMP/cases/plan-case/REQUEST.md"
66
+ printf '%s\n' \
67
+ 'outcome|plan|' \
68
+ 'frontmatter|mode|greenfield' \
69
+ 'frontmatter|archetype|cli-tool' \
70
+ 'domain|security|applicable' \
71
+ 'contains|GP-101|' \
72
+ 'gate|prepublication|fresh-prepublication' \
73
+ 'not-contains|PLACEHOLDER|' \
74
+ 'max-count|## Open Questions|1' \
75
+ > "$TMP/cases/plan-case/EXPECTATIONS"
76
+
77
+ printf '%s\n' '# refusal request' > "$TMP/cases/refusal-case/REQUEST.md"
78
+ printf '%s\n' \
79
+ 'outcome|refusal|' \
80
+ 'contains-ci|Usage Policy|' \
81
+ 'not-contains|GP-101|' \
82
+ > "$TMP/cases/refusal-case/EXPECTATIONS"
83
+
84
+ printf '%s\n' 'Produce PLAN.mdx only.' > "$TMP/cases/plan-case/REQUEST.md"
85
+ if GODPLANS_EVAL_CASES="$TMP/cases" "$ROOT/scripts/eval.sh" --check-cases >/dev/null 2>&1; then
86
+ fail "plan-only request contradicted the companion artifact contract"
87
+ fi
88
+ printf '%s\n' '# plan request' > "$TMP/cases/plan-case/REQUEST.md"
89
+
90
+ cp -R "$TMP/cases" "$TMP/cases with space"
91
+ if ! GODPLANS_EVAL_CASES="$TMP/cases with space" "$ROOT/scripts/eval.sh" --check-cases >/dev/null 2>&1; then
92
+ fail "case validation failed when the case path contained spaces"
93
+ fi
94
+
95
+ printf '%s\n' '#!/usr/bin/env sh' \
96
+ 'set -eu' \
97
+ 'case "$1" in' \
98
+ ' */plan-case/REQUEST.md)' \
99
+ ' cp "$GODPLANS_TEST_PLAN" "$2"' \
100
+ ' cp "$GODPLANS_TEST_VALIDATOR" "$(dirname "$2")/validate-plan.sh"' \
101
+ ' cp "$GODPLANS_TEST_SIDECAR" "$(dirname "$2")/PLAN.json"' \
102
+ ' chmod +x "$(dirname "$2")/validate-plan.sh"' \
103
+ ' ;;' \
104
+ ' */refusal-case/REQUEST.md)' \
105
+ ' printf "%s\n" "Refused under the usage policy." > "$2"' \
106
+ ' ;;' \
107
+ ' *) exit 9 ;;' \
108
+ 'esac' \
109
+ > "$TMP/bin/runner"
110
+ chmod +x "$TMP/bin/runner"
111
+
112
+ printf '%s\n' '#!/usr/bin/env sh' 'exit 0' > "$TMP/bin/validator"
113
+ chmod +x "$TMP/bin/validator"
114
+
115
+ printf '%s\n' \
116
+ '---' \
117
+ 'name: example' \
118
+ 'status: planning' \
119
+ 'mode: greenfield' \
120
+ 'archetype: cli-tool' \
121
+ '---' \
122
+ '| security | applicable | scaled baseline |' \
123
+ 'fresh-prepublication' \
124
+ '- [ ] GP-101 [W1.1] Example task' \
125
+ '## Open Questions' \
126
+ > "$TMP/PLAN.mdx"
127
+
128
+ node -e '
129
+ const fs = require("node:fs");
130
+ const crypto = require("node:crypto");
131
+ const plan = fs.readFileSync(process.argv[1]);
132
+ fs.writeFileSync(process.argv[2], JSON.stringify({
133
+ format: "godplans/plan-json@2",
134
+ plan_digest: "sha256:" + crypto.createHash("sha256").update(plan).digest("hex")
135
+ }));
136
+ ' "$TMP/PLAN.mdx" "$TMP/PLAN.json"
137
+
138
+ GODPLANS_EVAL_CASES="$TMP/cases" \
139
+ GODPLANS_EVAL_RUNNER="$TMP/bin/runner" \
140
+ GODPLANS_VALIDATOR="$TMP/bin/validator" \
141
+ GODPLANS_TEST_PLAN="$TMP/PLAN.mdx" \
142
+ GODPLANS_TEST_VALIDATOR="$TMP/bin/validator" \
143
+ GODPLANS_TEST_SIDECAR="$TMP/PLAN.json" \
144
+ "$ROOT/scripts/eval.sh" --output "$TMP/output" > "$TMP/run.out"
145
+
146
+ grep -q '^plan-case[[:space:]]PASS[[:space:]]8/8$' "$TMP/run.out" || fail "plan case did not pass all expectations"
147
+ grep -q '^refusal-case[[:space:]]PASS[[:space:]]3/3$' "$TMP/run.out" || fail "refusal case did not pass all expectations"
148
+ test -f "$TMP/output/plan-case/PLAN.mdx" || fail "plan output was not retained"
149
+ test -f "$TMP/output/plan-case/PLAN.json" || fail "plan sidecar was not retained"
150
+ test -f "$TMP/output/refusal-case/RESPONSE.md" || fail "refusal output was not retained"
151
+
152
+ GODPLANS_EVAL_CASES="$TMP/cases" \
153
+ GODPLANS_VALIDATOR="$TMP/bin/validator" \
154
+ "$ROOT/scripts/eval.sh" --score-only --output "$TMP/output" > "$TMP/rescore.out"
155
+ grep -q '^plan-case[[:space:]]PASS[[:space:]]8/8$' "$TMP/rescore.out" || fail "saved plan did not rescore"
156
+ grep -q '^refusal-case[[:space:]]PASS[[:space:]]3/3$' "$TMP/rescore.out" || fail "saved refusal did not rescore"
157
+
158
+ rm "$TMP/output/plan-case/validate-plan.sh"
159
+ if GODPLANS_EVAL_CASES="$TMP/cases" GODPLANS_VALIDATOR="$TMP/bin/validator" \
160
+ "$ROOT/scripts/eval.sh" --score-only --output "$TMP/output" >/dev/null 2>&1; then
161
+ fail "score-only accepted a missing validator companion"
162
+ fi
163
+
164
+ cp "$TMP/bin/validator" "$TMP/output/plan-case/validate-plan.sh"
165
+ chmod +x "$TMP/output/plan-case/validate-plan.sh"
166
+ perl -0pi -e 's/fresh-prepublication/stale-prepublication/' "$TMP/output/plan-case/PLAN.mdx"
167
+ if GODPLANS_EVAL_CASES="$TMP/cases" GODPLANS_VALIDATOR="$TMP/bin/validator" \
168
+ "$ROOT/scripts/eval.sh" --score-only --output "$TMP/output" >/dev/null 2>&1; then
169
+ fail "score-only accepted a violated gate invariant"
170
+ fi
171
+
172
+ printf '%s\n' 'outcome|unknown|' > "$TMP/cases/plan-case/EXPECTATIONS"
173
+ if GODPLANS_EVAL_CASES="$TMP/cases" "$ROOT/scripts/eval.sh" --check-cases >/dev/null 2>&1; then
174
+ fail "invalid expectation operation was accepted"
175
+ fi
176
+
177
+ # Control arm. Restore the manifest mutated above and run both arms into a
178
+ # fresh output directory so no earlier mutation leaks into the comparison.
179
+ printf '%s\n' \
180
+ 'outcome|plan|' \
181
+ 'frontmatter|mode|greenfield' \
182
+ 'frontmatter|archetype|cli-tool' \
183
+ 'domain|security|applicable' \
184
+ 'contains|GP-101|' \
185
+ 'gate|prepublication|fresh-prepublication' \
186
+ 'not-contains|PLACEHOLDER|' \
187
+ 'max-count|## Open Questions|1' \
188
+ > "$TMP/cases/plan-case/EXPECTATIONS"
189
+
190
+ if GODPLANS_EVAL_CASES="$TMP/cases" GODPLANS_EVAL_RUNNER="$TMP/bin/runner" \
191
+ "$ROOT/scripts/eval.sh" --baseline --output "$TMP/base-output" >/dev/null 2>&1; then
192
+ fail "--baseline ran without a baseline runner"
193
+ fi
194
+
195
+ if GODPLANS_EVAL_CASES="$TMP/cases" GODPLANS_EVAL_RUNNER="$TMP/bin/runner" \
196
+ GODPLANS_EVAL_BASELINE_RUNNER="$TMP/bin/runner" \
197
+ "$ROOT/scripts/eval.sh" --baseline --output "$TMP/base-output" >/dev/null 2>&1; then
198
+ fail "--baseline accepted the skill runner as its own control"
199
+ fi
200
+
201
+ # A weak control: it answers, but produces none of the plan structure.
202
+ printf '%s\n' '#!/usr/bin/env sh' \
203
+ 'set -eu' \
204
+ 'printf "%s\n" "An unaided answer with no plan structure." > "$2"' \
205
+ > "$TMP/bin/baseline-runner"
206
+ chmod +x "$TMP/bin/baseline-runner"
207
+
208
+ GODPLANS_EVAL_CASES="$TMP/cases" \
209
+ GODPLANS_EVAL_RUNNER="$TMP/bin/runner" \
210
+ GODPLANS_EVAL_BASELINE_RUNNER="$TMP/bin/baseline-runner" \
211
+ GODPLANS_VALIDATOR="$TMP/bin/validator" \
212
+ GODPLANS_TEST_PLAN="$TMP/PLAN.mdx" \
213
+ GODPLANS_TEST_VALIDATOR="$TMP/bin/validator" \
214
+ GODPLANS_TEST_SIDECAR="$TMP/PLAN.json" \
215
+ "$ROOT/scripts/eval.sh" --baseline --output "$TMP/base-output" > "$TMP/baseline.out" 2> "$TMP/baseline.err" \
216
+ || fail "the control arm changed the exit code"
217
+
218
+ grep -q '^plan-case[[:space:]]PASS[[:space:]]8/8$' "$TMP/baseline.out" || fail "skill arm regressed under --baseline"
219
+ grep -q '^plan-case[[:space:]]BASE[[:space:]]' "$TMP/baseline.out" || fail "no control row for the plan case"
220
+ grep -q '^AGGREGATE[[:space:]]' "$TMP/baseline.out" || fail "no aggregate row"
221
+ grep -q 'delta +' "$TMP/baseline.out" || fail "no delta reported"
222
+ test -f "$TMP/base-output/plan-case/baseline/PLAN.mdx" || fail "control artifact was not retained"
223
+ if grep -q '^plan-case[[:space:]]MISS' "$TMP/baseline.err"; then
224
+ fail "control misses were reported as skill-arm misses"
225
+ fi
226
+
227
+ # A final EXPECTATIONS line with no trailing newline is still an assertion,
228
+ # both when the manifest is validated and when an artifact is scored.
229
+ mkdir -p "$TMP/eof-cases/eof-case" "$TMP/eof-output/eof-case"
230
+ printf '%s\n' '# refusal request' > "$TMP/eof-cases/eof-case/REQUEST.md"
231
+ printf 'contains|Refused|\noutcome|refusal|' > "$TMP/eof-cases/eof-case/EXPECTATIONS"
232
+ GODPLANS_EVAL_CASES="$TMP/eof-cases" "$ROOT/scripts/eval.sh" --check-cases >/dev/null 2>&1 ||
233
+ fail "an outcome line without a trailing newline was not read"
234
+ printf 'outcome|refusal|\ncontains|MUST-APPEAR|' > "$TMP/eof-cases/eof-case/EXPECTATIONS"
235
+ printf '%s\n' 'Refused under the usage policy.' > "$TMP/eof-output/eof-case/RESPONSE.md"
236
+ if GODPLANS_EVAL_CASES="$TMP/eof-cases" GODPLANS_VALIDATOR="$TMP/bin/validator" \
237
+ "$ROOT/scripts/eval.sh" --score-only --output "$TMP/eof-output" >"$TMP/eof.out" 2>"$TMP/eof.err"; then
238
+ fail "score-only dropped a final expectation that had no trailing newline"
239
+ fi
240
+ grep -q '^eof-case[[:space:]]FAIL[[:space:]]1/2$' "$TMP/eof.out" ||
241
+ fail "the unterminated final expectation was not scored"
242
+ grep -q '^eof-case[[:space:]]MISS[[:space:]]contains|MUST-APPEAR|$' "$TMP/eof.err" ||
243
+ fail "the unterminated final expectation was not reported as a miss"
244
+
245
+ # A control that beats the skill arm reports a signed negative delta, never "+-N".
246
+ mkdir -p "$TMP/delta-cases/control-wins"
247
+ printf '%s\n' '# refusal request' > "$TMP/delta-cases/control-wins/REQUEST.md"
248
+ printf '%s\n' 'outcome|refusal|' 'contains|CONTROL-ONLY|' > "$TMP/delta-cases/control-wins/EXPECTATIONS"
249
+ printf '%s\n' '#!/usr/bin/env sh' 'printf "%s\n" "skill answer" > "$2"' > "$TMP/bin/weak-skill"
250
+ printf '%s\n' '#!/usr/bin/env sh' 'printf "%s\n" "CONTROL-ONLY answer" > "$2"' > "$TMP/bin/strong-control"
251
+ chmod +x "$TMP/bin/weak-skill" "$TMP/bin/strong-control"
252
+ if GODPLANS_EVAL_CASES="$TMP/delta-cases" \
253
+ GODPLANS_EVAL_RUNNER="$TMP/bin/weak-skill" \
254
+ GODPLANS_EVAL_BASELINE_RUNNER="$TMP/bin/strong-control" \
255
+ GODPLANS_VALIDATOR="$TMP/bin/validator" \
256
+ "$ROOT/scripts/eval.sh" --baseline --output "$TMP/delta-output" >"$TMP/delta.out" 2>/dev/null; then
257
+ fail "a failing skill arm exited zero"
258
+ fi
259
+ grep -q '^control-wins[[:space:]]BASE[[:space:]]2/2[[:space:]]delta -1$' "$TMP/delta.out" ||
260
+ fail "a negative per-case delta was not reported as -1"
261
+ grep -q '^AGGREGATE[[:space:]]skill 1/2[[:space:]]baseline 2/2[[:space:]]delta -1$' "$TMP/delta.out" ||
262
+ fail "a negative aggregate delta was not reported as -1"
263
+ if grep -q 'delta +-' "$TMP/delta.out"; then
264
+ fail "a negative delta carried a plus sign"
265
+ fi
266
+
267
+ # The matrix coordinator runs against a scratch repository, so its fake
268
+ # profiles and two-case roster never touch the real runners, cases, or roster.
269
+ MATRIX_ROOT="$TMP/matrix-repo"
270
+ mkdir -p "$MATRIX_ROOT/scripts" "$MATRIX_ROOT/evals/runners" "$MATRIX_ROOT/evals/cases"
271
+ for script in eval.sh eval-matrix.sh summarize-eval.js summarize-matrix.js; do
272
+ cp "$ROOT/scripts/$script" "$MATRIX_ROOT/scripts/$script"
273
+ done
274
+ add_matrix_case() {
275
+ mkdir -p "$MATRIX_ROOT/evals/cases/$1"
276
+ printf '%s\n' '# refusal request' > "$MATRIX_ROOT/evals/cases/$1/REQUEST.md"
277
+ printf '%s\n' '# neutral request' > "$MATRIX_ROOT/evals/cases/$1/REQUEST.baseline.md"
278
+ printf '%s\n' 'outcome|refusal|' 'contains|REFUSED|' > "$MATRIX_ROOT/evals/cases/$1/EXPECTATIONS"
279
+ }
280
+ add_matrix_case alpha
281
+ add_matrix_case beta
282
+ printf '%s\n' '# scratch roster' 'alpha' ' beta # trailing comment' '' > "$MATRIX_ROOT/evals/cases-roster.txt"
283
+
284
+ write_runner() {
285
+ printf '%s\n' '#!/usr/bin/env sh' 'set -eu' "$2" > "$1"
286
+ chmod +x "$1"
287
+ }
288
+ for profile in fa fb fc; do
289
+ write_runner "$MATRIX_ROOT/evals/runners/$profile.sh" 'printf "%s\n" "REFUSED by policy" > "$2"'
290
+ write_runner "$MATRIX_ROOT/evals/runners/$profile-baseline.sh" 'printf "%s\n" "plain answer" > "$2"'
291
+ done
292
+
293
+ run_matrix() {
294
+ GODPLANS_MATRIX_PROFILES="fa fb fc" GODPLANS_VALIDATOR="$TMP/bin/validator" \
295
+ bash "$MATRIX_ROOT/scripts/eval-matrix.sh" "$@"
296
+ }
297
+
298
+ run_matrix --check >/dev/null 2>"$TMP/matrix-check.err" ||
299
+ fail "matrix check rejected a complete two-case roster: $(cat "$TMP/matrix-check.err")"
300
+ mv "$MATRIX_ROOT/evals/cases/beta/REQUEST.baseline.md" "$TMP/beta-baseline.md"
301
+ if run_matrix --check >/dev/null 2>"$TMP/matrix-incomplete.err"; then
302
+ fail "matrix check accepted a case without a control request"
303
+ fi
304
+ grep -q 'beta' "$TMP/matrix-incomplete.err" || fail "incomplete matrix case was not named"
305
+ mv "$TMP/beta-baseline.md" "$MATRIX_ROOT/evals/cases/beta/REQUEST.baseline.md"
306
+
307
+ # The roster, not the directory listing, is the expected case set. A case
308
+ # directory the roster does not list, or a listed case whose directory is gone,
309
+ # fails the check instead of changing the case count.
310
+ add_matrix_case gamma
311
+ if run_matrix --check >/dev/null 2>"$TMP/matrix-unlisted.err"; then
312
+ fail "matrix check accepted a case directory missing from the roster"
313
+ fi
314
+ grep -q 'evals/cases/gamma is not in evals/cases-roster.txt' "$TMP/matrix-unlisted.err" ||
315
+ fail "an unlisted case directory was not named: $(cat "$TMP/matrix-unlisted.err")"
316
+ rm -rf "$MATRIX_ROOT/evals/cases/gamma"
317
+ mv "$MATRIX_ROOT/evals/cases/beta" "$TMP/beta-case"
318
+ if run_matrix --check >/dev/null 2>"$TMP/matrix-dropped.err"; then
319
+ fail "matrix check accepted a roster case whose directory is missing"
320
+ fi
321
+ grep -q 'lists beta, but evals/cases/beta does not exist' "$TMP/matrix-dropped.err" ||
322
+ fail "a dropped case was not named: $(cat "$TMP/matrix-dropped.err")"
323
+ mv "$TMP/beta-case" "$MATRIX_ROOT/evals/cases/beta"
324
+ cp "$MATRIX_ROOT/evals/cases-roster.txt" "$TMP/roster.saved"
325
+ printf '%s\n' 'alpha' 'beta' 'alpha' > "$MATRIX_ROOT/evals/cases-roster.txt"
326
+ if run_matrix --check >/dev/null 2>"$TMP/matrix-duplicate.err"; then
327
+ fail "matrix check accepted a duplicate roster entry"
328
+ fi
329
+ grep -q 'duplicate case in evals/cases-roster.txt: alpha' "$TMP/matrix-duplicate.err" ||
330
+ fail "a duplicate roster entry was not named: $(cat "$TMP/matrix-duplicate.err")"
331
+ cp "$TMP/roster.saved" "$MATRIX_ROOT/evals/cases-roster.txt"
332
+ run_matrix --check >/dev/null 2>"$TMP/matrix-check.err" ||
333
+ fail "matrix check rejected the restored roster: $(cat "$TMP/matrix-check.err")"
334
+
335
+ # One failing case in the first profiles must not abort the profiles after it.
336
+ write_runner "$MATRIX_ROOT/evals/runners/fb.sh" \
337
+ 'case "$1" in */alpha/*) printf "%s\n" "plain answer" > "$2" ;; *) printf "%s\n" "REFUSED by policy" > "$2" ;; esac'
338
+ if run_matrix --output "$TMP/matrix-fail" >/dev/null 2>&1; then
339
+ fail "matrix exited zero with a failing case"
340
+ fi
341
+ test -s "$TMP/matrix-fail/fc/EVAL.tsv" || fail "a failing profile aborted the profiles after it"
342
+ test -s "$TMP/matrix-fail/MATRIX.json" || fail "a failing case suppressed the matrix summary"
343
+
344
+ # A missing run fails the matrix and leaves no summary, but later profiles still run.
345
+ write_runner "$MATRIX_ROOT/evals/runners/fb.sh" \
346
+ 'case "$1" in */alpha/*) exit 1 ;; *) printf "%s\n" "REFUSED by policy" > "$2" ;; esac'
347
+ if run_matrix --output "$TMP/matrix-missing" >/dev/null 2>"$TMP/matrix-missing.err"; then
348
+ fail "matrix exited zero with a missing run"
349
+ fi
350
+ test -s "$TMP/matrix-missing/fc/EVAL.tsv" || fail "a runner error aborted the profiles after it"
351
+ [ ! -e "$TMP/matrix-missing/MATRIX.json" ] || fail "matrix summarized a profile with a missing run"
352
+ grep -q 'profile fb has no scored skill or control arm for alpha' "$TMP/matrix-missing.err" ||
353
+ fail "the missing run was not named: $(cat "$TMP/matrix-missing.err")"
354
+
355
+ # A control run that errors leaves a `BASE runner-error` marker, not a score.
356
+ # eval.sh does not fail on it, so the summarizer must, naming only that arm.
357
+ write_runner "$MATRIX_ROOT/evals/runners/fb.sh" 'printf "%s\n" "REFUSED by policy" > "$2"'
358
+ write_runner "$MATRIX_ROOT/evals/runners/fb-baseline.sh" \
359
+ 'case "$1" in */alpha/*) exit 1 ;; *) printf "%s\n" "plain answer" > "$2" ;; esac'
360
+ if run_matrix --output "$TMP/matrix-no-control" >/dev/null 2>"$TMP/matrix-no-control.err"; then
361
+ fail "matrix exited zero with a missing control run"
362
+ fi
363
+ test -s "$TMP/matrix-no-control/fc/EVAL.tsv" || fail "a control runner error aborted the profiles after it"
364
+ grep -q '^alpha[[:space:]]BASE[[:space:]]runner-error$' "$TMP/matrix-no-control/fb/EVAL.tsv" ||
365
+ fail "the control runner error was not recorded in EVAL.tsv"
366
+ [ ! -e "$TMP/matrix-no-control/MATRIX.json" ] || fail "matrix summarized a profile with a missing control run"
367
+ grep -q 'profile fb has no scored control arm for alpha' "$TMP/matrix-no-control.err" ||
368
+ fail "the missing control run was not named: $(cat "$TMP/matrix-no-control.err")"
369
+ write_runner "$MATRIX_ROOT/evals/runners/fb-baseline.sh" 'printf "%s\n" "plain answer" > "$2"'
370
+
371
+ run_matrix --output "$TMP/matrix-pass" >/dev/null 2>&1 || fail "a clean matrix run failed"
372
+ node -e '
373
+ const matrix = require(process.argv[1]);
374
+ if (matrix.case_count !== 2) throw new Error("case count");
375
+ ' "$TMP/matrix-pass/MATRIX.json" || fail "matrix did not take its case count from the roster"
376
+
377
+ echo "ok [eval-harness]"
@@ -0,0 +1,243 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6
+ TMP="$(mktemp -d)"
7
+ trap 'rm -rf "$TMP"' EXIT
8
+
9
+ fail() {
10
+ echo "FAIL [evidence-harnesses] $*" >&2
11
+ exit 1
12
+ }
13
+
14
+ if grep -R -E '(ANTHROPIC|GEMINI|GOOGLE)_API_[K]EY' \
15
+ "$ROOT/skills" "$ROOT/evals" "$ROOT/scripts" "$ROOT/README.md" "$ROOT/docs" \
16
+ >/dev/null; then
17
+ fail "skill and evaluation surfaces must not require provider key variables"
18
+ fi
19
+
20
+ mkdir -p "$TMP/matrix/codex" "$TMP/bin"
21
+ case_count=0
22
+ for case_dir in "$ROOT"/evals/cases/*; do
23
+ case_name=$(basename "$case_dir")
24
+ if grep -q '^outcome|plan|' "$case_dir/EXPECTATIONS" && [ "$case_count" -lt 5 ]; then
25
+ mkdir -p "$TMP/matrix/codex/$case_name/baseline"
26
+ printf '%s\n' "# treatment plan for $case_name" > "$TMP/matrix/codex/$case_name/PLAN.mdx"
27
+ printf '%s\n' "# control plan for $case_name" > "$TMP/matrix/codex/$case_name/baseline/PLAN.mdx"
28
+ case_count=$((case_count + 1))
29
+ fi
30
+ done
31
+ [ "$case_count" -eq 5 ] || fail "could not prepare five external-grade pairs"
32
+
33
+ for judge in one two; do
34
+ if [ "$judge" = "one" ]; then
35
+ score_a=24
36
+ score_b=18
37
+ else
38
+ score_a=22
39
+ score_b=20
40
+ fi
41
+ # The fixture judge is schema-less, like the Gemini adapter: it reads the
42
+ # criterion keys from the packet's Required JSON schema, so a packet that
43
+ # stops carrying the grade shape fails here.
44
+ printf '%s\n' \
45
+ '#!/usr/bin/env bash' \
46
+ 'set -eu' \
47
+ 'packet=$(sed -n "s/^# Packet //p" "$1" | head -1)' \
48
+ 'node - "$packet" "$1" "$2" '"$score_a"' '"$score_b"' <<'"'"'NODE'"'"'' \
49
+ 'const fs = require("node:fs");' \
50
+ 'const [packet, packetFile, output, totalA, totalB] = process.argv.slice(2);' \
51
+ 'const match = /^## Required JSON\n[\s\S]*?```json\n([\s\S]*?)\n```/m.exec(fs.readFileSync(packetFile, "utf8"));' \
52
+ 'if (!match) throw new Error("packet carries no Required JSON schema");' \
53
+ 'const criteria = JSON.parse(match[1]).properties.plans.items.properties.scores.required;' \
54
+ 'const scores = (total) => { const base = Math.floor(Number(total) / criteria.length); const extra = Number(total) % criteria.length; return Object.fromEntries(criteria.map((key, index) => [key, base + (index < extra ? 1 : 0)])); };' \
55
+ 'const grade = { packet_id: packet, plans: [{ label: "A", scores: scores(totalA), total: Number(totalA) }, { label: "B", scores: scores(totalB), total: Number(totalB) }], preference: "A", rationale: "fixture" };' \
56
+ 'fs.writeFileSync(output, JSON.stringify(grade));' \
57
+ 'NODE' \
58
+ > "$TMP/bin/judge-$judge"
59
+ chmod +x "$TMP/bin/judge-$judge"
60
+ done
61
+
62
+ node "$ROOT/scripts/eval-external.js" \
63
+ --matrix "$TMP/matrix" \
64
+ --source-profile codex \
65
+ --judge "one=$TMP/bin/judge-one" \
66
+ --judge "two=$TMP/bin/judge-two" \
67
+ --output "$TMP/external" >/dev/null
68
+
69
+ node -e '
70
+ const summary = require(process.argv[1]);
71
+ if (summary.sample_size !== 5) throw new Error("sample size");
72
+ if (summary.mean_absolute_inter_rater_gap !== 2) throw new Error("inter-rater gap");
73
+ if (!summary.judges.one || !summary.judges.two) throw new Error("judge summary");
74
+ ' "$TMP/external/SUMMARY.json" || fail "external-grade summary is wrong"
75
+ for packet in "$TMP"/external/packets/*.md; do
76
+ grep -q 'decision_completeness' "$packet" && grep -q '"preference"' "$packet" ||
77
+ fail "packet does not carry the grade schema: $(basename "$packet")"
78
+ done
79
+
80
+ # Judges are distinct by label, and a label names a grade directory, so a
81
+ # repeated label, one that differs only in case (one directory on a
82
+ # case-insensitive file system), or one that is not a single safe path segment
83
+ # is refused before any packet is written.
84
+ if node "$ROOT/scripts/eval-external.js" \
85
+ --matrix "$TMP/matrix" \
86
+ --source-profile codex \
87
+ --judge "one=$TMP/bin/judge-one" \
88
+ --judge "one=$TMP/bin/judge-two" \
89
+ --output "$TMP/external-dup" >/dev/null 2>"$TMP/external-dup.err"; then
90
+ fail "external grading accepted two judges with the same label"
91
+ fi
92
+ grep -q 'duplicate judge label: one' "$TMP/external-dup.err" ||
93
+ fail "a duplicate judge label was not named: $(cat "$TMP/external-dup.err")"
94
+ [ ! -e "$TMP/external-dup" ] || fail "a duplicate judge label still wrote output"
95
+ if node "$ROOT/scripts/eval-external.js" \
96
+ --matrix "$TMP/matrix" \
97
+ --source-profile codex \
98
+ --judge "one=$TMP/bin/judge-one" \
99
+ --judge "ONE=$TMP/bin/judge-two" \
100
+ --output "$TMP/external-case" >/dev/null 2>"$TMP/external-case.err"; then
101
+ fail "external grading accepted judge labels that differ only in case"
102
+ fi
103
+ grep -q 'duplicate judge label: ONE' "$TMP/external-case.err" ||
104
+ fail "a case-variant judge label was not named: $(cat "$TMP/external-case.err")"
105
+ [ ! -e "$TMP/external-case" ] || fail "a case-variant judge label still wrote output"
106
+ if node "$ROOT/scripts/eval-external.js" \
107
+ --matrix "$TMP/matrix" \
108
+ --source-profile codex \
109
+ --judge "../one=$TMP/bin/judge-one" \
110
+ --judge "two=$TMP/bin/judge-two" \
111
+ --output "$TMP/external-label" >/dev/null 2>"$TMP/external-label.err"; then
112
+ fail "external grading accepted a judge label that is not a path segment"
113
+ fi
114
+ grep -q 'invalid judge label: \.\./one' "$TMP/external-label.err" ||
115
+ fail "an unsafe judge label was not named: $(cat "$TMP/external-label.err")"
116
+
117
+ printf '%s\n' \
118
+ '#!/usr/bin/env bash' \
119
+ 'set -eu' \
120
+ 'printf "%s\n" "treatment" > "$2"' \
121
+ > "$TMP/bin/plan-treatment"
122
+ printf '%s\n' \
123
+ '#!/usr/bin/env bash' \
124
+ 'set -eu' \
125
+ 'printf "%s\n" "control" > "$2"' \
126
+ > "$TMP/bin/plan-control"
127
+ printf '%s\n' \
128
+ '#!/usr/bin/env bash' \
129
+ 'set -eu' \
130
+ 'plan=$1' \
131
+ 'output=$3' \
132
+ 'mkdir -p "$output/repository/test"' \
133
+ 'cp "$plan" "$output/repository/arm.txt"' \
134
+ 'printf "%s\n" '"'"'{"scripts":{"test":"node --test"}}'"'"' > "$output/repository/package.json"' \
135
+ 'printf "%s\n" '"'"'const test = require("node:test"); const assert = require("node:assert"); test("fixture", () => assert.equal(1, 1));'"'"' > "$output/repository/test/fixture.test.js"' \
136
+ > "$TMP/bin/build"
137
+ printf '%s\n' \
138
+ '#!/usr/bin/env bash' \
139
+ 'set -eu' \
140
+ 'repo=$1' \
141
+ 'output=$2' \
142
+ 'mkdir -p "$output"' \
143
+ 'if grep -q control "$repo/arm.txt"; then findings='"'"'[{"severity":"Critical","status":"open"},{"severity":"High","status":"open"}]'"'"'; else findings="[]"; fi' \
144
+ 'printf '"'"'{"audit":{"engine_version":"2.11.0","pack_version":"2.11.0"},"findings":%s,"computed":{"verdict":"fixture"}}\n'"'"' "$findings" > "$output/AUDIT.json"' \
145
+ > "$TMP/bin/audit"
146
+ chmod +x "$TMP/bin/plan-treatment" "$TMP/bin/plan-control" "$TMP/bin/build" "$TMP/bin/audit"
147
+
148
+ node "$ROOT/scripts/eval-outcome.js" \
149
+ --case tenant-notes-api \
150
+ --plan-runner "$TMP/bin/plan-treatment" \
151
+ --control-plan-runner "$TMP/bin/plan-control" \
152
+ --build-runner "$TMP/bin/build" \
153
+ --audit-runner "$TMP/bin/audit" \
154
+ --output "$TMP/outcome" >/dev/null
155
+
156
+ node -e '
157
+ const summary = require(process.argv[1]);
158
+ if (!summary.treatment_better) throw new Error("treatment result");
159
+ if (summary.critical_or_high_delta !== -2) throw new Error("finding delta");
160
+ if (!summary.treatment.verify_passed || !summary.control.verify_passed) throw new Error("verification");
161
+ ' "$TMP/outcome/SUMMARY.json" || fail "build-outcome summary is wrong"
162
+
163
+ for verify_script in "$ROOT"/evals/outcomes/cases/*/VERIFY.sh; do
164
+ bash -n "$verify_script" || fail "invalid shell syntax: ${verify_script#"$ROOT"/}"
165
+ [ -x "$verify_script" ] || fail "outcome verifier is not executable: ${verify_script#"$ROOT"/}"
166
+ done
167
+
168
+ # A verifier that cannot run is a harness error, not a build that failed
169
+ # verification; any exit status the verifier itself returns is the verdict.
170
+ # The probe case lives in a scratch repository so the real outcome cases never
171
+ # change mode or content.
172
+ OUTCOME_ROOT="$TMP/outcome-repo"
173
+ PROBE="$OUTCOME_ROOT/evals/outcomes/cases/probe"
174
+ mkdir -p "$OUTCOME_ROOT/scripts" "$PROBE"
175
+ cp "$ROOT/scripts/eval-outcome.js" "$ROOT/scripts/outcome-summary.js" "$OUTCOME_ROOT/scripts/"
176
+ printf '%s\n' '# probe request' > "$PROBE/REQUEST.md"
177
+
178
+ run_probe() {
179
+ node "$OUTCOME_ROOT/scripts/eval-outcome.js" \
180
+ --case probe \
181
+ --plan-runner "$TMP/bin/plan-treatment" \
182
+ --control-plan-runner "$TMP/bin/plan-control" \
183
+ --build-runner "$TMP/bin/build" \
184
+ --audit-runner "$TMP/bin/audit" \
185
+ --output "$1"
186
+ }
187
+
188
+ printf '%s\n' '#!/usr/bin/env bash' 'exit 0' > "$PROBE/VERIFY.sh"
189
+ chmod 644 "$PROBE/VERIFY.sh"
190
+ if run_probe "$TMP/probe-mode" >/dev/null 2>"$TMP/probe-mode.err"; then
191
+ fail "a non-executable VERIFY.sh was scored as a verification result"
192
+ fi
193
+ [ ! -e "$TMP/probe-mode/SUMMARY.json" ] || fail "a non-executable VERIFY.sh still produced a summary"
194
+ grep -q 'VERIFY.sh is not executable' "$TMP/probe-mode.err" ||
195
+ fail "a non-executable VERIFY.sh was not named: $(cat "$TMP/probe-mode.err")"
196
+
197
+ # An interpreter the verifier names but the host lacks. Through env it would
198
+ # exit 127 like a failing command, so it must be caught before any arm runs.
199
+ for shebang in '#!/usr/bin/env godplans-missing-interpreter' '#!/nonexistent/godplans-missing-interpreter'; do
200
+ printf '%s\n' "$shebang" 'exit 0' > "$PROBE/VERIFY.sh"
201
+ chmod 755 "$PROBE/VERIFY.sh"
202
+ rm -rf "$TMP/probe-interpreter"
203
+ if run_probe "$TMP/probe-interpreter" >/dev/null 2>"$TMP/probe-interpreter.err"; then
204
+ fail "a verifier whose interpreter is missing was scored ($shebang)"
205
+ fi
206
+ [ ! -e "$TMP/probe-interpreter/treatment" ] || fail "arms ran before the missing interpreter was caught ($shebang)"
207
+ grep -q 'harness error: VERIFY.sh interpreter' "$TMP/probe-interpreter.err" ||
208
+ fail "a missing verifier interpreter was not a harness error: $(cat "$TMP/probe-interpreter.err")"
209
+ done
210
+
211
+ # A command inside the verifier that the build never installed exits 127.
212
+ # That is the build failing verification, not a harness fault.
213
+ printf '%s\n' '#!/usr/bin/env bash' 'set -eu' 'godplans-missing-verifier-command' > "$PROBE/VERIFY.sh"
214
+ run_probe "$TMP/probe-missing" >/dev/null 2>"$TMP/probe-missing.err" ||
215
+ fail "an exit 127 inside the verifier stopped the harness: $(cat "$TMP/probe-missing.err")"
216
+ node -e '
217
+ const summary = require(process.argv[1]);
218
+ if (summary.treatment.verify_passed || summary.control.verify_passed) throw new Error("verification");
219
+ ' "$TMP/probe-missing/SUMMARY.json" || fail "an exit 127 inside the verifier was not recorded as a failed verification"
220
+
221
+ printf '%s\n' '#!/usr/bin/env bash' 'exit 1' > "$PROBE/VERIFY.sh"
222
+ run_probe "$TMP/probe-fail" >/dev/null 2>&1 || fail "an ordinary verification failure stopped the harness"
223
+ node -e '
224
+ const summary = require(process.argv[1]);
225
+ if (summary.treatment.verify_passed || summary.control.verify_passed) throw new Error("verification");
226
+ ' "$TMP/probe-fail/SUMMARY.json" || fail "an ordinary verification failure was not recorded"
227
+
228
+ # A verifier stopped by a signal is a harness error. Rerunning into a directory
229
+ # that already holds a summary must not leave that stale summary behind.
230
+ printf '%s\n' '#!/usr/bin/env bash' 'exit 0' > "$PROBE/VERIFY.sh"
231
+ run_probe "$TMP/probe-rerun" >/dev/null 2>&1 || fail "a passing probe run failed"
232
+ [ -f "$TMP/probe-rerun/SUMMARY.json" ] || fail "a passing probe run wrote no summary"
233
+ [ -f "$TMP/probe-rerun/SUMMARY.md" ] || fail "a passing probe run wrote no SUMMARY.md"
234
+ printf '%s\n' '#!/usr/bin/env bash' 'kill -TERM $$' > "$PROBE/VERIFY.sh"
235
+ if run_probe "$TMP/probe-rerun" >/dev/null 2>"$TMP/probe-rerun.err"; then
236
+ fail "a verifier stopped by a signal was scored as a verification result"
237
+ fi
238
+ grep -q 'harness error: VERIFY.sh was stopped by SIGTERM' "$TMP/probe-rerun.err" ||
239
+ fail "a signalled verifier was not a harness error: $(cat "$TMP/probe-rerun.err")"
240
+ [ ! -e "$TMP/probe-rerun/SUMMARY.json" ] || fail "a failed rerun left the earlier SUMMARY.json in place"
241
+ [ ! -e "$TMP/probe-rerun/SUMMARY.md" ] || fail "a failed rerun left the earlier SUMMARY.md in place"
242
+
243
+ echo "ok [evidence-harnesses]"