diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-12 13:04:53 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-12 13:04:53 +0200 |
| commit | f40eb498c612aeda2ff7f3d5b898e4d1ddcec352 (patch) | |
| tree | 968dcfc8fb263abadaf715833af9a8acda0a60a3 /internal/calendar/precedence_ef_repro_test.go | |
| parent | ca3403893bfbebb325fe3ab6a98081640574bf2a (diff) | |
| download | lectio-f40eb498c612aeda2ff7f3d5b898e4d1ddcec352.tar.gz lectio-f40eb498c612aeda2ff7f3d5b898e4d1ddcec352.zip | |
temporal_ef: Sunday ranks, Rose Sundays, Holy Thursday white
Four fixes to internal/calendar/temporal_ef.go, all found by the
strengthened oracle test (previous commit):
1. Sunday ranks (defect 4). The generic Sunday branch assigned
class-2 to every Sunday except Advent I. RG 11-12 / RG 91 entry 6:
every Sunday of Advent and every Sunday of Lent is I class (as are
Passiontide's own two Sundays and Low Sunday, already correct via
their named-feast cases). Fixes St Joseph wrongly taking a Sunday
of Lent (defect 3, precedence_ef_repro_test.go's
TestJosephYieldsToSundayOfLent) as a direct consequence: once Lent
Sundays are I class, Joseph (also I class) no longer wins the tie
outright and correctly transfers to the 20th via the existing RG
96 walk -- no separate code change was needed for defect 3.
2. Rose (defect 5). efColour had no Rose case at all; Gaudete (Advent
III) and Laetare (Lent IV) now get Rose on that Sunday specifically
(RG 131: rose vestments may be used "in Officio et Missa diei
dominici tantum", for that Sunday's Office and Mass only), not the
surrounding Sundays.
3. Holy Thursday's colour (defect 6). RG 128(b) names the Missa in
Cena Domini as a whole-Mass exception to Passiontide's violet; RG
122 states the same fact affirmatively, in the White section
itself. Good Friday and Holy Saturday, either side, are unchanged
(still violet -- their own black/no-colour treatment is a separate,
unmodelled gap, noted in precedence_ef.go's own doc comments).
4. Beyond the seven, found by the same strengthened test and fixed for
the same RG 91 entry 18 reason defect 2 (next commit) relies on:
the Ember days of Lent had no case in efEmberSlug at all (only
September and Advent did), so they fell through to the ordinary
III-class Lenten-feria rank instead of the II class RG 91 entry 18
requires. The late-Advent ferias (17-23 Dec, RG 91 entry 18) and
the days within the Octave of the Nativity (26-31 Dec, RG 67-68)
had no elevation at all, defaulting to III/IV class. All three are
one-line, unambiguous, primary-cited additions to the same rank
logic already being touched here -- left unfixed, the strengthened
oracle test could only reach green by allow-listing them as if they
were defensible divergences, which they are not.
Witnesses (temporal_ef_test.go): TestTemporalEFSundayRanks,
TestTemporalEFRoseSundays, TestTemporalEFHolyThursdayColour,
TestTemporalEFEmberDayRanks. All fail before this commit; see the
report for the exact pre-fix failure messages.
Diffstat (limited to 'internal/calendar/precedence_ef_repro_test.go')
| -rw-r--r-- | internal/calendar/precedence_ef_repro_test.go | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/internal/calendar/precedence_ef_repro_test.go b/internal/calendar/precedence_ef_repro_test.go new file mode 100644 index 0000000..6c333d0 --- /dev/null +++ b/internal/calendar/precedence_ef_repro_test.go @@ -0,0 +1,45 @@ +package calendar_test + +// Reproduction tests for three named EF precedence defects (colitur's +// differential/oracle audit against lectio's ~66-line EF precedence +// approximation, internal/calendar/precedence_ef.go). Each test fails before +// its fix and passes after -- see the report for the exact pre-fix failure +// message. These exercise the REAL tridentine sanctoral data +// (caldata.Tridentine()) through the public Compute entry point, since the +// bugs are about how real fixed-date feasts interact with the temporal +// calendar, not about precedenceEF's arithmetic in isolation (that is +// covered separately, package-internal, in precedence_ef_test.go). + +import ( + "testing" + "time" + + "github.com/lukaszkasprzak/lectio/internal/caldata" + "github.com/lukaszkasprzak/lectio/internal/calendar" +) + +func efCompute(date string) calendar.LiturgicalDay { + sel := calendar.DefaultSelection() + sel.Form = "old" + d, _ := time.Parse("2006-01-02", date) + return calendar.Compute(d.UTC(), sel, []calendar.Layer{caldata.Tridentine()}) +} + +// TestJosephYieldsToSundayOfLent: RG 91 entry 6 (Sundays of Lent, I class) +// vs entry 11 (I-class feasts of the universal Church not above) -- the +// Sunday holds; St Joseph (19 March) transfers to the next free day (RG 95, +// RG 96), landing on the 20th. Before the fix (defect 4: Sunday ranks), Lent +// Sundays were wrongly II class, so Joseph (I class) won outright every time +// this collision occurred. +func TestJosephYieldsToSundayOfLent(t *testing.T) { + for _, year := range []string{"2006", "2017", "2023", "2028", "2034", "2045"} { + sunday := efCompute(year + "-03-19") + if sunday.Observed.Slug == "joseph-spouse-of-the-bl-virgin-mary" { + t.Errorf("%s-03-19 observed = %q want the Lent Sunday (RG 91 entry 6 beats entry 11)", year, sunday.Observed.Slug) + } + next := efCompute(year + "-03-20") + if next.Observed.Slug != "joseph-spouse-of-the-bl-virgin-mary" { + t.Errorf("%s-03-20 observed = %q want joseph-spouse-of-the-bl-virgin-mary (transferred one day, RG 96)", year, next.Observed.Slug) + } + } +} |
