@hxp-tools/godplans 0.0.0-stage → 2.0.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.
- package/CHANGELOG.md +1202 -0
- package/LICENSE +21 -0
- package/PROMPT.md +4006 -0
- package/README.md +245 -2
- package/bin/godplans.js +93 -0
- package/docs/ARCHITECTURE.md +136 -0
- package/docs/RELEASING.md +107 -0
- package/docs/assets/badge-approved.svg +12 -0
- package/docs/assets/badge-done.svg +11 -0
- package/docs/assets/badge-graded.svg +12 -0
- package/docs/assets/badge-validated.svg +10 -0
- package/docs/assets/hero.svg +37 -0
- package/docs/assets/quest-map.svg +53 -0
- package/evals/README.md +295 -0
- package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
- package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
- package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
- package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
- package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
- package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
- package/evals/cases/brownfield-cli/REQUEST.md +10 -0
- package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
- package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
- package/evals/cases/compliance-refusal/REQUEST.md +8 -0
- package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
- package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
- package/evals/cases/greenfield-saas/REQUEST.md +11 -0
- package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
- package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
- package/evals/cases/nested-pillars/REQUEST.md +11 -0
- package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
- package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
- package/evals/cases/observability-evidence/REQUEST.md +11 -0
- package/evals/cases/product-business/EXPECTATIONS +18 -0
- package/evals/cases/product-business/REQUEST.baseline.md +13 -0
- package/evals/cases/product-business/REQUEST.md +14 -0
- package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
- package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
- package/evals/cases/product-form-routing/REQUEST.md +11 -0
- package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
- package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
- package/evals/cases/prose-integrity/REQUEST.md +20 -0
- package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
- package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
- package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
- package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
- package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
- package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
- package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
- package/evals/cases/stale-prepublication/REQUEST.md +13 -0
- package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
- package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
- package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
- package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
- package/evals/cases/weekend-library/EXPECTATIONS +19 -0
- package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
- package/evals/cases/weekend-library/REQUEST.md +11 -0
- package/evals/cases-roster.txt +19 -0
- package/evals/external/GRADE.schema.json +39 -0
- package/evals/external/README.md +42 -0
- package/evals/external/RUBRIC.md +32 -0
- package/evals/metrics/context-cost.json +154 -0
- package/evals/outcomes/README.md +65 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
- package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
- package/evals/runners/claude-baseline.sh +4 -0
- package/evals/runners/claude-grade.sh +3 -0
- package/evals/runners/claude.sh +4 -0
- package/evals/runners/codex-baseline.sh +181 -0
- package/evals/runners/codex-builder.sh +96 -0
- package/evals/runners/codex-godaudits.sh +84 -0
- package/evals/runners/codex.sh +147 -0
- package/evals/runners/gemini-baseline.sh +4 -0
- package/evals/runners/gemini-grade.sh +3 -0
- package/evals/runners/gemini.sh +4 -0
- package/evals/runners/vendor-cli.sh +257 -0
- package/evals/runners/vendor-grade.sh +82 -0
- package/install.sh +323 -0
- package/package.json +91 -4
- package/requirements/skills-ref.txt +2 -0
- package/scripts/build-catalog.js +114 -0
- package/scripts/build-prompt.sh +257 -0
- package/scripts/context-metrics.js +118 -0
- package/scripts/eval-external.js +226 -0
- package/scripts/eval-matrix.sh +172 -0
- package/scripts/eval-outcome.js +143 -0
- package/scripts/eval.sh +321 -0
- package/scripts/lint-parity.js +331 -0
- package/scripts/lint.sh +743 -0
- package/scripts/outcome-summary.js +126 -0
- package/scripts/release-check.sh +108 -0
- package/scripts/release-prepare.js +41 -0
- package/scripts/summarize-eval.js +91 -0
- package/scripts/summarize-matrix.js +101 -0
- package/scripts/version-sync.js +65 -0
- package/skills/godplans/SKILL.md +192 -0
- package/skills/godplans/references/agent-memory.md +168 -0
- package/skills/godplans/references/architecture.md +189 -0
- package/skills/godplans/references/build.md +130 -0
- package/skills/godplans/references/business.md +252 -0
- package/skills/godplans/references/code-quality.md +165 -0
- package/skills/godplans/references/compliance.md +59 -0
- package/skills/godplans/references/database.md +157 -0
- package/skills/godplans/references/deploy.md +146 -0
- package/skills/godplans/references/discovery.md +297 -0
- package/skills/godplans/references/doc-set.md +243 -0
- package/skills/godplans/references/exemplar.md +228 -0
- package/skills/godplans/references/launch.md +162 -0
- package/skills/godplans/references/llm.md +132 -0
- package/skills/godplans/references/observe.md +178 -0
- package/skills/godplans/references/plan-format.md +340 -0
- package/skills/godplans/references/product.md +130 -0
- package/skills/godplans/references/repo.md +184 -0
- package/skills/godplans/references/roadmap.md +158 -0
- package/skills/godplans/references/security.md +156 -0
- package/skills/godplans/references/seo.md +133 -0
- package/skills/godplans/references/stack.md +133 -0
- package/skills/godplans/references/style-genome.md +198 -0
- package/skills/godplans/references/ui.md +153 -0
- package/skills/godplans/references/ux.md +150 -0
- package/skills/godplans/schemas/PLAN.schema.json +275 -0
- package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
- package/skills/godplans/scripts/plan-halflife.sh +76 -0
- package/skills/godplans/scripts/style-stats.py +630 -0
- package/skills/godplans/scripts/validate-plan.sh +1709 -0
- package/skills/godplans/templates/PLAN.template.mdx +269 -0
- package/tests/agent-memory-guidance.sh +32 -0
- package/tests/build-catalog.sh +81 -0
- package/tests/codex-runner.sh +139 -0
- package/tests/eval-harness.sh +377 -0
- package/tests/evidence-harnesses.sh +243 -0
- package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
- package/tests/install-regression.sh +246 -0
- package/tests/lib/plan-schema-check.js +163 -0
- package/tests/lint-selftest.sh +582 -0
- package/tests/package-contents.sh +143 -0
- package/tests/portable-prompt.test.sh +261 -0
- package/tests/release-tooling.sh +204 -0
- package/tests/run.sh +14 -0
- package/tests/script-usage.sh +37 -0
- package/tests/style-stats.sh +170 -0
- package/tests/validate-plan.sh +1970 -0
- package/tests/vendor-runner.sh +291 -0
|
@@ -0,0 +1,1970 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -u
|
|
4
|
+
|
|
5
|
+
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
6
|
+
# The drift fixtures rerun commands such as `test -f package.json`, which name
|
|
7
|
+
# repository paths, so the suite runs from the root wherever it was started.
|
|
8
|
+
cd "$ROOT_DIR" || exit 1
|
|
9
|
+
VALIDATOR="$ROOT_DIR/skills/godplans/scripts/validate-plan.sh"
|
|
10
|
+
TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/godplans-validator.XXXXXX")"
|
|
11
|
+
PASS_COUNT=0
|
|
12
|
+
FAIL_COUNT=0
|
|
13
|
+
|
|
14
|
+
trap 'rm -rf "$TMP_DIR"' EXIT HUP INT TERM
|
|
15
|
+
|
|
16
|
+
write_valid_plan() {
|
|
17
|
+
file=$1
|
|
18
|
+
status=$2
|
|
19
|
+
cat > "$file" <<'EOF'
|
|
20
|
+
---
|
|
21
|
+
name: validator-fixture
|
|
22
|
+
plan_version: 1
|
|
23
|
+
status: PLAN_STATUS
|
|
24
|
+
created: 2026-07-13
|
|
25
|
+
updated: 2026-07-13
|
|
26
|
+
mode: greenfield
|
|
27
|
+
product_form: cli-or-sdk
|
|
28
|
+
archetype: cli-tool
|
|
29
|
+
archetype_confidence: high
|
|
30
|
+
overlays: []
|
|
31
|
+
public_release: false
|
|
32
|
+
source_revision: none
|
|
33
|
+
input_digest: sha256:1c7ca1006bb3157ad989c1f1dd1cd1d6e8e2a44d9509821ffa43f3be205a12d5
|
|
34
|
+
validated_at: 2026-07-13T12:00:00Z
|
|
35
|
+
domains_applicable: [product, architecture, stack, security, code-quality, style-genome, agent-memory, repo, build, roadmap]
|
|
36
|
+
domains_deferred: []
|
|
37
|
+
domains_excluded: [database, business, llm, ux, ui, seo, deploy, observe, launch]
|
|
38
|
+
progress:
|
|
39
|
+
phases_total: 2
|
|
40
|
+
phases_done: 0
|
|
41
|
+
tasks_total: 3
|
|
42
|
+
tasks_done: 0
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# Validator fixture master plan
|
|
46
|
+
|
|
47
|
+
Done means the validator fixture passes every structural check.
|
|
48
|
+
|
|
49
|
+
## Scope and non-goals
|
|
50
|
+
|
|
51
|
+
In scope: validator behavior. Non-goals: application code.
|
|
52
|
+
|
|
53
|
+
## Plan provenance
|
|
54
|
+
|
|
55
|
+
Source revision: none
|
|
56
|
+
Input digest: sha256:1c7ca1006bb3157ad989c1f1dd1cd1d6e8e2a44d9509821ffa43f3be205a12d5
|
|
57
|
+
Validated at: 2026-07-13T12:00:00Z
|
|
58
|
+
Evidence inventory:
|
|
59
|
+
- `intake` = `sha256:1111111111111111111111111111111111111111111111111111111111111111`
|
|
60
|
+
|
|
61
|
+
## Product form
|
|
62
|
+
|
|
63
|
+
Primary: CLI or SDK. A vertical slice runs from command parsing through deterministic output and a consumer fixture.
|
|
64
|
+
|
|
65
|
+
### Archetype confidence
|
|
66
|
+
|
|
67
|
+
- Primary: cli-tool (score 0.86)
|
|
68
|
+
- Runner-up: library (score 0.29)
|
|
69
|
+
- Margin: 57 points
|
|
70
|
+
- Confidence: high
|
|
71
|
+
- Vetoes applied: none
|
|
72
|
+
- Overlays: none
|
|
73
|
+
- If the runner-up is right: +1 tasks and +0 phases; the consumer fixture becomes a published API surface check
|
|
74
|
+
|
|
75
|
+
## Compliance gate
|
|
76
|
+
|
|
77
|
+
Result: pass.
|
|
78
|
+
|
|
79
|
+
## Applicability matrix
|
|
80
|
+
|
|
81
|
+
| Domain | Status | Reason |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| product | applicable | fixture requirement |
|
|
84
|
+
| business | excluded | by-design: the validator ships free inside the skill with no account, price, or telemetry; revisit when: any task adds a price, a hosted endpoint, a sign-up route, or a telemetry call |
|
|
85
|
+
| architecture | applicable | shell and embedded Perl boundary |
|
|
86
|
+
| stack | applicable | stock macOS and Linux toolchain |
|
|
87
|
+
| database | excluded | by-design: the validator reads a plan and writes a sidecar, holding no state between runs; revisit when: any task introduces a datastore or a persisted cache |
|
|
88
|
+
| security | applicable | execution lifecycle is a safety boundary |
|
|
89
|
+
| llm | excluded | by-design: every check is deterministic Perl with no model call; revisit when: any task adds a model SDK dependency or a prompt template |
|
|
90
|
+
| ux | excluded | by-design: the only interaction is one command and an exit code; revisit when: the validator gains an interactive or multi-step flow |
|
|
91
|
+
| ui | excluded | by-design: output is stdout text with no rendered surface; revisit when: any task adds a rendered view the project owns |
|
|
92
|
+
| seo | excluded | by-design: nothing the validator produces is crawlable; revisit when: the project publishes a page a search engine can reach |
|
|
93
|
+
| code-quality | applicable | validator coverage |
|
|
94
|
+
| style-genome | applicable | portable shell conventions |
|
|
95
|
+
| agent-memory | applicable | execution rules travel with the plan |
|
|
96
|
+
| repo | applicable | validator ships in the skill package |
|
|
97
|
+
| build | applicable | validator is the emitted application artifact |
|
|
98
|
+
| roadmap | applicable | fixture tasks exercise ordering |
|
|
99
|
+
| deploy | excluded | by-design: the validator ships inside the skill package and is never deployed; revisit when: any task publishes a hosted or installable service |
|
|
100
|
+
| observe | excluded | by-design: nothing runs long enough to observe; revisit when: any task adds a long-running process or a scheduled job |
|
|
101
|
+
| launch | excluded | by-design: distribution is the skill release, not a public activation; revisit when: public_release flips to true |
|
|
102
|
+
|
|
103
|
+
### Module disposition
|
|
104
|
+
|
|
105
|
+
- product: landed R-PRD-1; dropped-by scale R-PRD-9 (fixture scope: no pricing surface to plan)
|
|
106
|
+
- architecture: landed R-ARCH-4; dropped-by scale R-ARCH-10 (one shell entry point, no heavy pattern to justify)
|
|
107
|
+
- stack: landed R-STACK-1
|
|
108
|
+
- security: landed R-SEC-1
|
|
109
|
+
- code-quality: landed R-CODE-21
|
|
110
|
+
- style-genome: landed R-DNA-14
|
|
111
|
+
- agent-memory: landed R-MEM-2
|
|
112
|
+
- repo: landed R-REPO-21
|
|
113
|
+
- build: landed R-BUILD-1
|
|
114
|
+
- roadmap: landed R-ROAD-1
|
|
115
|
+
|
|
116
|
+
## Decisions
|
|
117
|
+
|
|
118
|
+
The fixture uses two ordered phases.
|
|
119
|
+
|
|
120
|
+
### D1: portable runtime boundary
|
|
121
|
+
|
|
122
|
+
The validator uses Bash 3.2 plus stock Perl instead of a compiled runtime.
|
|
123
|
+
Falsifier:
|
|
124
|
+
- Signal: Perl availability on every supported platform
|
|
125
|
+
- Failure boundary: any supported platform ships without Perl
|
|
126
|
+
- Replan action: return to planning and replace the embedded parser with a supported runtime
|
|
127
|
+
|
|
128
|
+
## Requirements
|
|
129
|
+
|
|
130
|
+
R-1.1: WHEN validation runs THE SYSTEM SHALL return a reliable exit code.
|
|
131
|
+
|
|
132
|
+
## Architecture
|
|
133
|
+
|
|
134
|
+
The shell entry point delegates parsing to portable Perl.
|
|
135
|
+
|
|
136
|
+
## Style genome
|
|
137
|
+
|
|
138
|
+
ASCII text and Bash 3.2 compatible shell.
|
|
139
|
+
|
|
140
|
+
## Agent memory
|
|
141
|
+
|
|
142
|
+
The plan remains the source of truth.
|
|
143
|
+
|
|
144
|
+
## Documentation set
|
|
145
|
+
|
|
146
|
+
This manifest covers documentation committed to this repository. Documents held in a wiki or a compliance platform are marked present-elsewhere.
|
|
147
|
+
|
|
148
|
+
| Document | Stage | Verdict | Owner | Selected by, or reason and revisit when |
|
|
149
|
+
|---|---|---|---|---|
|
|
150
|
+
| decide.adr | decide | required | architecture | the portable runtime boundary is D1; written by GP-101 |
|
|
151
|
+
| build.readme | build | required | repo | always; written by GP-102 |
|
|
152
|
+
| build.style-genome | build | required | style-genome | always; written by GP-102 |
|
|
153
|
+
| govern.manifest | govern | required | repo | always; written by GP-102 |
|
|
154
|
+
| verify.dod | verify | required | product | always; written by GP-201 |
|
|
155
|
+
| operate.runbook | operate | not-applicable | observe | by-design: the validator is a script with no deployed surface to operate; revisit when: any task adds a hosted service or a scheduled job |
|
|
156
|
+
| serve.user-guide | serve | not-applicable | launch | absent: no external user was named in intake; revisit when: the validator ships to users outside this repository |
|
|
157
|
+
|
|
158
|
+
## Phases
|
|
159
|
+
|
|
160
|
+
## Phase 1: Validator behavior
|
|
161
|
+
|
|
162
|
+
Goal: validate the core plan contract.
|
|
163
|
+
|
|
164
|
+
### Wave 1.1
|
|
165
|
+
|
|
166
|
+
- [ ] GP-101 [W1.1] Parse plan state
|
|
167
|
+
- Files: skills/godplans/scripts/validate-plan.sh
|
|
168
|
+
- Depends on: none
|
|
169
|
+
- Reuses: repository shell conventions
|
|
170
|
+
- Acceptance: frontmatter and counters are checked
|
|
171
|
+
- Verify: `bash tests/validate-plan.sh`
|
|
172
|
+
- Requirements: R-1.1, R-CODE-21, R-ARCH-4, R-STACK-1
|
|
173
|
+
|
|
174
|
+
- [ ] GP-102 [W1.1] Check task references
|
|
175
|
+
- Files: tests/validate-plan.sh
|
|
176
|
+
- Depends on: GP-101
|
|
177
|
+
- Reuses: validator fixture
|
|
178
|
+
- Acceptance: dependencies and requirement IDs resolve
|
|
179
|
+
- Verify: `bash tests/validate-plan.sh`
|
|
180
|
+
- Requirements: R-1.1, R-CODE-21, R-REPO-21, R-DNA-14
|
|
181
|
+
|
|
182
|
+
Checkpoint: malformed plans fail with a diagnostic.
|
|
183
|
+
Checkpoint verify: `test -x skills/godplans/scripts/validate-plan.sh`
|
|
184
|
+
|
|
185
|
+
Must-haves:
|
|
186
|
+
- Truth: invalid plans return nonzero
|
|
187
|
+
- Artifact: skills/godplans/scripts/validate-plan.sh exists
|
|
188
|
+
- Link: the regression suite invokes the shipped validator
|
|
189
|
+
|
|
190
|
+
## Phase 2: Verification
|
|
191
|
+
|
|
192
|
+
Goal: prove the validator contract end to end.
|
|
193
|
+
|
|
194
|
+
### Wave 2.1
|
|
195
|
+
|
|
196
|
+
- [ ] GP-201 [W2.1] Run full validator regression suite
|
|
197
|
+
- Files: tests/validate-plan.sh
|
|
198
|
+
- Depends on: GP-101, GP-102
|
|
199
|
+
- Reuses: repository lint entry point
|
|
200
|
+
- Acceptance: all regression cases pass
|
|
201
|
+
- Verify: `bash tests/validate-plan.sh`
|
|
202
|
+
- Requirements: R-1.1, R-CODE-21, R-ROAD-1, R-BUILD-1, R-MEM-2, R-PRD-1, R-SEC-1
|
|
203
|
+
|
|
204
|
+
Checkpoint: the portable suite passes from a fresh checkout.
|
|
205
|
+
Checkpoint verify: `test -x tests/validate-plan.sh`
|
|
206
|
+
|
|
207
|
+
Must-haves:
|
|
208
|
+
- Truth: the validator reports a valid plan
|
|
209
|
+
- Artifact: tests/validate-plan.sh is executable
|
|
210
|
+
- Link: plan-format.md points to the validator
|
|
211
|
+
|
|
212
|
+
## Open Questions
|
|
213
|
+
|
|
214
|
+
None.
|
|
215
|
+
|
|
216
|
+
## Rules for executing agents
|
|
217
|
+
|
|
218
|
+
> [!IMPORTANT]
|
|
219
|
+
> Only approved or executing plans may be executed.
|
|
220
|
+
|
|
221
|
+
## Session log
|
|
222
|
+
|
|
223
|
+
- 2026-07-13 plan created
|
|
224
|
+
EOF
|
|
225
|
+
PLAN_STATUS="$status" perl -0pi -e 's/status: PLAN_STATUS/status: $ENV{PLAN_STATUS}/' "$file"
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
record_pass() {
|
|
229
|
+
PASS_COUNT=$((PASS_COUNT + 1))
|
|
230
|
+
printf 'ok %s\n' "$1"
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
record_fail() {
|
|
234
|
+
FAIL_COUNT=$((FAIL_COUNT + 1))
|
|
235
|
+
printf 'FAIL %s: %s\n' "$1" "$2" >&2
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
expect_pass() {
|
|
239
|
+
name=$1
|
|
240
|
+
shift
|
|
241
|
+
output=$("$VALIDATOR" "$@" 2>&1)
|
|
242
|
+
status=$?
|
|
243
|
+
if [ "$status" -eq 0 ]; then
|
|
244
|
+
record_pass "$name"
|
|
245
|
+
else
|
|
246
|
+
record_fail "$name" "expected success, got $status: $output"
|
|
247
|
+
fi
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
expect_fail() {
|
|
251
|
+
name=$1
|
|
252
|
+
expected=$2
|
|
253
|
+
shift 2
|
|
254
|
+
output=$("$VALIDATOR" "$@" 2>&1)
|
|
255
|
+
status=$?
|
|
256
|
+
if [ "$status" -eq 0 ]; then
|
|
257
|
+
record_fail "$name" "expected failure"
|
|
258
|
+
elif printf '%s\n' "$output" | grep -F "$expected" >/dev/null 2>&1; then
|
|
259
|
+
record_pass "$name"
|
|
260
|
+
else
|
|
261
|
+
record_fail "$name" "missing diagnostic '$expected': $output"
|
|
262
|
+
fi
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
new_case() {
|
|
266
|
+
CASE_NUMBER=$((CASE_NUMBER + 1))
|
|
267
|
+
CASE_FILE="$TMP_DIR/case-$CASE_NUMBER.mdx"
|
|
268
|
+
cp "$BASE_PLAN" "$CASE_FILE"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
# Every sidecar the suite emits is also checked against the published schema,
|
|
272
|
+
# so the schema and the emitter cannot drift apart unnoticed.
|
|
273
|
+
SCHEMA="$ROOT_DIR/skills/godplans/schemas/PLAN.schema.json"
|
|
274
|
+
SCHEMA_CHECK="$ROOT_DIR/tests/lib/plan-schema-check.js"
|
|
275
|
+
check_sidecar() {
|
|
276
|
+
if output=$(node "$SCHEMA_CHECK" "$SCHEMA" "$2" 2>&1); then
|
|
277
|
+
record_pass "$1 conforms to PLAN.schema.json"
|
|
278
|
+
else
|
|
279
|
+
record_fail "$1 conforms to PLAN.schema.json" "$output"
|
|
280
|
+
fi
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
emit_sidecar() {
|
|
284
|
+
expect_pass "$1" --allow-planning --emit-json "$2" "$3"
|
|
285
|
+
check_sidecar "$1" "$2"
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
BASE_PLAN="$TMP_DIR/valid-planning.mdx"
|
|
289
|
+
CASE_NUMBER=0
|
|
290
|
+
write_valid_plan "$BASE_PLAN" planning
|
|
291
|
+
|
|
292
|
+
expect_pass "planning validation mode" --allow-planning "$BASE_PLAN"
|
|
293
|
+
expect_fail "planning execution gate" "requires status approved or executing" "$BASE_PLAN"
|
|
294
|
+
|
|
295
|
+
TABLE_PLAN="$TMP_DIR/valid-requirements-table.mdx"
|
|
296
|
+
cp "$BASE_PLAN" "$TABLE_PLAN"
|
|
297
|
+
perl -0pi -e 's/R-1\.1: WHEN validation runs THE SYSTEM SHALL return a reliable exit code\./| ID | Acceptance |\n|---|---|\n| R-1.1 | WHEN validation runs THE SYSTEM SHALL return a reliable exit code. |/' "$TABLE_PLAN"
|
|
298
|
+
expect_pass "local requirement in Markdown table" --allow-planning "$TABLE_PLAN"
|
|
299
|
+
|
|
300
|
+
ISOLATED_DIR="$TMP_DIR/standalone-companion"
|
|
301
|
+
mkdir "$ISOLATED_DIR"
|
|
302
|
+
cp "$VALIDATOR" "$ISOLATED_DIR/validate-plan.sh"
|
|
303
|
+
cp "$BASE_PLAN" "$ISOLATED_DIR/PLAN.mdx"
|
|
304
|
+
chmod +x "$ISOLATED_DIR/validate-plan.sh"
|
|
305
|
+
REPOSITORY_VALIDATOR="$VALIDATOR"
|
|
306
|
+
VALIDATOR="$ISOLATED_DIR/validate-plan.sh"
|
|
307
|
+
expect_pass "standalone copied validator" --allow-planning "$ISOLATED_DIR/PLAN.mdx"
|
|
308
|
+
VALIDATOR="$REPOSITORY_VALIDATOR"
|
|
309
|
+
|
|
310
|
+
ACTUAL_CATALOG="$TMP_DIR/actual-catalog"
|
|
311
|
+
EMBEDDED_CATALOG="$TMP_DIR/embedded-catalog"
|
|
312
|
+
# Only definitions count: an id that starts a line (after an optional list
|
|
313
|
+
# marker and **), the rule scripts/lint-parity.js and build-catalog.js share.
|
|
314
|
+
# An id cited mid-sentence is a cross-reference and defines nothing.
|
|
315
|
+
perl -ne '
|
|
316
|
+
$inside = 1, next if /^## Plan requirements\s*$/;
|
|
317
|
+
$inside = 0 if $inside && /^## /;
|
|
318
|
+
if ($inside && /^\s*(?:(?:[0-9]+\.|[-*])\s+)?(?:\*\*)?R-([A-Z][A-Z0-9-]*)-([0-9]+)/) {
|
|
319
|
+
$seen{$1}{$2} = 1;
|
|
320
|
+
}
|
|
321
|
+
if (eof) {
|
|
322
|
+
$inside = 0;
|
|
323
|
+
}
|
|
324
|
+
END {
|
|
325
|
+
for $prefix (sort keys %seen) {
|
|
326
|
+
@numbers = sort { $a <=> $b } keys %{$seen{$prefix}};
|
|
327
|
+
die "catalog gap for $prefix\n" if @numbers != $numbers[-1];
|
|
328
|
+
print "$prefix $numbers[-1]\n";
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
' "$ROOT_DIR"/skills/godplans/references/*.md > "$ACTUAL_CATALOG"
|
|
332
|
+
perl -ne 'print "$1 $2\n" if /^ ([A-Z][A-Z0-9-]*) => ([0-9]+),$/' "$REPOSITORY_VALIDATOR" | sort > "$EMBEDDED_CATALOG"
|
|
333
|
+
if diff -u "$ACTUAL_CATALOG" "$EMBEDDED_CATALOG" >/dev/null 2>&1; then
|
|
334
|
+
record_pass "embedded requirement catalog is current"
|
|
335
|
+
else
|
|
336
|
+
record_fail "embedded requirement catalog is current" "validator catalog differs from domain modules"
|
|
337
|
+
fi
|
|
338
|
+
|
|
339
|
+
APPROVED_PLAN="$TMP_DIR/valid-approved.mdx"
|
|
340
|
+
write_valid_plan "$APPROVED_PLAN" approved
|
|
341
|
+
expect_pass "approved execution gate" "$APPROVED_PLAN"
|
|
342
|
+
|
|
343
|
+
EXECUTING_PLAN="$TMP_DIR/valid-executing.mdx"
|
|
344
|
+
write_valid_plan "$EXECUTING_PLAN" executing
|
|
345
|
+
expect_pass "executing execution gate" "$EXECUTING_PLAN"
|
|
346
|
+
|
|
347
|
+
PARTIAL_PLAN="$TMP_DIR/valid-partial.mdx"
|
|
348
|
+
write_valid_plan "$PARTIAL_PLAN" executing
|
|
349
|
+
perl -0pi -e 's/- \[ \] GP-10/- [x] GP-10/g; s/phases_done: 0/phases_done: 1/; s/tasks_done: 0/tasks_done: 2/' "$PARTIAL_PLAN"
|
|
350
|
+
expect_pass "derived completed phase counters" "$PARTIAL_PLAN"
|
|
351
|
+
|
|
352
|
+
DONE_PLAN="$TMP_DIR/valid-done.mdx"
|
|
353
|
+
write_valid_plan "$DONE_PLAN" done
|
|
354
|
+
perl -0pi -e 's/- \[ \] GP-/- [x] GP-/g; s/phases_done: 0/phases_done: 2/; s/tasks_done: 0/tasks_done: 3/' "$DONE_PLAN"
|
|
355
|
+
expect_fail "done execution gate" "requires status approved or executing" "$DONE_PLAN"
|
|
356
|
+
expect_pass "done structural validation" --allow-planning "$DONE_PLAN"
|
|
357
|
+
|
|
358
|
+
CASE_FILE="$TMP_DIR/done-with-open-tasks.mdx"
|
|
359
|
+
write_valid_plan "$CASE_FILE" done
|
|
360
|
+
expect_fail "done with unchecked tasks" "status done requires every task checked, found 0 of 3" --allow-planning "$CASE_FILE"
|
|
361
|
+
|
|
362
|
+
new_case
|
|
363
|
+
perl -0pi -e 's/tasks_total: 3/tasks_total: 4/' "$CASE_FILE"
|
|
364
|
+
expect_fail "wrong task total" "tasks_total is 4, derived value is 3" --allow-planning "$CASE_FILE"
|
|
365
|
+
|
|
366
|
+
new_case
|
|
367
|
+
perl -0pi -e 's/tasks_done: 0/tasks_done: 1/' "$CASE_FILE"
|
|
368
|
+
expect_fail "wrong task done count" "tasks_done is 1, derived value is 0" --allow-planning "$CASE_FILE"
|
|
369
|
+
|
|
370
|
+
new_case
|
|
371
|
+
perl -0pi -e 's/phases_total: 2/phases_total: 3/' "$CASE_FILE"
|
|
372
|
+
expect_fail "wrong phase total" "phases_total is 3, derived value is 2" --allow-planning "$CASE_FILE"
|
|
373
|
+
|
|
374
|
+
new_case
|
|
375
|
+
perl -0pi -e 's/phases_done: 0/phases_done: 1/' "$CASE_FILE"
|
|
376
|
+
expect_fail "wrong phase done count" "phases_done is 1, derived value is 0" --allow-planning "$CASE_FILE"
|
|
377
|
+
|
|
378
|
+
new_case
|
|
379
|
+
perl -0pi -e 's/GP-102 \[W1\.1\]/GP-101 [W1.1]/' "$CASE_FILE"
|
|
380
|
+
expect_fail "duplicate task definitions" "duplicate task definition ID GP-101" --allow-planning "$CASE_FILE"
|
|
381
|
+
|
|
382
|
+
new_case
|
|
383
|
+
perl -0pi -e 's/## Phase 2: Verification/## Phase 3: Verification/' "$CASE_FILE"
|
|
384
|
+
expect_fail "non-sequential phase numbers" "expected Phase 2, found Phase 3" --allow-planning "$CASE_FILE"
|
|
385
|
+
|
|
386
|
+
new_case
|
|
387
|
+
perl -0pi -e 's/GP-101 \[W1\.1\]/GP-101/' "$CASE_FILE"
|
|
388
|
+
expect_fail "missing task wave" "GP-101 has malformed task heading" --allow-planning "$CASE_FILE"
|
|
389
|
+
|
|
390
|
+
new_case
|
|
391
|
+
perl -0pi -e 's/GP-101 \[W1\.1\]/GP-101 [W2.1]/' "$CASE_FILE"
|
|
392
|
+
expect_fail "task wave phase mismatch" "GP-101 wave phase 2 does not match Phase 1" --allow-planning "$CASE_FILE"
|
|
393
|
+
|
|
394
|
+
for field in Files "Depends on" Reuses Acceptance Verify Requirements; do
|
|
395
|
+
new_case
|
|
396
|
+
FIELD="$field" perl -0pi -e 's/^ - \Q$ENV{FIELD}\E:.*\n//m' "$CASE_FILE"
|
|
397
|
+
expect_fail "missing $field field" "GP-101 missing required field: $field" --allow-planning "$CASE_FILE"
|
|
398
|
+
done
|
|
399
|
+
|
|
400
|
+
new_case
|
|
401
|
+
perl -0pi -e 's/Verify: `bash tests\/validate-plan\.sh`/Verify: Manual: open the report/' "$CASE_FILE"
|
|
402
|
+
expect_fail "manual task verification" "Verify must be one executable command in backticks" --allow-planning "$CASE_FILE"
|
|
403
|
+
|
|
404
|
+
new_case
|
|
405
|
+
perl -0pi -e 's/Depends on: GP-101/Depends on: GP-999/' "$CASE_FILE"
|
|
406
|
+
expect_fail "unknown dependency" "GP-102 depends on undefined task GP-999" --allow-planning "$CASE_FILE"
|
|
407
|
+
|
|
408
|
+
new_case
|
|
409
|
+
perl -0pi -e 's/Depends on: none/Depends on: GP-201/' "$CASE_FILE"
|
|
410
|
+
expect_fail "forward dependency" "GP-101 depends on later task GP-201" --allow-planning "$CASE_FILE"
|
|
411
|
+
|
|
412
|
+
new_case
|
|
413
|
+
perl -0pi -e 's/Depends on: GP-101/Depends on: sometimes GP-101/' "$CASE_FILE"
|
|
414
|
+
expect_fail "malformed dependency" "GP-102 has malformed Depends on value" --allow-planning "$CASE_FILE"
|
|
415
|
+
|
|
416
|
+
new_case
|
|
417
|
+
perl -0pi -e 's/(- \[ \] GP-101.*? - Requirements: )[^\n]+/$1R-1.1, R-NOPE-1/s' "$CASE_FILE"
|
|
418
|
+
expect_fail "unknown domain requirement" "undefined requirement R-NOPE-1" --allow-planning "$CASE_FILE"
|
|
419
|
+
|
|
420
|
+
new_case
|
|
421
|
+
CODE_MAX=$(perl -ne 'print $1 if /^\s+CODE => (\d+),/' "$REPOSITORY_VALIDATOR")
|
|
422
|
+
CODE_OOR="R-CODE-$((CODE_MAX + 1))"
|
|
423
|
+
perl -0pi -e "s/R-CODE-21/$CODE_OOR/" "$CASE_FILE"
|
|
424
|
+
expect_fail "out-of-range domain requirement" "undefined requirement $CODE_OOR" --allow-planning "$CASE_FILE"
|
|
425
|
+
|
|
426
|
+
new_case
|
|
427
|
+
perl -0pi -e 's/R-1\.1, R-CODE-21/R-9.9, R-CODE-21/' "$CASE_FILE"
|
|
428
|
+
expect_fail "unknown local requirement" "undefined requirement R-9.9" --allow-planning "$CASE_FILE"
|
|
429
|
+
|
|
430
|
+
new_case
|
|
431
|
+
perl -CSD -e 'print chr(0x2014), "\n"' >> "$CASE_FILE"
|
|
432
|
+
expect_fail "banned Unicode" "banned Unicode" --allow-planning "$CASE_FILE"
|
|
433
|
+
|
|
434
|
+
new_case
|
|
435
|
+
perl -0pi -e 's/## Open Questions\n/## Questions\n/' "$CASE_FILE"
|
|
436
|
+
expect_fail "missing Open Questions" "expected exactly one ## Open Questions section, found 0" --allow-planning "$CASE_FILE"
|
|
437
|
+
|
|
438
|
+
new_case
|
|
439
|
+
printf '\n## Open Questions\n\nDuplicate.\n' >> "$CASE_FILE"
|
|
440
|
+
expect_fail "duplicate Open Questions" "expected exactly one ## Open Questions section, found 2" --allow-planning "$CASE_FILE"
|
|
441
|
+
|
|
442
|
+
# Every skeleton section appears exactly once; Architecture and Agent memory
|
|
443
|
+
# are owed while their domain is applicable, as both are in the fixture.
|
|
444
|
+
for heading in "Scope and non-goals" "Compliance gate" "Requirements" "Architecture" "Style genome" "Agent memory" "Phases" "Rules for executing agents" "Session log"; do
|
|
445
|
+
new_case
|
|
446
|
+
HEADING=$heading perl -0pi -e 's/^## \Q$ENV{HEADING}\E$/## Notes on $ENV{HEADING}/m' "$CASE_FILE"
|
|
447
|
+
expect_fail "missing $heading section" "expected exactly one ## $heading section, found 0" --allow-planning "$CASE_FILE"
|
|
448
|
+
done
|
|
449
|
+
|
|
450
|
+
new_case
|
|
451
|
+
printf '\n## Rules for executing agents\n\nA second copy.\n' >> "$CASE_FILE"
|
|
452
|
+
expect_fail "duplicate executor rules" "expected exactly one ## Rules for executing agents section, found 2" --allow-planning "$CASE_FILE"
|
|
453
|
+
|
|
454
|
+
# The executor rules open with the template's GFM alert, inside their own
|
|
455
|
+
# section: the same alert elsewhere in the plan does not stand in for them.
|
|
456
|
+
new_case
|
|
457
|
+
perl -0pi -e 's/^> \[!IMPORTANT\]\n//m' "$CASE_FILE"
|
|
458
|
+
expect_fail "executor rules without the IMPORTANT alert" "executor rules lack > [!IMPORTANT]" --allow-planning "$CASE_FILE"
|
|
459
|
+
|
|
460
|
+
new_case
|
|
461
|
+
perl -0pi -e 's/^> \[!IMPORTANT\]\n//m; s/^(In scope: validator behavior\.)/> [!IMPORTANT]\n> $1/m' "$CASE_FILE"
|
|
462
|
+
expect_fail "IMPORTANT alert outside the executor rules" "executor rules lack > [!IMPORTANT]" --allow-planning "$CASE_FILE"
|
|
463
|
+
|
|
464
|
+
new_case
|
|
465
|
+
perl -0pi -e 's/^## Style genome$/## Style genome /m' "$CASE_FILE"
|
|
466
|
+
printf '\n## Style genome\n\nA second copy.\n' >> "$CASE_FILE"
|
|
467
|
+
expect_fail "duplicate section behind trailing spaces" "expected exactly one ## Style genome section, found 2" --allow-planning "$CASE_FILE"
|
|
468
|
+
|
|
469
|
+
# An excluded domain owes no section of its own.
|
|
470
|
+
NO_MEMORY_PLAN="$TMP_DIR/excluded-agent-memory.mdx"
|
|
471
|
+
cp "$BASE_PLAN" "$NO_MEMORY_PLAN"
|
|
472
|
+
perl -0pi -e '
|
|
473
|
+
s/^\| agent-memory \| applicable \|[^\n]*\|$/| agent-memory | excluded | by-design: the fixture writes no agent instruction files; revisit when: any task writes an AGENTS.md or a pillar file |/m;
|
|
474
|
+
s/^(domains_applicable: \[[^\]]*), agent-memory(.*)$/$1$2/m;
|
|
475
|
+
s/^(domains_excluded: \[)/$1agent-memory, /m;
|
|
476
|
+
s/^- agent-memory: landed R-MEM-2\n//m;
|
|
477
|
+
s/, R-MEM-2,/,/;
|
|
478
|
+
s/^## Agent memory\n\nThe plan remains the source of truth\.\n\n//m
|
|
479
|
+
' "$NO_MEMORY_PLAN"
|
|
480
|
+
expect_pass "excluded agent-memory needs no Agent memory section" --allow-planning "$NO_MEMORY_PLAN"
|
|
481
|
+
|
|
482
|
+
new_case
|
|
483
|
+
perl -0pi -e 's/## Phase 2: Verification/## Phase 2: Release/' "$CASE_FILE"
|
|
484
|
+
expect_fail "missing final Verification phase" "final phase must be Verification" --allow-planning "$CASE_FILE"
|
|
485
|
+
|
|
486
|
+
new_case
|
|
487
|
+
perl -0pi -e 's/^name:.*\n//m' "$CASE_FILE"
|
|
488
|
+
expect_fail "missing frontmatter field" "missing frontmatter field: name" --allow-planning "$CASE_FILE"
|
|
489
|
+
|
|
490
|
+
new_case
|
|
491
|
+
perl -0pi -e 's/^ tasks_done:.*\n//m' "$CASE_FILE"
|
|
492
|
+
expect_fail "missing progress counter" "missing progress counter: tasks_done" --allow-planning "$CASE_FILE"
|
|
493
|
+
|
|
494
|
+
new_case
|
|
495
|
+
perl -0pi -e 's/plan_version: 1/plan_version: zero/' "$CASE_FILE"
|
|
496
|
+
expect_fail "invalid plan version" "plan_version must be a positive integer" --allow-planning "$CASE_FILE"
|
|
497
|
+
|
|
498
|
+
new_case
|
|
499
|
+
perl -0pi -e 's/updated: 2026-07-13/updated: July 13/' "$CASE_FILE"
|
|
500
|
+
expect_fail "invalid updated date" "updated must use YYYY-MM-DD" --allow-planning "$CASE_FILE"
|
|
501
|
+
|
|
502
|
+
new_case
|
|
503
|
+
perl -0pi -e 's/status: planning/status: paused/' "$CASE_FILE"
|
|
504
|
+
expect_fail "invalid lifecycle status" "invalid status 'paused'" --allow-planning "$CASE_FILE"
|
|
505
|
+
|
|
506
|
+
new_case
|
|
507
|
+
perl -0pi -e 's/mode: greenfield/mode: rewrite/' "$CASE_FILE"
|
|
508
|
+
expect_fail "invalid plan mode" "invalid mode 'rewrite'" --allow-planning "$CASE_FILE"
|
|
509
|
+
|
|
510
|
+
new_case
|
|
511
|
+
perl -0pi -e 's/product_form: cli-or-sdk/product_form: website/' "$CASE_FILE"
|
|
512
|
+
expect_fail "invalid product form" "invalid product_form 'website'" --allow-planning "$CASE_FILE"
|
|
513
|
+
|
|
514
|
+
new_case
|
|
515
|
+
perl -0pi -e 's/public_release: false/public_release: maybe/' "$CASE_FILE"
|
|
516
|
+
expect_fail "invalid public release flag" "public_release must be true or false" --allow-planning "$CASE_FILE"
|
|
517
|
+
|
|
518
|
+
new_case
|
|
519
|
+
perl -0pi -e 's/R-1\.1, R-CODE-21/R-1.1, R-SEC-26/' "$CASE_FILE"
|
|
520
|
+
expect_fail "non-public plan with hardening role marker" "public_release false must not cite R-SEC-26" --allow-planning "$CASE_FILE"
|
|
521
|
+
|
|
522
|
+
new_case
|
|
523
|
+
perl -0pi -e 's/R-1\.1, R-CODE-21/R-1.1, R-ROAD-21/' "$CASE_FILE"
|
|
524
|
+
expect_fail "non-public plan with prepublication gate role marker" "public_release false must not cite R-ROAD-21" --allow-planning "$CASE_FILE"
|
|
525
|
+
|
|
526
|
+
new_case
|
|
527
|
+
perl -0pi -e 's/R-1\.1, R-CODE-21/R-1.1, R-LAUNCH-22/' "$CASE_FILE"
|
|
528
|
+
expect_fail "non-public plan with activation role marker" "public_release false must not cite R-LAUNCH-22" --allow-planning "$CASE_FILE"
|
|
529
|
+
|
|
530
|
+
new_case
|
|
531
|
+
perl -0pi -e 's/^source_revision:.*\n//m' "$CASE_FILE"
|
|
532
|
+
expect_fail "missing source revision" "missing frontmatter field: source_revision" --allow-planning "$CASE_FILE"
|
|
533
|
+
|
|
534
|
+
new_case
|
|
535
|
+
perl -0pi -e 's/input_digest: sha256:[0-9a-f]+/input_digest: latest/' "$CASE_FILE"
|
|
536
|
+
expect_fail "invalid input digest" "input_digest must be sha256" --allow-planning "$CASE_FILE"
|
|
537
|
+
|
|
538
|
+
new_case
|
|
539
|
+
perl -0pi -e 's/input_digest: sha256:[0-9a-f]+/input_digest: sha256:0000000000000000000000000000000000000000000000000000000000000000/' "$CASE_FILE"
|
|
540
|
+
expect_fail "placeholder input digest" "input_digest must not use the all-zero placeholder" --allow-planning "$CASE_FILE"
|
|
541
|
+
|
|
542
|
+
new_case
|
|
543
|
+
perl -0pi -e 's/validated_at: 2026-07-13T12:00:00Z/validated_at: yesterday/' "$CASE_FILE"
|
|
544
|
+
expect_fail "invalid validation timestamp" "validated_at must use UTC ISO-8601" --allow-planning "$CASE_FILE"
|
|
545
|
+
|
|
546
|
+
new_case
|
|
547
|
+
perl -0pi -e 's/## Plan provenance\n\n/## Evidence\n\n/' "$CASE_FILE"
|
|
548
|
+
expect_fail "missing Plan provenance" "expected exactly one ## Plan provenance section, found 0" --allow-planning "$CASE_FILE"
|
|
549
|
+
|
|
550
|
+
new_case
|
|
551
|
+
perl -0pi -e 's/Evidence inventory:/Evidence list:/' "$CASE_FILE"
|
|
552
|
+
expect_fail "incomplete Plan provenance" "Plan provenance is missing Evidence inventory:" --allow-planning "$CASE_FILE"
|
|
553
|
+
|
|
554
|
+
new_case
|
|
555
|
+
perl -0pi -e 's/Source revision: none/Source revision: 0123456789abcdef0123456789abcdef01234567/' "$CASE_FILE"
|
|
556
|
+
expect_fail "mismatched provenance source revision" "Plan provenance Source revision does not match frontmatter source_revision" --allow-planning "$CASE_FILE"
|
|
557
|
+
|
|
558
|
+
new_case
|
|
559
|
+
perl -0pi -e 's/Input digest: sha256:[0-9a-f]{64}/Input digest: sha256:cf2597de8c02e80d716a6c4a97d4c03cd75a566771121170be7c46bcf3b709e5/' "$CASE_FILE"
|
|
560
|
+
expect_fail "mismatched provenance input digest" "Plan provenance Input digest does not match frontmatter input_digest" --allow-planning "$CASE_FILE"
|
|
561
|
+
|
|
562
|
+
new_case
|
|
563
|
+
perl -0pi -e 's/Validated at: 2026-07-13T12:00:00Z/Validated at: 2026-07-14T12:00:00Z/' "$CASE_FILE"
|
|
564
|
+
expect_fail "mismatched provenance validation timestamp" "Plan provenance Validated at does not match frontmatter validated_at" --allow-planning "$CASE_FILE"
|
|
565
|
+
|
|
566
|
+
new_case
|
|
567
|
+
perl -0pi -e 's/^- `intake` = `sha256:[0-9a-f]{64}`\n//m' "$CASE_FILE"
|
|
568
|
+
expect_fail "empty provenance inventory" "Plan provenance Evidence inventory must contain at least one item" --allow-planning "$CASE_FILE"
|
|
569
|
+
|
|
570
|
+
new_case
|
|
571
|
+
perl -0pi -e 's/`intake`/`readme`/' "$CASE_FILE"
|
|
572
|
+
expect_fail "provenance inventory missing intake" "Plan provenance Evidence inventory must contain exactly one intake item" --allow-planning "$CASE_FILE"
|
|
573
|
+
|
|
574
|
+
new_case
|
|
575
|
+
perl -0pi -e 's/- `intake` = `sha256:([0-9a-f]{64})`/- intake = sha256:$1/' "$CASE_FILE"
|
|
576
|
+
expect_fail "malformed provenance inventory" "malformed Plan provenance inventory item" --allow-planning "$CASE_FILE"
|
|
577
|
+
|
|
578
|
+
new_case
|
|
579
|
+
perl -0pi -e 's/(- `intake` = `sha256:[0-9a-f]{64}`)/$1\n$1/' "$CASE_FILE"
|
|
580
|
+
expect_fail "duplicate provenance inventory label" "duplicate Plan provenance inventory label: intake" --allow-planning "$CASE_FILE"
|
|
581
|
+
|
|
582
|
+
new_case
|
|
583
|
+
perl -0pi -e 's/(Source revision: none)/$1\n$1/' "$CASE_FILE"
|
|
584
|
+
expect_fail "duplicate provenance field label" "Plan provenance has duplicate Source revision label" --allow-planning "$CASE_FILE"
|
|
585
|
+
|
|
586
|
+
new_case
|
|
587
|
+
perl -0pi -e 's/sha256:1111111111111111111111111111111111111111111111111111111111111111`/sha256:2222222222222222222222222222222222222222222222222222222222222222`/' "$CASE_FILE"
|
|
588
|
+
expect_fail "mismatched provenance aggregate digest" "Plan provenance Input digest does not match the Evidence inventory aggregate" --allow-planning "$CASE_FILE"
|
|
589
|
+
|
|
590
|
+
PROVENANCE_PLAN="$TMP_DIR/valid-multi-item-provenance.mdx"
|
|
591
|
+
cp "$BASE_PLAN" "$PROVENANCE_PLAN"
|
|
592
|
+
perl -0pi -e '
|
|
593
|
+
s/1c7ca1006bb3157ad989c1f1dd1cd1d6e8e2a44d9509821ffa43f3be205a12d5/cf2597de8c02e80d716a6c4a97d4c03cd75a566771121170be7c46bcf3b709e5/g;
|
|
594
|
+
s/- `intake` = `sha256:1111111111111111111111111111111111111111111111111111111111111111`/- `readme` = `sha256:2222222222222222222222222222222222222222222222222222222222222222`\n- `intake` = `sha256:1111111111111111111111111111111111111111111111111111111111111111`/
|
|
595
|
+
' "$PROVENANCE_PLAN"
|
|
596
|
+
expect_pass "valid provenance inventory aggregate" --allow-planning "$PROVENANCE_PLAN"
|
|
597
|
+
|
|
598
|
+
# A label is a repository-relative path: it may be a dotfile path, but it may
|
|
599
|
+
# not climb out of the repository or start at the filesystem root.
|
|
600
|
+
for label in '../outside.txt' '..' 'docs/../../etc/passwd'; do
|
|
601
|
+
new_case
|
|
602
|
+
LABEL=$label perl -0pi -e 's/(- `intake` = `sha256:[0-9a-f]{64}`)/$1\n- [recheck] `$ENV{LABEL}` = `sha256:2222222222222222222222222222222222222222222222222222222222222222`/' "$CASE_FILE"
|
|
603
|
+
expect_fail "provenance label $label climbs out" "Plan provenance inventory label $label must not contain a .. segment" --allow-planning "$CASE_FILE"
|
|
604
|
+
done
|
|
605
|
+
|
|
606
|
+
new_case
|
|
607
|
+
perl -0pi -e 's/(- `intake` = `sha256:[0-9a-f]{64}`)/$1\n- [recheck] `\/etc\/passwd` = `sha256:2222222222222222222222222222222222222222222222222222222222222222`/' "$CASE_FILE"
|
|
608
|
+
expect_fail "absolute provenance label" "malformed Plan provenance inventory item: - [recheck] \`/etc/passwd\`" --allow-planning "$CASE_FILE"
|
|
609
|
+
|
|
610
|
+
new_case
|
|
611
|
+
perl -0pi -e 's/## Product form\n/## Delivery form\n/' "$CASE_FILE"
|
|
612
|
+
expect_fail "missing Product form" "expected exactly one ## Product form section, found 0" --allow-planning "$CASE_FILE"
|
|
613
|
+
|
|
614
|
+
new_case
|
|
615
|
+
perl -0pi -e 's/public_release: false/public_release: true/' "$CASE_FILE"
|
|
616
|
+
expect_fail "public release requires prepublication gate" "public release requires a prepublication gate task" --allow-planning "$CASE_FILE"
|
|
617
|
+
|
|
618
|
+
PUBLIC_PLAN="$TMP_DIR/valid-public-release.mdx"
|
|
619
|
+
cp "$BASE_PLAN" "$PUBLIC_PLAN"
|
|
620
|
+
perl -0pi -e '
|
|
621
|
+
s/public_release: false/public_release: true/;
|
|
622
|
+
s/^\| launch \| excluded \|[^\n]*\|$/| launch | applicable | the validator ships as a public package |/m;
|
|
623
|
+
s/^(domains_excluded: \[[^\]]*), launch\]$/$1]/m;
|
|
624
|
+
s/^(domains_applicable: \[[^\]]*)\]$/$1, launch]/m;
|
|
625
|
+
s/^(- roadmap: landed R-ROAD-1)$/$1\n- launch: landed R-LAUNCH-22/m;
|
|
626
|
+
s/(- \[ \] GP-101.*? - Requirements: )[^\n]+/$1R-1.1, R-SEC-26, R-ARCH-4, R-STACK-1/s;
|
|
627
|
+
s/(- \[ \] GP-102.*? - Acceptance: )[^\n]+/$1fresh prepublication check records checked_at, hardening_revision, finding_counts, policy, verdict, owner, justification, accepted_at, and expires_at after current hardening evidence; any later change invalidates the pass/s;
|
|
628
|
+
s/(- \[ \] GP-102.*? - Requirements: )[^\n]+/$1R-1.1, R-ROAD-21, R-REPO-21, R-DNA-14/s;
|
|
629
|
+
s/(- \[ \] GP-201.*? - Depends on: )[^\n]+/$1GP-102/s;
|
|
630
|
+
s/(- \[ \] GP-201.*? - Requirements: )[^\n]+/$1R-1.1, R-LAUNCH-22, R-ROAD-1, R-BUILD-1, R-MEM-2, R-PRD-1, R-SEC-1, R-CODE-21/s
|
|
631
|
+
' "$PUBLIC_PLAN"
|
|
632
|
+
expect_pass "public release with ordered hardening gate activation chain" --allow-planning "$PUBLIC_PLAN"
|
|
633
|
+
|
|
634
|
+
GATE_BEFORE_HARDENING_PLAN="$TMP_DIR/gate-before-hardening.mdx"
|
|
635
|
+
cp "$PUBLIC_PLAN" "$GATE_BEFORE_HARDENING_PLAN"
|
|
636
|
+
perl -0pi -e 's/R-SEC-26/R-TEMP-1/; s/R-ROAD-21/R-SEC-26/; s/R-TEMP-1/R-ROAD-21/' "$GATE_BEFORE_HARDENING_PLAN"
|
|
637
|
+
expect_fail "prepublication gate before hardening" "prepublication gate must follow the latest hardening task" --allow-planning "$GATE_BEFORE_HARDENING_PLAN"
|
|
638
|
+
|
|
639
|
+
GATE_WITHOUT_HARDENING_DEPENDENCY_PLAN="$TMP_DIR/gate-without-hardening-dependency.mdx"
|
|
640
|
+
cp "$PUBLIC_PLAN" "$GATE_WITHOUT_HARDENING_DEPENDENCY_PLAN"
|
|
641
|
+
perl -0pi -e 's/(- \[ \] GP-102.*? - Depends on: )GP-101/$1none/s' "$GATE_WITHOUT_HARDENING_DEPENDENCY_PLAN"
|
|
642
|
+
expect_fail "prepublication gate without hardening dependency" "prepublication gate must depend on the latest hardening task GP-101" --allow-planning "$GATE_WITHOUT_HARDENING_DEPENDENCY_PLAN"
|
|
643
|
+
|
|
644
|
+
ACTIVATION_WITHOUT_GATE_DEPENDENCY_PLAN="$TMP_DIR/activation-without-gate-dependency.mdx"
|
|
645
|
+
cp "$PUBLIC_PLAN" "$ACTIVATION_WITHOUT_GATE_DEPENDENCY_PLAN"
|
|
646
|
+
perl -0pi -e 's/(- \[ \] GP-201.*? - Depends on: )GP-102/$1GP-101/s' "$ACTIVATION_WITHOUT_GATE_DEPENDENCY_PLAN"
|
|
647
|
+
expect_fail "public activation without gate dependency" "public activation must depend on the prepublication gate GP-102" --allow-planning "$ACTIVATION_WITHOUT_GATE_DEPENDENCY_PLAN"
|
|
648
|
+
|
|
649
|
+
INTERVENING_TASK_PLAN="$TMP_DIR/intervening-task-before-activation.mdx"
|
|
650
|
+
cp "$PUBLIC_PLAN" "$INTERVENING_TASK_PLAN"
|
|
651
|
+
perl -0pi -e 's/tasks_total: 3/tasks_total: 4/; s/(Checkpoint: malformed plans fail with a diagnostic\.)/- [ ] GP-103 [W1.1] Intervene after the prepublication gate\n - Files: docs\/release\/notes.md\n - Depends on: GP-102\n - Reuses: release fixture\n - Acceptance: release notes exist\n - Verify: `test -s docs\/release\/notes.md`\n - Requirements: R-1.1, R-CODE-21\n\n$1/' "$INTERVENING_TASK_PLAN"
|
|
652
|
+
expect_fail "task between prepublication gate and activation" "public activation must immediately follow the prepublication gate GP-102" --allow-planning "$INTERVENING_TASK_PLAN"
|
|
653
|
+
|
|
654
|
+
DUPLICATE_ACTIVATION_PLAN="$TMP_DIR/duplicate-public-activation.mdx"
|
|
655
|
+
cp "$PUBLIC_PLAN" "$DUPLICATE_ACTIVATION_PLAN"
|
|
656
|
+
perl -0pi -e 's/R-1\.1, R-ROAD-21/R-1.1, R-ROAD-21, R-LAUNCH-22/' "$DUPLICATE_ACTIVATION_PLAN"
|
|
657
|
+
expect_fail "duplicate public activation markers" "public release requires exactly one first activation task citing R-LAUNCH-22, found 2" --allow-planning "$DUPLICATE_ACTIVATION_PLAN"
|
|
658
|
+
|
|
659
|
+
DEFERRED_PLAN="$TMP_DIR/valid-deferred-domain.mdx"
|
|
660
|
+
cp "$BASE_PLAN" "$DEFERRED_PLAN"
|
|
661
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | deferred | trigger: the first public page task enters the roadmap; reversible until pages ship without metadata |/' "$DEFERRED_PLAN"
|
|
662
|
+
perl -0pi -e 's/^domains_deferred: \[\]$/domains_deferred: [seo]/m; s/^(domains_excluded: \[[^\]]*), seo(.*)$/$1$2/m' "$DEFERRED_PLAN"
|
|
663
|
+
expect_pass "deferred domain with trigger" --allow-planning "$DEFERRED_PLAN"
|
|
664
|
+
|
|
665
|
+
new_case
|
|
666
|
+
perl -0pi -e 's/^(domains_excluded: \[)database, /$1/m' "$CASE_FILE"
|
|
667
|
+
expect_fail "frontmatter drops an excluded domain" "frontmatter domains_excluded does not match the applicability matrix: missing database" --allow-planning "$CASE_FILE"
|
|
668
|
+
|
|
669
|
+
new_case
|
|
670
|
+
perl -0pi -e 's/^(domains_applicable: \[product), /$1, database, /m' "$CASE_FILE"
|
|
671
|
+
expect_fail "frontmatter promotes an excluded domain" "frontmatter domains_applicable does not match the applicability matrix: database is excluded in the matrix" --allow-planning "$CASE_FILE"
|
|
672
|
+
|
|
673
|
+
new_case
|
|
674
|
+
perl -0pi -e 's/^domains_deferred: \[\]$/domains_deferred: [product]/m' "$CASE_FILE"
|
|
675
|
+
expect_fail "frontmatter invents a deferral" "frontmatter domains_deferred does not match the applicability matrix: product is applicable in the matrix" --allow-planning "$CASE_FILE"
|
|
676
|
+
|
|
677
|
+
new_case
|
|
678
|
+
perl -0pi -e 's/^domains_deferred: \[\]$/domains_deferred: [analytics]/m' "$CASE_FILE"
|
|
679
|
+
expect_fail "frontmatter names an unknown domain" "frontmatter domains_deferred names unknown domain analytics" --allow-planning "$CASE_FILE"
|
|
680
|
+
|
|
681
|
+
new_case
|
|
682
|
+
perl -0pi -e 's/^domains_deferred: \[\]$/domains_deferred:\n - name: observe\n trigger: first real user/m' "$CASE_FILE"
|
|
683
|
+
expect_fail "frontmatter domain list must be inline" "frontmatter domains_deferred must be a single inline list" --allow-planning "$CASE_FILE"
|
|
684
|
+
|
|
685
|
+
new_case
|
|
686
|
+
perl -0pi -e 's/- \[ \] GP-101 \[W1\.1\]/- [ ] GP-101 [P] [W1.1]/; s{ - Files: tests/validate-plan\.sh\n - Depends on: GP-101}{ - Files: skills/godplans/scripts/validate-plan.sh\n - Depends on: GP-101}' "$CASE_FILE"
|
|
687
|
+
expect_fail "parallel task shares a wave file" "GP-101 and GP-102 are both in W1.1 and one is marked [P], but they share skills/godplans/scripts/validate-plan.sh" --allow-planning "$CASE_FILE"
|
|
688
|
+
|
|
689
|
+
PARALLEL_PLAN="$TMP_DIR/valid-parallel-tasks.mdx"
|
|
690
|
+
cp "$BASE_PLAN" "$PARALLEL_PLAN"
|
|
691
|
+
perl -0pi -e 's/- \[ \] GP-101 \[W1\.1\]/- [ ] GP-101 [P] [W1.1]/; s/- \[ \] GP-102 \[W1\.1\]/- [ ] GP-102 [P] [W1.1]/; s/Depends on: GP-101\n/Depends on: none\n/' "$PARALLEL_PLAN"
|
|
692
|
+
expect_pass "parallel tasks with disjoint files" --allow-planning "$PARALLEL_PLAN"
|
|
693
|
+
|
|
694
|
+
# [P] promises a runner it may start both tasks together; a dependency between
|
|
695
|
+
# them breaks that promise even when their files are disjoint.
|
|
696
|
+
CASE_FILE="$TMP_DIR/parallel-dependent-pair.mdx"
|
|
697
|
+
cp "$PARALLEL_PLAN" "$CASE_FILE"
|
|
698
|
+
perl -0pi -e 's/(GP-102 \[P\] \[W1\.1\].*?Depends on: )none/$1GP-101/s' "$CASE_FILE"
|
|
699
|
+
expect_fail "parallel task depends on its wave sibling" "GP-101 and GP-102 are both in W1.1 and one is marked [P], but one depends on the other" --allow-planning "$CASE_FILE"
|
|
700
|
+
|
|
701
|
+
# Paths compare as paths: backticks, notes, ./ and directory prefixes do not hide a shared file.
|
|
702
|
+
CASE_FILE="$TMP_DIR/parallel-backticked-path.mdx"
|
|
703
|
+
cp "$PARALLEL_PLAN" "$CASE_FILE"
|
|
704
|
+
perl -0pi -e 's{ - Files: tests/validate-plan\.sh\n - Depends on: none}{ - Files: `skills/godplans/scripts/validate-plan.sh`\n - Depends on: none}' "$CASE_FILE"
|
|
705
|
+
expect_fail "parallel backticked path still conflicts" "but they share skills/godplans/scripts/validate-plan.sh" --allow-planning "$CASE_FILE"
|
|
706
|
+
|
|
707
|
+
CASE_FILE="$TMP_DIR/parallel-directory-prefix.mdx"
|
|
708
|
+
cp "$PARALLEL_PLAN" "$CASE_FILE"
|
|
709
|
+
perl -0pi -e 's{ - Files: tests/validate-plan\.sh\n - Depends on: none}{ - Files: ./skills//godplans/scripts/\n - Depends on: none}' "$CASE_FILE"
|
|
710
|
+
expect_fail "parallel directory covers a sibling file" "but they share skills/godplans/scripts/validate-plan.sh" --allow-planning "$CASE_FILE"
|
|
711
|
+
|
|
712
|
+
CASE_FILE="$TMP_DIR/parallel-annotated-path.mdx"
|
|
713
|
+
cp "$PARALLEL_PLAN" "$CASE_FILE"
|
|
714
|
+
perl -0pi -e 's{ - Files: tests/validate-plan\.sh\n - Depends on: none}{ - Files: README.md, skills/godplans/scripts/validate-plan.sh (exit codes only, see D1)\n - Depends on: none}' "$CASE_FILE"
|
|
715
|
+
expect_fail "parallel annotated path still conflicts" "but they share skills/godplans/scripts/validate-plan.sh" --allow-planning "$CASE_FILE"
|
|
716
|
+
|
|
717
|
+
CASE_FILE="$TMP_DIR/parallel-wrapped-files.mdx"
|
|
718
|
+
cp "$PARALLEL_PLAN" "$CASE_FILE"
|
|
719
|
+
perl -0pi -e 's{ - Files: tests/validate-plan\.sh\n - Depends on: none}{ - Files: README.md,\n skills/godplans/scripts/validate-plan.sh\n - Depends on: none}' "$CASE_FILE"
|
|
720
|
+
expect_fail "parallel wrapped Files line still conflicts" "but they share skills/godplans/scripts/validate-plan.sh" --allow-planning "$CASE_FILE"
|
|
721
|
+
|
|
722
|
+
new_case
|
|
723
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | deferred | reversible until pages ship |/' "$CASE_FILE"
|
|
724
|
+
expect_fail "deferred domain without trigger" "applicability matrix defers seo without a trigger" --allow-planning "$CASE_FILE"
|
|
725
|
+
|
|
726
|
+
new_case
|
|
727
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | deferred | trigger: first public page ships |/' "$CASE_FILE"
|
|
728
|
+
expect_fail "deferred domain without reversibility" "applicability matrix defers seo without a reversibility argument" --allow-planning "$CASE_FILE"
|
|
729
|
+
|
|
730
|
+
new_case
|
|
731
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | deferred | trigger: later; reversible because no pages exist |/' "$CASE_FILE"
|
|
732
|
+
expect_fail "deferred domain with vague trigger" "applicability matrix defers seo with a vague trigger" --allow-planning "$CASE_FILE"
|
|
733
|
+
|
|
734
|
+
new_case
|
|
735
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | skipped | nothing to index |/' "$CASE_FILE"
|
|
736
|
+
expect_fail "invalid matrix status" "applicability matrix row for seo has invalid status 'skipped'" --allow-planning "$CASE_FILE"
|
|
737
|
+
|
|
738
|
+
new_case
|
|
739
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | excluded | |/' "$CASE_FILE"
|
|
740
|
+
expect_fail "excluded domain without reason" "applicability matrix excludes seo without a reason" --allow-planning "$CASE_FILE"
|
|
741
|
+
|
|
742
|
+
new_case
|
|
743
|
+
perl -0pi -e 's/(\| product \| applicable \| fixture requirement \|\n)/$1| product | applicable | duplicate row |\n/' "$CASE_FILE"
|
|
744
|
+
expect_fail "duplicate matrix row" "applicability matrix has a duplicate row for product" --allow-planning "$CASE_FILE"
|
|
745
|
+
|
|
746
|
+
new_case
|
|
747
|
+
perl -0pi -e 's/^\| architecture \|.*\n//m' "$CASE_FILE"
|
|
748
|
+
expect_fail "missing matrix domain" "applicability matrix is missing domain architecture" --allow-planning "$CASE_FILE"
|
|
749
|
+
|
|
750
|
+
new_case
|
|
751
|
+
perl -0pi -e 's/\| architecture \| applicable \| shell and embedded Perl boundary \|/| architecture | deferred | trigger: first package; reversible until then |/' "$CASE_FILE"
|
|
752
|
+
expect_fail "load-bearing domain cannot defer" "cannot defer load-bearing domain architecture" --allow-planning "$CASE_FILE"
|
|
753
|
+
|
|
754
|
+
new_case
|
|
755
|
+
perl -0pi -e 's/## Applicability matrix\n/## Domains\n/' "$CASE_FILE"
|
|
756
|
+
expect_fail "missing Applicability matrix" "expected exactly one ## Applicability matrix section, found 0" --allow-planning "$CASE_FILE"
|
|
757
|
+
|
|
758
|
+
FALSIFIER_PLAN="$TMP_DIR/valid-decision-falsifier.mdx"
|
|
759
|
+
cp "$BASE_PLAN" "$FALSIFIER_PLAN"
|
|
760
|
+
expect_pass "decision with falsifier" --allow-planning "$FALSIFIER_PLAN"
|
|
761
|
+
|
|
762
|
+
new_case
|
|
763
|
+
perl -0pi -e 's/Falsifier:\n- Signal: Perl availability on every supported platform\n- Failure boundary: any supported platform ships without Perl\n- Replan action: return to planning and replace the embedded parser with a supported runtime\n//' "$CASE_FILE"
|
|
764
|
+
expect_fail "decision missing falsifier" "decision D1 (line " --allow-planning "$CASE_FILE"
|
|
765
|
+
|
|
766
|
+
new_case
|
|
767
|
+
perl -0pi -e 's/(### D1: portable runtime boundary)/$1\n\n### D1: duplicate/' "$CASE_FILE"
|
|
768
|
+
expect_fail "duplicate decision heading" "duplicate decision heading D1" --allow-planning "$CASE_FILE"
|
|
769
|
+
|
|
770
|
+
new_case
|
|
771
|
+
perl -0pi -e 's/Replan action: return to planning and replace the embedded parser with a supported runtime/Replan action: wait and see/' "$CASE_FILE"
|
|
772
|
+
expect_fail "falsifier must return to planning" "Replan action must explicitly return to planning" --allow-planning "$CASE_FILE"
|
|
773
|
+
|
|
774
|
+
new_case
|
|
775
|
+
perl -0pi -e 's/Failure boundary: any supported platform ships without Perl/Failure boundary: things go badly/' "$CASE_FILE"
|
|
776
|
+
expect_fail "falsifier boundary must be observable" "Failure boundary lacks an observable event or numeric threshold" --allow-planning "$CASE_FILE"
|
|
777
|
+
|
|
778
|
+
# A cited id is not a number: D1, R-SEC-4, and the template's own placeholder
|
|
779
|
+
# carry digits but no threshold.
|
|
780
|
+
for boundary in "things go badly for D1" "things go badly for R-SEC-4 and GP-101" "(numeric threshold or observable event that kills D1)"; do
|
|
781
|
+
new_case
|
|
782
|
+
BOUNDARY=$boundary perl -0pi -e 's/Failure boundary: any supported platform ships without Perl/Failure boundary: $ENV{BOUNDARY}/' "$CASE_FILE"
|
|
783
|
+
expect_fail "falsifier boundary '$boundary'" "Failure boundary lacks an observable event or numeric threshold" --allow-planning "$CASE_FILE"
|
|
784
|
+
done
|
|
785
|
+
|
|
786
|
+
# A calendar quarter is a deadline, not an Open Questions id.
|
|
787
|
+
new_case
|
|
788
|
+
perl -0pi -e 's/Failure boundary: any supported platform ships without Perl/Failure boundary: no paying customer by Q2/' "$CASE_FILE"
|
|
789
|
+
expect_pass "a calendar quarter counts as a boundary threshold" --allow-planning "$CASE_FILE"
|
|
790
|
+
|
|
791
|
+
new_case
|
|
792
|
+
perl -0pi -e 's/^- Signal: Perl availability[^\n]*$/- Signal: (metric or event and its evidence source)/m' "$CASE_FILE"
|
|
793
|
+
expect_fail "template Signal placeholder" "decision D1 Signal is too vague to observe" --allow-planning "$CASE_FILE"
|
|
794
|
+
|
|
795
|
+
# Only the placeholder's opening bracket is stripped: a backticked metric whose
|
|
796
|
+
# first segment is a vague word still names something observable.
|
|
797
|
+
new_case
|
|
798
|
+
perl -0pi -e 's/^- Signal: Perl availability[^\n]*$/- Signal: `usage.daily_active_tenants` from the analytics warehouse/m' "$CASE_FILE"
|
|
799
|
+
expect_pass "a backticked metric name opens a Signal" --allow-planning "$CASE_FILE"
|
|
800
|
+
|
|
801
|
+
# Trailing whitespace is invisible in Markdown, so it hides no heading or label.
|
|
802
|
+
TRAILING_PLAN="$TMP_DIR/trailing-whitespace.mdx"
|
|
803
|
+
cp "$BASE_PLAN" "$TRAILING_PLAN"
|
|
804
|
+
perl -0pi -e 's/^## Decisions$/## Decisions /m; s/^Falsifier:$/Falsifier: \t/m; s/^### Module disposition$/### Module disposition /m' "$TRAILING_PLAN"
|
|
805
|
+
expect_pass "trailing whitespace on headings and labels" --allow-planning "$TRAILING_PLAN"
|
|
806
|
+
|
|
807
|
+
new_case
|
|
808
|
+
perl -0pi -e 's/### D1: portable runtime boundary/### D1 portable runtime boundary/' "$CASE_FILE"
|
|
809
|
+
expect_fail "malformed decision heading" "malformed decision heading" --allow-planning "$CASE_FILE"
|
|
810
|
+
|
|
811
|
+
new_case
|
|
812
|
+
perl -0pi -e 's/### D1: portable runtime boundary.*?## Requirements/## Requirements/s' "$CASE_FILE"
|
|
813
|
+
expect_fail "missing decision entries" "Decisions must contain at least one" --allow-planning "$CASE_FILE"
|
|
814
|
+
|
|
815
|
+
JSON_OUT="$TMP_DIR/plan.json"
|
|
816
|
+
emit_sidecar "emit JSON sidecar" "$JSON_OUT" "$BASE_PLAN"
|
|
817
|
+
node -e '
|
|
818
|
+
const fs = require("node:fs");
|
|
819
|
+
const crypto = require("node:crypto");
|
|
820
|
+
const plan = fs.readFileSync(process.argv[1]);
|
|
821
|
+
const doc = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
|
822
|
+
const digest = "sha256:" + crypto.createHash("sha256").update(plan).digest("hex");
|
|
823
|
+
if (doc.format !== "godplans/plan-json@2") throw new Error("bad format tag");
|
|
824
|
+
if (doc.plan_digest !== digest) throw new Error("plan_digest mismatch");
|
|
825
|
+
if (doc.status !== "planning") throw new Error("status mismatch");
|
|
826
|
+
if (doc.public_release !== false) throw new Error("public_release mismatch");
|
|
827
|
+
if (doc.tasks.length !== 3) throw new Error("task count mismatch");
|
|
828
|
+
if (doc.tasks[0].id !== "GP-101" || doc.tasks[0].wave !== "W1.1") throw new Error("task shape mismatch");
|
|
829
|
+
if (doc.tasks[1].depends_on[0] !== "GP-101") throw new Error("depends_on mismatch");
|
|
830
|
+
if (doc.tasks[2].requirements.indexOf("R-CODE-21") < 0) throw new Error("requirements mismatch");
|
|
831
|
+
if (doc.phases.length !== 2 || doc.phases[1].name !== "Verification") throw new Error("phase shape mismatch");
|
|
832
|
+
if (doc.applicability.length !== 19) throw new Error("applicability mismatch");
|
|
833
|
+
if (doc.decisions.length !== 1 || doc.decisions[0].falsifier.signal.indexOf("Perl") < 0) throw new Error("decision mismatch");
|
|
834
|
+
if (doc.metrics.task_history.active !== 3 || doc.metrics.task_history.superseded !== 0) throw new Error("history mismatch");
|
|
835
|
+
' "$BASE_PLAN" "$JSON_OUT" && record_pass "JSON sidecar content" || record_fail "JSON sidecar content" "node assertion failed"
|
|
836
|
+
|
|
837
|
+
HISTORY_PLAN="$TMP_DIR/plan-with-superseded-task.mdx"
|
|
838
|
+
cp "$BASE_PLAN" "$HISTORY_PLAN"
|
|
839
|
+
perl -0pi -e 's/(Checkpoint: malformed plans fail with a diagnostic\.)/~~- [ ] GP-103 [W1.2] Add crawl metadata~~\n - Superseded: no public surface remains in scope\n - Requirements: R-SEO-1\n\n$1/' "$HISTORY_PLAN"
|
|
840
|
+
HISTORY_JSON="$TMP_DIR/history.json"
|
|
841
|
+
emit_sidecar "emit superseded task metrics" "$HISTORY_JSON" "$HISTORY_PLAN"
|
|
842
|
+
node -e '
|
|
843
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
844
|
+
if (doc.superseded_tasks.length !== 1 || doc.superseded_tasks[0].id !== "GP-103") throw new Error("superseded task missing");
|
|
845
|
+
if (doc.metrics.task_history.historical !== 4) throw new Error("historical count mismatch");
|
|
846
|
+
if (doc.metrics.task_history.supersession_rate !== 0.25) throw new Error("supersession rate mismatch");
|
|
847
|
+
const seo = doc.metrics.domains.find((entry) => entry.domain === "seo");
|
|
848
|
+
if (!seo || seo.supersession_rate !== 1) throw new Error("domain supersession rate mismatch");
|
|
849
|
+
' "$HISTORY_JSON" && record_pass "superseded task metric content" || record_fail "superseded task metric content" "node assertion failed"
|
|
850
|
+
|
|
851
|
+
HALFLIFE_OUT="$TMP_DIR/PLAN.metrics.json"
|
|
852
|
+
if "$ROOT_DIR/skills/godplans/scripts/plan-halflife.sh" "$HISTORY_PLAN" "$HALFLIFE_OUT" >/dev/null &&
|
|
853
|
+
node -e '
|
|
854
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
855
|
+
if (doc.format !== "godplans/plan-half-life@1") throw new Error("format mismatch");
|
|
856
|
+
if (doc.metrics.task_history.superseded !== 1) throw new Error("metric mismatch");
|
|
857
|
+
' "$HALFLIFE_OUT"; then
|
|
858
|
+
record_pass "plan half-life report"
|
|
859
|
+
else
|
|
860
|
+
record_fail "plan half-life report" "report generation failed"
|
|
861
|
+
fi
|
|
862
|
+
|
|
863
|
+
# Replan measures the outgoing plan with the validator it was written against.
|
|
864
|
+
# The stubs stand in for an older companion that accepts a plan the shipped
|
|
865
|
+
# sibling rejects; neither has an executable bit, so both must run under bash.
|
|
866
|
+
HALFLIFE="$ROOT_DIR/skills/godplans/scripts/plan-halflife.sh"
|
|
867
|
+
write_stub_validator() {
|
|
868
|
+
printf '%s\n' \
|
|
869
|
+
'while [ "$#" -gt 0 ]; do' \
|
|
870
|
+
' [ "$1" = --emit-json ] && { shift; out=$1; }' \
|
|
871
|
+
' shift' \
|
|
872
|
+
'done' \
|
|
873
|
+
"printf '{\"plan_digest\":\"sha256:stub\",\"plan_version\":$2,\"metrics\":{}}' > \"\$out\"" > "$1"
|
|
874
|
+
chmod -x "$1"
|
|
875
|
+
}
|
|
876
|
+
metrics_version_is() {
|
|
877
|
+
node -e 'const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8")); process.exit(doc.plan_version === Number(process.argv[2]) ? 0 : 1);' "$1" "$2"
|
|
878
|
+
}
|
|
879
|
+
COMPANION_DIR="$TMP_DIR/halflife-companion"
|
|
880
|
+
mkdir "$COMPANION_DIR"
|
|
881
|
+
printf '%s\n' 'an outgoing plan the shipped validator rejects' > "$COMPANION_DIR/PLAN.mdx"
|
|
882
|
+
write_stub_validator "$COMPANION_DIR/validate-plan.sh" 7
|
|
883
|
+
write_stub_validator "$TMP_DIR/override-validator.sh" 9
|
|
884
|
+
if "$HALFLIFE" "$COMPANION_DIR/PLAN.mdx" "$COMPANION_DIR/metrics.json" >/dev/null 2>&1 &&
|
|
885
|
+
metrics_version_is "$COMPANION_DIR/metrics.json" 7; then
|
|
886
|
+
record_pass "plan half-life uses the plan's companion validator"
|
|
887
|
+
else
|
|
888
|
+
record_fail "plan half-life uses the plan's companion validator" "the sibling validator measured the plan"
|
|
889
|
+
fi
|
|
890
|
+
if GODPLANS_VALIDATOR="$TMP_DIR/override-validator.sh" "$HALFLIFE" "$COMPANION_DIR/PLAN.mdx" "$COMPANION_DIR/metrics.json" >/dev/null 2>&1 &&
|
|
891
|
+
metrics_version_is "$COMPANION_DIR/metrics.json" 9; then
|
|
892
|
+
record_pass "plan half-life GODPLANS_VALIDATOR override wins"
|
|
893
|
+
else
|
|
894
|
+
record_fail "plan half-life GODPLANS_VALIDATOR override wins" "the override was ignored"
|
|
895
|
+
fi
|
|
896
|
+
# With no companion, the newer sibling measures the plan; a rejection names the way out.
|
|
897
|
+
REPLACED_DIR="$TMP_DIR/halflife-replaced"
|
|
898
|
+
mkdir "$REPLACED_DIR"
|
|
899
|
+
cp "$COMPANION_DIR/PLAN.mdx" "$REPLACED_DIR/PLAN.mdx"
|
|
900
|
+
if output=$("$HALFLIFE" "$REPLACED_DIR/PLAN.mdx" "$REPLACED_DIR/metrics.json" 2>&1); then
|
|
901
|
+
record_fail "plan half-life rejection names GODPLANS_VALIDATOR" "the sibling accepted an invalid plan"
|
|
902
|
+
elif printf '%s\n' "$output" | grep -F "set GODPLANS_VALIDATOR to the validator it was written against" >/dev/null; then
|
|
903
|
+
record_pass "plan half-life rejection names GODPLANS_VALIDATOR"
|
|
904
|
+
else
|
|
905
|
+
record_fail "plan half-life rejection names GODPLANS_VALIDATOR" "missing hint: $output"
|
|
906
|
+
fi
|
|
907
|
+
|
|
908
|
+
# Options are refused rather than read as a plan path; usage errors exit 2.
|
|
909
|
+
halflife_status() {
|
|
910
|
+
output=$("$HALFLIFE" "$@" 2>&1)
|
|
911
|
+
status=$?
|
|
912
|
+
}
|
|
913
|
+
halflife_status --help
|
|
914
|
+
if [ "$status" -eq 0 ] && printf '%s\n' "$output" | grep -F "Usage:" >/dev/null; then
|
|
915
|
+
record_pass "plan half-life --help prints usage"
|
|
916
|
+
else
|
|
917
|
+
record_fail "plan half-life --help prints usage" "status $status: $output"
|
|
918
|
+
fi
|
|
919
|
+
halflife_status --bogus
|
|
920
|
+
if [ "$status" -eq 2 ] && printf '%s\n' "$output" | grep -F "Unknown option: --bogus" >/dev/null; then
|
|
921
|
+
record_pass "plan half-life refuses an unknown option"
|
|
922
|
+
else
|
|
923
|
+
record_fail "plan half-life refuses an unknown option" "status $status: $output"
|
|
924
|
+
fi
|
|
925
|
+
halflife_status "$HISTORY_PLAN" "$TMP_DIR/extra.json" extra
|
|
926
|
+
if [ "$status" -eq 2 ] && [ ! -e "$TMP_DIR/extra.json" ] && printf '%s\n' "$output" | grep -F "Usage:" >/dev/null; then
|
|
927
|
+
record_pass "plan half-life refuses a third argument"
|
|
928
|
+
else
|
|
929
|
+
record_fail "plan half-life refuses a third argument" "status $status: $output"
|
|
930
|
+
fi
|
|
931
|
+
|
|
932
|
+
DRIFT_PLAN="$TMP_DIR/drift-check.mdx"
|
|
933
|
+
cp "$BASE_PLAN" "$DRIFT_PLAN"
|
|
934
|
+
perl -0pi -e '
|
|
935
|
+
s/status: planning/status: executing/;
|
|
936
|
+
s/phases_done: 0/phases_done: 1/;
|
|
937
|
+
s/tasks_done: 0/tasks_done: 2/;
|
|
938
|
+
s/- \[ \] GP-10/- [x] GP-10/g;
|
|
939
|
+
s/ - Verify: `bash tests\/validate-plan\.sh`/ - Verify: `test -f package.json`/g;
|
|
940
|
+
s/Checkpoint verify: `test -x skills\/godplans\/scripts\/validate-plan\.sh`/Checkpoint verify: `test -f package.json`/
|
|
941
|
+
' "$DRIFT_PLAN"
|
|
942
|
+
if "$VALIDATOR" --drift-check 1 "$DRIFT_PLAN" >/dev/null 2>&1; then
|
|
943
|
+
record_pass "phase-boundary drift check"
|
|
944
|
+
else
|
|
945
|
+
record_fail "phase-boundary drift check" "completed task or checkpoint recheck failed"
|
|
946
|
+
fi
|
|
947
|
+
|
|
948
|
+
RECHECK_PLAN="$TMP_DIR/drift-recheck.mdx"
|
|
949
|
+
cp "$DRIFT_PLAN" "$RECHECK_PLAN"
|
|
950
|
+
printf '%s\n' 'stable evidence' > "$TMP_DIR/recheck.txt"
|
|
951
|
+
RECHECK_DIGEST=$(shasum -a 256 "$TMP_DIR/recheck.txt" | awk '{print $1}')
|
|
952
|
+
AGGREGATE_DIGEST=$(node -e '
|
|
953
|
+
const crypto = require("node:crypto");
|
|
954
|
+
const entries = {
|
|
955
|
+
intake: "1111111111111111111111111111111111111111111111111111111111111111",
|
|
956
|
+
"recheck.txt": process.argv[1],
|
|
957
|
+
};
|
|
958
|
+
const input = Object.keys(entries).sort().map((key) => `${key}\t${entries[key]}\n`).join("");
|
|
959
|
+
process.stdout.write(crypto.createHash("sha256").update(input).digest("hex"));
|
|
960
|
+
' "$RECHECK_DIGEST")
|
|
961
|
+
RECHECK_DIGEST="$RECHECK_DIGEST" AGGREGATE_DIGEST="$AGGREGATE_DIGEST" perl -0pi -e '
|
|
962
|
+
s/1c7ca1006bb3157ad989c1f1dd1cd1d6e8e2a44d9509821ffa43f3be205a12d5/$ENV{AGGREGATE_DIGEST}/g;
|
|
963
|
+
s/(- `intake` = `sha256:[0-9a-f]{64}`)/$1\n- [recheck] `recheck.txt` = `sha256:$ENV{RECHECK_DIGEST}`/;
|
|
964
|
+
s/`test -f package.json`/`test -f recheck.txt`/g
|
|
965
|
+
' "$RECHECK_PLAN"
|
|
966
|
+
if (cd "$TMP_DIR" && "$VALIDATOR" --drift-check 1 "$RECHECK_PLAN" >/dev/null 2>&1); then
|
|
967
|
+
record_pass "phase-boundary provenance recheck"
|
|
968
|
+
else
|
|
969
|
+
record_fail "phase-boundary provenance recheck" "stable evidence failed"
|
|
970
|
+
fi
|
|
971
|
+
printf '%s\n' 'drifted evidence' > "$TMP_DIR/recheck.txt"
|
|
972
|
+
output=$(cd "$TMP_DIR" && "$VALIDATOR" --drift-check 1 "$RECHECK_PLAN" 2>&1) && status=0 || status=$?
|
|
973
|
+
if [ "$status" -ne 0 ] && printf '%s\n' "$output" | grep -F "recheck evidence drifted: recheck.txt" >/dev/null; then
|
|
974
|
+
record_pass "phase-boundary provenance drift fails"
|
|
975
|
+
else
|
|
976
|
+
record_fail "phase-boundary provenance drift fails" "drift was not rejected: $output"
|
|
977
|
+
fi
|
|
978
|
+
|
|
979
|
+
# Dotfile and underscore paths are ordinary repository paths: a fresh
|
|
980
|
+
# .godaudits/EVIDENCE.json is recorded as a recheck entry and recomputed.
|
|
981
|
+
DOTFILE_DIR="$TMP_DIR/dotfile-repo"
|
|
982
|
+
mkdir -p "$DOTFILE_DIR/.godaudits"
|
|
983
|
+
printf '%s\n' '{"findings":[]}' > "$DOTFILE_DIR/.godaudits/EVIDENCE.json"
|
|
984
|
+
printf '%s\n' 'title: site' > "$DOTFILE_DIR/_config.yml"
|
|
985
|
+
EVIDENCE_DIGEST=$(shasum -a 256 "$DOTFILE_DIR/.godaudits/EVIDENCE.json" | awk '{print $1}')
|
|
986
|
+
CONFIG_DIGEST=$(shasum -a 256 "$DOTFILE_DIR/_config.yml" | awk '{print $1}')
|
|
987
|
+
AGGREGATE_DIGEST=$(node -e '
|
|
988
|
+
const crypto = require("node:crypto");
|
|
989
|
+
const entries = {
|
|
990
|
+
intake: "1111111111111111111111111111111111111111111111111111111111111111",
|
|
991
|
+
".godaudits/EVIDENCE.json": process.argv[1],
|
|
992
|
+
"_config.yml": process.argv[2],
|
|
993
|
+
};
|
|
994
|
+
const input = Object.keys(entries).sort().map((key) => `${key}\t${entries[key]}\n`).join("");
|
|
995
|
+
process.stdout.write(crypto.createHash("sha256").update(input).digest("hex"));
|
|
996
|
+
' "$EVIDENCE_DIGEST" "$CONFIG_DIGEST")
|
|
997
|
+
DOTFILE_PLAN="$TMP_DIR/drift-dotfile.mdx"
|
|
998
|
+
cp "$DRIFT_PLAN" "$DOTFILE_PLAN"
|
|
999
|
+
EVIDENCE_DIGEST="$EVIDENCE_DIGEST" CONFIG_DIGEST="$CONFIG_DIGEST" AGGREGATE_DIGEST="$AGGREGATE_DIGEST" perl -0pi -e '
|
|
1000
|
+
s/1c7ca1006bb3157ad989c1f1dd1cd1d6e8e2a44d9509821ffa43f3be205a12d5/$ENV{AGGREGATE_DIGEST}/g;
|
|
1001
|
+
s/(- `intake` = `sha256:[0-9a-f]{64}`)/$1\n- [recheck] `.godaudits\/EVIDENCE.json` = `sha256:$ENV{EVIDENCE_DIGEST}`\n- `_config.yml` = `sha256:$ENV{CONFIG_DIGEST}`/;
|
|
1002
|
+
s/`test -f package.json`/`test -f _config.yml`/g
|
|
1003
|
+
' "$DOTFILE_PLAN"
|
|
1004
|
+
expect_pass "dotfile and underscore provenance labels" --allow-planning "$DOTFILE_PLAN"
|
|
1005
|
+
output=$(cd "$DOTFILE_DIR" && "$VALIDATOR" --drift-check 1 "$DOTFILE_PLAN" 2>&1) && status=0 || status=$?
|
|
1006
|
+
if [ "$status" -eq 0 ] && printf '%s\n' "$output" | grep -F "recheck evidence ok: .godaudits/EVIDENCE.json" >/dev/null; then
|
|
1007
|
+
record_pass "dotfile recheck label is recomputed"
|
|
1008
|
+
else
|
|
1009
|
+
record_fail "dotfile recheck label is recomputed" "status $status: $output"
|
|
1010
|
+
fi
|
|
1011
|
+
|
|
1012
|
+
new_case
|
|
1013
|
+
perl -0pi -e 's/^Checkpoint verify:.*\n//m' "$CASE_FILE"
|
|
1014
|
+
expect_fail "missing checkpoint verification" "Phase 1 is missing Checkpoint verify" --allow-planning "$CASE_FILE"
|
|
1015
|
+
|
|
1016
|
+
new_case
|
|
1017
|
+
perl -0pi -e 's/## Decisions\n/## Choices\n/' "$CASE_FILE"
|
|
1018
|
+
expect_fail "missing Decisions section" "expected exactly one ## Decisions section, found 0" --allow-planning "$CASE_FILE"
|
|
1019
|
+
|
|
1020
|
+
# Exclusion tripwires: an exclusion with no evidence state and no expiry reads
|
|
1021
|
+
# exactly like a considered decision, which is the row an auditor pulls first.
|
|
1022
|
+
|
|
1023
|
+
new_case
|
|
1024
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | excluded | by-design: nothing the validator produces is crawlable |/' "$CASE_FILE"
|
|
1025
|
+
expect_fail "excluded domain without tripwire" "applicability matrix excludes seo without a revisit when: tripwire" --allow-planning "$CASE_FILE"
|
|
1026
|
+
|
|
1027
|
+
new_case
|
|
1028
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | excluded | nothing the validator produces is crawlable; revisit when: the project publishes a reachable page |/' "$CASE_FILE"
|
|
1029
|
+
expect_fail "excluded domain without evidence state" "applicability matrix excludes seo without an evidence state" --allow-planning "$CASE_FILE"
|
|
1030
|
+
|
|
1031
|
+
new_case
|
|
1032
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | excluded | unknown: nobody checked for crawlable routes; revisit when: the project publishes a reachable page |/' "$CASE_FILE"
|
|
1033
|
+
expect_fail "excluded domain on an unknown state" "applicability matrix excludes seo on evidence state 'unknown'" --allow-planning "$CASE_FILE"
|
|
1034
|
+
|
|
1035
|
+
new_case
|
|
1036
|
+
perl -0pi -e 's/\| seo \| excluded \|[^\n]*\|/| seo | excluded | by-design: nothing is crawlable; revisit when: later |/' "$CASE_FILE"
|
|
1037
|
+
expect_fail "excluded domain with a vague tripwire" "applicability matrix excludes seo with a vague revisit when: predicate" --allow-planning "$CASE_FILE"
|
|
1038
|
+
|
|
1039
|
+
new_case
|
|
1040
|
+
perl -0pi -e 's/\| repo \| applicable \| validator ships in the skill package \|/| repo | excluded | by-design: no repository is planned; revisit when: the project gains a version-controlled home |/; s/^(domains_applicable: \[[^\]]*), repo(.*)$/$1$2/m; s/^(domains_excluded: \[)/$1repo, /m' "$CASE_FILE"
|
|
1041
|
+
expect_fail "load-bearing domain cannot be excluded" "applicability matrix cannot exclude load-bearing domain repo" --allow-planning "$CASE_FILE"
|
|
1042
|
+
|
|
1043
|
+
# Module disposition: the only place a module requirement may leave the plan.
|
|
1044
|
+
|
|
1045
|
+
new_case
|
|
1046
|
+
perl -0pi -e 's/### Module disposition\n/### Module notes\n/' "$CASE_FILE"
|
|
1047
|
+
expect_fail "missing module disposition" "expected exactly one ### Module disposition block under ## Applicability matrix, found 0" --allow-planning "$CASE_FILE"
|
|
1048
|
+
|
|
1049
|
+
# Placement is part of the contract: the disposition follows the matrix table,
|
|
1050
|
+
# once, and the archetype block sits under ## Product form.
|
|
1051
|
+
new_case
|
|
1052
|
+
perl -0pi -e 's/(### Module disposition\n\n(?:- [^\n]*\n)+)//; $block = $1; s/(## Agent memory\n\nThe plan remains the source of truth\.\n)/$1\n$block/' "$CASE_FILE"
|
|
1053
|
+
expect_fail "module disposition outside the matrix" "found 0 there and 1 elsewhere" --allow-planning "$CASE_FILE"
|
|
1054
|
+
|
|
1055
|
+
new_case
|
|
1056
|
+
perl -0pi -e 's/^(- security: landed R-SEC-1)$/\n### Module disposition\n\n$1/m' "$CASE_FILE"
|
|
1057
|
+
expect_fail "module disposition split into two blocks" "expected exactly one ### Module disposition block under ## Applicability matrix, found 2" --allow-planning "$CASE_FILE"
|
|
1058
|
+
|
|
1059
|
+
new_case
|
|
1060
|
+
perl -0pi -e 's/(### Archetype confidence\n\n(?:- [^\n]*\n)+)//; $block = $1; s/(## Agent memory\n\nThe plan remains the source of truth\.\n)/$1\n$block/' "$CASE_FILE"
|
|
1061
|
+
expect_fail "archetype confidence outside Product form" "### Archetype confidence must sit under ## Product form" --allow-planning "$CASE_FILE"
|
|
1062
|
+
|
|
1063
|
+
new_case
|
|
1064
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1\n//m' "$CASE_FILE"
|
|
1065
|
+
expect_fail "module disposition skips an applicable module" "module disposition is missing applicable module roadmap" --allow-planning "$CASE_FILE"
|
|
1066
|
+
|
|
1067
|
+
new_case
|
|
1068
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1; dropped-by vibes R-ROAD-9 (felt heavy)/m' "$CASE_FILE"
|
|
1069
|
+
expect_fail "module disposition names an unknown layer" "drops by unknown layer 'vibes'" --allow-planning "$CASE_FILE"
|
|
1070
|
+
|
|
1071
|
+
new_case
|
|
1072
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1; dropped-by scale R-ROAD-9/m' "$CASE_FILE"
|
|
1073
|
+
expect_fail "module disposition drops without a reason" "dropped-by clause without a parenthesised reason" --allow-planning "$CASE_FILE"
|
|
1074
|
+
|
|
1075
|
+
new_case
|
|
1076
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1; dropped-by scale R-ROAD-1 (cut for the weekend appetite)/m' "$CASE_FILE"
|
|
1077
|
+
expect_fail "module disposition lands and drops one id" "module disposition for roadmap both lands and drops R-ROAD-1" --allow-planning "$CASE_FILE"
|
|
1078
|
+
|
|
1079
|
+
new_case
|
|
1080
|
+
perl -0pi -e 's/^- build: landed R-BUILD-1$/- build: landed none; dropped-by scale R-BUILD-1 (cut for the weekend appetite)/m' "$CASE_FILE"
|
|
1081
|
+
expect_fail "module disposition drops a requirement a task cites" "module disposition drops R-BUILD-1 but GP-201 still traces to it" --allow-planning "$CASE_FILE"
|
|
1082
|
+
|
|
1083
|
+
new_case
|
|
1084
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-STACK-7/m' "$CASE_FILE"
|
|
1085
|
+
expect_fail "module disposition lands an unreferenced requirement" "module disposition lands R-STACK-7 but nothing outside the frontmatter, session log, and disposition block references it" --allow-planning "$CASE_FILE"
|
|
1086
|
+
|
|
1087
|
+
new_case
|
|
1088
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-SEC-1/m' "$CASE_FILE"
|
|
1089
|
+
expect_fail "module disposition crosses module prefixes" "module disposition for stack lists R-SEC-1, which is not an R-STACK requirement" --allow-planning "$CASE_FILE"
|
|
1090
|
+
|
|
1091
|
+
new_case
|
|
1092
|
+
perl -0pi -e 's/^- product: landed R-PRD-1;[^\n]*$/- product: landed R-PRD-1\n- observe: landed R-OBS-1/m' "$CASE_FILE"
|
|
1093
|
+
expect_fail "module disposition covers an excluded module" "module disposition covers observe, which the applicability matrix marks excluded" --allow-planning "$CASE_FILE"
|
|
1094
|
+
|
|
1095
|
+
# Documentation set: selection, ownership, and defended absences.
|
|
1096
|
+
|
|
1097
|
+
new_case
|
|
1098
|
+
perl -0pi -e 's/## Documentation set\n/## Docs\n/' "$CASE_FILE"
|
|
1099
|
+
expect_fail "missing documentation set" "expected exactly one ## Documentation set section, found 0" --allow-planning "$CASE_FILE"
|
|
1100
|
+
|
|
1101
|
+
new_case
|
|
1102
|
+
perl -0pi -e 's/^This manifest covers documentation committed to this repository[^\n]*\n//m' "$CASE_FILE"
|
|
1103
|
+
expect_fail "documentation set without a boundary statement" "documentation set must state its boundary" --allow-planning "$CASE_FILE"
|
|
1104
|
+
|
|
1105
|
+
new_case
|
|
1106
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.manual | build | required | repo | always; written by GP-102 |/m' "$CASE_FILE"
|
|
1107
|
+
expect_fail "documentation set invents a catalog id" "documentation set names build.manual, which is not a doc-set.md catalog id" --allow-planning "$CASE_FILE"
|
|
1108
|
+
|
|
1109
|
+
new_case
|
|
1110
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|([^\n]*)\|$/| build.readme | build | required | build |$1|/m' "$CASE_FILE"
|
|
1111
|
+
expect_fail "documentation set reassigns ownership" "documentation set row build.readme names owner 'build'; the catalog owner is repo" --allow-planning "$CASE_FILE"
|
|
1112
|
+
|
|
1113
|
+
new_case
|
|
1114
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | verify | required | repo | always; written by GP-102 |/m' "$CASE_FILE"
|
|
1115
|
+
expect_fail "documentation set moves a document between stages" "documentation set row build.readme declares stage 'verify'" --allow-planning "$CASE_FILE"
|
|
1116
|
+
|
|
1117
|
+
new_case
|
|
1118
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | required | repo | always, and somebody will get to it |/m' "$CASE_FILE"
|
|
1119
|
+
expect_fail "required document with no writing task" "documentation set row build.readme is required but names no GP task" --allow-planning "$CASE_FILE"
|
|
1120
|
+
|
|
1121
|
+
new_case
|
|
1122
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | required | repo | always; written by GP-909 |/m' "$CASE_FILE"
|
|
1123
|
+
expect_fail "required document names a nonexistent task" "documentation set row build.readme names GP-909, which is not a task in this plan" --allow-planning "$CASE_FILE"
|
|
1124
|
+
|
|
1125
|
+
new_case
|
|
1126
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | no external user was named in intake |/m' "$CASE_FILE"
|
|
1127
|
+
expect_fail "excluded document without a tripwire" "documentation set excludes serve.user-guide without a revisit when: tripwire" --allow-planning "$CASE_FILE"
|
|
1128
|
+
|
|
1129
|
+
new_case
|
|
1130
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | unknown: nobody asked who reads this; revisit when: the validator ships to users outside this repository |/m' "$CASE_FILE"
|
|
1131
|
+
expect_fail "excluded document on an unknown state" "documentation set excludes serve.user-guide on evidence state 'unknown'; only absent, by-design, or present-elsewhere may exclude" --allow-planning "$CASE_FILE"
|
|
1132
|
+
|
|
1133
|
+
new_case
|
|
1134
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | absent: no external user was named in intake; revisit when: post-MVP |/m' "$CASE_FILE"
|
|
1135
|
+
expect_fail "excluded document with a vague tripwire" "documentation set excludes serve.user-guide with a vague revisit when: predicate" --allow-planning "$CASE_FILE"
|
|
1136
|
+
|
|
1137
|
+
new_case
|
|
1138
|
+
perl -0pi -e 's/^\| operate\.runbook \| operate \| not-applicable \| observe \|[^\n]*\|$/| operate.runbook | operate | required | observe | always; written by GP-201 |/m' "$CASE_FILE"
|
|
1139
|
+
expect_fail "required document owned by an excluded module" "its owner module observe is excluded in the applicability matrix" --allow-planning "$CASE_FILE"
|
|
1140
|
+
|
|
1141
|
+
# Archetype confidence: the label is arithmetic over the plan's own scores.
|
|
1142
|
+
|
|
1143
|
+
new_case
|
|
1144
|
+
perl -0pi -e 's/^- Margin: 57 points$/- Margin: 40 points/m' "$CASE_FILE"
|
|
1145
|
+
expect_fail "archetype margin disagrees with the scores" "Margin is 40 but the scores give 57" --allow-planning "$CASE_FILE"
|
|
1146
|
+
|
|
1147
|
+
new_case
|
|
1148
|
+
perl -0pi -e 's/^- Confidence: high$/- Confidence: medium/m; s/^archetype_confidence: high$/archetype_confidence: medium/m' "$CASE_FILE"
|
|
1149
|
+
expect_fail "archetype confidence contradicts its own arithmetic" "archetype confidence states medium but a margin of 57" --allow-planning "$CASE_FILE"
|
|
1150
|
+
|
|
1151
|
+
new_case
|
|
1152
|
+
perl -0pi -e 's/^archetype_confidence: high$/archetype_confidence: low/m' "$CASE_FILE"
|
|
1153
|
+
expect_fail "frontmatter confidence contradicts the block" "frontmatter archetype_confidence is low but the block" --allow-planning "$CASE_FILE"
|
|
1154
|
+
|
|
1155
|
+
new_case
|
|
1156
|
+
perl -0pi -e 's/^- Primary: cli-tool \(score 0\.86\)$/- Primary: library (score 0.86)/m' "$CASE_FILE"
|
|
1157
|
+
expect_fail "archetype block disagrees with frontmatter" "Primary is library but frontmatter archetype is cli-tool" --allow-planning "$CASE_FILE"
|
|
1158
|
+
|
|
1159
|
+
new_case
|
|
1160
|
+
perl -0pi -e 's/^- Primary: cli-tool \(score 0\.86\)$/- Primary: cli-tool (score 0.40)/m; s/^- Runner-up: library \(score 0\.29\)$/- Runner-up: none/m; s/^- Margin: 57 points$/- Margin: 40 points/m; s/^- Confidence: high$/- Confidence: low/m; s/^archetype_confidence: high$/archetype_confidence: low/m' "$CASE_FILE"
|
|
1161
|
+
expect_fail "archetype below the floor keeps a named archetype" "Primary score 0.40 is below the 0.45 floor, so frontmatter archetype must be unknown" --allow-planning "$CASE_FILE"
|
|
1162
|
+
|
|
1163
|
+
# Below the floor with a medium label: the floor fired, not low confidence.
|
|
1164
|
+
new_case
|
|
1165
|
+
perl -0pi -e 's/^archetype: cli-tool$/archetype: unknown/m; s/^archetype_confidence: high$/archetype_confidence: medium/m; s/^- Primary: cli-tool \(score 0\.86\)$/- Primary: cli-tool (score 0.40)/m; s/^- Runner-up: library \(score 0\.29\)$/- Runner-up: none/m; s/^- Margin: 57 points$/- Margin: 40 points/m; s/^- Confidence: high$/- Confidence: medium/m' "$CASE_FILE"
|
|
1166
|
+
output=$("$VALIDATOR" --allow-planning "$CASE_FILE" 2>&1) && status=0 || status=$?
|
|
1167
|
+
if [ "$status" -ne 0 ] &&
|
|
1168
|
+
printf '%s\n' "$output" | grep -F "the archetype Primary score is below the 0.45 floor, so the archetype belongs in ## Open Questions" >/dev/null &&
|
|
1169
|
+
! printf '%s\n' "$output" | grep -F "confidence is low" >/dev/null; then
|
|
1170
|
+
record_pass "floor below a medium label names the floor"
|
|
1171
|
+
else
|
|
1172
|
+
record_fail "floor below a medium label names the floor" "$output"
|
|
1173
|
+
fi
|
|
1174
|
+
|
|
1175
|
+
# Only the nine scored archetypes exist; a merged hybrid is refused.
|
|
1176
|
+
new_case
|
|
1177
|
+
perl -0pi -e 's/^archetype: cli-tool$/archetype: hybrid/m; s/^- Primary: cli-tool \(score 0\.86\)$/- Primary: hybrid (score 0.86)/m' "$CASE_FILE"
|
|
1178
|
+
expect_fail "hybrid frontmatter archetype" "invalid archetype 'hybrid'; expected unknown or one of cli-tool, library" --allow-planning "$CASE_FILE"
|
|
1179
|
+
expect_fail "hybrid Primary archetype" "archetype confidence names hybrid, which is not one of" --allow-planning "$CASE_FILE"
|
|
1180
|
+
|
|
1181
|
+
new_case
|
|
1182
|
+
perl -0pi -e 's/^- Runner-up: library \(score 0\.29\)$/- Runner-up: monolith (score 0.29)/m' "$CASE_FILE"
|
|
1183
|
+
expect_fail "unknown Runner-up archetype" "archetype confidence names monolith, which is not one of" --allow-planning "$CASE_FILE"
|
|
1184
|
+
|
|
1185
|
+
new_case
|
|
1186
|
+
perl -0pi -e 's/^- If the runner-up is right: [^\n]*$/- If the runner-up is right: some rework in the packaging tasks/m' "$CASE_FILE"
|
|
1187
|
+
expect_fail "archetype counterfactual priced in adjectives" "counterfactual must be priced in tasks and phases" --allow-planning "$CASE_FILE"
|
|
1188
|
+
|
|
1189
|
+
new_case
|
|
1190
|
+
perl -0pi -e 's/^- Overlays: none$/- Overlays: public-ui/m' "$CASE_FILE"
|
|
1191
|
+
expect_fail "archetype overlays disagree with frontmatter" "Overlays says 'public-ui' but frontmatter overlays is []" --allow-planning "$CASE_FILE"
|
|
1192
|
+
|
|
1193
|
+
new_case
|
|
1194
|
+
perl -0pi -e 's/^### Archetype confidence\n/### Archetype notes\n/m' "$CASE_FILE"
|
|
1195
|
+
expect_fail "missing archetype confidence block" "expected exactly one ### Archetype confidence block, found 0" --allow-planning "$CASE_FILE"
|
|
1196
|
+
|
|
1197
|
+
LOW_CONFIDENCE_PLAN="$TMP_DIR/valid-low-confidence.mdx"
|
|
1198
|
+
cp "$BASE_PLAN" "$LOW_CONFIDENCE_PLAN"
|
|
1199
|
+
perl -0pi -e '
|
|
1200
|
+
s/^archetype: cli-tool$/archetype: unknown/m;
|
|
1201
|
+
s/^archetype_confidence: high$/archetype_confidence: low/m;
|
|
1202
|
+
s/^- Primary: cli-tool \(score 0\.86\)$/- Primary: cli-tool (score 0.40)/m;
|
|
1203
|
+
s/^- Runner-up: library \(score 0\.29\)$/- Runner-up: library (score 0.36)/m;
|
|
1204
|
+
s/^- Margin: 57 points$/- Margin: 4 points/m;
|
|
1205
|
+
s/^- Confidence: high$/- Confidence: low/m;
|
|
1206
|
+
s/^None\.$/### Q1: Is this a cli-tool or a library, given the archetype score of 0.40?\n- Owner: the maintainer (the answer is theirs to give)\n- Blocks: build, from the start of Phase 1\n- Decide by: 2026-08-14, the Phase 1 wave boundary\n- Why it matters: the archetype sets the matrix defaults and the documentation set.\n- Options: (a) cli-tool; (b) library; (c) both, published as a library with a thin command wrapper.\n- Recommended default: (a), which the current entry point already matches./m
|
|
1207
|
+
' "$LOW_CONFIDENCE_PLAN"
|
|
1208
|
+
expect_pass "low confidence with the archetype asked" --allow-planning "$LOW_CONFIDENCE_PLAN"
|
|
1209
|
+
|
|
1210
|
+
CASE_FILE="$TMP_DIR/low-confidence-unasked.mdx"
|
|
1211
|
+
cp "$LOW_CONFIDENCE_PLAN" "$CASE_FILE"
|
|
1212
|
+
perl -0pi -e 's/^### Q1: Is this a cli-tool or a library[^\n]*$/### Q1: Which package registry receives the release?/m' "$CASE_FILE"
|
|
1213
|
+
expect_fail "low confidence without the archetype question" "archetype belongs in ## Open Questions" --allow-planning "$CASE_FILE"
|
|
1214
|
+
|
|
1215
|
+
CASE_FILE="$TMP_DIR/low-confidence-assure.mdx"
|
|
1216
|
+
cp "$LOW_CONFIDENCE_PLAN" "$CASE_FILE"
|
|
1217
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|([^\n]*)\|$/| assure.threat-model | assure | not-applicable | security | by-design: no auth boundary and no stored personal data; revisit when: any task adds a session or persists user data |/m' "$CASE_FILE"
|
|
1218
|
+
expect_fail "low confidence deletes an assure row" "not-applicable while archetype confidence is low" --allow-planning "$CASE_FILE"
|
|
1219
|
+
|
|
1220
|
+
# Overlays raise and never lower.
|
|
1221
|
+
|
|
1222
|
+
new_case
|
|
1223
|
+
perl -0pi -e 's/^overlays: \[\]$/overlays: [public-ui]/m; s/^- Overlays: none$/- Overlays: public-ui/m' "$CASE_FILE"
|
|
1224
|
+
expect_fail "overlay domain excluded anyway" "which the public-ui overlay covers" --allow-planning "$CASE_FILE"
|
|
1225
|
+
|
|
1226
|
+
new_case
|
|
1227
|
+
perl -0pi -e 's/^overlays: \[\]$/overlays: [telemetry]/m' "$CASE_FILE"
|
|
1228
|
+
expect_fail "unknown overlay" "names unknown overlay telemetry" --allow-planning "$CASE_FILE"
|
|
1229
|
+
|
|
1230
|
+
new_case
|
|
1231
|
+
perl -0pi -e 's/^overlays: \[\]$/overlays: ai-system/m' "$CASE_FILE"
|
|
1232
|
+
expect_fail "overlays must be an inline list" "overlays must be a single inline list" --allow-planning "$CASE_FILE"
|
|
1233
|
+
|
|
1234
|
+
OVERLAY_PLAN="$TMP_DIR/valid-overlay.mdx"
|
|
1235
|
+
cp "$BASE_PLAN" "$OVERLAY_PLAN"
|
|
1236
|
+
perl -0pi -e '
|
|
1237
|
+
s/^overlays: \[\]$/overlays: [shipped-artifact]/m;
|
|
1238
|
+
s/^- Overlays: none$/- Overlays: shipped-artifact/m;
|
|
1239
|
+
s/^\| deploy \| excluded \|[^\n]*\|$/| deploy | deferred | trigger: the first distribution task enters the roadmap; reversible until an artifact is published |/m;
|
|
1240
|
+
s/^(domains_excluded: \[[^\]]*), deploy(.*)$/$1$2/m;
|
|
1241
|
+
s/^domains_deferred: \[\]$/domains_deferred: [deploy]/m
|
|
1242
|
+
' "$OVERLAY_PLAN"
|
|
1243
|
+
expect_pass "overlay domain may defer" --allow-planning "$OVERLAY_PLAN"
|
|
1244
|
+
|
|
1245
|
+
# The business domain: a plan written before the domain existed gains the
|
|
1246
|
+
# row in replan, the domain never defers, the monetized overlay keeps it in
|
|
1247
|
+
# the plan, and its requirements resolve against the embedded catalog.
|
|
1248
|
+
|
|
1249
|
+
new_case
|
|
1250
|
+
perl -0pi -e 's/^\| business \| excluded \|[^\n]*\|\n//m; s/^(domains_excluded: \[database), business/$1/m' "$CASE_FILE"
|
|
1251
|
+
expect_fail "plan written before the business domain" "applicability matrix is missing domain business" --allow-planning "$CASE_FILE"
|
|
1252
|
+
|
|
1253
|
+
new_case
|
|
1254
|
+
perl -0pi -e 's/^\| business \| excluded \|[^\n]*\|$/| business | deferred | trigger: the first priced plan enters the roadmap; reversible until checkout ships |/m; s/^(domains_excluded: \[database), business/$1/m; s/^domains_deferred: \[\]$/domains_deferred: [business]/m' "$CASE_FILE"
|
|
1255
|
+
expect_fail "business never defers" "cannot defer load-bearing domain business" --allow-planning "$CASE_FILE"
|
|
1256
|
+
|
|
1257
|
+
new_case
|
|
1258
|
+
perl -0pi -e 's/^overlays: \[\]$/overlays: [monetized]/m; s/^- Overlays: none$/- Overlays: monetized/m' "$CASE_FILE"
|
|
1259
|
+
expect_fail "monetized overlay keeps business in the plan" "which the monetized overlay covers; overlays raise and never lower, so this row must be applicable" --allow-planning "$CASE_FILE"
|
|
1260
|
+
|
|
1261
|
+
BUSINESS_PLAN="$TMP_DIR/valid-business.mdx"
|
|
1262
|
+
cp "$BASE_PLAN" "$BUSINESS_PLAN"
|
|
1263
|
+
perl -0pi -e '
|
|
1264
|
+
s/^overlays: \[\]$/overlays: [monetized]/m;
|
|
1265
|
+
s/^- Overlays: none$/- Overlays: monetized/m;
|
|
1266
|
+
s/^\| business \| excluded \|[^\n]*\|$/| business | applicable | the fixture sells a paid tier |/m;
|
|
1267
|
+
s/^(domains_excluded: \[database), business/$1/m;
|
|
1268
|
+
s/^(domains_applicable: \[product), /$1, business, /m;
|
|
1269
|
+
s/^(- product: landed R-PRD-1;[^\n]*\n)/$1- business: landed R-BIZ-9; dropped-by archetype R-BIZ-25 (D1: no controlled experiments, D2: no flag mechanism)\n/m;
|
|
1270
|
+
s/^( - Requirements: R-1\.1, R-CODE-21, R-ARCH-4, R-STACK-1)$/$1, R-BIZ-9/m
|
|
1271
|
+
' "$BUSINESS_PLAN"
|
|
1272
|
+
expect_pass "monetized plan with the business module landed" --allow-planning "$BUSINESS_PLAN"
|
|
1273
|
+
|
|
1274
|
+
new_case
|
|
1275
|
+
cp "$BUSINESS_PLAN" "$CASE_FILE"
|
|
1276
|
+
perl -0pi -e 's/^( - Requirements: R-1\.1, R-CODE-21, R-ARCH-4, R-STACK-1), R-BIZ-9$/$1, R-BIZ-27/m' "$CASE_FILE"
|
|
1277
|
+
expect_fail "business requirement outside the catalog" "R-BIZ-27" --allow-planning "$CASE_FILE"
|
|
1278
|
+
|
|
1279
|
+
# Brownfield absent: claims carry the search that came back empty.
|
|
1280
|
+
|
|
1281
|
+
BROWNFIELD_PLAN="$TMP_DIR/valid-brownfield-absent.mdx"
|
|
1282
|
+
cp "$BASE_PLAN" "$BROWNFIELD_PLAN"
|
|
1283
|
+
perl -0pi -e '
|
|
1284
|
+
s/^mode: greenfield$/mode: brownfield/m;
|
|
1285
|
+
s/^\| seo \| excluded \|[^\n]*\|$/| seo | excluded | absent: no HTML template or route table under src (`grep -rl "<html" src` returns nothing); revisit when: the project publishes a page a search engine can reach |/m
|
|
1286
|
+
' "$BROWNFIELD_PLAN"
|
|
1287
|
+
expect_pass "brownfield absent claim with a citation" --allow-planning "$BROWNFIELD_PLAN"
|
|
1288
|
+
|
|
1289
|
+
CASE_FILE="$TMP_DIR/brownfield-absent-uncited.mdx"
|
|
1290
|
+
cp "$BROWNFIELD_PLAN" "$CASE_FILE"
|
|
1291
|
+
perl -0pi -e 's/^\| seo \| excluded \|[^\n]*\|$/| seo | excluded | absent: no HTML template or route table under src; revisit when: the project publishes a page a search engine can reach |/m' "$CASE_FILE"
|
|
1292
|
+
expect_fail "brownfield absent claim with no search" "absent: claim with no backticked command" --allow-planning "$CASE_FILE"
|
|
1293
|
+
|
|
1294
|
+
DOC_CATALOG_ACTUAL="$TMP_DIR/doc-catalog-actual"
|
|
1295
|
+
DOC_CATALOG_EMBEDDED="$TMP_DIR/doc-catalog-embedded"
|
|
1296
|
+
perl -ne 'print "$1 $3 $2\n" if /^\|\s*`([a-z]+\.[a-z0-9-]+)`\s*\|\s*(durable|evidence|transient)\s*\|\s*([a-z-]+)\s*\|/' \
|
|
1297
|
+
"$ROOT_DIR/skills/godplans/references/doc-set.md" | sort > "$DOC_CATALOG_ACTUAL"
|
|
1298
|
+
perl -ne "print \"\$1 \$2 \$3\n\" if /^ '([a-z]+\.[a-z0-9-]+)' => '([a-z-]+)\|(durable|evidence|transient)',\$/" \
|
|
1299
|
+
"$VALIDATOR" | sort > "$DOC_CATALOG_EMBEDDED"
|
|
1300
|
+
if diff -u "$DOC_CATALOG_ACTUAL" "$DOC_CATALOG_EMBEDDED" >/dev/null 2>&1; then
|
|
1301
|
+
record_pass "embedded document catalog is current"
|
|
1302
|
+
else
|
|
1303
|
+
record_fail "embedded document catalog is current" "validator doc catalog differs from doc-set.md"
|
|
1304
|
+
fi
|
|
1305
|
+
|
|
1306
|
+
SIDECAR_PLAN="$TMP_DIR/sidecar-source.mdx"
|
|
1307
|
+
cp "$BASE_PLAN" "$SIDECAR_PLAN"
|
|
1308
|
+
SIDECAR_JSON="$TMP_DIR/sidecar.json"
|
|
1309
|
+
if "$VALIDATOR" --allow-planning --emit-json "$SIDECAR_JSON" "$SIDECAR_PLAN" >/dev/null 2>&1 \
|
|
1310
|
+
&& node -e '
|
|
1311
|
+
const doc = require(process.argv[1]);
|
|
1312
|
+
const seo = doc.applicability.find((row) => row.domain === "seo");
|
|
1313
|
+
const repo = doc.module_disposition.find((row) => row.module === "repo");
|
|
1314
|
+
const readme = doc.documentation.find((row) => row.id === "build.readme");
|
|
1315
|
+
const product = doc.module_disposition.find((row) => row.module === "product");
|
|
1316
|
+
if (doc.archetype_confidence !== "high") throw new Error("archetype confidence missing");
|
|
1317
|
+
if (!Array.isArray(doc.overlays)) throw new Error("overlays missing");
|
|
1318
|
+
if (!seo || seo.evidence_state !== "by-design" || !seo.revisit_when) throw new Error("applicability tripwire missing");
|
|
1319
|
+
if (!repo || !repo.landed.includes("R-REPO-21")) throw new Error("module disposition missing");
|
|
1320
|
+
if (!product || product.dropped[0].layer !== "scale") throw new Error("dropped layer missing");
|
|
1321
|
+
if (!readme || readme.owner !== "repo" || readme.durability !== "durable") throw new Error("documentation row missing");
|
|
1322
|
+
' "$SIDECAR_JSON"; then
|
|
1323
|
+
record_pass "sidecar carries tripwires, disposition, and documentation"
|
|
1324
|
+
else
|
|
1325
|
+
record_fail "sidecar carries tripwires, disposition, and documentation" "sidecar payload incomplete"
|
|
1326
|
+
fi
|
|
1327
|
+
check_sidecar "tripwire sidecar" "$SIDECAR_JSON"
|
|
1328
|
+
|
|
1329
|
+
# The schema checker must be able to fail, or every conformance pass above is vacuous.
|
|
1330
|
+
BAD_SIDECAR="$TMP_DIR/bad-sidecar.json"
|
|
1331
|
+
node -e '
|
|
1332
|
+
const fs = require("node:fs");
|
|
1333
|
+
const doc = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
1334
|
+
doc.created = "2026-02-30";
|
|
1335
|
+
doc.tasks[0].depends_on = ["GP-1"];
|
|
1336
|
+
doc.surprise = true;
|
|
1337
|
+
fs.writeFileSync(process.argv[2], JSON.stringify(doc));
|
|
1338
|
+
' "$JSON_OUT" "$BAD_SIDECAR"
|
|
1339
|
+
output=$(node "$SCHEMA_CHECK" "$SCHEMA" "$BAD_SIDECAR" 2>&1) && status=0 || status=$?
|
|
1340
|
+
if [ "$status" -ne 0 ] &&
|
|
1341
|
+
printf '%s\n' "$output" | grep -F '$.created: "2026-02-30" is not a valid date' >/dev/null &&
|
|
1342
|
+
printf '%s\n' "$output" | grep -F '$.tasks[0].depends_on[0]' >/dev/null &&
|
|
1343
|
+
printf '%s\n' "$output" | grep -F 'unexpected property surprise' >/dev/null; then
|
|
1344
|
+
record_pass "schema checker rejects a nonconforming sidecar"
|
|
1345
|
+
else
|
|
1346
|
+
record_fail "schema checker rejects a nonconforming sidecar" "$output"
|
|
1347
|
+
fi
|
|
1348
|
+
|
|
1349
|
+
# The checker walks the whole schema before reading a document, so a keyword
|
|
1350
|
+
# it does not implement fails even where no document ever reaches it.
|
|
1351
|
+
UNCHECKED_SCHEMA="$TMP_DIR/unchecked-keyword.schema.json"
|
|
1352
|
+
printf '%s\n' '{"type":"object","properties":{"x":{"oneOf":[{"type":"string"}]}},"additionalProperties":false}' > "$UNCHECKED_SCHEMA"
|
|
1353
|
+
printf '%s\n' '{}' > "$TMP_DIR/empty-document.json"
|
|
1354
|
+
output=$(node "$SCHEMA_CHECK" "$UNCHECKED_SCHEMA" "$TMP_DIR/empty-document.json" 2>&1) && status=0 || status=$?
|
|
1355
|
+
if [ "$status" -eq 2 ] && printf '%s\n' "$output" | grep -F 'unsupported schema keyword oneOf at $.x' >/dev/null; then
|
|
1356
|
+
record_pass "schema checker refuses an unreached unsupported keyword"
|
|
1357
|
+
else
|
|
1358
|
+
record_fail "schema checker refuses an unreached unsupported keyword" "status $status: $output"
|
|
1359
|
+
fi
|
|
1360
|
+
|
|
1361
|
+
# PLAN.v1.schema.json covers every @1 sidecar, godplans 1.9.0 through 1.13.0:
|
|
1362
|
+
# the retained 1.9.0 evaluation sidecar is the oldest shape, a real 1.13.0
|
|
1363
|
+
# sidecar the fullest, and the fields 1.9.0 lacks stay typed when present.
|
|
1364
|
+
V1_SCHEMA="$ROOT_DIR/skills/godplans/schemas/PLAN.v1.schema.json"
|
|
1365
|
+
V1_SIDECAR_1_9="$ROOT_DIR/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json"
|
|
1366
|
+
V1_SIDECAR_1_13="$ROOT_DIR/tests/fixtures/plan-json-v1-1.13.0.json"
|
|
1367
|
+
for sidecar in "$V1_SIDECAR_1_9" "$V1_SIDECAR_1_13"; do
|
|
1368
|
+
if output=$(node "$SCHEMA_CHECK" "$V1_SCHEMA" "$sidecar" 2>&1); then
|
|
1369
|
+
record_pass "${sidecar#"$ROOT_DIR"/} conforms to PLAN.v1.schema.json"
|
|
1370
|
+
else
|
|
1371
|
+
record_fail "${sidecar#"$ROOT_DIR"/} conforms to PLAN.v1.schema.json" "$output"
|
|
1372
|
+
fi
|
|
1373
|
+
done
|
|
1374
|
+
BAD_V1_SIDECAR="$TMP_DIR/bad-v1-sidecar.json"
|
|
1375
|
+
node -e '
|
|
1376
|
+
const fs = require("node:fs");
|
|
1377
|
+
const doc = JSON.parse(fs.readFileSync(process.argv[1], "utf8"));
|
|
1378
|
+
doc.overlays = ["monetized"];
|
|
1379
|
+
doc.applicability[0].evidence_state = "unknown";
|
|
1380
|
+
doc.tasks[0].parallel = "yes";
|
|
1381
|
+
fs.writeFileSync(process.argv[2], JSON.stringify(doc));
|
|
1382
|
+
' "$V1_SIDECAR_1_13" "$BAD_V1_SIDECAR"
|
|
1383
|
+
output=$(node "$SCHEMA_CHECK" "$V1_SCHEMA" "$BAD_V1_SIDECAR" 2>&1) && status=0 || status=$?
|
|
1384
|
+
if [ "$status" -ne 0 ] &&
|
|
1385
|
+
printf '%s\n' "$output" | grep -F '$.overlays[0]' >/dev/null &&
|
|
1386
|
+
printf '%s\n' "$output" | grep -F '$.applicability[0].evidence_state' >/dev/null &&
|
|
1387
|
+
printf '%s\n' "$output" | grep -F '$.tasks[0].parallel' >/dev/null; then
|
|
1388
|
+
record_pass "PLAN.v1.schema.json still types its optional fields"
|
|
1389
|
+
else
|
|
1390
|
+
record_fail "PLAN.v1.schema.json still types its optional fields" "$output"
|
|
1391
|
+
fi
|
|
1392
|
+
|
|
1393
|
+
# Plans carry the executor rules verbatim from plan-format.md, and the template
|
|
1394
|
+
# is how they get there, so the two copies must match line for line.
|
|
1395
|
+
executor_rules() {
|
|
1396
|
+
awk '/^## Rules for executing agents/ { inside = 1; next } inside && /^## / { exit } inside && /^>/ { print }' "$1"
|
|
1397
|
+
}
|
|
1398
|
+
executor_rules "$ROOT_DIR/skills/godplans/references/plan-format.md" > "$TMP_DIR/rules-format"
|
|
1399
|
+
executor_rules "$ROOT_DIR/skills/godplans/templates/PLAN.template.mdx" > "$TMP_DIR/rules-template"
|
|
1400
|
+
if [ -s "$TMP_DIR/rules-format" ] && cmp -s "$TMP_DIR/rules-format" "$TMP_DIR/rules-template"; then
|
|
1401
|
+
record_pass "template executor rules match plan-format.md"
|
|
1402
|
+
else
|
|
1403
|
+
record_fail "template executor rules match plan-format.md" "$(diff "$TMP_DIR/rules-format" "$TMP_DIR/rules-template" 2>&1)"
|
|
1404
|
+
fi
|
|
1405
|
+
|
|
1406
|
+
# The archetype list is kept by hand in four places: the discovery.md scoring
|
|
1407
|
+
# table, the plan-format.md frontmatter paragraph, @archetypes in the
|
|
1408
|
+
# validator, and the PLAN.schema.json enum (plus unknown). An archetype added
|
|
1409
|
+
# to one and not the others would make the validator refuse plans that use it.
|
|
1410
|
+
archetypes_discovery=$(awk -F'|' '
|
|
1411
|
+
/^## / { inside = ($0 == "## Archetype detection") }
|
|
1412
|
+
inside && /^\| [a-z]/ { gsub(/ /, "", $2); print $2 }
|
|
1413
|
+
' "$ROOT_DIR/skills/godplans/references/discovery.md" | sort | tr '\n' ' ')
|
|
1414
|
+
archetypes_format=$(perl -ne '
|
|
1415
|
+
next unless /^`archetype` is one of the [a-z]+ archetypes `discovery\.md` scores \(([^)]*)\)/;
|
|
1416
|
+
my $list = $1;
|
|
1417
|
+
print "$_\n" for $list =~ /`([a-z-]+)`/g;
|
|
1418
|
+
' "$ROOT_DIR/skills/godplans/references/plan-format.md" | sort | tr '\n' ' ')
|
|
1419
|
+
archetypes_validator=$(sed -n 's/^my @archetypes = qw(\(.*\));$/\1/p' "$ROOT_DIR/skills/godplans/scripts/validate-plan.sh" | tr ' ' '\n' | sort | tr '\n' ' ')
|
|
1420
|
+
archetypes_schema=$(node -e '
|
|
1421
|
+
const s = require(process.argv[1]);
|
|
1422
|
+
const names = s.properties.archetype.enum.filter((x) => x !== "unknown").sort();
|
|
1423
|
+
console.log(names.join("\n"));
|
|
1424
|
+
' "$SCHEMA" | sort | tr '\n' ' ')
|
|
1425
|
+
if [ -n "$archetypes_discovery" ] &&
|
|
1426
|
+
[ "$archetypes_discovery" = "$archetypes_format" ] &&
|
|
1427
|
+
[ "$archetypes_discovery" = "$archetypes_validator" ] &&
|
|
1428
|
+
[ "$archetypes_discovery" = "$archetypes_schema" ]; then
|
|
1429
|
+
record_pass "archetype list matches discovery.md"
|
|
1430
|
+
else
|
|
1431
|
+
record_fail "archetype list matches discovery.md" "discovery [$archetypes_discovery] plan-format [$archetypes_format] validator [$archetypes_validator] schema [$archetypes_schema]"
|
|
1432
|
+
fi
|
|
1433
|
+
|
|
1434
|
+
# Encoding: the sidecar is UTF-8 whatever the plan's characters, and the plan
|
|
1435
|
+
# itself must be valid UTF-8 without a byte order mark.
|
|
1436
|
+
|
|
1437
|
+
UTF8_PLAN="$TMP_DIR/latin-range.mdx"
|
|
1438
|
+
cp "$BASE_PLAN" "$UTF8_PLAN"
|
|
1439
|
+
perl -0pi -e 's/frontmatter and counters are checked/frontmatter and counters are checked (caf\xc3\xa9 r\xc3\xa9sum\xc3\xa9)/' "$UTF8_PLAN"
|
|
1440
|
+
UTF8_JSON="$TMP_DIR/latin-range.json"
|
|
1441
|
+
emit_sidecar "Latin-1 range characters in a task" "$UTF8_JSON" "$UTF8_PLAN"
|
|
1442
|
+
if node -e '
|
|
1443
|
+
const bytes = require("node:fs").readFileSync(process.argv[1]);
|
|
1444
|
+
const doc = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
1445
|
+
if (!doc.tasks[0].acceptance.includes("caf\u00e9 r\u00e9sum\u00e9")) throw new Error("text changed");
|
|
1446
|
+
' "$UTF8_JSON"; then
|
|
1447
|
+
record_pass "sidecar is strict UTF-8"
|
|
1448
|
+
else
|
|
1449
|
+
record_fail "sidecar is strict UTF-8" "sidecar did not decode as UTF-8"
|
|
1450
|
+
fi
|
|
1451
|
+
|
|
1452
|
+
new_case
|
|
1453
|
+
perl -0pi -e 's/frontmatter and counters are checked/frontmatter and counters are checked (caf\xe9)/' "$CASE_FILE"
|
|
1454
|
+
expect_fail "invalid UTF-8 plan" "plan is not valid UTF-8" --allow-planning "$CASE_FILE"
|
|
1455
|
+
|
|
1456
|
+
new_case
|
|
1457
|
+
perl -0pi -e 's/\A/\xef\xbb\xbf/' "$CASE_FILE"
|
|
1458
|
+
output=$("$VALIDATOR" --allow-planning "$CASE_FILE" 2>&1) && status=0 || status=$?
|
|
1459
|
+
if [ "$status" -ne 0 ] && [ "$(printf '%s\n' "$output" | grep -c '^FAIL ')" -eq 1 ] &&
|
|
1460
|
+
printf '%s\n' "$output" | grep -F 'byte order mark' >/dev/null; then
|
|
1461
|
+
record_pass "byte order mark fails once"
|
|
1462
|
+
else
|
|
1463
|
+
record_fail "byte order mark fails once" "$output"
|
|
1464
|
+
fi
|
|
1465
|
+
|
|
1466
|
+
for codepoint in 2705 27F6 2B05 2588 231A 2934 200D 20E3 E0067 1FB00; do
|
|
1467
|
+
new_case
|
|
1468
|
+
CODEPOINT=$codepoint perl -CSD -e 'print "- 2026-07-14 marker ", chr(hex $ENV{CODEPOINT}), "\n"' >> "$CASE_FILE"
|
|
1469
|
+
expect_fail "banned Unicode U+$codepoint" "banned Unicode" --allow-planning "$CASE_FILE"
|
|
1470
|
+
done
|
|
1471
|
+
# Keyboard symbols in Miscellaneous Technical are text, not emoji: a plan may document shortcuts.
|
|
1472
|
+
for codepoint in 2318 2325 2303 232B; do
|
|
1473
|
+
new_case
|
|
1474
|
+
CODEPOINT=$codepoint perl -CSD -e 'print "- 2026-07-14 press ", chr(hex $ENV{CODEPOINT}), "K\n"' >> "$CASE_FILE"
|
|
1475
|
+
expect_pass "keyboard symbol U+$codepoint is allowed" --allow-planning "$CASE_FILE"
|
|
1476
|
+
done
|
|
1477
|
+
|
|
1478
|
+
# Frontmatter is YAML: quotes and trailing comments are not part of a value,
|
|
1479
|
+
# and a date must exist on the calendar.
|
|
1480
|
+
|
|
1481
|
+
QUOTED_PLAN="$TMP_DIR/quoted-frontmatter.mdx"
|
|
1482
|
+
cp "$BASE_PLAN" "$QUOTED_PLAN"
|
|
1483
|
+
perl -0pi -e 's/^name: validator-fixture$/name: "validator-fixture"/m; s/^validated_at: (\S+)$/validated_at: '"'"'$1'"'"'/m; s/^overlays: \[\]$/overlays: [] # none fired/m; s/^ tasks_total: 3$/ tasks_total: "3"/m' "$QUOTED_PLAN"
|
|
1484
|
+
QUOTED_JSON="$TMP_DIR/quoted-frontmatter.json"
|
|
1485
|
+
emit_sidecar "quoted frontmatter values" "$QUOTED_JSON" "$QUOTED_PLAN"
|
|
1486
|
+
if node -e '
|
|
1487
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
1488
|
+
if (doc.name !== "validator-fixture") throw new Error("name kept its quotes");
|
|
1489
|
+
if (doc.validated_at !== "2026-07-13T12:00:00Z") throw new Error("timestamp kept its quotes");
|
|
1490
|
+
if (doc.progress.tasks_total !== 3) throw new Error("counter kept its quotes");
|
|
1491
|
+
' "$QUOTED_JSON"; then
|
|
1492
|
+
record_pass "sidecar carries unquoted frontmatter values"
|
|
1493
|
+
else
|
|
1494
|
+
record_fail "sidecar carries unquoted frontmatter values" "quotes leaked into the sidecar"
|
|
1495
|
+
fi
|
|
1496
|
+
|
|
1497
|
+
new_case
|
|
1498
|
+
perl -0pi -e 's/^overlays: \[\]$/overlays:/m' "$CASE_FILE"
|
|
1499
|
+
expect_fail "empty overlays value" "frontmatter field is empty: overlays" --allow-planning "$CASE_FILE"
|
|
1500
|
+
|
|
1501
|
+
new_case
|
|
1502
|
+
perl -0pi -e 's/^created: 2026-07-13$/created: 2026-13-45/m' "$CASE_FILE"
|
|
1503
|
+
expect_fail "impossible created date" "created 2026-13-45 is not a real calendar date" --allow-planning "$CASE_FILE"
|
|
1504
|
+
|
|
1505
|
+
new_case
|
|
1506
|
+
perl -0pi -e 's/^updated: 2026-07-13$/updated: 2026-02-30/m' "$CASE_FILE"
|
|
1507
|
+
expect_fail "impossible updated date" "updated 2026-02-30 is not a real calendar date" --allow-planning "$CASE_FILE"
|
|
1508
|
+
|
|
1509
|
+
new_case
|
|
1510
|
+
perl -0pi -e 's/2026-07-13T12:00:00Z/2026-07-13T25:00:00Z/g' "$CASE_FILE"
|
|
1511
|
+
expect_fail "impossible validation time" "validated_at 2026-07-13T25:00:00Z is not a real calendar date" --allow-planning "$CASE_FILE"
|
|
1512
|
+
|
|
1513
|
+
LEAP_PLAN="$TMP_DIR/leap-day.mdx"
|
|
1514
|
+
cp "$BASE_PLAN" "$LEAP_PLAN"
|
|
1515
|
+
perl -0pi -e 's/^updated: 2026-07-13$/updated: 2028-02-29/m' "$LEAP_PLAN"
|
|
1516
|
+
expect_pass "leap day is a real date" --allow-planning "$LEAP_PLAN"
|
|
1517
|
+
|
|
1518
|
+
# Task fields may wrap; the validator and the sidecar read the whole value.
|
|
1519
|
+
|
|
1520
|
+
WRAPPED_PLAN="$TMP_DIR/wrapped-fields.mdx"
|
|
1521
|
+
cp "$BASE_PLAN" "$WRAPPED_PLAN"
|
|
1522
|
+
perl -0pi -e 's/ - Acceptance: frontmatter and counters are checked\n/ - Acceptance: frontmatter and counters are checked;\n a malformed plan returns exit 1 with a FAIL line per problem\n/; s/( - Requirements: R-1\.1, R-CODE-21,) (R-ARCH-4, R-STACK-1)\n/$1\n $2\n/' "$WRAPPED_PLAN"
|
|
1523
|
+
WRAPPED_JSON="$TMP_DIR/wrapped-fields.json"
|
|
1524
|
+
emit_sidecar "wrapped task fields" "$WRAPPED_JSON" "$WRAPPED_PLAN"
|
|
1525
|
+
if node -e '
|
|
1526
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
1527
|
+
if (doc.tasks[0].acceptance !== "frontmatter and counters are checked; a malformed plan returns exit 1 with a FAIL line per problem") throw new Error("acceptance truncated");
|
|
1528
|
+
if (doc.tasks[0].requirements.join(",") !== "R-1.1,R-CODE-21,R-ARCH-4,R-STACK-1") throw new Error("requirements truncated");
|
|
1529
|
+
' "$WRAPPED_JSON"; then
|
|
1530
|
+
record_pass "sidecar joins wrapped field lines"
|
|
1531
|
+
else
|
|
1532
|
+
record_fail "sidecar joins wrapped field lines" "a wrapped field was cut at its first line"
|
|
1533
|
+
fi
|
|
1534
|
+
|
|
1535
|
+
new_case
|
|
1536
|
+
perl -0pi -e 's/( - Requirements: R-1\.1, R-CODE-21, R-ARCH-4)(, R-STACK-1)\n/$1\n R-NOPE-99$2\n/' "$CASE_FILE"
|
|
1537
|
+
expect_fail "wrapped requirement is still checked" "has malformed Requirements value" --allow-planning "$CASE_FILE"
|
|
1538
|
+
|
|
1539
|
+
new_case
|
|
1540
|
+
perl -0pi -e 's/( - Requirements: R-1\.1, R-CODE-21, R-ARCH-4, R-STACK-1)\n/$1,\n R-NOPE-99\n/' "$CASE_FILE"
|
|
1541
|
+
expect_fail "wrapped undefined requirement" "GP-101 cites undefined requirement R-NOPE-99" --allow-planning "$CASE_FILE"
|
|
1542
|
+
|
|
1543
|
+
# A failed-Verify note nested under a field is a list item, never part of that field.
|
|
1544
|
+
NOTE_PLAN="$TMP_DIR/nested-note.mdx"
|
|
1545
|
+
cp "$BASE_PLAN" "$NOTE_PLAN"
|
|
1546
|
+
perl -0pi -e 's/( - Acceptance: frontmatter and counters are checked)\n/$1\n - Note (2026-08-01): Verify failed on a missing fixture\n/; s/( - Requirements: R-1\.1, R-CODE-21, R-ARCH-4, R-STACK-1)\n/$1\n - Note (2026-08-01): Verify failed again\n/' "$NOTE_PLAN"
|
|
1547
|
+
NOTE_JSON="$TMP_DIR/nested-note.json"
|
|
1548
|
+
emit_sidecar "4-space Note lines under task fields" "$NOTE_JSON" "$NOTE_PLAN"
|
|
1549
|
+
if node -e '
|
|
1550
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
1551
|
+
if (doc.tasks[0].acceptance !== "frontmatter and counters are checked") throw new Error("note merged into acceptance");
|
|
1552
|
+
' "$NOTE_JSON"; then
|
|
1553
|
+
record_pass "sidecar keeps Note lines out of field values"
|
|
1554
|
+
else
|
|
1555
|
+
record_fail "sidecar keeps Note lines out of field values" "a Note line was joined to a field"
|
|
1556
|
+
fi
|
|
1557
|
+
|
|
1558
|
+
# Verify and Checkpoint verify carry a command that can actually be rerun.
|
|
1559
|
+
|
|
1560
|
+
new_case
|
|
1561
|
+
perl -0pi -e 's/(GP-101.*? - Verify: )`[^`]+`/$1` `/s' "$CASE_FILE"
|
|
1562
|
+
expect_fail "blank Verify command" "GP-101 Verify must be one executable command in backticks" --allow-planning "$CASE_FILE"
|
|
1563
|
+
|
|
1564
|
+
new_case
|
|
1565
|
+
perl -0pi -e 's/(GP-101.*? - Verify: )`[^`]+`/$1` manual: open the report`/s' "$CASE_FILE"
|
|
1566
|
+
expect_fail "indented manual Verify" "GP-101 Verify must be one executable command in backticks" --allow-planning "$CASE_FILE"
|
|
1567
|
+
|
|
1568
|
+
new_case
|
|
1569
|
+
perl -0pi -e 's/^Checkpoint verify: `test -x skills[^\n]*$/Checkpoint verify: ` `/m' "$CASE_FILE"
|
|
1570
|
+
expect_fail "blank Checkpoint verify" "Phase 1 Checkpoint verify must be one executable command in backticks" --allow-planning "$CASE_FILE"
|
|
1571
|
+
|
|
1572
|
+
new_case
|
|
1573
|
+
perl -0pi -e 's/^Checkpoint verify: `test -x skills[^\n]*$/Checkpoint verify: `Manual: open the report and eyeball it`/m' "$CASE_FILE"
|
|
1574
|
+
expect_fail "manual Checkpoint verify" "Phase 1 Checkpoint verify must be one executable command in backticks" --allow-planning "$CASE_FILE"
|
|
1575
|
+
|
|
1576
|
+
new_case
|
|
1577
|
+
perl -0pi -e 's/^(Checkpoint verify: [^\n]*)$/$1\n$1/m' "$CASE_FILE"
|
|
1578
|
+
expect_fail "duplicate Checkpoint verify" "Phase 1 has duplicate Checkpoint verify" --allow-planning "$CASE_FILE"
|
|
1579
|
+
|
|
1580
|
+
new_case
|
|
1581
|
+
perl -0pi -e 's/^Checkpoint: malformed plans[^\n]*\n//m' "$CASE_FILE"
|
|
1582
|
+
expect_fail "missing Checkpoint" "Phase 1 is missing Checkpoint" --allow-planning "$CASE_FILE"
|
|
1583
|
+
|
|
1584
|
+
# Drift check: a sampled Verify or the phase checkpoint that stops passing
|
|
1585
|
+
# returns the plan to planning.
|
|
1586
|
+
|
|
1587
|
+
DRIFT_FAIL_PLAN="$TMP_DIR/drift-sample-fails.mdx"
|
|
1588
|
+
cp "$DRIFT_PLAN" "$DRIFT_FAIL_PLAN"
|
|
1589
|
+
perl -0pi -e 's/(- \[x\] GP-102.*? - Verify: )`test -f package\.json`/$1`test -f no-such-file-for-drift`/s' "$DRIFT_FAIL_PLAN"
|
|
1590
|
+
expect_fail "drift sample failure" "drift sample GP-102 exited 1" --drift-check 1 "$DRIFT_FAIL_PLAN"
|
|
1591
|
+
|
|
1592
|
+
DRIFT_FAIL_PLAN="$TMP_DIR/drift-checkpoint-fails.mdx"
|
|
1593
|
+
cp "$DRIFT_PLAN" "$DRIFT_FAIL_PLAN"
|
|
1594
|
+
perl -0pi -e 's/^Checkpoint verify: `test -f package\.json`$/Checkpoint verify: `test -f no-such-file-for-drift`/m' "$DRIFT_FAIL_PLAN"
|
|
1595
|
+
expect_fail "drift checkpoint failure" "Phase 1 checkpoint exited 1" --drift-check 1 "$DRIFT_FAIL_PLAN"
|
|
1596
|
+
|
|
1597
|
+
expect_fail "drift phase incomplete" "drift phase 2 is not complete" --drift-check 2 "$DRIFT_PLAN"
|
|
1598
|
+
expect_fail "drift phase missing" "drift phase 9 does not exist" --drift-check 9 "$DRIFT_PLAN"
|
|
1599
|
+
|
|
1600
|
+
DRIFT_FAIL_PLAN="$TMP_DIR/drift-recheck-intake.mdx"
|
|
1601
|
+
cp "$DRIFT_PLAN" "$DRIFT_FAIL_PLAN"
|
|
1602
|
+
perl -0pi -e 's/^- `intake` =/- [recheck] `intake` =/m' "$DRIFT_FAIL_PLAN"
|
|
1603
|
+
expect_fail "drift recheck of intake" "recheck inventory label intake is not a file path" --drift-check 1 "$DRIFT_FAIL_PLAN"
|
|
1604
|
+
|
|
1605
|
+
# Exit statuses: every FAIL, drift and I/O included, exits 1; only a usage error exits 2.
|
|
1606
|
+
expect_status() {
|
|
1607
|
+
name=$1
|
|
1608
|
+
want=$2
|
|
1609
|
+
expected=$3
|
|
1610
|
+
shift 3
|
|
1611
|
+
output=$("$VALIDATOR" "$@" 2>&1)
|
|
1612
|
+
status=$?
|
|
1613
|
+
if [ "$status" -eq "$want" ] && printf '%s\n' "$output" | grep -F -- "$expected" >/dev/null 2>&1; then
|
|
1614
|
+
record_pass "$name"
|
|
1615
|
+
else
|
|
1616
|
+
record_fail "$name" "expected status $want and '$expected', got $status: $output"
|
|
1617
|
+
fi
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
expect_status "drift sample failure exits 1" 1 "drift sample GP-102 exited 1" --drift-check 1 "$TMP_DIR/drift-sample-fails.mdx"
|
|
1621
|
+
expect_status "drift phase missing exits 1" 1 "drift phase 9 does not exist" --drift-check 9 "$DRIFT_PLAN"
|
|
1622
|
+
expect_status "drift phase incomplete exits 1" 1 "drift phase 2 is not complete" --drift-check 2 "$DRIFT_PLAN"
|
|
1623
|
+
mkdir "$TMP_DIR/no-evidence"
|
|
1624
|
+
output=$(cd "$TMP_DIR/no-evidence" && "$VALIDATOR" --drift-check 1 "$RECHECK_PLAN" 2>&1) && status=0 || status=$?
|
|
1625
|
+
if [ "$status" -eq 1 ] && printf '%s\n' "$output" | grep -F "recheck evidence recheck.txt cannot be read" >/dev/null; then
|
|
1626
|
+
record_pass "missing recheck file exits 1"
|
|
1627
|
+
else
|
|
1628
|
+
record_fail "missing recheck file exits 1" "expected status 1, got $status: $output"
|
|
1629
|
+
fi
|
|
1630
|
+
|
|
1631
|
+
DRIFT_FAIL_PLAN="$TMP_DIR/drift-sample-signal.mdx"
|
|
1632
|
+
cp "$DRIFT_PLAN" "$DRIFT_FAIL_PLAN"
|
|
1633
|
+
perl -0pi -e 's/(- \[x\] GP-101.*? - Verify: )`test -f package\.json`/$1`kill -TERM \$\$`/s' "$DRIFT_FAIL_PLAN"
|
|
1634
|
+
expect_status "drift sample killed by a signal" 1 "drift sample GP-101 was killed by signal 15" --drift-check 1 "$DRIFT_FAIL_PLAN"
|
|
1635
|
+
|
|
1636
|
+
expect_status "emit-json into a missing directory exits 1" 1 "cannot write $TMP_DIR/no-such-dir/PLAN.json.tmp" --allow-planning --emit-json "$TMP_DIR/no-such-dir/PLAN.json" "$DRIFT_PLAN"
|
|
1637
|
+
expect_status "drift phase zero is a usage error" 2 "--drift-check phase must be a positive integer" --drift-check 0 "$DRIFT_PLAN"
|
|
1638
|
+
expect_status "unknown option is a usage error" 2 "Unknown option: --bogus" --bogus "$DRIFT_PLAN"
|
|
1639
|
+
|
|
1640
|
+
# Superseded history: struck tasks keep their reason and requirements, stay
|
|
1641
|
+
# unchecked, and never reuse an ID.
|
|
1642
|
+
|
|
1643
|
+
SUPERSEDED_TASK='~~- [ ] GP-103 [W1.1] Write the readme~~\n - Superseded: the readme moved to the release task\n - Requirements: R-REPO-21\n\n'
|
|
1644
|
+
new_case
|
|
1645
|
+
SUPERSEDED_TASK=$SUPERSEDED_TASK perl -0pi -e 's/(Checkpoint: malformed plans)/$ENV{SUPERSEDED_TASK}$1/; s/\\n/\n/g' "$CASE_FILE"
|
|
1646
|
+
cp "$CASE_FILE" "$TMP_DIR/superseded-base.mdx"
|
|
1647
|
+
expect_pass "superseded task with reason and requirements" --allow-planning "$CASE_FILE"
|
|
1648
|
+
|
|
1649
|
+
superseded_case() {
|
|
1650
|
+
CASE_NUMBER=$((CASE_NUMBER + 1))
|
|
1651
|
+
CASE_FILE="$TMP_DIR/case-$CASE_NUMBER.mdx"
|
|
1652
|
+
cp "$TMP_DIR/superseded-base.mdx" "$CASE_FILE"
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
superseded_case
|
|
1656
|
+
perl -0pi -e 's/~~- \[ \] GP-103/~~- [x] GP-103/' "$CASE_FILE"
|
|
1657
|
+
expect_fail "checked superseded task" "superseded task GP-103 must remain unchecked" --allow-planning "$CASE_FILE"
|
|
1658
|
+
|
|
1659
|
+
superseded_case
|
|
1660
|
+
perl -0pi -e 's/^ - Superseded: [^\n]*\n//m' "$CASE_FILE"
|
|
1661
|
+
expect_fail "superseded task without a reason" "superseded task GP-103 missing required field: Superseded" --allow-planning "$CASE_FILE"
|
|
1662
|
+
|
|
1663
|
+
superseded_case
|
|
1664
|
+
perl -0pi -e 's/^ - Requirements: R-REPO-21\n//m' "$CASE_FILE"
|
|
1665
|
+
expect_fail "superseded task without requirements" "superseded task GP-103 missing required field: Requirements" --allow-planning "$CASE_FILE"
|
|
1666
|
+
|
|
1667
|
+
superseded_case
|
|
1668
|
+
perl -0pi -e 's/^( - Superseded: [^\n]*)$/$1\n$1/m' "$CASE_FILE"
|
|
1669
|
+
expect_fail "superseded task with two reasons" "superseded task GP-103 has duplicate required field: Superseded" --allow-planning "$CASE_FILE"
|
|
1670
|
+
|
|
1671
|
+
superseded_case
|
|
1672
|
+
perl -0pi -e 's/^ - Superseded: [^\n]*$/ - Superseded:/m' "$CASE_FILE"
|
|
1673
|
+
expect_fail "superseded task with an empty reason" "superseded task GP-103 has empty required field: Superseded" --allow-planning "$CASE_FILE"
|
|
1674
|
+
|
|
1675
|
+
superseded_case
|
|
1676
|
+
perl -0pi -e 's/^ - Requirements: R-REPO-21$/ - Requirements: R-REPO-21, R-NOPE-1/m' "$CASE_FILE"
|
|
1677
|
+
expect_fail "superseded task cites an undefined requirement" "superseded task GP-103 cites undefined requirement R-NOPE-1" --allow-planning "$CASE_FILE"
|
|
1678
|
+
|
|
1679
|
+
superseded_case
|
|
1680
|
+
perl -0pi -e 's/^ - Requirements: R-REPO-21$/ - Requirements: the readme/m' "$CASE_FILE"
|
|
1681
|
+
expect_fail "superseded task with malformed requirements" "superseded task GP-103 has malformed Requirements value" --allow-planning "$CASE_FILE"
|
|
1682
|
+
|
|
1683
|
+
superseded_case
|
|
1684
|
+
perl -0pi -e 's/~~- \[ \] GP-103/~~- [ ] GP-102/' "$CASE_FILE"
|
|
1685
|
+
expect_fail "superseded task reuses an active ID" "duplicate historical task ID GP-102" --allow-planning "$CASE_FILE"
|
|
1686
|
+
|
|
1687
|
+
superseded_case
|
|
1688
|
+
perl -0pi -e 's/(Checkpoint: malformed plans)/~~- [ ] GP-103 [W1.1] Write it again~~\n - Superseded: duplicate\n - Requirements: R-REPO-21\n\n$1/' "$CASE_FILE"
|
|
1689
|
+
expect_fail "two superseded tasks share an ID" "duplicate historical task ID GP-103" --allow-planning "$CASE_FILE"
|
|
1690
|
+
|
|
1691
|
+
superseded_case
|
|
1692
|
+
perl -0pi -e 's/Write the readme~~/Write the readme/' "$CASE_FILE"
|
|
1693
|
+
expect_fail "unclosed superseded heading" "malformed superseded task on line" --allow-planning "$CASE_FILE"
|
|
1694
|
+
|
|
1695
|
+
superseded_case
|
|
1696
|
+
perl -0pi -e 's/~~- \[ \] GP-103/~~- [ ] GP-013/' "$CASE_FILE"
|
|
1697
|
+
expect_fail "superseded heading with a short ID" "malformed superseded task on line" --allow-planning "$CASE_FILE"
|
|
1698
|
+
|
|
1699
|
+
superseded_case
|
|
1700
|
+
perl -0pi -e 's/~~- \[ \] GP-103/~~ - [ ] GP-103/' "$CASE_FILE"
|
|
1701
|
+
expect_fail "spaced superseded heading after a task" "malformed superseded task on line" --allow-planning "$CASE_FILE"
|
|
1702
|
+
if "$VALIDATOR" --allow-planning "$CASE_FILE" 2>&1 | grep -F "GP-102 has duplicate required field" >/dev/null; then
|
|
1703
|
+
record_fail "spaced superseded heading leaves GP-102 fields alone" "its fields were merged into GP-102"
|
|
1704
|
+
else
|
|
1705
|
+
record_pass "spaced superseded heading leaves GP-102 fields alone"
|
|
1706
|
+
fi
|
|
1707
|
+
|
|
1708
|
+
new_case
|
|
1709
|
+
perl -0pi -e 's/(### Wave 1\.1\n\n)/$1~~ - [ ] GP-103 [W1.1] Write the readme~~\n - Superseded: moved\n - Requirements: R-NOPE-1\n\n/' "$CASE_FILE"
|
|
1710
|
+
expect_fail "spaced superseded heading first in a wave" "malformed superseded task on line" --allow-planning "$CASE_FILE"
|
|
1711
|
+
|
|
1712
|
+
new_case
|
|
1713
|
+
perl -0pi -e 's/^- \[ \] GP-102 \[W1\.1\]/- [ ] GP-102 [W1.1]/m' "$CASE_FILE"
|
|
1714
|
+
expect_fail "task heading with a doubled space" "malformed task definition on line" --allow-planning "$CASE_FILE"
|
|
1715
|
+
|
|
1716
|
+
superseded_case
|
|
1717
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | required | repo | always; written by GP-103 |/m' "$CASE_FILE"
|
|
1718
|
+
expect_fail "required document names a superseded task" "documentation set row build.readme names superseded task GP-103" --allow-planning "$CASE_FILE"
|
|
1719
|
+
|
|
1720
|
+
# A phase whose every task was superseded stays as history.
|
|
1721
|
+
SUPERSEDED_PHASE_PLAN="$TMP_DIR/superseded-phase.mdx"
|
|
1722
|
+
cp "$BASE_PLAN" "$SUPERSEDED_PHASE_PLAN"
|
|
1723
|
+
perl -0pi -e '
|
|
1724
|
+
s/phases_total: 2/phases_total: 3/;
|
|
1725
|
+
s/phases_done: 0/phases_done: 1/;
|
|
1726
|
+
s/## Phase 2: Verification/## Phase 2: Packaging\n\n~~- [ ] GP-250 [W2.1] Build a tarball~~\n - Superseded: the skill installer replaced tarball distribution\n - Requirements: R-BUILD-1\n\n## Phase 3: Verification/;
|
|
1727
|
+
s/GP-201 \[W2\.1\]/GP-301 [W3.1]/;
|
|
1728
|
+
s/### Wave 2\.1/### Wave 3.1/;
|
|
1729
|
+
s/written by GP-201/written by GP-301/;
|
|
1730
|
+
' "$SUPERSEDED_PHASE_PLAN"
|
|
1731
|
+
SUPERSEDED_PHASE_JSON="$TMP_DIR/superseded-phase.json"
|
|
1732
|
+
emit_sidecar "phase of superseded tasks" "$SUPERSEDED_PHASE_JSON" "$SUPERSEDED_PHASE_PLAN"
|
|
1733
|
+
|
|
1734
|
+
# Wave order and dependencies.
|
|
1735
|
+
|
|
1736
|
+
new_case
|
|
1737
|
+
perl -0pi -e 's/GP-101 \[W1\.1\]/GP-101 [W1.2]/' "$CASE_FILE"
|
|
1738
|
+
expect_fail "wave tags go backwards" "GP-102 [W1.1] follows a W1.2 task; waves within a phase must not go backwards" --allow-planning "$CASE_FILE"
|
|
1739
|
+
|
|
1740
|
+
new_case
|
|
1741
|
+
perl -0pi -e 's/Depends on: GP-101\n/Depends on: GP-102\n/' "$CASE_FILE"
|
|
1742
|
+
expect_fail "task depends on itself" "GP-102 depends on itself" --allow-planning "$CASE_FILE"
|
|
1743
|
+
|
|
1744
|
+
new_case
|
|
1745
|
+
perl -0pi -e 's/(Checkpoint: malformed plans)/- [ ] GP-150 [W1.1] Stray task\n\n$1/' "$CASE_FILE"
|
|
1746
|
+
expect_fail "task heading without fields" "GP-150 missing required field: Files" --allow-planning "$CASE_FILE"
|
|
1747
|
+
|
|
1748
|
+
new_case
|
|
1749
|
+
perl -0pi -e 's/^- \[ \] GP-101/- [?] GP-101/m' "$CASE_FILE"
|
|
1750
|
+
expect_fail "malformed task checkbox" "malformed task definition on line" --allow-planning "$CASE_FILE"
|
|
1751
|
+
|
|
1752
|
+
new_case
|
|
1753
|
+
perl -0pi -e 's/(## Plan provenance)/- [ ] GP-150 [W1.1] Loose task\n\n$1/' "$CASE_FILE"
|
|
1754
|
+
expect_fail "task outside a phase" "GP-150 is not inside a numbered phase" --allow-planning "$CASE_FILE"
|
|
1755
|
+
|
|
1756
|
+
new_case
|
|
1757
|
+
perl -0pi -e 's/( - Files: tests\/validate-plan\.sh\n - Depends on: GP-101)/$1\n - Depends on: none/' "$CASE_FILE"
|
|
1758
|
+
expect_fail "duplicate task field" "GP-102 has duplicate required field: Depends on" --allow-planning "$CASE_FILE"
|
|
1759
|
+
|
|
1760
|
+
new_case
|
|
1761
|
+
perl -0pi -e 's/ - Reuses: validator fixture/ - Reuses:/' "$CASE_FILE"
|
|
1762
|
+
expect_fail "empty task field" "GP-102 has empty required field: Reuses" --allow-planning "$CASE_FILE"
|
|
1763
|
+
|
|
1764
|
+
new_case
|
|
1765
|
+
perl -0pi -e 's/(## Phase 2: Verification)/## Phase 2: Packaging\n\nGoal: nothing yet.\n\n## Phase 3: Verification/; s/GP-201 \[W2\.1\]/GP-301 [W3.1]/' "$CASE_FILE"
|
|
1766
|
+
expect_fail "phase without tasks" "Phase 2 has no task definitions" --allow-planning "$CASE_FILE"
|
|
1767
|
+
|
|
1768
|
+
# Module disposition: a semicolon inside the reason, landed means referenced
|
|
1769
|
+
# outside the frontmatter, the session log, and the disposition block, and tasks
|
|
1770
|
+
# stay out of excluded or deferred modules.
|
|
1771
|
+
|
|
1772
|
+
DISCOVERY_DROP_PLAN="$TMP_DIR/discovery-drop.mdx"
|
|
1773
|
+
cp "$BASE_PLAN" "$DISCOVERY_DROP_PLAN"
|
|
1774
|
+
perl -0pi -e 's/^- product: landed R-PRD-1;[^\n]*$/- product: landed R-PRD-1; dropped-by archetype R-PRD-9 (no design system to publish; the app uses stock primitives)/m' "$DISCOVERY_DROP_PLAN"
|
|
1775
|
+
expect_pass "dropped-by reason containing a semicolon" --allow-planning "$DISCOVERY_DROP_PLAN"
|
|
1776
|
+
|
|
1777
|
+
new_case
|
|
1778
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1; dropped-by scale R-ROAD-9 ( )/m' "$CASE_FILE"
|
|
1779
|
+
expect_fail "module disposition with a blank reason" "dropped-by clause without a parenthesised reason" --allow-planning "$CASE_FILE"
|
|
1780
|
+
|
|
1781
|
+
new_case
|
|
1782
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1; kept R-ROAD-2/m' "$CASE_FILE"
|
|
1783
|
+
expect_fail "module disposition with an unknown clause" "module disposition for roadmap has an unrecognised clause 'kept R-ROAD-2'" --allow-planning "$CASE_FILE"
|
|
1784
|
+
|
|
1785
|
+
new_case
|
|
1786
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1\n- analytics: landed R-AN-1/m' "$CASE_FILE"
|
|
1787
|
+
expect_fail "module disposition names an unknown module" "module disposition names unknown module analytics" --allow-planning "$CASE_FILE"
|
|
1788
|
+
|
|
1789
|
+
new_case
|
|
1790
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1\n- roadmap: landed R-ROAD-1/m' "$CASE_FILE"
|
|
1791
|
+
expect_fail "module disposition duplicate line" "module disposition has a duplicate line for roadmap" --allow-planning "$CASE_FILE"
|
|
1792
|
+
|
|
1793
|
+
new_case
|
|
1794
|
+
perl -0pi -e 's/^- roadmap: landed R-ROAD-1$/- roadmap: landed R-ROAD-1, R-ROAD-99/m' "$CASE_FILE"
|
|
1795
|
+
expect_fail "module disposition lands an undefined id" "module disposition for roadmap lands undefined requirement R-ROAD-99" --allow-planning "$CASE_FILE"
|
|
1796
|
+
|
|
1797
|
+
new_case
|
|
1798
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-STACK-1, R-STACK-7/m; s/^- 2026-07-13 plan created$/- 2026-07-13 plan created; R-STACK-7 noted/m' "$CASE_FILE"
|
|
1799
|
+
expect_fail "landed requirement only in the session log" "module disposition lands R-STACK-7 but nothing outside the frontmatter, session log, and disposition block references it" --allow-planning "$CASE_FILE"
|
|
1800
|
+
|
|
1801
|
+
new_case
|
|
1802
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-STACK-1, R-STACK-7/m; s/^name: validator-fixture$/name: validator-fixture-R-STACK-7/m' "$CASE_FILE"
|
|
1803
|
+
expect_fail "landed requirement only in the frontmatter" "module disposition lands R-STACK-7 but nothing outside the frontmatter, session log, and disposition block references it" --allow-planning "$CASE_FILE"
|
|
1804
|
+
|
|
1805
|
+
new_case
|
|
1806
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-STACK-1, R-STACK-7/m; s/\(one shell entry point, no heavy pattern to justify\)/(one shell entry point, see R-STACK-7)/' "$CASE_FILE"
|
|
1807
|
+
expect_fail "landed requirement only in another disposition line" "module disposition lands R-STACK-7 but nothing outside the frontmatter, session log, and disposition block references it" --allow-planning "$CASE_FILE"
|
|
1808
|
+
|
|
1809
|
+
LANDED_IN_DECISION_PLAN="$TMP_DIR/landed-in-decision.mdx"
|
|
1810
|
+
cp "$BASE_PLAN" "$LANDED_IN_DECISION_PLAN"
|
|
1811
|
+
perl -0pi -e 's/^- stack: landed R-STACK-1$/- stack: landed R-STACK-1, R-STACK-7/m; s/^(The validator uses Bash 3\.2 plus stock Perl instead of a compiled runtime)\.$/$1 (R-STACK-7)./m' "$LANDED_IN_DECISION_PLAN"
|
|
1812
|
+
expect_pass "landed requirement referenced by a decision" --allow-planning "$LANDED_IN_DECISION_PLAN"
|
|
1813
|
+
|
|
1814
|
+
new_case
|
|
1815
|
+
perl -0pi -e 's/(- \[ \] GP-101.*? - Requirements: )[^\n]+/$1R-1.1, R-CODE-21, R-ARCH-4, R-STACK-1, R-SEO-3/s' "$CASE_FILE"
|
|
1816
|
+
expect_fail "task cites an excluded module" "GP-101 cites R-SEO-3, but the applicability matrix marks seo excluded" --allow-planning "$CASE_FILE"
|
|
1817
|
+
|
|
1818
|
+
CASE_FILE="$TMP_DIR/deferred-module-cited.mdx"
|
|
1819
|
+
cp "$DEFERRED_PLAN" "$CASE_FILE"
|
|
1820
|
+
perl -0pi -e 's/(- \[ \] GP-101.*? - Requirements: )[^\n]+/$1R-1.1, R-CODE-21, R-ARCH-4, R-STACK-1, R-SEO-1/s' "$CASE_FILE"
|
|
1821
|
+
expect_fail "task cites a deferred module" "GP-101 cites R-SEO-1, but the applicability matrix marks seo deferred" --allow-planning "$CASE_FILE"
|
|
1822
|
+
|
|
1823
|
+
# Documentation set: brownfield state tokens and malformed rows.
|
|
1824
|
+
|
|
1825
|
+
BROWNFIELD_DOCS_PLAN="$TMP_DIR/brownfield-doc-states.mdx"
|
|
1826
|
+
cp "$BASE_PLAN" "$BROWNFIELD_DOCS_PLAN"
|
|
1827
|
+
perl -0pi -e '
|
|
1828
|
+
s/^mode: greenfield$/mode: brownfield/m;
|
|
1829
|
+
s/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | required | repo | present-current: adopt; README.md exists and is current, frontmatter only |/m;
|
|
1830
|
+
s/^\| govern\.manifest \| govern \| required \| repo \|[^\n]*\|$/| govern.manifest | govern | required | repo | present-elsewhere: confirm; the manifest lives in the team wiki |/m;
|
|
1831
|
+
s/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | present-drifted: docs\/guide.md exists but nothing in the profile justifies it (orphan, see Q1) |/m;
|
|
1832
|
+
s/^None\.$/### Q1: Should docs\/guide.md be kept, moved, or archived?\n- Owner: the maintainer (a records decision, not the agent'"'"'s)\n- Blocks: nothing\n- Decide by: 2026-08-14, the Phase 2 start\n- Why it matters: an orphan guide drifts from the validator it describes.\n- Options: (a) keep it and plan a refresh; (b) archive it; (c) fold it into the readme.\n- Recommended default: (b), which deletes nothing and stops the drift./m
|
|
1833
|
+
' "$BROWNFIELD_DOCS_PLAN"
|
|
1834
|
+
expect_pass "brownfield adopt, confirm, and orphan rows" --allow-planning "$BROWNFIELD_DOCS_PLAN"
|
|
1835
|
+
|
|
1836
|
+
CASE_FILE="$TMP_DIR/brownfield-drifted-no-task.mdx"
|
|
1837
|
+
cp "$BROWNFIELD_DOCS_PLAN" "$CASE_FILE"
|
|
1838
|
+
perl -0pi -e 's/present-current: adopt;/present-drifted: refresh;/' "$CASE_FILE"
|
|
1839
|
+
expect_fail "drifted document without a refresh task" "documentation set row build.readme is required but names no GP task" --allow-planning "$CASE_FILE"
|
|
1840
|
+
|
|
1841
|
+
CASE_FILE="$TMP_DIR/brownfield-orphan-unasked.mdx"
|
|
1842
|
+
cp "$BROWNFIELD_DOCS_PLAN" "$CASE_FILE"
|
|
1843
|
+
perl -0pi -e 's/ \(orphan, see Q1\)//' "$CASE_FILE"
|
|
1844
|
+
expect_fail "orphan document without a question" "documentation set row serve.user-guide is an orphan but cites no ### Q<n>" --allow-planning "$CASE_FILE"
|
|
1845
|
+
|
|
1846
|
+
CASE_FILE="$TMP_DIR/brownfield-orphan-quarter.mdx"
|
|
1847
|
+
cp "$BROWNFIELD_DOCS_PLAN" "$CASE_FILE"
|
|
1848
|
+
perl -0pi -e 's/docs\/guide\.md exists but/docs\/guide.md was last edited in Q3 2025 but/' "$CASE_FILE"
|
|
1849
|
+
expect_pass "orphan row citing its question after a quarter" --allow-planning "$CASE_FILE"
|
|
1850
|
+
|
|
1851
|
+
# Greenfield documents are absent: only present-elsewhere may be recorded.
|
|
1852
|
+
new_case
|
|
1853
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | required | repo | present-current: adopt |/m' "$CASE_FILE"
|
|
1854
|
+
expect_fail "greenfield adopt row" "documentation set row build.readme records present-current in a greenfield plan" --allow-planning "$CASE_FILE"
|
|
1855
|
+
|
|
1856
|
+
new_case
|
|
1857
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | present-stub: docs\/guide.md (orphan, see Q1) |/m' "$CASE_FILE"
|
|
1858
|
+
expect_fail "greenfield orphan row" "documentation set row serve.user-guide records present-stub in a greenfield plan" --allow-planning "$CASE_FILE"
|
|
1859
|
+
|
|
1860
|
+
new_case
|
|
1861
|
+
perl -0pi -e 's/^\| govern\.manifest \| govern \| required \| repo \|[^\n]*\|$/| govern.manifest | govern | required | repo | present-elsewhere: confirm; the manifest lives in the team wiki |/m' "$CASE_FILE"
|
|
1862
|
+
expect_pass "greenfield confirm row" --allow-planning "$CASE_FILE"
|
|
1863
|
+
|
|
1864
|
+
new_case
|
|
1865
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | not-applicable | launch | no external user; revisit when: the validator ships to users outside this repository |/m' "$CASE_FILE"
|
|
1866
|
+
expect_fail "not-applicable row without a state" "the cell must open with 'absent:', 'by-design:', or 'present-elsewhere:'" --allow-planning "$CASE_FILE"
|
|
1867
|
+
|
|
1868
|
+
new_case
|
|
1869
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|[^\n]*\|$/| build.readme | build | Required | repo | somebody will get to it |/m' "$CASE_FILE"
|
|
1870
|
+
expect_fail "documentation row with a capitalized verdict" "malformed documentation set row: | build.readme | build | Required" --allow-planning "$CASE_FILE"
|
|
1871
|
+
|
|
1872
|
+
new_case
|
|
1873
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|([^\n]*)\|$/| build.readme | build | required | repo (shared) |$1|/m' "$CASE_FILE"
|
|
1874
|
+
expect_fail "documentation row with an annotated owner" "malformed documentation set row: | build.readme" --allow-planning "$CASE_FILE"
|
|
1875
|
+
|
|
1876
|
+
new_case
|
|
1877
|
+
perl -0pi -e 's/^\| build\.readme \| build \| required \| repo \|([^\n]*)\|$/| build.readme | build | essential | repo |$1|/m' "$CASE_FILE"
|
|
1878
|
+
expect_fail "documentation row with an invalid verdict" "documentation set row build.readme has invalid verdict 'essential'" --allow-planning "$CASE_FILE"
|
|
1879
|
+
|
|
1880
|
+
new_case
|
|
1881
|
+
perl -0pi -e 's/^(\| build\.readme \| build \| required \| repo \|[^\n]*\|)$/$1\n$1/m' "$CASE_FILE"
|
|
1882
|
+
expect_fail "documentation row twice" "documentation set has a duplicate row for build.readme" --allow-planning "$CASE_FILE"
|
|
1883
|
+
|
|
1884
|
+
new_case
|
|
1885
|
+
perl -0pi -e 's/^\| serve\.user-guide \| serve \| not-applicable \| launch \|[^\n]*\|$/| serve.user-guide | serve | optional | launch | |/m' "$CASE_FILE"
|
|
1886
|
+
expect_fail "optional document without a reason" "documentation set row serve.user-guide is optional but says nothing about why" --allow-planning "$CASE_FILE"
|
|
1887
|
+
|
|
1888
|
+
# Decisions: every ### heading is a D<n> entry or the assumptions ledger, and
|
|
1889
|
+
# the sidecar lists decisions in numeric order.
|
|
1890
|
+
|
|
1891
|
+
new_case
|
|
1892
|
+
perl -0pi -e 's/^## Requirements$/### Cache: Redis for sessions\n\nWe will use Redis because it is fast.\n\n## Requirements/m' "$CASE_FILE"
|
|
1893
|
+
expect_fail "decision heading without a D number" "malformed decision heading on line" --allow-planning "$CASE_FILE"
|
|
1894
|
+
|
|
1895
|
+
DECISIONS_PLAN="$TMP_DIR/decision-order.mdx"
|
|
1896
|
+
cp "$BASE_PLAN" "$DECISIONS_PLAN"
|
|
1897
|
+
DECISION_BLOCK='The second runtime bet.\nFalsifier:\n- Signal: Perl availability on every supported platform\n- Failure boundary: any supported platform ships without Perl\n- Replan action: return to planning and replace the embedded parser with a supported runtime\n\n'
|
|
1898
|
+
DECISION_BLOCK=$DECISION_BLOCK perl -0pi -e 's/^## Requirements$/### D10: tenth decision\n$ENV{DECISION_BLOCK}### D2: second decision\n$ENV{DECISION_BLOCK}### Assumptions ledger\n\n- A1: Perl stays in the base image\n - Blast radius: wrong costs +1 tasks and +0 phases\n - Validated by: GP-101\n\n## Requirements/m; s/\\n/\n/g' "$DECISIONS_PLAN"
|
|
1899
|
+
DECISIONS_JSON="$TMP_DIR/decision-order.json"
|
|
1900
|
+
emit_sidecar "decisions with an assumptions ledger" "$DECISIONS_JSON" "$DECISIONS_PLAN"
|
|
1901
|
+
if node -e '
|
|
1902
|
+
const doc = JSON.parse(require("node:fs").readFileSync(process.argv[1], "utf8"));
|
|
1903
|
+
if (doc.decisions.map((entry) => entry.id).join(",") !== "D1,D2,D10") throw new Error("decision order");
|
|
1904
|
+
' "$DECISIONS_JSON"; then
|
|
1905
|
+
record_pass "sidecar decisions sort numerically"
|
|
1906
|
+
else
|
|
1907
|
+
record_fail "sidecar decisions sort numerically" "decisions are not in numeric order"
|
|
1908
|
+
fi
|
|
1909
|
+
|
|
1910
|
+
new_case
|
|
1911
|
+
perl -0pi -e 's/^- Signal: Perl availability[^\n]*\n//m' "$CASE_FILE"
|
|
1912
|
+
expect_fail "falsifier missing its signal" "decision D1 Falsifier is missing Signal" --allow-planning "$CASE_FILE"
|
|
1913
|
+
|
|
1914
|
+
new_case
|
|
1915
|
+
perl -0pi -e 's/^- Signal: Perl availability[^\n]*$/- Signal: usage/m' "$CASE_FILE"
|
|
1916
|
+
expect_fail "vague falsifier signal" "decision D1 Signal is too vague to observe" --allow-planning "$CASE_FILE"
|
|
1917
|
+
|
|
1918
|
+
new_case
|
|
1919
|
+
perl -0pi -e 's/^- Replan action: [^\n]*$/- Replan action: return to planning and think about it/m' "$CASE_FILE"
|
|
1920
|
+
expect_fail "replan action without a verb" "decision D1 Replan action must name what changes" --allow-planning "$CASE_FILE"
|
|
1921
|
+
|
|
1922
|
+
# Archetype: a named Primary above the floor must be the frontmatter archetype.
|
|
1923
|
+
|
|
1924
|
+
new_case
|
|
1925
|
+
perl -0pi -e 's/^archetype: cli-tool$/archetype: unknown/m' "$CASE_FILE"
|
|
1926
|
+
expect_fail "unknown archetype above the floor" "Primary is cli-tool but frontmatter archetype is unknown" --allow-planning "$CASE_FILE"
|
|
1927
|
+
|
|
1928
|
+
new_case
|
|
1929
|
+
perl -0pi -e 's/^- Primary: cli-tool \(score 0\.86\)$/- Primary: cli-tool (score 1.20)/m' "$CASE_FILE"
|
|
1930
|
+
expect_fail "archetype score above one" "archetype confidence Primary score exceeds 1.00" --allow-planning "$CASE_FILE"
|
|
1931
|
+
|
|
1932
|
+
new_case
|
|
1933
|
+
perl -0pi -e 's/^- Runner-up: library \(score 0\.29\)$/- Runner-up: library (score 0.90)/m' "$CASE_FILE"
|
|
1934
|
+
expect_fail "runner-up above primary" "archetype confidence Runner-up scores at or above Primary" --allow-planning "$CASE_FILE"
|
|
1935
|
+
|
|
1936
|
+
new_case
|
|
1937
|
+
perl -0pi -e 's/^- If the runner-up is right: [^\n]*\n//m' "$CASE_FILE"
|
|
1938
|
+
expect_fail "runner-up without a counterfactual" "names a runner-up but no 'If the runner-up is right:' counterfactual" --allow-planning "$CASE_FILE"
|
|
1939
|
+
|
|
1940
|
+
# Fenced code is quoted text: headings and task lines inside it are not plan
|
|
1941
|
+
# structure. An unclosed fence is reported, and the lines after it are still
|
|
1942
|
+
# validated rather than blanked.
|
|
1943
|
+
|
|
1944
|
+
FENCED_PLAN="$TMP_DIR/fenced-example.mdx"
|
|
1945
|
+
cp "$BASE_PLAN" "$FENCED_PLAN"
|
|
1946
|
+
perl -0pi -e 's/^The plan remains the source of truth\.$/The plan remains the source of truth. The emitted AGENTS.md reads:\n\n```markdown\n## Open Questions\n\n- [ ] GP-150 [W1.1] Example task\n```\n\n~~~text\n## Decisions\n~~~/m' "$FENCED_PLAN"
|
|
1947
|
+
expect_pass "fenced headings and tasks are not structure" --allow-planning "$FENCED_PLAN"
|
|
1948
|
+
|
|
1949
|
+
CASE_FILE="$TMP_DIR/unclosed-fence.mdx"
|
|
1950
|
+
cp "$FENCED_PLAN" "$CASE_FILE"
|
|
1951
|
+
perl -0pi -e 's/\n~~~\n/\n/' "$CASE_FILE"
|
|
1952
|
+
expect_fail "unclosed code fence" "code fence opened on line" --allow-planning "$CASE_FILE"
|
|
1953
|
+
|
|
1954
|
+
CASE_FILE="$TMP_DIR/unclosed-mermaid.mdx"
|
|
1955
|
+
cp "$BASE_PLAN" "$CASE_FILE"
|
|
1956
|
+
perl -0pi -e 's/^(The shell entry point delegates parsing to portable Perl\.)$/$1\n\n```mermaid\nflowchart LR\n A --> B/m' "$CASE_FILE"
|
|
1957
|
+
output=$("$VALIDATOR" --allow-planning "$CASE_FILE" 2>&1)
|
|
1958
|
+
if [ "$(printf '%s\n' "$output" | grep -c '^FAIL ')" -eq 1 ] &&
|
|
1959
|
+
printf '%s\n' "$output" | grep -F "code fence opened on line" >/dev/null; then
|
|
1960
|
+
record_pass "unclosed fence is the only failure"
|
|
1961
|
+
else
|
|
1962
|
+
record_fail "unclosed fence is the only failure" "$output"
|
|
1963
|
+
fi
|
|
1964
|
+
|
|
1965
|
+
if [ "$FAIL_COUNT" -ne 0 ]; then
|
|
1966
|
+
printf '\n%d passed, %d failed\n' "$PASS_COUNT" "$FAIL_COUNT" >&2
|
|
1967
|
+
exit 1
|
|
1968
|
+
fi
|
|
1969
|
+
|
|
1970
|
+
printf '\n%d validator regression checks passed\n' "$PASS_COUNT"
|