summaryrefslogtreecommitdiff
path: root/internal/readings
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-08-05 14:10:34 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-08-05 14:10:34 +0200
commiteb4a02205f5b3b972c44b854d5becbbd0b522981 (patch)
tree6bf2014c441e71dfeb8a06d17c07355c57c51035 /internal/readings
parent197ce6980daa1c3773eed1548f54861d616d35e4 (diff)
downloadlectio-eb4a02205f5b3b972c44b854d5becbbd0b522981.tar.gz
lectio-eb4a02205f5b3b972c44b854d5becbbd0b522981.zip
readings: PartIDs(new) stops declaring aklamacja, which the engine never emits
caldata.go:42 parses only first/psalm/second/gospel out of the lectionary data, so no OF reading ever carries Part == "acclamation". PartIDs("new") listed aklamacja anyway, so the app built a checkbox from it that filters an ID that never appears -- a dead control, same defect class the app previously shipped for the whole 1962 form. ofPartOrder stays the full five-ID set: it also drives render.LocalizeHeading's label matching, where a scraped heading can still read "Aklamacja" even though this engine's own readings never produce that section. PartIDs now draws from a new, narrower ofEmittedPartOrder instead. Rewrote TestPartLabelsMatchesWhatTheEngineEmits's OF half: it compared PartLabels("of") to a hand-copied duplicate of ofPartOrder, asserting a declaration against itself, which cannot fail for this class of bug. It now sweeps Days over calendar year 2026 and asserts PartLabels("of") matches the observed part-ID set exactly (0.5s). Confirmed red against the pre-fix code, green after.
Diffstat (limited to 'internal/readings')
-rw-r--r--internal/readings/offline.go14
-rw-r--r--internal/readings/partids_test.go2
2 files changed, 14 insertions, 2 deletions
diff --git a/internal/readings/offline.go b/internal/readings/offline.go
index 608abd8..be7c430 100644
--- a/internal/readings/offline.go
+++ b/internal/readings/offline.go
@@ -98,6 +98,18 @@ var (
efPartOrder = []string{"epistola", "evangelium"}
)
+// ofEmittedPartOrder is the subset of ofPartOrder the offline engine can
+// actually produce, in display order. It excludes "aklamacja":
+// internal/caldata/caldata.go:42 parses only "first", "psalm", "second" and
+// "gospel" out of the lectionary data, so no computed OF reading ever carries
+// Part == "acclamation" and ofPart's "aklamacja" mapping above is never
+// reached. ofPartOrder stays the full five-ID set on purpose -- it also
+// drives render.LocalizeHeading's *label* matching, where a scraped heading
+// can still read "Aklamacja" even though this engine's own readings never
+// produce that section -- so PartIDs, which promises IDs an app can filter
+// on, needs this narrower list rather than reusing or shrinking ofPartOrder.
+var ofEmittedPartOrder = []string{"pierwsze_czytanie", "psalm", "drugie_czytanie", "ewangelia"}
+
// PartIDs returns the part IDs the given lectionary can emit, in display order.
// lect takes config.Config.Lectionary's values: "new" or "traditional". An
// unknown lectionary returns nil. Callers that build per-part UI (the dlectio
@@ -106,7 +118,7 @@ var (
func PartIDs(lect string) []string {
switch lect {
case "new":
- return append([]string(nil), ofPartOrder...)
+ return append([]string(nil), ofEmittedPartOrder...)
case "traditional":
return append([]string(nil), efPartOrder...)
}
diff --git a/internal/readings/partids_test.go b/internal/readings/partids_test.go
index 1ba9373..fdbd816 100644
--- a/internal/readings/partids_test.go
+++ b/internal/readings/partids_test.go
@@ -35,7 +35,7 @@ func TestDayInfoCarriesRank(t *testing.T) {
// them instead, seven of the nine 1962 IDs were wrong and the epistle's
// checkbox did nothing.
func TestPartIDs(t *testing.T) {
- wantNew := []string{"pierwsze_czytanie", "psalm", "drugie_czytanie", "aklamacja", "ewangelia"}
+ wantNew := []string{"pierwsze_czytanie", "psalm", "drugie_czytanie", "ewangelia"}
wantOld := []string{"epistola", "evangelium"}
if got := PartIDs("new"); !equalSlice(got, wantNew) {
t.Errorf("PartIDs(new) = %v, want %v", got, wantNew)