Implement octave-vs-octave precedence, and fix a real day-label bug it surfaced
Deploy / deploy (push) Successful in 52s
Deploy / deploy (push) Successful in 52s
When more than one octave is active on a day with no temporal standing of
its own (St. Lawrence's and the Assumption's genuinely overlap every Aug
16-17), which one governs the day's content/label is now decided by rank
comparison instead of "whichever started first" (an accident of
insertion order). Per direct instruction:
- Highest effective rank wins outright; every other active octave still
gets commemorated, same as a single octave already outranking a weak
rival saint.
- A rank tie goes to whichever octave started more recently -- day 1 of
a new octave needs to be fully present, the whole point of it
starting. No real tied-rank case exists yet to verify this
empirically, unlike everything else here -- documented in TODO.md as
a stated decision, not a live finding.
New OctaveConfig.closingDayRank (default duplex): an octave's own final
day ("in Octava") is elevated above its ordinary in-between rank --
live-verified as a real, general pattern (both St. Lawrence's Aug 17 and
the Assumption's Aug 22 show as Duplex, above their otherwise-Semiduplex
ordinary days), not a one-off. This elevation is *why* Lawrence's octave
beats the Assumption's on their one real overlap day despite the
Assumption being the far higher-ranked feast overall. Feeds both the
existing rival-saint threshold and the new octave-vs-octave comparison.
calendar/octaves.ts gains resolveActiveOctave (+ pickWinningOctave, the
comparison itself factored out for direct unit testing against synthetic
data, since no real tied-rank overlap exists to test against yet).
hours/resolve-common.ts's resolveOfficeWinner and calendar/day-label.ts
both now call it instead of each keeping their own "activeOctavesFor(...)
[0]" logic.
That consolidation surfaced a real, independent bug: getDayLabel never
checked temporalCategory at all before choosing an octave name, unlike
resolveOfficeWinner -- found while testing the real Aug 16 overlap (a
Sunday that year, where the temporal Sunday has standing and should win
outright). Live-verified counterexample: the Christmas Octave's own
stack (Dec 30) was wrongly labeled "3rd Day within the Octave of The Holy
Innocents" instead of the correct plain temporal label -- the real title
never names any of the four stacked octaves there. Fixed by sharing the
exact same ordinary-feria gate resolveOfficeWinner already had, so the
two can no longer disagree.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+21
-11
@@ -14,7 +14,7 @@ import { easterSunday } from './easter';
|
||||
import { adventStart, firstSundayStrictlyAfter, sundayOnOrBefore } from './temporal';
|
||||
import { addDays, daysBetween, toIsoDate } from './date-math';
|
||||
import { getTemporalFeastRecord } from './temporal-feasts';
|
||||
import { activeOctavesFor, type ActiveOctave } from './octaves';
|
||||
import { resolveActiveOctave, type ActiveOctave } from './octaves';
|
||||
|
||||
function capitalize(text: string): string {
|
||||
return text.charAt(0).toUpperCase() + text.slice(1);
|
||||
@@ -186,16 +186,26 @@ export function getDayLabel(day: LiturgicalDay): string {
|
||||
return commemoratedSaint ? `${commemoratedSaint.name} — ${anchorName}` : anchorName;
|
||||
}
|
||||
|
||||
// An active octave (St. Lawrence's, Christmas's own stack, ...) is this
|
||||
// day's real primary identity in the live engine, not a footnote — e.g.
|
||||
// "Tertia die infra Octavam S. Laurentii Martyris", not "Wednesday in
|
||||
// the 11th week after Trinity". Picks the oldest-started octave when
|
||||
// several are stacked (activeOctavesFor's own ordering) as the headline;
|
||||
// the others still ride along as ordinary octave commemorations, just
|
||||
// not separately named here.
|
||||
const octaves = activeOctavesFor(day.date);
|
||||
if (octaves.length > 0) {
|
||||
const primary = octaveLabel(octaves[0]!);
|
||||
// An active octave (St. Lawrence's, ...) is this day's real primary
|
||||
// identity in the live engine, not a footnote — e.g. "Tertia die infra
|
||||
// Octavam S. Laurentii Martyris", not "Wednesday in the 11th week after
|
||||
// Trinity" — but *only* when the temporal day itself has no standing of
|
||||
// its own (`ordinary-feria`), same gate as hours/resolve-common.ts's
|
||||
// resolveOfficeWinner and for the same reason: live-verified
|
||||
// counterexample is the Christmas Octave's own stack (Dec 30, e.g.,
|
||||
// `privileged-feria-minor`), where the real title stays the temporal
|
||||
// Sunday's own ("De Dominica Infra Octavam Nativitatis") with no octave
|
||||
// name in it at all — this label agreeing with resolveOfficeWinner
|
||||
// about which one wins is what makes "the office is Lawrence's" and
|
||||
// "the label says Lawrence" consistent instead of two independent
|
||||
// guesses that can disagree. When more than one octave is active at
|
||||
// once (resolveActiveOctave), the highest-ranked wins the headline
|
||||
// (ties broken by whichever started more recently) — the others still
|
||||
// ride along as ordinary octave commemorations, just not separately
|
||||
// named here.
|
||||
const activeOctave = day.temporalCategory === 'ordinary-feria' ? resolveActiveOctave(day.date) : undefined;
|
||||
if (activeOctave) {
|
||||
const primary = octaveLabel(activeOctave);
|
||||
return commemoratedSaint ? `${primary} — ${commemoratedSaint.name}` : primary;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user