@ontrails/testing 1.0.0-beta.3 → 1.0.0-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +478 -8
  2. package/README.md +86 -22
  3. package/package.json +34 -5
  4. package/src/all-established.ts +168 -0
  5. package/src/all.ts +51 -12
  6. package/src/assertions.ts +253 -0
  7. package/src/cli.ts +6 -0
  8. package/src/composes.ts +433 -0
  9. package/src/context.ts +200 -14
  10. package/src/contracts.ts +46 -35
  11. package/src/detours.ts +155 -18
  12. package/src/effective-examples.ts +414 -0
  13. package/src/errors.ts +47 -0
  14. package/src/examples.ts +302 -177
  15. package/src/harness-cli.ts +83 -58
  16. package/src/harness-http.ts +341 -0
  17. package/src/harness-mcp.ts +46 -16
  18. package/src/http.ts +10 -0
  19. package/src/index.ts +22 -14
  20. package/src/logger.ts +3 -1
  21. package/src/mcp.ts +6 -0
  22. package/src/scenario.ts +375 -0
  23. package/src/signals.ts +221 -0
  24. package/src/surface-parity.ts +389 -0
  25. package/src/trail.ts +1 -1
  26. package/src/types.ts +24 -52
  27. package/.turbo/turbo-build.log +0 -1
  28. package/.turbo/turbo-lint.log +0 -3
  29. package/.turbo/turbo-typecheck.log +0 -1
  30. package/dist/all.d.ts +0 -30
  31. package/dist/all.d.ts.map +0 -1
  32. package/dist/all.js +0 -47
  33. package/dist/all.js.map +0 -1
  34. package/dist/assertions.d.ts +0 -49
  35. package/dist/assertions.d.ts.map +0 -1
  36. package/dist/assertions.js +0 -84
  37. package/dist/assertions.js.map +0 -1
  38. package/dist/context.d.ts +0 -19
  39. package/dist/context.d.ts.map +0 -1
  40. package/dist/context.js +0 -33
  41. package/dist/context.js.map +0 -1
  42. package/dist/contracts.d.ts +0 -16
  43. package/dist/contracts.d.ts.map +0 -1
  44. package/dist/contracts.js +0 -66
  45. package/dist/contracts.js.map +0 -1
  46. package/dist/detours.d.ts +0 -12
  47. package/dist/detours.d.ts.map +0 -1
  48. package/dist/detours.js +0 -30
  49. package/dist/detours.js.map +0 -1
  50. package/dist/examples.d.ts +0 -22
  51. package/dist/examples.d.ts.map +0 -1
  52. package/dist/examples.js +0 -187
  53. package/dist/examples.js.map +0 -1
  54. package/dist/harness-cli.d.ts +0 -21
  55. package/dist/harness-cli.d.ts.map +0 -1
  56. package/dist/harness-cli.js +0 -213
  57. package/dist/harness-cli.js.map +0 -1
  58. package/dist/harness-mcp.d.ts +0 -21
  59. package/dist/harness-mcp.d.ts.map +0 -1
  60. package/dist/harness-mcp.js +0 -50
  61. package/dist/harness-mcp.js.map +0 -1
  62. package/dist/hike.d.ts +0 -32
  63. package/dist/hike.d.ts.map +0 -1
  64. package/dist/hike.js +0 -169
  65. package/dist/hike.js.map +0 -1
  66. package/dist/index.d.ts +0 -14
  67. package/dist/index.d.ts.map +0 -1
  68. package/dist/index.js +0 -16
  69. package/dist/index.js.map +0 -1
  70. package/dist/logger.d.ts +0 -15
  71. package/dist/logger.d.ts.map +0 -1
  72. package/dist/logger.js +0 -87
  73. package/dist/logger.js.map +0 -1
  74. package/dist/trail.d.ts +0 -20
  75. package/dist/trail.d.ts.map +0 -1
  76. package/dist/trail.js +0 -80
  77. package/dist/trail.js.map +0 -1
  78. package/dist/types.d.ts +0 -80
  79. package/dist/types.d.ts.map +0 -1
  80. package/dist/types.js +0 -5
  81. package/dist/types.js.map +0 -1
  82. package/src/__tests__/context.test.ts +0 -60
  83. package/src/__tests__/contracts.test.ts +0 -93
  84. package/src/__tests__/detours.test.ts +0 -55
  85. package/src/__tests__/examples.test.ts +0 -176
  86. package/src/__tests__/hike.test.ts +0 -164
  87. package/src/__tests__/logger.test.ts +0 -136
  88. package/src/__tests__/trail.test.ts +0 -99
  89. package/src/hike.ts +0 -283
  90. package/tsconfig.json +0 -9
  91. package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md CHANGED
@@ -1,18 +1,488 @@
1
1
  # @ontrails/testing
2
2
 
