Skip to content

feat(db): store and fetch content-addressed processes in TransformationDB - #1117

Draft
ryuwd wants to merge 3 commits into
DIRACGrid:mainfrom
ryuwd:cwl-4-db
Draft

ryuwd wants to merge 3 commits into
DIRACGrid:mainfrom
ryuwd:cwl-4-db

Conversation

@ryuwd

@ryuwd ryuwd commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Closes #1109. Part of #1080.

Blocked by #1114 and #1115, whose commits this branch includes until they merge.

ryuwd added 3 commits October 23, 2026 16:18
A process is identified by the SHA-256 of a canonical form defined over
the parsed JSON document, not over any CWL library's output, so that it
is deterministic, stable across library upgrades and reproducible by any
tool. Ids, doc and label where they are metadata, $namespaces and dirac:
hints are dropped; prefixes are expanded to full URIs; lists become
maps; fully scoped identifiers are shortened against their scope; type
shorthands are expanded and named types written by short name. Each
child run body is replaced by its own identity, so a workflow's identity
covers its children's (a Merkle tree). pack and unpack convert to and
from a self-contained $graph whose components are named by their
identity.

Documents must be resolved before canonicalisation: $import, $include
and any other schema-salad directive is refused, since the identity
would not cover what it names and a runner would fetch it. Standard
library only.

Closes DIRACGrid#1106
Part of DIRACGrid#1080
Unit tests ran on SQLite only, but production runs on MySQL and MariaDB,
which differ from SQLite where the transformation tables rely on them.
The diracx-db transformation tests now share one fixture that runs each
test on SQLite and on every server given by DIRACX_TEST_MYSQL_URL or
DIRACX_TEST_MARIADB_URL, and a CI job runs them on MySQL 8.4 and
MariaDB 11.4 service containers, pinned by digest.

It found one difference already: a failed CHECK constraint is an
IntegrityError on SQLite but an OperationalError on MySQL and MariaDB
through PyMySQL, so the deltas test now accepts either, matched on the
constraint's name.

Closes DIRACGrid#1108
…onDB

insert_processes stores documents under their content hash with INSERT
IGNORE, so concurrent submissions of a shared process are safe, and
get_processes fetches them, on the DX-ADR-004 Processes table unchanged.

MySQL's JSON type re-sorts keys and reformats numbers, so a stored row is
not the bytes that were hashed: what must hold is that the value read
back re-hashes to its identity, which the round-trip test checks on
SQLite, MySQL and MariaDB.

Closes DIRACGrid#1109
Part of DIRACGrid#1080
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 diracx | 🛠️ Build #35356706 | 📁 Comparing acd6d93 against latest (833c593)

  🔍 Preview build  

1 file changed
± dev/explanations/components/db/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Transformation System] Store and fetch content-addressed processes in TransformationDB

1 participant