contracts 1.24.0: devotionals two years ahead; Apps fetch 2 weeks

CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS (24) for how far ahead the Hub
schedules Cross Code's devotionals, CROSSCODE_DEVOTIONALS_FETCH_DAYS (14)
for what GET /api/v2/devotionals answers. The CSV takes 800 rows and
8 MB, so two years fit in one file. CROSSCODE_DEVOTIONALS_AHEAD_MONTHS
kept, deprecated. Docs: Hub 2.26.1, hub-protocol.md §3c, the App plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-30 23:23:18 +02:00
co-authored by Claude Opus 5.5
parent 986d69d51d
commit 9cf2956aff
9 changed files with 77 additions and 29 deletions
+12 -1
View File
@@ -2,6 +2,7 @@ import {
BIBLE_BOOKS, BIBLE_TRANSLATIONS, DEVOTIONAL_CSV_COLUMNS, FREE_BIBLE_TRANSLATION_IDS, FREE_QUOTE_VERSES, DEVOTIONAL_CSV_TEMPLATE, checkDevotionalCsv, devotionalCsv,
devotionalDisclaimer, devotionalsReplySchema, findBibleBook, quotedVerses, formatBibleReference, parseBibleReference, parseCsv, passageVerseCount, youVersionUrl,
type PassageLocation,
CROSSCODE_DEVOTIONALS_FETCH_DAYS, CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS, DEVOTIONAL_CSV_MAX_ROWS,
} from "../src";
import { sample } from "./helpers";
@@ -202,7 +203,17 @@ describe("checkDevotionalCsv", () => {
expect(r.rows[0]).toMatchObject({ taken: true, errors: [] });
expect(r.rows[1]!.warnings[0]!.message).toContain("40 verses");
expect(r.rows[1]!.devotional).not.toBeNull();
expect(r.rows[2]!.errors[0]!.message).toContain("more than 3 months ahead");
expect(r.rows[2]!.errors[0]!.message).toContain("too far ahead (the last day is 2027-03-31)");
});
it("1.24.0: two years ahead in the Hub, in one file; Apps fetch 2 weeks", () => {
expect([CROSSCODE_DEVOTIONALS_SCHEDULE_MONTHS, CROSSCODE_DEVOTIONALS_FETCH_DAYS]).toEqual([24, 14]);
const start = Date.UTC(2027, 0, 1);
const rows = Array.from({ length: 731 }, (_, i) => row({ date: new Date(start + i * 864e5).toISOString().slice(0, 10), translation: "KJV" }));
const r = checkDevotionalCsv(devotionalCsv(rows), { latestDate: "2028-12-31" });
expect(DEVOTIONAL_CSV_MAX_ROWS).toBeGreaterThanOrEqual(731);
expect(r.fileError).toBeNull();
expect(r.rows.filter((x) => x.devotional)).toHaveLength(731);
});
it("refuses a file without the required columns, or without rows", () => {