diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/kernel/validate.ml | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/kernel/validate.ml b/lib/kernel/validate.ml index 9be030a..b11c05c 100644 --- a/lib/kernel/validate.ml +++ b/lib/kernel/validate.ml @@ -35,14 +35,18 @@ let run vocab ~year_start ~temporal ~year = (* Weekday agreement. *) if t.Temporal.weekday <> Date.weekday date then fail date "weekday" "temporal weekday disagrees with Date.weekday"; - (* Slug well-formed. Uniqueness *per date* needs no check: [temporal] - returns exactly one office by construction, which is the type - system delivering the invariant. Uniqueness *across the year* is - deliberately NOT asserted -- a resumed Sunday reuses an earlier - Epiphany key on purpose, so the check would be false. *) - (match Slug.of_string (Slug.to_string cel.Celebration.slug) with - | Ok _ -> () - | Error e -> fail date "slug" e); + (* Slug: three properties, none checked here, all delivered + elsewhere. Well-formedness needs no check: [Slug.t] is a private + string validated on every construction path ([of_string], + [of_string_exn], [t_of_sexp]), and [to_string] is the identity, + so round-tripping an existing [Slug.t] can never fail -- a check + here would be structurally incapable of firing, which is worse + than no check, since it would look like coverage that isn't + there. Uniqueness *per date* needs no check either: [temporal] + returns exactly one office by construction. Uniqueness *across + the year* is deliberately NOT asserted -- a resumed Sunday + reuses an earlier Epiphany key on purpose, so the check would be + false. *) (* Vocabulary closure. *) if not (List.exists (fun r -> vocab.Vocab.rank_to_string r = vocab.Vocab.rank_to_string cel.Celebration.rank) |
