aboutsummaryrefslogtreecommitdiff
path: root/internal/calendar/precedence_ef_repro_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 13:05:34 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-12 13:05:34 +0200
commit00a32e549493b0fb51ae23e8a5e73aa54a5205b1 (patch)
treeae3b87489a27e2beee5262887d586057234830cf /internal/calendar/precedence_ef_repro_test.go
parentf40eb498c612aeda2ff7f3d5b898e4d1ddcec352 (diff)
downloadlectio-00a32e549493b0fb51ae23e8a5e73aa54a5205b1.tar.gz
lectio-00a32e549493b0fb51ae23e8a5e73aa54a5205b1.zip
calendar: RG 96 transfers must skip II-class days too (defect 1)
transferIfImpededEF's forward walk only skipped days whose temporal office was I class. RG 96 requires skipping to "the next following day that is not I or II class" -- II class also blocks. 2011: the Sacred Heart (Friday after the Corpus Christi octave) falls on 1 July and impedes the Precious Blood, also fixed on 1 July. The walk landed the Precious Blood on 2 July, displacing the Visitation (II class, fixed) outright, and never reached 3 July (an ordinary II-class Sunday) at all. Two changes were needed together, not one: 1. The walk's continuation threshold widens from "temporal band <= 2" to "<= 3", which is what actually captures every II-class temporal day (an ordinary Sunday, or a II-class named feast) as well as every I-class one -- band 3 is precedenceEF's own value for any non-Sunday-privileged II-class temporal candidate, unchanged by this commit. 2. A FIXED sanctoral II-class feast (the Visitation) has no temporal band at all -- the walk needs to also check whether some OTHER fixed celebration, class 1 or 2, already resolves onto the candidate day. computeEF now builds this check once (occupiedByRank, parameterised by which ranks count) and passes it in. Widening (1) alone is wrong on its own: a class-1 feast is NEVER actually impeded by a mere II-class day (I class always outranks II class outright, no tie exists) -- naively applying the wide "<=3" threshold to decide whether the ORIGINAL date is impeded, not just where to land afterwards, wrongly bumped unimpeded feasts landing on an ordinary Sunday (caught while testing this: All Saints, 1 Nov 2026, a Sunday that year, was wrongly pushed to 3 Nov). transferIfImpededEF now uses two different thresholds for two different questions -- class 1 only to decide IF a candidate is impeded at all, class 1 OR 2 to decide where an already-impeded one may land -- see its own doc comment for the full reasoning. Witness (precedence_ef_repro_test.go): TestTransferSkipsBothIAndIIClass. Fails before this commit with: 2011-07-02 observed = "precious-blood-of-our-lord-jesus-christ" want visitation-of-the-blessed-virgin-mary (RG 96: the Precious Blood must skip past it, not displace it) 2011-07-04 observed = "ef-time-after-pentecost-3-monday" want precious-blood-of-our-lord-jesus-christ (RG 96: first day that is neither I nor II class)
Diffstat (limited to 'internal/calendar/precedence_ef_repro_test.go')
-rw-r--r--internal/calendar/precedence_ef_repro_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/internal/calendar/precedence_ef_repro_test.go b/internal/calendar/precedence_ef_repro_test.go
index 6c333d0..1f38996 100644
--- a/internal/calendar/precedence_ef_repro_test.go
+++ b/internal/calendar/precedence_ef_repro_test.go
@@ -43,3 +43,25 @@ func TestJosephYieldsToSundayOfLent(t *testing.T) {
}
}
}
+
+// TestTransferSkipsBothIAndIIClass: RG 96 -- an impeded I-class feast
+// transfers to the next day that is NOT ITSELF I OR II CLASS (not merely "not
+// I class"). 2011: the Sacred Heart (Friday after the Corpus Christi octave)
+// falls on 1 July and impedes the Precious Blood (also 1 July, fixed). 2
+// July is the Visitation (II class, fixed); 3 July is an ordinary II-class
+// Sunday. Both must be skipped; the Precious Blood lands on 4 July, and the
+// Visitation is observed, undisplaced, on its own day.
+func TestTransferSkipsBothIAndIIClass(t *testing.T) {
+ if got := efCompute("2011-07-01").Observed.Slug; got != "ef-sacred-heart" {
+ t.Fatalf("2011-07-01 observed = %q want ef-sacred-heart", got)
+ }
+ if got := efCompute("2011-07-02").Observed.Slug; got != "visitation-of-the-blessed-virgin-mary" {
+ t.Errorf("2011-07-02 observed = %q want visitation-of-the-blessed-virgin-mary (RG 96: the Precious Blood must skip past it, not displace it)", got)
+ }
+ if got := efCompute("2011-07-03").Observed.Slug; got != "ef-time-after-pentecost-sunday-3" {
+ t.Errorf("2011-07-03 observed = %q want ef-time-after-pentecost-sunday-3 (an ordinary II-class Sunday also blocks a I-class transfer)", got)
+ }
+ if got := efCompute("2011-07-04").Observed.Slug; got != "precious-blood-of-our-lord-jesus-christ" {
+ t.Errorf("2011-07-04 observed = %q want precious-blood-of-our-lord-jesus-christ (RG 96: first day that is neither I nor II class)", got)
+ }
+}