37ac31c3f2
Deploy / deploy (push) Successful in 39s
Corrects and completes the occurrence rules, based on a design discussion plus one concrete data point: St. Anthony Abbot (plain Duplex) was found outright winning against an ordinary Sunday in the real Monastic 1617 engine, which the old duplex-1-classis-only threshold got wrong. - FeastClass gains `vigil`, inserted between `simplex` and `semiduplex` — one ordering that correctly serves both "does this win against a Sunday" (vigil behaves like simplex there) and "which of two saints wins a landing-day collision" (vigil beats simplex, loses to semiduplex). - LiturgicalDay.occurring (a flat OccurringFeast[] that could only ever express a losing *sanctoral* candidate) is replaced by `winner: DayWinner` + `commemorations: Commemoration[]` — a discriminated list that can hold the temporal day itself, one or more sanctoral entries, or (not built yet, but the shape already accommodates it) a future octave kind. - commemorations.ts: ordinary Sundays let Duplex+ win outright (Sunday commemorated in return), Semiduplex/Vigil transfer elsewhere (too substantial a feast to cheapen with a bare commemoration), Simplex stays and is commemorated. Privileged Sundays never displace; Duplex-majus+ commemorated, everything else transfers. - collision.ts (new): resolves two sanctoral candidates wanting the same day (a transfer landing on an already-occupied day, or two native saints sharing a date) — duplex > semiduplex > vigil > simplex, loser always commemorated, ties favor the native occupant. - temporal-id.ts (new): maps any date to one of the 52 real Sunday-collect ids from the previous commit, so a temporal winner/commemoration can actually be looked up, not just labeled "temporal" in the abstract. - index.ts's resolveDay orchestrates all of it, including the actual Monday/Saturday transfer mechanism. Landing on a privileged feria (the concrete case: Holy Week, right after Palm Sunday) is explicitly deferred rather than guessed at — it needs its own Easter-keyed lookup table, the same way the reference engine handles it. Added the Vigil of St. Lawrence (Aug 9) as real content specifically to exercise the backward-transfer rule end-to-end: Aug 9, 2026 is a Sunday, so the vigil transfers cleanly back to Saturday, verified by a new integration test alongside the unit-level rule and collision tests.
43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
import type { DayWinner } from '../calendar/types';
|
|
import { isAtLeast } from '../calendar/commemorations';
|
|
|
|
export interface SplitAntiphon {
|
|
incipit: string;
|
|
full: string;
|
|
}
|
|
|
|
/**
|
|
* Antiphon text is stored as one string with an embedded "*" marking where
|
|
* the incipit (the "half antiphon") ends — the same convention Divinum
|
|
* Officium's own data uses, so no separate half/full fields are needed.
|
|
*
|
|
* The "*" is kept in `full` (by explicit choice — it's a meaningful chant
|
|
* mark, not just an incipit-boundary artifact, even though the reference
|
|
* engine's own rendering happens to strip it there).
|
|
*/
|
|
export function splitAntiphon(text: string): SplitAntiphon {
|
|
const starIndex = text.indexOf('*');
|
|
if (starIndex === -1) {
|
|
return { incipit: text, full: text };
|
|
}
|
|
const before = text.slice(0, starIndex).trim();
|
|
const after = text.slice(starIndex + 1).trim();
|
|
return { incipit: before.replace(/,$/, '.'), full: `${before} * ${after}` };
|
|
}
|
|
|
|
/**
|
|
* Real practice: the antiphon is said in full both before and after the
|
|
* psalms on a Double-rank feast or higher; below that, only the incipit is
|
|
* said before the psalms (the full text is always said after, regardless
|
|
* of rank).
|
|
*
|
|
* Only asks whether the day's *winner* (not a merely-commemorated feast)
|
|
* is Double-or-higher — a privileged Sunday with nothing winning, or a
|
|
* commemorated low-rank saint, both correctly return false here. A Sunday
|
|
* being "privileged" doesn't by itself make this true; that's a
|
|
* `TemporalCategory` question, not a `FeastClass` one.
|
|
*/
|
|
export function isDoubleOrHigher(winner: DayWinner): boolean {
|
|
return winner.kind === 'sanctoral' && isAtLeast(winner.rank, 'duplex');
|
|
}
|