1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/usr/bin/env bash
# build-oracle-ef.sh — build the EF (1962) regression oracle from the committed
# missalemeum snapshot (sources/snapshot.tar.gz, missalemeum/en/YYYY-MM-DD.json,
# 2026-01-01 .. 2027-12-31, 730 days), not a live fetch, so the oracle is
# reproducible offline and pinned to a known-good snapshot.
#
# Three things about this data that cost hours to learn (see oracle_ef_test.go):
# 1. info.id looks like "sancti:MM-DD:rank:colour", but its embedded rank is
# the rank of the PROPERS USED that day, not the day's own rank (e.g.
# 2026-01-02 is a class-4 feria whose id is "sancti:01-01:1:w" because it
# reuses the Circumcision's propers). Extracted here for provenance only
# -- never parse rank/colour out of it. Use info.rank/info.colors.
# 2. info.colors is an array; 14 of 730 days carry two values (Gaudete/
# Laetare "pv", Palm Sunday "rv", Good Friday "bv", Holy Saturday "vw").
# The Go test compares by membership, not equality.
# 3. A two-colour value on a weekday can be a proper-reuse artifact (a feria
# inside Gaudete/Laetare week reusing the Sunday's own propers) rather
# than a claim about that weekday's own colour.
#
# From repo root:
# scripts/build-oracle-ef.sh
# Writes internal/calendar/testdata/oracle-ef.json:
# { "YYYY-MM-DD": {"id":"...", "tempora":"...", "title":"...", "rank":N, "colours":["w",...]} }
set -euo pipefail
out=internal/calendar/testdata/oracle-ef.json
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
tar xzf sources/snapshot.tar.gz -C "$work" missalemeum/en
jq -s '
map({(.[0].info.date): {
id: (.[0].info.id // ""),
tempora: (.[0].info.tempora // ""),
title: .[0].info.title,
rank: .[0].info.rank,
colours: .[0].info.colors
}}) | add
' "$work"/missalemeum/en/*.json > "$out"
echo "wrote $out ($(jq 'length' "$out") days)" >&2
|