This package owns deterministic workflow orchestration for the project experiments and artifact generation.
| File | Role |
|---|---|
__init__.py |
Public module exports for the analysis layer. |
workflow.py |
Pipeline entrypoint for source-mechanism analogues, figure generation, and report materialisation. |
report_schemas.py |
Typed report/figure-registry schemas and the runtime validator enforced at the write boundary. |
artifacts.py |
Source-declared Stage-02 report, figure, registry, and data-path contract for audits and CI. |
- Inputs:
experiment_config.pyis the single source of experiment truth. - Execution: Scripts call into
workflowfunctions; this package stays importable and testable. - Output: Writes JSON and figure files into
output/under deterministic, test-backed filenames. - Audit contract:
artifacts.expected_artifacts(project_root)declares the complete hand-off without accepting arbitrary files discovered underoutput/. - Determinism: All analyses are keyed by explicit
seedvalues from config.
Every report payload written to output/reports/*.json and the
output/figures/figure_registry.json payload is typed and centrally validated:
- What is validated:
report_schemas.pydeclares oneTypedDictper report (documentation for readers and mypy) plus a shallow runtime schema table of required/optional top-level fields and their types. Declared degradations are part of the schema —bnn_torchaccepts either the fullstatus: "ok"payload or the single-key{"status": "skipped: ..."}payload written when the PyTorch optional extra is unavailable. - Where: validation happens once, at the single write boundary.
workflow._write_json(payload, path, schema="<name>")callsreport_schemas.validate_reportbefore anything touches disk; a malformed payload raisesReportSchemaErrornaming the report and field, and no file (or directory) is created. Additionally, each figure generator's consumed report fields are declared inreport_schemas.FIGURE_DEPENDENCY_CONTRACTSand checked viacheck_figure_contract(generator, report_name, report)inworkflow.pyimmediately before the figure call, so a missing input fails with a named report+field error instead of an anonymousKeyError. - How to add a schema when adding a report: define the
TypedDictand the_REPORT_SCHEMASentry inreport_schemas.py, passschema="<name>"at the new_write_jsoncall site inworkflow.py, declare any figure dependencies inFIGURE_DEPENDENCY_CONTRACTS, and rely ontests/analysis/test_report_schemas.py— its accept/reject tests are derived mechanically from the schema table, so every declared schema is covered automatically (add report-specific shape tests only for bespoke variants such asbnn_torch).
Schemas describe existing payload shapes; they never add, rename, or drop report keys. Validation is a software-quality boundary, not evidence about any scientific quantity.
../README.md— project source overview../AGENTS.md— source-layer editing rules