aboutsummaryrefslogtreecommitdiff
path: root/lib/kernel/validate.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kernel/validate.ml')
-rw-r--r--lib/kernel/validate.ml31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/kernel/validate.ml b/lib/kernel/validate.ml
index f523b39..c7b6093 100644
--- a/lib/kernel/validate.ml
+++ b/lib/kernel/validate.ml
@@ -414,18 +414,26 @@ let run (rite : ('s, 'r) Rite.t) (layer : 'r Layer.t) ~year =
is why it is a match on the sorted part list rather than three
separate tests:
- - zero or two, never one -- an Epistle without a Gospel, or the
- reverse, is a malformed Mass, not a partial one;
- - only [First] and [Gospel] ever appear -- the chants (Psalm,
- Second, Tract, Alleluia, Sequence) are deliberately unbuilt,
- with no source and no oracle, so a citation carrying one is a
- defect and not a feature arriving early;
+ - zero, or exactly one of the rite's own well-formed shapes,
+ never a partial one -- an Epistle without a Gospel, or the
+ reverse, is a malformed Mass regardless of which shapes the
+ rite declares;
+ - no part outside the rite's own {!Rite.t.citation_shapes} ever
+ appears -- for EF that is still only [First]/[Gospel] (the
+ other chants remain deliberately unbuilt there, with no
+ source and no oracle, so one appearing is a defect, not a
+ feature arriving early); for the OF it is [First]/[Second]/
+ [Gospel], [Second] only ever alongside both of the others (its
+ own doc comment has the full citation and argument);
- no part appears twice -- two Epistles and no Gospel has length
two and would slip past a bare cardinality test.
- [Citation.part]'s own constructor order puts [First] before
- [Gospel], so the sorted well-formed list is literally
- [[First; Gospel]] and nothing else. *)
+ Each of [rite.Rite.citation_shapes]'s own shapes is normalised
+ with the SAME [List.sort compare] a day's actual parts are put
+ through, so a rite may list them in any order without silently
+ failing to match -- robustness the single hardcoded
+ [[First; Gospel]] this replaced never needed to worry about. *)
+ let citation_shapes = List.map (List.sort compare) rite.Rite.citation_shapes in
let year_has_citations =
Array.exists
(fun (d : ('s, 'r) Liturgical_day.t) -> d.Liturgical_day.citations <> [])
@@ -439,7 +447,6 @@ let run (rite : ('s, 'r) Rite.t) (layer : 'r Layer.t) ~year =
List.map (fun (c : Citation.t) -> c.Citation.part) d.Liturgical_day.citations
in
match List.sort compare parts with
- | [ Citation.First; Citation.Gospel ] -> ()
| [] ->
(* Separate check name from the malformed case below on
purpose: this is the lectionary chain falling through
@@ -449,9 +456,11 @@ let run (rite : ('s, 'r) Rite.t) (layer : 'r Layer.t) ~year =
fail date "citations-unresolved"
"no reading citations resolved for this day: the lectionary chain fell through \
every step"
+ | sorted when List.mem sorted citation_shapes -> ()
| sorted ->
fail date "citations"
- (Printf.sprintf "expected exactly one First and one Gospel, got [%s]"
+ (Printf.sprintf
+ "citation parts [%s] match none of this rite's own well-formed shapes"
(String.concat "," (List.map Citation.part_to_string sorted))))
resolved;
(* ---- Formulary invariant (Task 3, celebrant-rubrics-phase1) ----