@ontrails/testing 1.0.0-beta.2 → 1.0.0-beta.22
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 +406 -5
- package/README.md +86 -22
- package/package.json +34 -5
- package/src/all-established.ts +168 -0
- package/src/all.ts +51 -12
- package/src/assertions.ts +253 -0
- package/src/cli.ts +6 -0
- package/src/composes.ts +433 -0
- package/src/context.ts +200 -14
- package/src/contracts.ts +45 -21
- package/src/detours.ts +155 -18
- package/src/effective-examples.ts +414 -0
- package/src/errors.ts +47 -0
- package/src/examples.ts +302 -177
- package/src/harness-cli.ts +83 -58
- package/src/harness-http.ts +341 -0
- package/src/harness-mcp.ts +46 -16
- package/src/http.ts +10 -0
- package/src/index.ts +22 -14
- package/src/logger.ts +3 -1
- package/src/mcp.ts +6 -0
- package/src/scenario.ts +375 -0
- package/src/signals.ts +221 -0
- package/src/surface-parity.ts +389 -0
- package/src/trail.ts +1 -1
- package/src/types.ts +24 -52
- package/.turbo/turbo-build.log +0 -1
- package/.turbo/turbo-lint.log +0 -3
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/all.d.ts +0 -30
- package/dist/all.d.ts.map +0 -1
- package/dist/all.js +0 -47
- package/dist/all.js.map +0 -1
- package/dist/assertions.d.ts +0 -49
- package/dist/assertions.d.ts.map +0 -1
- package/dist/assertions.js +0 -84
- package/dist/assertions.js.map +0 -1
- package/dist/context.d.ts +0 -19
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -33
- package/dist/context.js.map +0 -1
- package/dist/contracts.d.ts +0 -16
- package/dist/contracts.d.ts.map +0 -1
- package/dist/contracts.js +0 -56
- package/dist/contracts.js.map +0 -1
- package/dist/detours.d.ts +0 -12
- package/dist/detours.d.ts.map +0 -1
- package/dist/detours.js +0 -30
- package/dist/detours.js.map +0 -1
- package/dist/examples.d.ts +0 -22
- package/dist/examples.d.ts.map +0 -1
- package/dist/examples.js +0 -187
- package/dist/examples.js.map +0 -1
- package/dist/harness-cli.d.ts +0 -21
- package/dist/harness-cli.d.ts.map +0 -1
- package/dist/harness-cli.js +0 -213
- package/dist/harness-cli.js.map +0 -1
- package/dist/harness-mcp.d.ts +0 -21
- package/dist/harness-mcp.d.ts.map +0 -1
- package/dist/harness-mcp.js +0 -50
- package/dist/harness-mcp.js.map +0 -1
- package/dist/hike.d.ts +0 -32
- package/dist/hike.d.ts.map +0 -1
- package/dist/hike.js +0 -169
- package/dist/hike.js.map +0 -1
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -16
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts +0 -15
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -87
- package/dist/logger.js.map +0 -1
- package/dist/trail.d.ts +0 -20
- package/dist/trail.d.ts.map +0 -1
- package/dist/trail.js +0 -80
- package/dist/trail.js.map +0 -1
- package/dist/types.d.ts +0 -80
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -5
- package/dist/types.js.map +0 -1
- package/src/__tests__/context.test.ts +0 -60
- package/src/__tests__/contracts.test.ts +0 -68
- package/src/__tests__/detours.test.ts +0 -55
- package/src/__tests__/examples.test.ts +0 -176
- package/src/__tests__/hike.test.ts +0 -164
- package/src/__tests__/logger.test.ts +0 -136
- package/src/__tests__/trail.test.ts +0 -99
- package/src/hike.ts +0 -283
- package/tsconfig.json +0 -9
- package/tsconfig.tsbuildinfo +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,406 @@
|
|
|
1
1
|
# @ontrails/testing
|
|
2
2
|
|
|
3
|
+
## 1.0.0-beta.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @ontrails/cli@1.0.0-beta.22
|
|
8
|
+
- @ontrails/core@1.0.0-beta.22
|
|
9
|
+
- @ontrails/http@1.0.0-beta.22
|
|
10
|
+
- @ontrails/mcp@1.0.0-beta.22
|
|
11
|
+
- @ontrails/observe@1.0.0-beta.22
|
|
12
|
+
|
|
13
|
+
## 1.0.0-beta.21
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [99523f2]
|
|
18
|
+
- @ontrails/core@1.0.0-beta.21
|
|
19
|
+
- @ontrails/cli@1.0.0-beta.21
|
|
20
|
+
- @ontrails/http@1.0.0-beta.21
|
|
21
|
+
- @ontrails/mcp@1.0.0-beta.21
|
|
22
|
+
- @ontrails/observe@1.0.0-beta.21
|
|
23
|
+
|
|
24
|
+
## 1.0.0-beta.20
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [851a2a3]
|
|
29
|
+
- Updated dependencies [9bec01c]
|
|
30
|
+
- Updated dependencies [accb9ec]
|
|
31
|
+
- @ontrails/core@1.0.0-beta.20
|
|
32
|
+
- @ontrails/mcp@1.0.0-beta.20
|
|
33
|
+
- @ontrails/cli@1.0.0-beta.20
|
|
34
|
+
- @ontrails/http@1.0.0-beta.20
|
|
35
|
+
- @ontrails/observe@1.0.0-beta.20
|
|
36
|
+
|
|
37
|
+
## 1.0.0-beta.19
|
|
38
|
+
|
|
39
|
+
### Major Changes
|
|
40
|
+
|
|
41
|
+
- 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.
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- 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.
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- 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.
|
|
50
|
+
- f8d80b9: Refresh current-facing compose vocabulary in package documentation after the composition cutover.
|
|
51
|
+
- 337b467: Construct declared Trails error classes when `testComposes` injects composed trail error examples.
|
|
52
|
+
- 16cb740: Run examples and contract checks across live trail version entries, and project version-entry example coverage into topo and survey reports.
|
|
53
|
+
- 5d88104: Polish Trails blaze terminology across package docs and Warden guidance.
|
|
54
|
+
- f04a9ef: Tighten trail-versioning API polish by keeping executor cross-validation internals out of public options and improving absent marker diagnostics.
|
|
55
|
+
- Updated dependencies [e41c382]
|
|
56
|
+
- Updated dependencies [a2f1825]
|
|
57
|
+
- Updated dependencies [a2f1825]
|
|
58
|
+
- Updated dependencies [1eb5bdc]
|
|
59
|
+
- Updated dependencies [f8d80b9]
|
|
60
|
+
- Updated dependencies [94a8380]
|
|
61
|
+
- Updated dependencies [94a8380]
|
|
62
|
+
- Updated dependencies [846a597]
|
|
63
|
+
- Updated dependencies [8638dae]
|
|
64
|
+
- Updated dependencies [8638dae]
|
|
65
|
+
- Updated dependencies [8638dae]
|
|
66
|
+
- Updated dependencies [223aaad]
|
|
67
|
+
- Updated dependencies [3125f4d]
|
|
68
|
+
- Updated dependencies [2494dc6]
|
|
69
|
+
- Updated dependencies [2d53717]
|
|
70
|
+
- Updated dependencies [16cb740]
|
|
71
|
+
- Updated dependencies [8894ecb]
|
|
72
|
+
- Updated dependencies [fdf7ec9]
|
|
73
|
+
- Updated dependencies [92e709b]
|
|
74
|
+
- Updated dependencies [d76be13]
|
|
75
|
+
- Updated dependencies [84f56a5]
|
|
76
|
+
- Updated dependencies [431b04c]
|
|
77
|
+
- Updated dependencies [5d88104]
|
|
78
|
+
- Updated dependencies [f04a9ef]
|
|
79
|
+
- Updated dependencies [fc00aeb]
|
|
80
|
+
- Updated dependencies [ab1c77c]
|
|
81
|
+
- Updated dependencies [8ca5b85]
|
|
82
|
+
- @ontrails/core@1.0.0-beta.19
|
|
83
|
+
- @ontrails/cli@1.0.0-beta.19
|
|
84
|
+
- @ontrails/http@1.0.0-beta.19
|
|
85
|
+
- @ontrails/mcp@1.0.0-beta.19
|
|
86
|
+
- @ontrails/observe@1.0.0-beta.19
|
|
87
|
+
|
|
88
|
+
## 1.0.0-beta.18
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [c0b2948]
|
|
93
|
+
- Updated dependencies [fc3219c]
|
|
94
|
+
- Updated dependencies [bc2d327]
|
|
95
|
+
- Updated dependencies [bf44972]
|
|
96
|
+
- Updated dependencies [e0ae995]
|
|
97
|
+
- @ontrails/http@1.0.0-beta.18
|
|
98
|
+
- @ontrails/observe@1.0.0-beta.18
|
|
99
|
+
- @ontrails/cli@1.0.0-beta.18
|
|
100
|
+
- @ontrails/core@1.0.0-beta.18
|
|
101
|
+
- @ontrails/mcp@1.0.0-beta.18
|
|
102
|
+
|
|
103
|
+
## 1.0.0-beta.17
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- ce42573: Add an example-driven CLI/MCP/HTTP surface parity helper.
|
|
108
|
+
- e1eb4ee: Add an HTTP surface harness and include HTTP projection validation in `testAllEstablished`.
|
|
109
|
+
- Updated dependencies [3dc8254]
|
|
110
|
+
- Updated dependencies [61497c5]
|
|
111
|
+
- @ontrails/core@1.0.0-beta.17
|
|
112
|
+
- @ontrails/cli@1.0.0-beta.17
|
|
113
|
+
- @ontrails/http@1.0.0-beta.17
|
|
114
|
+
- @ontrails/mcp@1.0.0-beta.17
|
|
115
|
+
- @ontrails/observe@1.0.0-beta.17
|
|
116
|
+
|
|
117
|
+
## 1.0.0-beta.16
|
|
118
|
+
|
|
119
|
+
### Minor Changes
|
|
120
|
+
|
|
121
|
+
- bcdc484: Add an explicit `unmockable: { reason }` resource marker and have testing auto-mock resolution skip intentionally unmockable resources.
|
|
122
|
+
- bb1cadf: Rename the generated `testAll` suite from `governance` to `contract`.
|
|
123
|
+
|
|
124
|
+
### Patch Changes
|
|
125
|
+
|
|
126
|
+
- 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.
|
|
127
|
+
- 193ae78: Migrate testing logger types from the legacy `@ontrails/logging` package to `@ontrails/observe`.
|
|
128
|
+
- Updated dependencies [73622ae]
|
|
129
|
+
- Updated dependencies [e991a5b]
|
|
130
|
+
- Updated dependencies [25f3c5c]
|
|
131
|
+
- Updated dependencies [6300f70]
|
|
132
|
+
- Updated dependencies [d172013]
|
|
133
|
+
- Updated dependencies [c3fc5c3]
|
|
134
|
+
- Updated dependencies [20d7a5c]
|
|
135
|
+
- Updated dependencies [be5fb46]
|
|
136
|
+
- Updated dependencies [e898cc4]
|
|
137
|
+
- Updated dependencies [a8997ed]
|
|
138
|
+
- Updated dependencies [fe03945]
|
|
139
|
+
- Updated dependencies [3395234]
|
|
140
|
+
- Updated dependencies [d40430d]
|
|
141
|
+
- Updated dependencies [bcdc484]
|
|
142
|
+
- Updated dependencies [ed171d5]
|
|
143
|
+
- Updated dependencies [49c2e7d]
|
|
144
|
+
- Updated dependencies [331e3a9]
|
|
145
|
+
- Updated dependencies [4399fdb]
|
|
146
|
+
- Updated dependencies [4b8d13b]
|
|
147
|
+
- Updated dependencies [fbd42fc]
|
|
148
|
+
- Updated dependencies [63d1aef]
|
|
149
|
+
- Updated dependencies [112b9f2]
|
|
150
|
+
- Updated dependencies [893025e]
|
|
151
|
+
- Updated dependencies [ed888e2]
|
|
152
|
+
- Updated dependencies [2e05e27]
|
|
153
|
+
- Updated dependencies [9cdb0f2]
|
|
154
|
+
- Updated dependencies [c8caa5e]
|
|
155
|
+
- Updated dependencies [f4b90c9]
|
|
156
|
+
- Updated dependencies [eec5e9d]
|
|
157
|
+
- Updated dependencies [4e75129]
|
|
158
|
+
- Updated dependencies [47505fe]
|
|
159
|
+
- Updated dependencies [ebd4434]
|
|
160
|
+
- Updated dependencies [863d473]
|
|
161
|
+
- Updated dependencies [344f2f7]
|
|
162
|
+
- Updated dependencies [26f9ffd]
|
|
163
|
+
- Updated dependencies [66056ac]
|
|
164
|
+
- Updated dependencies [0bad534]
|
|
165
|
+
- Updated dependencies [10eae9a]
|
|
166
|
+
- Updated dependencies [22c6c06]
|
|
167
|
+
- @ontrails/core@1.0.0-beta.16
|
|
168
|
+
- @ontrails/cli@1.0.0-beta.16
|
|
169
|
+
- @ontrails/mcp@1.0.0-beta.16
|
|
170
|
+
- @ontrails/observe@1.0.0-beta.16
|
|
171
|
+
|
|
172
|
+
## 1.0.0-beta.15
|
|
173
|
+
|
|
174
|
+
### Minor Changes
|
|
175
|
+
|
|
176
|
+
- f511a3a: Rename `app` field to `graph` in `CliHarnessOptions` and `McpHarnessOptions`
|
|
177
|
+
|
|
178
|
+
### Patch Changes
|
|
179
|
+
|
|
180
|
+
- Updated dependencies [4ad6b25]
|
|
181
|
+
- @ontrails/core@1.0.0-beta.15
|
|
182
|
+
- @ontrails/cli@1.0.0-beta.15
|
|
183
|
+
- @ontrails/observe@1.0.0-beta.15
|
|
184
|
+
- @ontrails/mcp@1.0.0-beta.15
|
|
185
|
+
|
|
186
|
+
## 1.0.0-beta.14
|
|
187
|
+
|
|
188
|
+
### Minor Changes
|
|
189
|
+
|
|
190
|
+
- 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.
|
|
191
|
+
|
|
192
|
+
### Patch Changes
|
|
193
|
+
|
|
194
|
+
- Updated dependencies [69057e9]
|
|
195
|
+
- @ontrails/cli@1.0.0-beta.14
|
|
196
|
+
- @ontrails/core@1.0.0-beta.14
|
|
197
|
+
- @ontrails/logging@1.0.0-beta.14
|
|
198
|
+
- @ontrails/mcp@1.0.0-beta.14
|
|
199
|
+
|
|
200
|
+
## 1.0.0-beta.13
|
|
201
|
+
|
|
202
|
+
### Minor Changes
|
|
203
|
+
|
|
204
|
+
- Trail-native vocabulary cutover. Breaking API field renames across all packages:
|
|
205
|
+
|
|
206
|
+
- Trail spec: `run:` → `blaze:`, `follow:` → `crosses:`, `services:` → `provisions:`, `metadata:` → `meta:`, `emits:` → `signals:`
|
|
207
|
+
- Runtime: `ctx.follow()` → `ctx.cross()`, `ctx.emit()` → `ctx.signal()`, `ctx.signal` (abort) → `ctx.abortSignal`
|
|
208
|
+
- Entry points: `blaze(app)` → `trailhead(app)`
|
|
209
|
+
- Package rename: `@ontrails/crumbs` → `@ontrails/tracker`
|
|
210
|
+
- Wrapper types: `Layer` → `Gate`, `layers`/`middleware` → `gates`
|
|
211
|
+
- Transport: `surface` → `trailhead`, `adapter` → `connector`
|
|
212
|
+
|
|
213
|
+
### Patch Changes
|
|
214
|
+
|
|
215
|
+
- 6944147: Complete trifecta for config, permits, and tracker (formerly tracks)
|
|
216
|
+
|
|
217
|
+
- **config**: Add `configProvision`, `configGate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
|
|
218
|
+
- **permits**: Add `authService` and `auth.verify` trail for runtime authorization checks
|
|
219
|
+
- **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured signal tracking
|
|
220
|
+
- **cli**: Fix build flag handling and improve bootstrap scaffolding
|
|
221
|
+
- **testing**: Expand test context helpers and example-based testing utilities
|
|
222
|
+
- **core/mcp/http**: Internal alignment for provision and composition updates
|
|
223
|
+
|
|
224
|
+
- Updated dependencies [6944147]
|
|
225
|
+
- Updated dependencies
|
|
226
|
+
- @ontrails/core@1.0.0-beta.13
|
|
227
|
+
- @ontrails/cli@1.0.0-beta.13
|
|
228
|
+
- @ontrails/mcp@1.0.0-beta.13
|
|
229
|
+
- @ontrails/logging@1.0.0-beta.13
|
|
230
|
+
|
|
231
|
+
## 1.0.0-beta.12
|
|
232
|
+
|
|
233
|
+
### Patch Changes
|
|
234
|
+
|
|
235
|
+
- Complete trifecta for config, permits, and tracker (formerly tracks)
|
|
236
|
+
|
|
237
|
+
- **config**: Add `configProvision`, `config.gate`, `config.trail`, and `config.workspace` trails with full `defineConfig`, `resolve`, `describe`, `explain`, `doctor`, and code generation support
|
|
238
|
+
- **permits**: Add `authProvision` and `auth.verify` trail for runtime authorization checks
|
|
239
|
+
- **tracker**: Rename tracks to tracker; add `trackerProvision` and `tracker.status` trail for structured event tracking
|
|
240
|
+
- **cli**: Fix build flag handling and improve bootstrap scaffolding
|
|
241
|
+
- **testing**: Expand test context helpers and example-based testing utilities
|
|
242
|
+
- **core/mcp/http**: Internal alignment for provision and composition updates
|
|
243
|
+
|
|
244
|
+
- Updated dependencies
|
|
245
|
+
- @ontrails/core@1.0.0-beta.12
|
|
246
|
+
- @ontrails/cli@1.0.0-beta.12
|
|
247
|
+
- @ontrails/mcp@1.0.0-beta.12
|
|
248
|
+
- @ontrails/logging@1.0.0-beta.12
|
|
249
|
+
|
|
250
|
+
## 1.0.0-beta.11
|
|
251
|
+
|
|
252
|
+
### Minor Changes
|
|
253
|
+
|
|
254
|
+
- Add provisions as a first-class primitive.
|
|
255
|
+
|
|
256
|
+
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()`.
|
|
257
|
+
|
|
258
|
+
**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.
|
|
259
|
+
|
|
260
|
+
**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.
|
|
261
|
+
|
|
262
|
+
**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.
|
|
263
|
+
|
|
264
|
+
**Trailheads:** Provision overrides thread through `run` and `trailhead` on CLI, MCP, and HTTP.
|
|
265
|
+
|
|
266
|
+
**Introspection:** Survey and trailhead map outputs include provision graph. Topo exposes `.provisions`, `.getProvision()`, `.hasProvision()`, `.listProvisions()`, `.provisionIds()`, `.provisionCount`.
|
|
267
|
+
|
|
268
|
+
**Docs:** ADR-009 accepted. Unified services guide, updated vocabulary, getting-started, architecture, and package READMEs.
|
|
269
|
+
|
|
270
|
+
### Patch Changes
|
|
271
|
+
|
|
272
|
+
- Updated dependencies
|
|
273
|
+
- @ontrails/core@1.0.0-beta.11
|
|
274
|
+
- @ontrails/cli@1.0.0-beta.11
|
|
275
|
+
- @ontrails/mcp@1.0.0-beta.11
|
|
276
|
+
- @ontrails/logging@1.0.0-beta.11
|
|
277
|
+
|
|
278
|
+
## 1.0.0-beta.10
|
|
279
|
+
|
|
280
|
+
### Patch Changes
|
|
281
|
+
|
|
282
|
+
- Updated dependencies
|
|
283
|
+
- @ontrails/core@1.0.0-beta.10
|
|
284
|
+
- @ontrails/cli@1.0.0-beta.10
|
|
285
|
+
- @ontrails/mcp@1.0.0-beta.10
|
|
286
|
+
- @ontrails/logging@1.0.0-beta.10
|
|
287
|
+
|
|
288
|
+
## 1.0.0-beta.9
|
|
289
|
+
|
|
290
|
+
### Minor Changes
|
|
291
|
+
|
|
292
|
+
- Consolidated improvements across all trailhead packages.
|
|
293
|
+
|
|
294
|
+
**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.
|
|
295
|
+
|
|
296
|
+
**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.
|
|
297
|
+
|
|
298
|
+
**mcp**: Return `Result` from `buildMcpTools()` on collision instead of throwing.
|
|
299
|
+
|
|
300
|
+
**cli**: Verify exception catching via centralized `executeTrail`.
|
|
301
|
+
|
|
302
|
+
**testing**: Cross-context awareness improvements.
|
|
303
|
+
|
|
304
|
+
**warden**: Refactor rules as composable trails with examples.
|
|
305
|
+
|
|
306
|
+
**schema**: Error code and empty body fixes.
|
|
307
|
+
|
|
308
|
+
### Patch Changes
|
|
309
|
+
|
|
310
|
+
- Updated dependencies
|
|
311
|
+
- @ontrails/core@1.0.0-beta.9
|
|
312
|
+
- @ontrails/cli@1.0.0-beta.9
|
|
313
|
+
- @ontrails/mcp@1.0.0-beta.9
|
|
314
|
+
- @ontrails/logging@1.0.0-beta.9
|
|
315
|
+
|
|
316
|
+
## 1.0.0-beta.8
|
|
317
|
+
|
|
318
|
+
### Patch Changes
|
|
319
|
+
|
|
320
|
+
- @ontrails/cli@1.0.0-beta.8
|
|
321
|
+
- @ontrails/core@1.0.0-beta.8
|
|
322
|
+
- @ontrails/logging@1.0.0-beta.8
|
|
323
|
+
- @ontrails/mcp@1.0.0-beta.8
|
|
324
|
+
|
|
325
|
+
## 1.0.0-beta.7
|
|
326
|
+
|
|
327
|
+
### Patch Changes
|
|
328
|
+
|
|
329
|
+
- @ontrails/cli@1.0.0-beta.7
|
|
330
|
+
- @ontrails/core@1.0.0-beta.7
|
|
331
|
+
- @ontrails/logging@1.0.0-beta.7
|
|
332
|
+
- @ontrails/mcp@1.0.0-beta.7
|
|
333
|
+
|
|
334
|
+
## 1.0.0-beta.6
|
|
335
|
+
|
|
336
|
+
### Patch Changes
|
|
337
|
+
|
|
338
|
+
- Updated dependencies
|
|
339
|
+
- @ontrails/core@1.0.0-beta.6
|
|
340
|
+
- @ontrails/cli@1.0.0-beta.6
|
|
341
|
+
- @ontrails/logging@1.0.0-beta.6
|
|
342
|
+
- @ontrails/mcp@1.0.0-beta.6
|
|
343
|
+
|
|
344
|
+
## 1.0.0-beta.5
|
|
345
|
+
|
|
346
|
+
### Patch Changes
|
|
347
|
+
|
|
348
|
+
- Updated dependencies
|
|
349
|
+
- @ontrails/core@1.0.0-beta.5
|
|
350
|
+
- @ontrails/logging@1.0.0-beta.5
|
|
351
|
+
- @ontrails/cli@1.0.0-beta.5
|
|
352
|
+
- @ontrails/mcp@1.0.0-beta.5
|
|
353
|
+
|
|
354
|
+
## 1.0.0-beta.4
|
|
355
|
+
|
|
356
|
+
### Major Changes
|
|
357
|
+
|
|
358
|
+
- API simplification: unified trail model, intent enum, run, metadata.
|
|
359
|
+
|
|
360
|
+
**BREAKING CHANGES:**
|
|
361
|
+
|
|
362
|
+
- `hike()` removed — use `trail()` with optional `crosses: [...]` field
|
|
363
|
+
- `follows` renamed to `crosses` (matching `ctx.cross()`)
|
|
364
|
+
- `topo.hikes` removed — single `topo.trails` map
|
|
365
|
+
- `kind: 'hike'` removed — everything is `kind: 'trail'`
|
|
366
|
+
- `readOnly`/`destructive` booleans replaced by `intent: 'read' | 'write' | 'destroy'`
|
|
367
|
+
- `implementation` field renamed to `run`
|
|
368
|
+
- `markers` field renamed to `metadata`
|
|
369
|
+
- `testHike` renamed to `testCrosses`, `HikeScenario` to `CrossScenario`
|
|
370
|
+
- `trailhead()` now returns the trailhead handle (`Command` for CLI, `Server` for MCP)
|
|
371
|
+
|
|
372
|
+
### Patch Changes
|
|
373
|
+
|
|
374
|
+
- Updated dependencies
|
|
375
|
+
- @ontrails/core@1.0.0-beta.4
|
|
376
|
+
- @ontrails/cli@1.0.0-beta.4
|
|
377
|
+
- @ontrails/mcp@1.0.0-beta.4
|
|
378
|
+
- @ontrails/logging@1.0.0-beta.4
|
|
379
|
+
|
|
380
|
+
## 1.0.0-beta.3
|
|
381
|
+
|
|
382
|
+
### Minor Changes
|
|
383
|
+
|
|
384
|
+
- Bug fixes across all trailhead packages found via parallel Codex review.
|
|
385
|
+
|
|
386
|
+
**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.
|
|
387
|
+
|
|
388
|
+
**cli**: Switch trailhead to parseAsync for proper async error handling, add boolean flag negation (--no-flag), and strict number parsing that rejects partial input.
|
|
389
|
+
|
|
390
|
+
**mcp**: Align BlobRef with core (including ReadableStream support) and detect tool-name collisions after normalization.
|
|
391
|
+
|
|
392
|
+
**testing**: Include hikes in testContracts validation, with cross-context awareness.
|
|
393
|
+
|
|
394
|
+
**warden**: Collect hike detour targets, validate detour refs in hike specs, and stop implementation-returns-result from walking into nested function bodies.
|
|
395
|
+
|
|
396
|
+
### Patch Changes
|
|
397
|
+
|
|
398
|
+
- Updated dependencies
|
|
399
|
+
- @ontrails/core@1.0.0-beta.3
|
|
400
|
+
- @ontrails/cli@1.0.0-beta.3
|
|
401
|
+
- @ontrails/mcp@1.0.0-beta.3
|
|
402
|
+
- @ontrails/logging@1.0.0-beta.3
|
|
403
|
+
|
|
3
404
|
## 1.0.0-beta.2
|
|
4
405
|
|
|
5
406
|
### Patch Changes
|
|
@@ -32,12 +433,12 @@
|
|
|
32
433
|
- Initial v1 beta release of the Trails framework.
|
|
33
434
|
|
|
34
435
|
- **@ontrails/core** — Result type, error taxonomy, trail/hike/event/topo, validateTopo, validateInput/Output, deriveFields, patterns, redaction, branded types, resilience
|
|
35
|
-
- **@ontrails/cli** — CLI
|
|
36
|
-
- **@ontrails/mcp** — MCP
|
|
37
|
-
- **@ontrails/logging** — Structured logging, sinks, formatters, LogTape
|
|
38
|
-
- **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours,
|
|
436
|
+
- **@ontrails/cli** — CLI trailhead connector, Commander integration, flag derivation, gates
|
|
437
|
+
- **@ontrails/mcp** — MCP trailhead connector, tool generation, annotations, progress bridge
|
|
438
|
+
- **@ontrails/logging** — Structured logging, sinks, formatters, LogTape connector
|
|
439
|
+
- **@ontrails/testing** — testAll, testExamples, testTrail, testHike, testContracts, testDetours, trailhead harnesses
|
|
39
440
|
- **@ontrails/warden** — AST-based code convention rules via oxc-parser, drift detection, CI formatters
|
|
40
|
-
- **@ontrails/schema** —
|
|
441
|
+
- **@ontrails/schema** — Trailhead map generation, hashing, semantic diffing
|
|
41
442
|
|
|
42
443
|
### Patch Changes
|
|
43
444
|
|
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(
|
|
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 {
|
|
9
|
+
import { graph } from '../app';
|
|
10
10
|
|
|
11
|
-
testAll(
|
|
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(
|
|
22
|
-
testContracts(
|
|
23
|
-
testDetours(
|
|
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
|
|
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
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
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
|
-
##
|
|
56
|
+
## Testing composition (trails with composes)
|
|
59
57
|
|
|
60
|
-
|
|
58
|
+
`testTrail` works the same for trails with `composes` -- it exercises the composition graph:
|
|
61
59
|
|
|
62
60
|
```typescript
|
|
63
|
-
import {
|
|
61
|
+
import { testTrail } from '@ontrails/testing';
|
|
64
62
|
|
|
65
|
-
|
|
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
|
-
|
|
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
|
|
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({
|
|
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({
|
|
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
|
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ontrails/testing",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.22",
|
|
4
|
+
"files": [
|
|
5
|
+
"src/**/*.ts",
|
|
6
|
+
"!src/**/__tests__/**",
|
|
7
|
+
"!src/**/*.test.ts",
|
|
8
|
+
"!src/**/*.test-d.ts",
|
|
9
|
+
"README.md",
|
|
10
|
+
"CHANGELOG.md"
|
|
11
|
+
],
|
|
4
12
|
"type": "module",
|
|
5
13
|
"exports": {
|
|
6
14
|
".": "./src/index.ts",
|
|
15
|
+
"./cli": "./src/cli.ts",
|
|
16
|
+
"./established": "./src/all-established.ts",
|
|
17
|
+
"./http": "./src/http.ts",
|
|
18
|
+
"./mcp": "./src/mcp.ts",
|
|
19
|
+
"./surface-parity": "./src/surface-parity.ts",
|
|
7
20
|
"./package.json": "./package.json"
|
|
8
21
|
},
|
|
9
22
|
"scripts": {
|
|
@@ -13,11 +26,27 @@
|
|
|
13
26
|
"lint": "oxlint ./src",
|
|
14
27
|
"clean": "rm -rf dist *.tsbuildinfo"
|
|
15
28
|
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@ontrails/drizzle": "^1.0.0-beta.22",
|
|
31
|
+
"@ontrails/store": "^1.0.0-beta.22"
|
|
32
|
+
},
|
|
16
33
|
"peerDependencies": {
|
|
17
|
-
"@ontrails/cli": "^1.0.0-beta.
|
|
18
|
-
"@ontrails/core": "^1.0.0-beta.
|
|
19
|
-
"@ontrails/
|
|
20
|
-
"@ontrails/mcp": "^1.0.0-beta.
|
|
34
|
+
"@ontrails/cli": "^1.0.0-beta.22",
|
|
35
|
+
"@ontrails/core": "^1.0.0-beta.22",
|
|
36
|
+
"@ontrails/http": "^1.0.0-beta.22",
|
|
37
|
+
"@ontrails/mcp": "^1.0.0-beta.22",
|
|
38
|
+
"@ontrails/observe": "^1.0.0-beta.22",
|
|
21
39
|
"zod": "^4.3.5"
|
|
40
|
+
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"@ontrails/cli": {
|
|
43
|
+
"optional": true
|
|
44
|
+
},
|
|
45
|
+
"@ontrails/http": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"@ontrails/mcp": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
22
51
|
}
|
|
23
52
|
}
|