1.4 KiB
1.4 KiB
Tasks: validation-spec-conformance
1. Implementation drift fixes
- 1.1 Add
withHooks(hooks)method toBaseSchemareturning an immutable clone with merged_hooks. - 1.2 Invoke
beforeValidate/afterValidate/onErrorfromparse(sync) andparseAsync(awaited) at every terminal branch. - 1.3 Carry
_hooksthrough_clone()so chained builders preserve hook state. - 1.4 Wire
recordParseSuccess/recordParseFailureand the duration histogram inparse/parseAsync, tagged withschema.type = this.constructor.name. - 1.5 Re-implement
safeParseas atry { return { success: true, data: this.parse(input) } } catch …shim so OTel + hooks fire on the safe path too. - 1.6 Update
src/core/schema/schema.mdFeatures and API Reference to documentwithHooksand OTel emission.
2. New tests
- 2.1 Add
src/core/schema/schema.spec-conformance.test.tscovering VL-01, VL-02, VL-10, VL-11 (sync + async hook paths, OTel counters + histogram via fake MeterProvider).
3. Spec annotations
- 3.1 Add
**Verified by:**line under every### VL-NNrequirement inopenspec/specs/validation/spec.md(all 12 requirements).
4. Verify
- 4.1
bunx turbo lint typecheck test --filter=@suaveplan/validationgreen. - 4.2
bunx turbo test:coverage --filter=@suaveplan/validation100/100/100/100. - 4.3
bun scripts/openspec-conformance.ts @suaveplan/validationexits 0.