diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/extract_missalemeum_oracle.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/extract_missalemeum_oracle.py b/tools/extract_missalemeum_oracle.py index 1abc574..6d3f8f0 100644 --- a/tools/extract_missalemeum_oracle.py +++ b/tools/extract_missalemeum_oracle.py @@ -111,10 +111,19 @@ def extract_citation(sections, section_id, date, label): def main(): - if len(sys.argv) != 3: - print(f"usage: {sys.argv[0]} <snapshot-dir> <out-file>", file=sys.stderr) + # <expected-days> (added 2026-08-17, the 2038 oracle extension) is the + # number of day-files this run MUST produce, stated by the caller rather + # than hardcoded. It used to be a bare `!= 730`, which silently forbade + # extracting any window other than the original 2026-2027 pair. It stays + # MANDATORY-in-effect via its default so the existing documented command + # keeps its own guard unchanged: a partial fetch (a dropped HTTP request, + # an interrupted unpack) must fail loudly here rather than quietly + # produce a short fixture that then "passes" a comparison it never ran. + if len(sys.argv) not in (3, 4): + print(f"usage: {sys.argv[0]} <snapshot-dir> <out-file> [expected-days]", file=sys.stderr) return 2 snapshot_dir, out_path = sys.argv[1], sys.argv[2] + expected_days = int(sys.argv[3]) if len(sys.argv) == 4 else 730 src = os.path.join(snapshot_dir, "missalemeum", "en") rows = [] for fname in sorted(os.listdir(src)): @@ -153,8 +162,8 @@ def main(): f"|{cit_first}|{cit_gospel}" ) - if len(rows) != 730: - print(f"ERROR: expected 730 days, got {len(rows)}", file=sys.stderr) + if len(rows) != expected_days: + print(f"ERROR: expected {expected_days} days, got {len(rows)}", file=sys.stderr) return 1 with open(out_path, "w", encoding="utf-8") as f: |
