From 158f6a6dae58d7c4010a27a9e75652c29191be5f Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 9 Sep 2026 10:54:20 -0500 Subject: [PATCH 1/3] scaffold: factor the cell key out of the inclusion pin The pin's filename rule (_, slashes mapped to dashes) is the key for everything the campaign dir keeps per cell, so it becomes cell_key() and the pin derives from it. No behavior change. Co-Authored-By: Claude Fable 5.1 --- mechababs/scaffold.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/mechababs/scaffold.py b/mechababs/scaffold.py index 89b3bd1..45368d8 100644 --- a/mechababs/scaffold.py +++ b/mechababs/scaffold.py @@ -70,20 +70,33 @@ def derivative_path(source_dataset, app_config, label): return f"derivatives/{derivative_name(source_dataset, app_config, label)}" -def inclusion_pin(study, label, source_dataset, app_config): - """Where this cell's requested subject list is pinned, beside the statefile. +def cell_key(source_dataset, app_config): + """The cell's identity as one filename-safe token: ``_``. Both halves of the cell's identity are *paths*, so neither is filename-safe as written. The sourcedata half is the whole study-relative path with ``/`` mapped to ``-`` (whole, so two datasets whose directories share a basename cannot collide); the app half is the config's stem. The result is a key mechababs constructs and never parses back, so the ambiguity of ``-`` inside a component - costs nothing — and this is the only place the name is derived. + costs nothing — and this is the only place the key is derived. Everything the + campaign dir keeps per cell (the inclusion pin, the duct records) is named by it. """ - name = f"{source_dataset.replace('/', '-')}_{app_stem(app_config)}.csv" + return f"{source_dataset.replace('/', '-')}_{app_stem(app_config)}" + + +def inclusion_pin(study, label, source_dataset, app_config): + """Where this cell's requested subject list is pinned, beside the statefile.""" + name = f"{cell_key(source_dataset, app_config)}.csv" return campaign_mod.inclusions_dir(study, label) / name +def duct_dir(study, label, source_dataset, app_config): + """Where this cell's duct records go: one directory per cell, so every attempt + at scaffolding or merging it — a retire-and-redo, a ``datalad rerun`` — lands + beside the others and the cell's orchestration history reads out of one place.""" + return campaign_mod.duct_dir(study, label) / cell_key(source_dataset, app_config) + + def source_dataset_url(study, source_dataset): """The source dataset's URL, from the study's own ``.gitmodules``. From b61b4ca6ce4de9db7b5f7ec5f35acfe2ed2e36cd Mon Sep 17 00:00:00 2001 From: Austin Macdonald Date: Wed, 9 Sep 2026 10:54:20 -0500 Subject: [PATCH 2/3] dispatch: run every recorded transition under duct con/mechababs#53. The recorded command becomes `duct --fail-time 0 -p mechababs-inner ...`, so the usage and resource records of each scaffold and merge are outputs of the same datalad run and travel with the study, at .mechababs/campaigns/