PureYAML/scripts/validation-coverage.tsv
Mihaela M 2e45ecaffe feat(validation): add type-directed Check dispatch
Introduce the core of the validation-rules idiom: a Check<Subject> with a
positive description, a when predicate, and a Bool or multi-error check
that fires only on values of its Subject type wherever they occur. AnyCheck
erases the subject and dispatches by runtime type, guarding an optional or
a wrong type from matching. The validator gains a checks list, a
validating(_:) overload, and a traversal that offers each node the values
it may specialise on. BuiltinCheck.mappingKeysAreUnique is the
type-directed counterpart of the legacy rule.

The machinery has its own negative tests (wrong type, optional, false
predicate yield nothing; same type twice yields two errors) and the builtin
ships a failing and a near-miss test. The coverage gate catches the five
new public types, which are classified as validation machinery. The default
validator is unchanged, so this is additive; retiring the legacy Rule,
moving the default onto the check, the combinator algebra, the error
rendering, and de-duplicating the Tagged validator are the remaining steps.
2026-06-28 07:23:23 +02:00

5.9 KiB

1# Public-type validation coverage manifest (validation-rules.md).
2# Every public type in the PureYAML target is classified exactly once.
3# `validated`: carries a runtime invariant the type system does not enforce; backed by a
4# Validation<Subject> in the framework phase.
5# `excluded`: a caseless namespace, a closed sum type whose illegal states are unrepresentable,
6# a pure data-transfer type, an error value, or engine/machinery that is not a validated subject.
7# scripts/check-validation-coverage.sh fails the build if a public type is missing here or a line
8# here is no longer public.
9# --- namespaces (caseless enums) ---
10# --- model ---
11# --- stream ---
12# --- parsing ---
13# --- emitting ---
14# --- decoding / encoding (Codable machinery) ---
15# --- tagged node subsystem ---
16# --- validation framework's own types ---