3
+ ## 1.0.0-beta.30
4
+
5
+ ### Patch Changes
6
+
7
+ - @ontrails/cli@1.0.0-beta.30
8
+ - @ontrails/core@1.0.0-beta.30
9
+ - @ontrails/http@1.0.0-beta.30
10
+ - @ontrails/mcp@1.0.0-beta.30
11
+ - @ontrails/observe@1.0.0-beta.30
12
+
13
+ ## 1.0.0-beta.29
14
+
15
+ ### Patch Changes
16
+
17
+ - @ontrails/cli@1.0.0-beta.29
18
+ - @ontrails/core@1.0.0-beta.29
19
+ - @ontrails/http@1.0.0-beta.29
20
+ - @ontrails/mcp@1.0.0-beta.29
21
+ - @ontrails/observe@1.0.0-beta.29
22
+
23
+ ## 1.0.0-beta.28
24
+
25
+ ### Patch Changes
26
+
27
+ - @ontrails/cli@1.0.0-beta.28
28
+ - @ontrails/core@1.0.0-beta.28
29
+ - @ontrails/http@1.0.0-beta.28
30
+ - @ontrails/mcp@1.0.0-beta.28
31
+ - @ontrails/observe@1.0.0-beta.28
32
+
33
+ ## 1.0.0-beta.27
34
+
35
+ ### Patch Changes
36
+
37
+ - @ontrails/cli@1.0.0-beta.27
38
+ - @ontrails/core@1.0.0-beta.27
39
+ - @ontrails/http@1.0.0-beta.27
40
+ - @ontrails/mcp@1.0.0-beta.27
41
+ - @ontrails/observe@1.0.0-beta.27
42
+
43
+ ## 1.0.0-beta.26
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [1307568]
48
+ - Updated dependencies [371d19e]
49
+ - @ontrails/core@1.0.0-beta.26
50
+ - @ontrails/cli@1.0.0-beta.26
51
+ - @ontrails/http@1.0.0-beta.26
52
+ - @ontrails/mcp@1.0.0-beta.26
53
+ - @ontrails/observe@1.0.0-beta.26
54
+
55
+ ## 1.0.0-beta.25
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [a9fdbc7]
60
+ - Updated dependencies [c36aca9]
61
+ - Updated dependencies [3befcf1]
62
+ - Updated dependencies [2c08afe]
63
+ - Updated dependencies [f1e6efa]
64
+ - Updated dependencies [f1e6efa]
65
+ - Updated dependencies [a4f9cf6]
66
+ - Updated dependencies [9bcf34e]
67
+ - Updated dependencies [f7d97fc]
68
+ - Updated dependencies [df13faf]
69
+ - @ontrails/mcp@1.0.0-beta.25
70
+ - @ontrails/core@1.0.0-beta.25
71
+ - @ontrails/http@1.0.0-beta.25
72
+ - @ontrails/cli@1.0.0-beta.25
73
+ - @ontrails/observe@1.0.0-beta.25
74
+
75
+ ## 1.0.0-beta.24
76
+
77
+ ### Patch Changes
78
+
79
+ - @ontrails/cli@1.0.0-beta.24
80
+ - @ontrails/core@1.0.0-beta.24
81
+ - @ontrails/http@1.0.0-beta.24
82
+ - @ontrails/mcp@1.0.0-beta.24
83
+ - @ontrails/observe@1.0.0-beta.24
84
+
85
+ ## 1.0.0-beta.23
86
+
87
+ ### Patch Changes
88
+
89
+ - Updated dependencies [9c5ecdc]
90
+ - @ontrails/http@1.0.0-beta.23
91
+ - @ontrails/cli@1.0.0-beta.23
92
+ - @ontrails/core@1.0.0-beta.23
93
+ - @ontrails/mcp@1.0.0-beta.23
94
+ - @ontrails/observe@1.0.0-beta.23
95
+
96
+ ## 1.0.0-beta.22
97
+
98
+ ### Patch Changes
99
+
100
+ - @ontrails/cli@1.0.0-beta.22
101
+ - @ontrails/core@1.0.0-beta.22
102
+ - @ontrails/http@1.0.0-beta.22
103
+ - @ontrails/mcp@1.0.0-beta.22
104
+ - @ontrails/observe@1.0.0-beta.22
105
+
106
+ ## 1.0.0-beta.21
107
+
108
+ ### Patch Changes
109
+
110
+ - Updated dependencies [99523f2]
111
+ - @ontrails/core@1.0.0-beta.21
112
+ - @ontrails/cli@1.0.0-beta.21
113
+ - @ontrails/http@1.0.0-beta.21
114
+ - @ontrails/mcp@1.0.0-beta.21
115
+ - @ontrails/observe@1.0.0-beta.21
116
+
117
+ ## 1.0.0-beta.20
118
+
119
+ ### Patch Changes
120
+
121
+ - Updated dependencies [851a2a3]
122
+ - Updated dependencies [9bec01c]
123
+ - Updated dependencies [accb9ec]
124
+ - @ontrails/core@1.0.0-beta.20
125
+ - @ontrails/mcp@1.0.0-beta.20
126
+ - @ontrails/cli@1.0.0-beta.20
127
+ - @ontrails/http@1.0.0-beta.20
128
+ - @ontrails/observe@1.0.0-beta.20
129
+
130
+ ## 1.0.0-beta.19
131
+
132
+ ### Major Changes
133
+
134
+ - 1eb5bdc: Rename first-class trail composition from the `cross` API family to the `compose` family across core contracts, testing helpers, topo projections, Warden rules, CLI scaffolds, and docs. `composes`, `ctx.compose`, `composeInput`, and `Compose*` type names are now the public authoring vocabulary; topo persistence migrates legacy composition rows and graph keys forward.
135
+
136
+ ### Minor Changes
137
+
138
+ - 492f71c: Move CLI, MCP, HTTP, established-surface, and surface-parity helpers behind explicit subpaths so root contract testing imports no longer require optional surface peers. The Trails CLI scaffolder now emits `import { testAllEstablished } from '@ontrails/testing/established'` for generated verification.
139
+
140
+ ### Patch Changes
141
+
142
+ - e41c382: Document beta-channel install guidance in package and adapter README install snippets so consumers use explicit `@beta` (or pinned `1.0.0-beta.N`) tags instead of accidental `latest` resolution during the prerelease line. Adds the policy doc at `docs/releases/beta-channel-policy.md`, prints both `latest` and `beta` dist-tags in `bun run publish:registry-check`, and aligns plugin/skill install snippets.
143
+ - f8d80b9: Refresh current-facing compose vocabulary in package documentation after the composition cutover.
144
+ - 337b467: Construct declared Trails error classes when `testComposes` injects composed trail error examples.
145
+ - 16cb740: Run examples and contract checks across live trail version entries, and project version-entry example coverage into topo and survey reports.
146
+ - 5d88104: Polish Trails blaze terminology across package docs and Warden guidance.
147
+ - f04a9ef: Tighten trail-versioning API polish by keeping executor cross-validation internals out of public options and improving absent marker diagnostics.
148
+ - Updated dependencies [e41c382]
149
+ - Updated dependencies [a2f1825]
150
+ - Updated dependencies [a2f1825]
151
+ - Updated dependencies [1eb5bdc]
152
+ - Updated dependencies [f8d80b9]
153
+ - Updated dependencies [94a8380]
154
+ - Updated dependencies [94a8380]
155
+ - Updated dependencies [846a597]
156
+ - Updated dependencies [8638dae]
157
+ - Updated dependencies [8638dae]
158
+ - Updated dependencies [8638dae]
159
+ - Updated dependencies [223aaad]
160
+ - Updated dependencies [3125f4d]
161
+ - Updated dependencies [2494dc6]
162
+ - Updated dependencies [2d53717]
163
+ - Updated dependencies [16cb740]
164
+ - Updated dependencies [8894ecb]
165
+ - Updated dependencies [fdf7ec9]
166
+ - Updated dependencies [92e709b]
167
+ - Updated dependencies [d76be13]
168
+ - Updated dependencies [84f56a5]
169
+ - Updated dependencies [431b04c]
170
+ - Updated dependencies [5d88104]
171
+ - Updated dependencies [f04a9ef]
172
+ - Updated dependencies [fc00aeb]
173
+ - Updated dependencies [ab1c77c]
174
+ - Updated dependencies [8ca5b85]
175
+ - @ontrails/core@1.0.0-beta.19
176
+ - @ontrails/cli@1.0.0-beta.19
177
+ - @ontrails/http@1.0.0-beta.19
178
+ - @ontrails/mcp@1.0.0-beta.19
179
+ - @ontrails/observe@1.0.0-beta.19
180
+
181
+ ## 1.0.0-beta.18
182
+
183
+ ### Patch Changes
184
+
185
+ - Updated dependencies [c0b2948]
186
+ - Updated dependencies [fc3219c]
187
+ - Updated dependencies [bc2d327]
188
+ - Updated dependencies [bf44972]
189
+ - Updated dependencies [e0ae995]
190
+ - @ontrails/http@1.0.0-beta.18
191
+ - @ontrails/observe@1.0.0-beta.18
192
+ - @ontrails/cli@1.0.0-beta.18
193
+ - @ontrails/core@1.0.0-beta.18
194
+ - @ontrails/mcp@1.0.0-beta.18
195
+
196
+ ## 1.0.0-beta.17
197
+
198
+ ### Patch Changes
199
+
200
+ - ce42573: Add an example-driven CLI/MCP/HTTP surface parity helper.
201
+ - e1eb4ee: Add an HTTP surface harness and include HTTP projection validation in `testAllEstablished`.
202
+ - Updated dependencies [3dc8254]
203
+ - Updated dependencies [61497c5]
204
+ - @ontrails/core@1.0.0-beta.17
205
+ - @ontrails/cli@1.0.0-beta.17
206
+ - @ontrails/http@1.0.0-beta.17
207
+ - @ontrails/mcp@1.0.0-beta.17
208
+ - @ontrails/observe@1.0.0-beta.17
209
+
210
+ ## 1.0.0-beta.16
211
+
212
+ ### Minor Changes
213
+
214
+ - bcdc484: Add an explicit `unmockable: { reason }` resource marker and have testing auto-mock resolution skip intentionally unmockable resources.
215
+ - bb1cadf: Rename the generated `testAll` suite from `governance` to `contract`.
216
+
217
+ ### Patch Changes
218
+
219
+ - d40430d: Remove the retired `@ontrails/logging` workspace from the prerelease package set. Use `@ontrails/observe` for log and trace sink contracts and `@ontrails/logtape` for LogTape forwarding.
220
+ - 193ae78: Migrate testing logger types from the legacy `@ontrails/logging` package to `@ontrails/observe`.
221
+ - Updated dependencies [73622ae]
222
+ - Updated dependencies [e991a5b]
223
+ - Updated dependencies [25f3c5c]
224
+ - Updated dependencies [6300f70]
225
+ - Updated dependencies [d172013]
226
+ - Updated dependencies [c3fc5c3]
227
+ - Updated dependencies [20d7a5c]
228
+ - Updated dependencies [be5fb46]
229
+ - Updated dependencies [e898cc4]
230
+ - Updated dependencies [a8997ed]
231
+ - Updated dependencies [fe03945]
232
+ - Updated dependencies [3395234]
233
+ - Updated dependencies [d40430d]
234
+ - Updated dependencies [bcdc484]
235
+ - Updated dependencies [ed171d5]
236
+ - Updated dependencies [49c2e7d]
237
+ - Updated dependencies [331e3a9]
238
+ - Updated dependencies [4399fdb]
239
+ - Updated dependencies [4b8d13b]
240
+ - Updated dependencies [fbd42fc]
241
+ - Updated dependencies [63d1aef]
242
+ - Updated dependencies [112b9f2]
243
+ - Updated dependencies [893025e]
244
+ - Updated dependencies [ed888e2]
245
+ - Updated dependencies [2e05e27]
246
+ - Updated dependencies [9cdb0f2]
247
+ - Updated dependencies [c8caa5e]
248
+ - Updated dependencies [f4b90c9]
249
+ - Updated dependencies [eec5e9d]
250
+ - Updated dependencies [4e75129]
251
+ - Updated dependencies [47505fe]
252
+ - Updated dependencies [ebd4434]
253
+ - Updated dependencies [863d473]
254
+ - Updated dependencies [344f2f7]
255
+ - Updated dependencies [26f9ffd]
256
+ - Updated dependencies [66056ac]
257
+ - Updated dependencies [0bad534]
258
+ - Updated dependencies [10eae9a]
259
+ - Updated dependencies [22c6c06]
260
+ - @ontrails/core@1.0.0-beta.16
261
+ - @ontrails/cli@1.0.0-beta.16
262
+ - @ontrails/mcp@1.0.0-beta.16
263
+ - @ontrails/observe@1.0.0-beta.16
264
+
265
+ ## 1.0.0-beta.15
266
+
267
+ ### Minor Changes
268
+
269
+ - f511a3a: Rename `app` field to `graph` in `CliHarnessOptions` and `McpHarnessOptions`
270
+
271
+ ### Patch Changes
272
+
273
+ - Updated dependencies [4ad6b25]
274
+ - @ontrails/core@1.0.0-beta.15
275
+ - @ontrails/cli@1.0.0-beta.15
276
+ - @ontrails/observe@1.0.0-beta.15
277
+ - @ontrails/mcp@1.0.0-beta.15
278
+
279
+ ## 1.0.0-beta.14
280
+
281
+ ### Minor Changes
282
+
283
+ - 69057e9: Add hierarchical CLI command trees and structured input, enforce established-only topo exports across trailheads, move developer topo and tracker state onto shared `trails.db` with pins and maintenance flows, and ship schema-derived stores through `@ontrails/store` and its Drizzle runtime.
284
+
285
+ ### Patch Changes
286
+
287
+ - Updated dependencies [69057e9]
288
+ - @ontrails/cli@1.0.0-beta.14
289
+ - @ontrails/core@1.0.0-beta.14
290
+ - @ontrails/logging@1.0.0-beta.14
291
+ - @ontrails/mcp@1.0.0-beta.14
292
+
293
+ ## 1.0.0-beta.13
294
+
295
+ ### Minor Changes
296
+
297
+ - Trail-native vocabulary cutover. Breaking API field renames across all packages:
298
+
299
+ - Trail spec: `run:` → `blaze:`, `follow:` → `crosses:`, `services:` → `provisions:`, `metadata:` → `meta:`, `emits:` → `signals:`
300
+ - Runtime: `ctx.follow()` → `ctx.cross()`, `ctx.emit()` → `ctx.signal()`, `ctx.signal` (abort) → `ctx.abortSignal`
301
+ - Entry points: `blaze(app)` → `trailhead(app)`
302
+ - Package rename: `@ontrails/crumbs` → `@ontrails/tracker`
303
+ - Wrapper types: `Layer` → `Gate`, `layers`/`middleware` → `gates`
304
+ - Transport: `surface` → `trailhead`, `adapter` → `connector`
305
+
306
+ ### Patch Changes
307
+
308
+ - 6944147: Complete trifecta for config, permits, and tracker (formerly tracks)
309
+
310
+ - **config**: Add `configProvision`, `configGate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
311
+ - **permits**: Add `authService` and `auth.verify` trail for runtime authorization checks
312
+ - **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured signal tracking
313
+ - **cli**: Fix build flag handling and improve bootstrap scaffolding
314
+ - **testing**: Expand test context helpers and example-based testing utilities
315
+ - **core/mcp/http**: Internal alignment for provision and composition updates
316
+
317
+ - Updated dependencies [6944147]
318
+ - Updated dependencies
319
+ - @ontrails/core@1.0.0-beta.13
320
+ - @ontrails/cli@1.0.0-beta.13
321
+ - @ontrails/mcp@1.0.0-beta.13
322
+ - @ontrails/logging@1.0.0-beta.13
323
+
324
+ ## 1.0.0-beta.12
325
+
326
+ ### Patch Changes
327
+
328
+ - Complete trifecta for config, permits, and tracker (formerly tracks)
329
+
330
+ - **config**: Add `configProvision`, `config.gate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
331
+ - **permits**: Add `authProvision` and `auth.verify` trail for runtime authorization checks
332
+ - **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured event tracking
333
+ - **cli**: Fix build flag handling and improve bootstrap scaffolding
334
+ - **testing**: Expand test context helpers and example-based testing utilities
335
+ - **core/mcp/http**: Internal alignment for provision and composition updates
336
+
337
+ - Updated dependencies
338
+ - @ontrails/core@1.0.0-beta.12
339
+ - @ontrails/cli@1.0.0-beta.12
340
+ - @ontrails/mcp@1.0.0-beta.12
341
+ - @ontrails/logging@1.0.0-beta.12
342
+
343
+ ## 1.0.0-beta.11
344
+
345
+ ### Minor Changes
346
+
347
+ - Add provisions as a first-class primitive.
348
+
349
+ Provisions make infrastructure dependencies declarative, injectable, and governable. Define a provision with `provision()`, declare it on a trail with `provisions: [db]`, and access it with `db.from(ctx)` or `ctx.provision()`.
350
+
351
+ **Core:** `provision()` factory, `ProvisionSpec<T>`, `ProvisionContext`, singleton resolution in `executeTrail`, in-flight creation dedup, `isProvision` guard, `findDuplicateProvisionId`, topo provision discovery and validation, `provisions` field on trail specs.
352
+
353
+ **Testing:** Auto-resolution of `mock` factories in `testAll`, `testExamples`, `testContracts`, and `testCrosses`. Explicit `provisions` overrides with correct precedence (`explicit > ctx.extensions > auto-mock`). Provision mock propagation through crossing graphs.
354
+
355
+ **Warden:** `provision-declarations` rule validates `db.from(ctx)` and `ctx.provision()` usage matches declared `provisions: [...]`. `provision-exists` rule validates declared provision IDs resolve in project context. Scope-aware AST walking skips nested function boundaries.
356
+
357
+ **Trailheads:** Provision overrides thread through `run` and `trailhead` on CLI, MCP, and HTTP.
358
+
359
+ **Introspection:** Survey and trailhead map outputs include provision graph. Topo exposes `.provisions`, `.getProvision()`, `.hasProvision()`, `.listProvisions()`, `.provisionIds()`, `.provisionCount`.
360
+
361
+ **Docs:** ADR-009 accepted. Unified services guide, updated vocabulary, getting-started, architecture, and package READMEs.
362
+
363
+ ### Patch Changes
364
+
365
+ - Updated dependencies
366
+ - @ontrails/core@1.0.0-beta.11
367
+ - @ontrails/cli@1.0.0-beta.11
368
+ - @ontrails/mcp@1.0.0-beta.11
369
+ - @ontrails/logging@1.0.0-beta.11
370
+
371
+ ## 1.0.0-beta.10
372
+
373
+ ### Patch Changes
374
+
375
+ - Updated dependencies
376
+ - @ontrails/core@1.0.0-beta.10
377
+ - @ontrails/cli@1.0.0-beta.10
378
+ - @ontrails/mcp@1.0.0-beta.10
379
+ - @ontrails/logging@1.0.0-beta.10
380
+
381
+ ## 1.0.0-beta.9
382
+
383
+ ### Minor Changes
384
+
385
+ - Consolidated improvements across all trailhead packages.
386
+
387
+ **core**: Add `TrailResult<T>` utility type, `topo.ids()` and `topo.count` accessors, `run()` for headless trail execution, and extract shared `executeTrail` pipeline used by CLI/MCP/HTTP.
388
+
389
+ **http**: Detect route path collisions and return `Result` from `buildHttpRoutes()`, wire request `AbortSignal` through to trail context, and make write → POST mapping explicit in intent-to-method lookup.
390
+
391
+ **mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
392
+
393
+ **cli**: Verify exception catching via centralized `executeTrail`.
394
+
395
+ **testing**: Cross-context awareness improvements.
396
+
397
+ **warden**: Refactor rules as composable trails with examples.
398
+
399
+ **schema**: Error code and empty body fixes.
400
+
401
+ ### Patch Changes
402
+
403
+ - Updated dependencies
404
+ - @ontrails/core@1.0.0-beta.9
405
+ - @ontrails/cli@1.0.0-beta.9
406
+ - @ontrails/mcp@1.0.0-beta.9
407
+ - @ontrails/logging@1.0.0-beta.9
408
+
409
+ ## 1.0.0-beta.8
410
+
411
+ ### Patch Changes
412
+
413
+ - @ontrails/cli@1.0.0-beta.8
414
+ - @ontrails/core@1.0.0-beta.8
415
+ - @ontrails/logging@1.0.0-beta.8
416
+ - @ontrails/mcp@1.0.0-beta.8
417
+
418
+ ## 1.0.0-beta.7
419
+
420
+ ### Patch Changes
421
+
422
+ - @ontrails/cli@1.0.0-beta.7
423
+ - @ontrails/core@1.0.0-beta.7
424
+ - @ontrails/logging@1.0.0-beta.7
425
+ - @ontrails/mcp@1.0.0-beta.7
426
+
427
+ ## 1.0.0-beta.6
428
+
429
+ ### Patch Changes
430
+
431
+ - Updated dependencies
432
+ - @ontrails/core@1.0.0-beta.6
433
+ - @ontrails/cli@1.0.0-beta.6
434
+ - @ontrails/logging@1.0.0-beta.6
435
+ - @ontrails/mcp@1.0.0-beta.6
436
+
437
+ ## 1.0.0-beta.5
438
+
439
+ ### Patch Changes
440
+
441
+ - Updated dependencies
442
+ - @ontrails/core@1.0.0-beta.5
443
+ - @ontrails/logging@1.0.0-beta.5
444
+ - @ontrails/cli@1.0.0-beta.5
445
+ - @ontrails/mcp@1.0.0-beta.5
446
+
447
+ ## 1.0.0-beta.4
448
+
449
+ ### Major Changes
450
+
451
+ - API simplification: unified trail model, intent enum, run, metadata.
452
+
453
+ **BREAKING CHANGES:**
454
+
455
+ - `hike()` removed — use `trail()` with optional `crosses: [...]` field
456
+ - `follows` renamed to `crosses` (matching `ctx.cross()`)
457
+ - `topo.hikes` removed — single `topo.trails` map
458
+ - `kind: 'hike'` removed — everything is `kind: 'trail'`
459
+ - `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
460
+ - `implementation` field renamed to `run`
461
+ - `markers` field renamed to `metadata`
462
+ - `testHike` renamed to `testCrosses`, `HikeScenario` to `CrossScenario`
463
+ - `trailhead()` now returns the trailhead handle (`Command` for CLI, `Server` for MCP)
464
+
465
+ ### Patch Changes
466
+
467
+ - Updated dependencies
468
+ - @ontrails/core@1.0.0-beta.4
469
+ - @ontrails/cli@1.0.0-beta.4
470
+ - @ontrails/mcp@1.0.0-beta.4
471
+ - @ontrails/logging@1.0.0-beta.4
472
+
3
473
  ## 1.0.0-beta.3
4
474
 
5
475
  ### Minor Changes
6
476
 
7
- - Bug fixes across all surface packages found via parallel Codex review.
477
+ - Bug fixes across all trailhead packages found via parallel Codex review.
8
478
 
9
479
  **core**: Fix Result.toJson false circular detection on DAGs, deserializeError subclass round-trip, topo cross-kind ID collisions, validateTopo multi-node cycle detection, error example input validation bypass, and deriveFields array type collapse.
10
480
 
11
- **cli**: Switch blaze to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
481
+ **cli**: Switch trailhead to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
12
482
 
13
483
  **mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
14
484
 
15
- **testing**: Include hikes in testContracts validation, with follow-context awareness.
485
+ **testing**: Include hikes in testContracts validation, with cross-context awareness.
16
486
 
17
487
  **warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
18
488
 
@@ -56,12 +526,12 @@
56
526
  - Initial v1 beta release of the Trails framework.
57
527
 
58
528
  - **@ontrails/core** — Result type, error taxonomy, trail/hike/event/topo, validateTopo, validateInput/Output, deriveFields, patterns, redaction, branded types, resilience
59
- - **@ontrails/cli** — CLI surface adapter, Commander integration, flag derivation, layers
60
- - **@ontrails/mcp** — MCP surface adapter, tool generation, annotations, progress bridge
61
- - **@ontrails/logging** — Structured logging, sinks, formatters, LogTape adapter
62
- - **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, surface harnesses
529
+ - **@ontrails/cli** — CLI trailhead connector, Commander integration, flag derivation, gates
530
+ - **@ontrails/mcp** — MCP trailhead connector, tool generation, annotations, progress bridge
531
+ - **@ontrails/logging** — Structured logging, sinks, formatters, LogTape connector
532
+ - **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, trailhead harnesses
63
533
  - **@ontrails/warden** — AST-based code convention rules via oxc-parser, drift detection, CI formatters
64
- - **@ontrails/schema** — Surface map generation, hashing, semantic diffing
534
+ - **@ontrails/schema** — Trailhead map generation, hashing, semantic diffing
65
535
 
66
536
  ### Patch Changes
67
537
 
package/README.md CHANGED
@@ -1,14 +1,14 @@
1
1
  # @ontrails/testing
2
2
 
3
- Contract-driven testing for Trails. Add examples to your trails, then `testAll(app)` runs them as assertions, validates output schemas, checks composition graphs, and verifies structural integrity. One line of test code, full governance.
3
+ Contract-driven testing for Trails. Add examples to your trails, then `testAll(graph)` runs them as assertions, validates output schemas, checks composition graphs, and verifies structural integrity. One line of test code, full contract coverage.
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ```typescript
8
8
  import { testAll } from '@ontrails/testing';
