aboutsummaryrefslogtreecommitdiff
path: root/lib/kernel/validate.ml
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 17:13:06 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 17:13:06 +0200
commita2654a1e4d8987a251bcefbad2b0f0b867a6c6e6 (patch)
tree39360eccd3fa8ee5379fc46276d1e0ef0e6ff2b5 /lib/kernel/validate.ml
parente19adb9c7ea369cafe76e7eff50e9248a4a954d0 (diff)
parente5b368dec8fdc9ab983ee0f1dee69c37883cbe12 (diff)
downloadcolitur-a2654a1e4d8987a251bcefbad2b0f0b867a6c6e6.tar.gz
colitur-a2654a1e4d8987a251bcefbad2b0f0b867a6c6e6.zip
Merge branch 'ef-rg16a': RG 16(a), RG 111(b), RG 113, and commemoration identity
Closes the largest known-wrong-output item on record (RG 16(a): a Feast of the Lord occurring on a II-class Sunday leaves the Sunday uncommemorated -- 5996 wrong days over 1583-9999) together with RG 111(b)'s rank floor on the day it holds, and gives the oracle layer the ability to compare commemoration identity rather than only presence and count. Also corrects a methodological defect that had produced wrong rulings in both this project and its sibling: docs/research/ holds an electronic transcription alongside two photographic scans, and the transcription silently drops commemoration lines -- seven across the year. Reasoning from its silence had convicted the oracle wrongly on 14 August and ruled a genuine 9 August commemoration spurious. The scans are the primary source; the rule is now recorded at the top of the register. RG 113 replaces an alphabetical same-rank tie-break that had no rubrical warrant. A bare Commemoratio has no row in RG 91's table at all, so band no longer hands one the entry of a III-class universal feast: 4451 days, all four reordered pairs verified against a photographic scan, zero observed-day changes.
Diffstat (limited to 'lib/kernel/validate.ml')
-rw-r--r--lib/kernel/validate.ml90
1 files changed, 80 insertions, 10 deletions
diff --git a/lib/kernel/validate.ml b/lib/kernel/validate.ml
index cc8bdce..ffeb89e 100644
--- a/lib/kernel/validate.ml
+++ b/lib/kernel/validate.ml
@@ -293,26 +293,96 @@ let run (rite : ('s, 'r) Rite.t) (layer : 'r Layer.t) ~year =
"transfer placement did not reach a fixed point within the round guard (RG 96-98)";
(* "admission": re-offer this day's own admitted commemorations
back to [rite.rules.admit] and require the exact same set back.
- [origin] is reconstructed as [Sanctoral] uniformly:
- {!Liturgical_day.t} does not retain a commemoration's original
- origin, and the real EF [admit] (precedence_ef.ml) reads only
- rank and slug from a candidate, never [origin], so this
- reconstruction is exact for it; documented in validate.mli as
- the one place a rite whose [admit] DOES consult [origin] could
- see a false negative from this check. *)
+ [origin] is RECOVERED, not fabricated -- see the fuller note
+ below on [as_candidates]. It was formerly reconstructed as
+ [Sanctoral] uniformly, justified by the claim that the real EF
+ [admit] reads only rank and slug and never [origin]. That claim
+ is now FALSE: since ea22ad2 the EF [admit] orders by [band]
+ (RG 113), and [band] does read [origin] via [is_temporal], so a
+ temporal-origin commemoration relabelled [Sanctoral] would be
+ scored on the wrong table entry. The recovery below is exact,
+ not a heuristic: [resolve] builds exactly one temporal
+ candidate per day, so a slug match against the day's own
+ temporal office identifies it unambiguously. *)
let observed_candidate : 'r Precedence.candidate =
{ Precedence.cel = d.Liturgical_day.observed; origin = Precedence.Sanctoral }
in
+ (* [~temporal] (fix round 1, RG16(a) task): {!Precedence.rules.admit}
+ now also takes the day's own temporal-cycle candidate, reused
+ here from {!Liturgical_day.t}'s own embedded [Temporal.t] --
+ the exact same value {!Calendar} passed to {!Precedence.resolve}
+ in the first place, so re-offering is against the SAME inputs,
+ not a reconstruction that could itself introduce a false
+ negative. [origin] is [Precedence.Temporal], genuinely (this IS
+ the temporal candidate, not a reconstructed sanctoral one). *)
+ let temporal_candidate : 'r Precedence.candidate =
+ { Precedence.cel = d.Liturgical_day.temporal.Temporal.office;
+ origin = Precedence.Temporal }
+ in
+ (* [band]'s own [context] (RG 113, docs/research/rules-register.md
+ ยง4 "Commemorations" -- {!Precedence.rules.admit}'s own new
+ [int] parameter, added alongside RG 113's fix: [admit] now
+ orders/selects by the rite's table-of-precedence value
+ {!resolve} attaches to each candidate, not by [Vocab.rank]
+ alone). Reconstructed from {!Liturgical_day.t}'s own embedded
+ [Temporal.t], the same source [temporal_candidate] above
+ already draws its [cel] from, so this is the exact [ctx]
+ {!Calendar} passed to {!Precedence.resolve} for this date in
+ the first place, not a re-derivation that could itself drift. *)
+ let day_ctx : 's Precedence.context =
+ { Precedence.date;
+ season = d.Liturgical_day.temporal.Temporal.season;
+ weekday = d.Liturgical_day.temporal.Temporal.weekday }
+ in
+ (* CORRECTED (Task B fix round 1, coordinator finding 5): [origin]
+ used to be reconstructed as [Sanctoral] UNCONDITIONALLY, which
+ was harmless while nothing here called [band] on the result
+ (the comment this replaces was correct about [PE.admit] itself:
+ it never reads [origin]) -- but this function ALSO now calls
+ [rite.rules.Precedence.band day_ctx cand] on every one of these
+ reconstructed candidates (the line just below), and [band] DOES
+ read [origin] (its own [is_temporal] test) to choose between its
+ temporal- and sanctoral-keyed branches. A genuinely
+ TEMPORAL-origin commemoration (a privileged Advent/Lent/
+ Passiontide feria, an Ember day, an impeded Sunday) mislabelled
+ [Sanctoral] would score the WRONG band entry (e.g. a Lent feria
+ scoring entry 23, "III-class feasts in particular calendars",
+ instead of its real entry 22) -- inert today only because
+ nothing currently asserts on the SCORE [band] returns here, only
+ on whether re-offering [admit] the same values round-trips
+ (which happens not to depend on getting [origin] right for any
+ case this codebase's data reaches -- unverified in general).
+ [Liturgical_day.t] itself still does not retain a
+ commemoration's original origin, so it is recovered the only
+ way available: a commemoration whose SLUG matches the day's own
+ temporal office is temporal-origin; every other commemoration
+ is sanctoral-origin. This is exact whenever slugs cannot
+ collide across the two streams (Task 12's own "observed" check
+ already assumes this for a different purpose), which is the
+ same assumption the rest of this codebase already leans on. *)
+ let temporal_office_slug = d.Liturgical_day.temporal.Temporal.office.Celebration.slug in
let as_candidates comms =
- List.map (fun (c, p) -> ({ Precedence.cel = c; origin = Precedence.Sanctoral }, p)) comms
+ List.map
+ (fun (c, p) ->
+ let origin =
+ if Slug.equal c.Celebration.slug temporal_office_slug then Precedence.Temporal
+ else Precedence.Sanctoral
+ in
+ let cand : 'r Precedence.candidate = { Precedence.cel = c; origin } in
+ (cand, p, rite.Rite.rules.Precedence.band day_ctx cand))
+ comms
in
let offered = as_candidates d.Liturgical_day.commemorations in
- let readmitted = rite.Rite.rules.Precedence.admit ~observed:observed_candidate offered in
+ let readmitted =
+ rite.Rite.rules.Precedence.admit ~observed:observed_candidate
+ ~temporal:temporal_candidate offered
+ in
let norm l =
List.map (fun (c, p) -> (Slug.to_string c.Precedence.cel.Celebration.slug, p)) l
|> List.sort compare
in
- if norm readmitted <> norm offered then
+ let offered_pairs = List.map (fun (c, p, _) -> (c, p)) offered in
+ if norm readmitted <> norm offered_pairs then
fail date "admission"
(Printf.sprintf
"admit is not a fixed point on this day's own commemorations: re-offering %d \