substrate-ai 0.20.52 → 0.20.53
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/package.json
CHANGED
|
@@ -162,6 +162,156 @@ Strata Story 2-4 ("morning briefing generator", v0.20.41) shipped two architectu
|
|
|
162
162
|
|
|
163
163
|
A one-repo variant of this probe would pass against the (broken) v0.20.41 implementation; the two-repo variant catches the wrong-cwd defect because the parent-cwd `git log --all` returns BOTH commits but substring-match attribution mis-routes them.
|
|
164
164
|
|
|
165
|
+
## State-integration probe shapes
|
|
166
|
+
|
|
167
|
+
State-integration probes exercise code that reads from or writes to external state: the filesystem, subprocesses, git repositories, databases, network endpoints, and registries. Four principles govern probe design in this category:
|
|
168
|
+
|
|
169
|
+
1. **Real-state context, not synthesized**: populate a tmpdir with a structure matching the production layout (e.g., for fleet-scanning logic, N subdirs each containing a `.git` directory). Do not pass artificial in-memory structures or bypass the I/O layer.
|
|
170
|
+
2. **Sandbox choice leans `twin` more often**: any probe that touches the user's home directory, writes to the filesystem outside the project, or exercises a running service MUST use `sandbox: twin`. Reserve `sandbox: host` exclusively for read-only registry / config-shape probes that cannot mutate host state.
|
|
171
|
+
3. **Multi-resource fixtures MUST contain ≥2 distinct, non-overlapping resources**: a single-resource fixture silently passes when the defect only surfaces under multiplicity. Create two or more distinct instances and assert each one independently.
|
|
172
|
+
4. **External-binary availability assertions**: if the probe invokes `git`, `dolt`, `podman`, or any other binary that may not be installed, either add a sibling availability probe or put an inline `command -v <binary> || { echo "NOT_FOUND"; exit 1; }` check at the top of the `command:` block.
|
|
173
|
+
|
|
174
|
+
### Filesystem shape
|
|
175
|
+
|
|
176
|
+
Populate a tmpdir with a production-layout directory structure and assert file contents or directory invariants. Use `sandbox: twin` — the probe writes to the filesystem.
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
- name: fleet-config-files-written-per-project
|
|
180
|
+
sandbox: twin
|
|
181
|
+
command: |
|
|
182
|
+
set -e
|
|
183
|
+
FLEET=$(mktemp -d)
|
|
184
|
+
mkdir -p "$FLEET/alpha" "$FLEET/beta"
|
|
185
|
+
node <REPO_ROOT>/dist/cli.mjs scan-fleet --root "$FLEET"
|
|
186
|
+
test -f "$FLEET/alpha/config.json" && echo "ALPHA_CONFIG_FOUND"
|
|
187
|
+
test -f "$FLEET/beta/config.json" && echo "BETA_CONFIG_FOUND"
|
|
188
|
+
expect_stdout_regex:
|
|
189
|
+
- ALPHA_CONFIG_FOUND
|
|
190
|
+
- BETA_CONFIG_FOUND
|
|
191
|
+
description: fleet scanner writes per-project config files to production-layout tmpdir with ≥2 dirs
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Subprocess shape
|
|
195
|
+
|
|
196
|
+
Assert binary availability first via `command -v`, then exercise the subprocess via its production invocation path. Use `sandbox: twin` — the probe may mutate host state.
|
|
197
|
+
|
|
198
|
+
```yaml
|
|
199
|
+
- name: git-binary-available
|
|
200
|
+
sandbox: host
|
|
201
|
+
command: |
|
|
202
|
+
command -v git && echo "GIT_FOUND" || { echo "GIT_NOT_FOUND"; exit 1; }
|
|
203
|
+
expect_stdout_regex:
|
|
204
|
+
- GIT_FOUND
|
|
205
|
+
description: git binary must be on PATH before subprocess probes run
|
|
206
|
+
- name: subprocess-production-path-invoked
|
|
207
|
+
sandbox: twin
|
|
208
|
+
command: |
|
|
209
|
+
set -e
|
|
210
|
+
TMPOUT=$(mktemp)
|
|
211
|
+
node <REPO_ROOT>/dist/cli.mjs run-task --output "$TMPOUT"
|
|
212
|
+
grep -q '"status":"ok"' "$TMPOUT" && echo "TASK_COMPLETED"
|
|
213
|
+
expect_stdout_regex:
|
|
214
|
+
- TASK_COMPLETED
|
|
215
|
+
description: subprocess invocation via production CLI path produces expected output shape
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Git shape (canonical obs_017 pattern)
|
|
219
|
+
|
|
220
|
+
Create a ≥2-repo fleet in a tmpdir with non-overlapping commit messages, set `cwd` per-repo (NOT fleet root), and assert each repo's commits are attributed correctly. This is the canonical obs_017 pattern: the cwd-as-parent defect produces plausible output against a one-repo fleet but fails with two repos because `git log` at fleet root aggregates all repos' commits into one undifferentiated blob, making per-project attribution impossible.
|
|
221
|
+
|
|
222
|
+
```yaml
|
|
223
|
+
- name: git-per-repo-commit-attribution
|
|
224
|
+
sandbox: twin
|
|
225
|
+
command: |
|
|
226
|
+
set -e
|
|
227
|
+
FLEET=$(mktemp -d)
|
|
228
|
+
for proj in alpha beta; do
|
|
229
|
+
mkdir -p "$FLEET/$proj"
|
|
230
|
+
git -C "$FLEET/$proj" init -q
|
|
231
|
+
git -C "$FLEET/$proj" config user.email t@example.com
|
|
232
|
+
git -C "$FLEET/$proj" config user.name test
|
|
233
|
+
echo "$proj content" > "$FLEET/$proj/a.md"
|
|
234
|
+
git -C "$FLEET/$proj" add .
|
|
235
|
+
git -C "$FLEET/$proj" commit -qm "$proj-only commit"
|
|
236
|
+
done
|
|
237
|
+
ALPHA_LOG=$(git -C "$FLEET/alpha" log --oneline)
|
|
238
|
+
BETA_LOG=$(git -C "$FLEET/beta" log --oneline)
|
|
239
|
+
echo "alpha: $ALPHA_LOG"
|
|
240
|
+
echo "beta: $BETA_LOG"
|
|
241
|
+
expect_stdout_regex:
|
|
242
|
+
- 'alpha:.*alpha-only commit'
|
|
243
|
+
- 'beta:.*beta-only commit'
|
|
244
|
+
expect_stdout_no_regex:
|
|
245
|
+
- 'alpha:.*beta-only commit'
|
|
246
|
+
- 'beta:.*alpha-only commit'
|
|
247
|
+
description: >-
|
|
248
|
+
per-repo cwd correctly isolates each project's commits — catches the cwd-as-parent
|
|
249
|
+
defect (obs_017) where git log at fleet root aggregates all repos into one blob
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Database shape
|
|
253
|
+
|
|
254
|
+
Exercise a Dolt or SQLite database in a twin sandbox, seeding ≥2 rows and asserting per-row behavior. Use `sandbox: twin`.
|
|
255
|
+
|
|
256
|
+
```yaml
|
|
257
|
+
- name: database-per-row-attribution
|
|
258
|
+
sandbox: twin
|
|
259
|
+
command: |
|
|
260
|
+
set -e
|
|
261
|
+
DBDIR=$(mktemp -d)
|
|
262
|
+
sqlite3 "$DBDIR/test.db" "CREATE TABLE items (id INTEGER, name TEXT);"
|
|
263
|
+
sqlite3 "$DBDIR/test.db" "INSERT INTO items VALUES (1, 'alpha-item');"
|
|
264
|
+
sqlite3 "$DBDIR/test.db" "INSERT INTO items VALUES (2, 'beta-item');"
|
|
265
|
+
node <REPO_ROOT>/dist/cli.mjs query-items --db "$DBDIR/test.db"
|
|
266
|
+
expect_stdout_regex:
|
|
267
|
+
- alpha-item
|
|
268
|
+
- beta-item
|
|
269
|
+
description: database probe seeds ≥2 rows and asserts per-row output is correctly attributed
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Network shape
|
|
273
|
+
|
|
274
|
+
Exercise an HTTP endpoint with `expect_stdout_no_regex` error-envelope guards. Use `sandbox: twin` for endpoints that mutate state; `sandbox: host` for strictly read-only checks that cannot affect the host.
|
|
275
|
+
|
|
276
|
+
```yaml
|
|
277
|
+
- name: api-endpoint-returns-success-shape
|
|
278
|
+
sandbox: twin
|
|
279
|
+
command: |
|
|
280
|
+
set -e
|
|
281
|
+
curl -sf http://localhost:3000/health
|
|
282
|
+
expect_stdout_no_regex:
|
|
283
|
+
- '"isError"\s*:\s*true'
|
|
284
|
+
- '"status"\s*:\s*"error"'
|
|
285
|
+
- '"error"\s*:'
|
|
286
|
+
expect_stdout_regex:
|
|
287
|
+
- '"status"\s*:\s*"ok"'
|
|
288
|
+
description: health endpoint returns success-shaped JSON without error envelope
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Registry shape
|
|
292
|
+
|
|
293
|
+
Read from an npm/package registry or fleet-config source. Precede the registry probe with a binary-availability sibling probe. Use `sandbox: host` — registry reads are strictly read-only and cannot mutate host state.
|
|
294
|
+
|
|
295
|
+
```yaml
|
|
296
|
+
- name: npm-binary-available
|
|
297
|
+
sandbox: host
|
|
298
|
+
command: |
|
|
299
|
+
command -v npm && echo "NPM_FOUND" || { echo "NPM_NOT_FOUND"; exit 1; }
|
|
300
|
+
expect_stdout_regex:
|
|
301
|
+
- NPM_FOUND
|
|
302
|
+
description: npm binary must be on PATH before registry probe runs
|
|
303
|
+
- name: package-registry-version-resolves
|
|
304
|
+
sandbox: host
|
|
305
|
+
command: |
|
|
306
|
+
npm view @substrate-ai/sdlc version 2>&1
|
|
307
|
+
expect_stdout_no_regex:
|
|
308
|
+
- 'Not found'
|
|
309
|
+
- 'npm ERR!'
|
|
310
|
+
expect_stdout_regex:
|
|
311
|
+
- '\d+\.\d+\.\d+'
|
|
312
|
+
description: npm registry resolves @substrate-ai/sdlc and returns a semver version string
|
|
313
|
+
```
|
|
314
|
+
|
|
165
315
|
## Mission
|
|
166
316
|
|
|
167
317
|
Author runtime probes for the story described above. Use the AC sections provided:
|