9
- import { app } from '../app';
9
+ import { graph } from '../app';
10
10
 
11
- testAll(app);
11
+ testAll(graph);
12
12
  ```
13
13
 
14
14
  That single call covers example execution, contract validation, detour checks, and topo validation. For most apps, this is all you need.
@@ -18,25 +18,23 @@ If you want finer control:
18
18
  ```typescript
19
19
  import { testExamples, testContracts, testDetours } from '@ontrails/testing';
20
20
 
21
- testExamples(app); // Run every trail's examples as tests
22
- testContracts(app); // Validate outputs against declared schemas
23
- testDetours(app); // Verify detour targets exist
21
+ testExamples(graph); // Run every trail's examples as tests
22
+ testContracts(graph); // Validate outputs against declared schemas
23
+ testDetours(graph); // Validate detour constructor, recover, and ordering semantics
24
24
  ```
25
25
 
26
26
  ## API
27
27
 
28
28
  | Export | What it does |
29
29
  | --- | --- |
30
- | `testAll(topo, ctx?)` | Single-line governance suite: validation + examples + contracts + detours |
30
+ | `testAll(topo, ctx?)` | Single-line contract suite: validation + examples + contracts + detours |
31
31
  | `testExamples(topo, ctx?)` | Run trail examples as `describe`/`test` blocks |
32
- | `testTrail(trail, scenarios)` | Custom scenarios for edge cases and error paths |
33
- | `testHike(hike, scenarios)` | Test composition graphs -- follow chains, failure injection |
34
- | `testContracts(topo, ctx?)` | Validate implementation output against declared schemas |
35
- | `testDetours(topo)` | Verify every detour target exists in the topo |
32
+ | `testTrail(trail, scenarios)` | Custom scenarios for edge cases, error paths, and composition chains |
33
+ | `testContracts(topo, ctx?)` | Validate output against declared schemas |
34
+ | `testDetours(topo)` | Validate detour constructor, recover, and shadowing semantics |
35
+ | `createComposeContext(options?)` | Mock `ComposeFn` for testing composite trails; returns preconfigured `Result` values keyed by trail ID |
36
36
  | `createTestContext(options?)` | `TrailContext` with sensible test defaults |
37
37
  | `createTestLogger()` | Logger that captures entries in memory for assertions |
38
- | `createCliHarness(options)` | Execute CLI commands in-process, capture stdout/stderr |
39
- | `createMcpHarness(options)` | Invoke MCP tools directly without transport |
40
38
 
41
39
  See the [API Reference](../../docs/api-reference.md) for the full list.
42
40
 
@@ -55,37 +53,103 @@ testTrail(showTrail, [
55
53
  ]);
56
54
  ```
