Generalize non-Sunday movable feasts into one Easter-offset resolver
Deploy / deploy (push) Successful in 1m21s

The bespoke applyImmaculateHeart function (following the applyMarianSaturday/
applyChristTheKing precedent of one hand-written override function per
feast) doesn't scale: several more feasts are planned that all reduce to
"weekday N days from Easter Sunday" (Ember/Rogation days, more
Sacred-Heart-family Marian devotions, St. Joseph's pre-1955 Eastertide
feast, Lenten Friday Passion devotions), and one-off functions invite
subtle ordering bugs -- applyImmaculateHeart had to be sequenced after
applyMarianSaturday specifically or it would have been silently clobbered.

Replaced with calendar/movable-feasts.ts's generic applyMovableFeasts,
which scans calendar/temporal-feasts.ts's existing per-feast YAML records
for a new optional `easterOffset` field. Adding the next movable feast is
now a new data/calendar/temporal-feasts/<id>.yml file with `rank` and
`easterOffset` set, not a new TypeScript function. Same rank-compared,
commemorate-the-loser semantics as before, just centralized instead of
duplicated per feast.

christ-the-king, marian-saturday, and christmas-octave-sunday stay as
their own functions -- they're structurally different rules (a fixed
month-position search, a date-less fallback default, and a fixed-date-
range Sunday search, respectively), not Easter offsets, so force-fitting
them into this table wouldn't actually simplify anything.

No behavior change -- the existing Immaculate Heart of Mary test suite
passes unchanged through the new generic path.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZSAgRi4QE4XRTqVto93zA
This commit is contained in:
2026-08-22 06:33:15 -04:00
parent cf4edfae2b
commit 5e79fb4edf
7 changed files with 135 additions and 55 deletions
+23
View File
@@ -13,6 +13,19 @@ export interface TemporalFeastRecord {
name: string;
octave?: OctaveConfig;
rank?: FeastClass;
/** Days from Easter Sunday (0) this feast's own date falls on, for a
* feast that ISN'T itself a Sunday -- see calendar/movable-feasts.ts.
* `resolveTemporalId`'s own Easter-offset resolution only ever finds
* one of the 52 canonical *Sunday* ids (it works by finding the
* governing Sunday on-or-before a date, then looking that Sunday's own
* offset up); a weekday-anchored feast like Immaculate Heart of Mary
* (Easter+69, always a Saturday) is invisible to that lookup no matter
* what, so it needs this separate field plus calendar/movable-feasts.ts's
* own override pass instead. A feast that *is* a Sunday (Pentecost)
* doesn't need this at all -- it's already covered by the ordinary
* Sunday lookup, and by EASTER_OFFSET_STARTS below if it also has an
* octave to start. */
easterOffset?: number;
}
const temporalFeastModules = import.meta.glob<{ default: TemporalFeastRecord }>(
@@ -29,6 +42,16 @@ export function getTemporalFeastRecord(id: string): TemporalFeastRecord | undefi
return temporalFeastsById.get(id);
}
/** Every temporal feast record carrying its own `easterOffset` -- the
* table calendar/movable-feasts.ts's applyMovableFeasts scans. Adding a
* new weekday-anchored movable feast (an Ember/Rogation day, a Sacred-
* Heart-family Marian feast, a Lenten Friday devotion, ...) is just a new
* `data/calendar/temporal-feasts/<id>.yml` file with `rank` and
* `easterOffset` set -- no new code. */
export function movableTemporalFeasts(): TemporalFeastRecord[] {
return [...temporalFeastsById.values()].filter((f) => f.easterOffset !== undefined);
}
/** Fixed-calendar-date starts (MM-DD -> temporal feast id). Only Christmas
* so far; Epiphany/Candlemas would join here if they ever needed an
* octave modeled too. */