From 36daf47dde9b0c16dacef31163ea74effdd5e7f3 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Tue, 18 Aug 2026 13:55:18 +0200 Subject: feat(overlay): a flat INI front end, which verifies its own output A convenience format for calendars that add a few local feasts and drop one or two universal entries. Section names are slugs, a [overlay] section carries the id, and status/subject/layer default so the common case -- an ordinary local saint's feast -- says only what distinguishes it. It is a FRONT DOOR, not a second data model. It parses to exactly the Overlay.t the S-expression form parses to, and everything downstream is the same code on the same values; a test asserts an INI overlay and its hand-written sexp equivalent produce identical Overlay.t values. It is also deliberately less expressive -- Add, Suppress and single-field Edit only -- and refuses Replace, multi-field edits and citation edits BY NAME rather than dropping them silently. Anything it cannot say is a reason to write sexp. Little of this is new machinery: tools/bootstrap_sanctoral.ml has parsed INI and mapped it to celebrations since the sanctoral was bootstrapped from lectio. The dates needed extending, since that mapping handled only MM-DD; the flat forms are easter+N/easter-N and mon/day/nth, with nth negative to count from the end. `colitur convert` is a separate step rather than --overlay sniffing the extension, so the author can read what their INI became. When a date form was mistyped, "what did the engine actually get" is the question, and an invisible transpile cannot answer it. The conversion verifies its own output: the emitted text is parsed back with the same function that loads an overlay and must equal what the INI denoted, or nothing is written. That is the point of the module. A transpiler emitting valid-but-wrong sexp is the failure a convenience format invites, and `colitur check` could never catch it -- the output would parse cleanly and mean something else. That check was WRONG on the first attempt, in exactly the way it exists to prevent. It re-serialised the parsed value instead of parsing the text being returned, so it verified t -> sexp -> t, which is true by construction and proves nothing. Found by mutation: corrupting the renderer to emit a different overlay id sailed through and exited 0. It now parses the returned text, the mutation is caught with exit 2, and two tests fail under it where none did before. --- man/colitur.1 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'man/colitur.1') diff --git a/man/colitur.1 b/man/colitur.1 index 6463415..58e46ff 100644 --- a/man/colitur.1 +++ b/man/colitur.1 @@ -65,6 +65,15 @@ occurrence, commemoration and transfer. .BI readings " YEAR" The Mass reading citations, one line per day. .TP +.BI convert " FILE" .ini +Convert a flat INI overlay to the S\-expression form, on standard output. The +conversion verifies its own output before emitting it: the generated text is +parsed back with the same function that loads an overlay, and must mean +exactly what the INI said. A separate step rather than teaching +.B \-\-overlay +to sniff the extension, so you can see what your INI became. See +.BR colitur\-overlay (5). +.TP .B new\-overlay Print a starter overlay file to standard output, for redirection. Every value in it is a placeholder that will appear in -- cgit v1.3