57
55
 
58
- ## testHike
56
+ ## Testing composition (trails with composes)
59
57
 
60
- Where `testTrail` exercises a single trail, `testHike` exercises the follow graph:
58
+ `testTrail` works the same for trails with `composes` -- it exercises the composition graph:
61
59
 
62
60
  ```typescript
63
- import { testHike } from '@ontrails/testing';
61
+ import { testTrail } from '@ontrails/testing';
64
62
 
65
- testHike(onboardHike, [
63
+ testTrail(onboardTrail, [
66
64
  { description: 'happy path', input: { name: 'Delta', type: 'tool' }, expectOk: true },
67
65
  { description: 'add fails', input: { name: 'Alpha' }, expectErr: AlreadyExistsError },
68
66
  ]);
69
67
  ```
70
68
 
71
- ## Surface harnesses
69
+ When you need to isolate a composite trail and stub out its dependencies, use `createComposeContext`:
70
+
71
+ ```typescript
72
+ import { createComposeContext, testTrail } from '@ontrails/testing';
73
+ import { Result } from '@ontrails/core';
74
+
75
+ const compose = createComposeContext({
76
+ responses: {
77
+ 'entity.add': Result.ok({ id: '1', name: 'Delta', type: 'tool' }),
78
+ 'search': Result.ok({ results: [] }),
79
+ },
80
+ });
81
+ testTrail(onboardTrail, [
82
+ {
83
+ description: 'uses mocked composes',
84
+ input: { name: 'Delta', type: 'tool' },
85
+ expectOk: true,
86
+ },
87
+ ], { compose });
88
+ ```
89
+
90
+ Calls to unregistered trail IDs return `Result.err` with a descriptive message, so missing stubs fail loudly.
91
+
92
+ ## Surface Harnesses
93
+
94
+ Surface harnesses live on explicit subpaths so projects that only import contract helpers from `@ontrails/testing` do not need CLI, MCP, or HTTP peers. Install the peer package for the subpath you use:
95
+
96
+ - `@ontrails/testing/cli` requires `@ontrails/cli`
97
+ - `@ontrails/testing/mcp` requires `@ontrails/mcp`
98
+ - `@ontrails/testing/http` requires `@ontrails/http`
99
+ - `@ontrails/testing/established` and `@ontrails/testing/surface-parity`
100
+ require all three shipped surface peers
72
101
 
