The tagged-node validator carried its own copy of the validation machinery: a Tagged.Rule cloning Validation's check type and a Tagged.Context cloning its context, differing only in subject type. That is the per-layer duplication the validation idiom exists to prevent (principle 10). Generalise the type-directed framework over both the subject and the document: SubjectContext, Check, and AnyCheck now take a Document type parameter for the validated tree's root. The model layer validates with a Model.Value document, the tagged layer with a Tagged.Node document, each truthful rather than forcing one root type to stand in for the other. The tagged layer keeps only what is genuinely its own: the Node document type, its built-in check (now Tagged.BuiltinCheck, a Check<Node, Node>), and its traversal. Tagged.Rule and the tagged Context are removed. The validator surface is unchanged but validating now takes a Check<Node, Node>. All 399 tests pass; the coverage gate reconciles to 62 public types.
5.8 KiB
5.8 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 --- |