diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-21 14:15:34 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-22 17:02:01 -0400 |
| commit | bf1294cf89265cfab7e4886a505e0338c9013203 (patch) | |
| tree | c60d5f0cb527ea359f3789c053d63d602f5fe00f /src/sisudoc/ocda | |
| parent | dispatch: pod materialised if source required (diff) | |
verify: this spine still produces this abstraction?
does this spine still produce this abstraction?
A database states an abstraction and carries the markup it was built
from, so re-parsing the one and comparing against the other says whether
the two still agree. Checked as follows:
- automatically and unskippably when a document is built from a
database, at the moment it is parsed and before anything has been
written from it.
- on --ocda-verify=<file>, an action of its own that materialises,
parses every language, compares, reports and writes nothing, the exit
status being the answer.
- on --no-verify as the escape, warning per document, for a newer spine
reading an older artefact where the abstraction is expected to differ
and the output is wanted anyway.
A build ends at the first failure rather than skipping the language.
A document rebuilt from a database now has its whole abstraction built.
(assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc/ocda')
| -rw-r--r-- | src/sisudoc/ocda/abstraction/db_in.d | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sisudoc/ocda/abstraction/db_in.d b/src/sisudoc/ocda/abstraction/db_in.d index 0a01364..986a09d 100644 --- a/src/sisudoc/ocda/abstraction/db_in.d +++ b/src/sisudoc/ocda/abstraction/db_in.d @@ -90,6 +90,34 @@ template spineDbLanguages() { return _out; } } +/+ ↓ the .ssp digest a database recorded for each of its languages. + . + What verify holds its answer against: the database says which .ssp it was + built from, so re-parsing the markup it carries and emitting the .ssp again + either reproduces that digest or does not. + . + Its own template, for the reason spineDbLanguages is: asking a file what it + recorded should not instantiate the reader. ++/ +template spineDbSspDigests() { + @trusted string[string] spineDbSspDigests(string db_file) { + import std.file : exists; + import d2sqlite3; + string[string] _out; + if (!db_file.exists) { return _out; } + try { + auto db = Database(db_file, SQLITE_OPEN_READONLY); + foreach (row; db.execute( + "SELECT lang, ssp_digest FROM documents ORDER BY id") + ) { + _out[row["lang"].as!string] = row["ssp_digest"].as!string; + } + } catch (Exception ex) { + return string[string].init; + } + return _out; + } +} template spineAbstractionDbRead() { import std.conv : to; import std.file; |