73
102
  ```typescript
74
- import { createCliHarness, createMcpHarness } from '@ontrails/testing';
103
+ import { createCliHarness } from '@ontrails/testing/cli';
104
+ import { createHttpHarness } from '@ontrails/testing/http';
105
+ import { createMcpHarness } from '@ontrails/testing/mcp';
75
106
 
76
107
  // CLI
77
- const cli = createCliHarness({ app });
108
+ const cli = createCliHarness({ graph });
78
109
  const result = await cli.run('entity show --name Alpha --output json');
79
110
  expect(result.exitCode).toBe(0);
80
111
 
81
112
  // MCP
82
- const mcp = createMcpHarness({ app });
113
+ const mcp = createMcpHarness({ graph });
83
114
  const tool = await mcp.callTool('myapp_entity_show', { name: 'Alpha' });
84
115
  expect(tool.isError).toBe(false);
116
+
117
+ // HTTP
118
+ const http = createHttpHarness({ graph });
119
+ const response = await http.get('/entity/show', { name: 'Alpha' });
120
+ expect(response.status).toBe(200);
121
+ ```
122
+
123
+ Use `testAllEstablished()` from `@ontrails/testing/established` when an established app should run the root contract suite and validate CLI, MCP, and HTTP projections in one call.
124
+
125
+ ## Surface Parity
126
+
127
+ `testSurfaceParity()` is a focused gate for established apps that want to prove their examples behave the same through every shipped surface.
128
+
129
+ ```typescript
130
+ import { testSurfaceParity } from '@ontrails/testing/surface-parity';
131
+ import { graph } from '../app';
132
+
133
+ const createDeterministicTestDb = () => ({});
134
+
135
+ testSurfaceParity(graph, {
136
+ createResources: () => ({
137
+ 'db.main': createDeterministicTestDb(),
138
+ }),
139
+ exclusions: [
140
+ {
141
+ example: 'Creates generated data',
142
+ reason: 'output includes generated IDs that intentionally differ per surface run',
143
+ trailId: 'entity.add',
144
+ },
145
+ ],
146
+ });
85
147
  ```
86
148
 
149
+ The helper compares normalized success payloads and normalized TrailsError category/code pairs. CLI command names, MCP tool names, HTTP method/path values, transport envelopes, activation consumers, internal trails, and planned WebSocket work stay outside the equality check. Use `createResources` when examples need deterministic fixtures for each surface invocation, and use exclusions for intentional semantic differences that should not be silently skipped.
150
+
87
151
  ## Installation
88
152
 
89
153
  ```bash
90
- bun add -d @ontrails/testing
154
+ bun add -d @ontrails/testing@beta
91
155
  ```