Skip to content
Halyard
Project
Source code on Codeberg (opens in new tab)

Search

Menu

Compliance Manifest

When halyard runs a pipeline, it can emit a compliance manifest — a structured, machine-readable record that captures what ran, on what data, when, and who triggered it. The manifest is the link between a pipeline output and the exact source code and input files that produced it.

The manifest is designed for regulated industries where auditors need to answer:

  • What code produced this output? (source hash)
  • What input data did it run on? (SHA-256 of each input file)
  • What did it write? (SHA-256 of each output file)
  • How many rows were in each DataFrame? (row counts per dataset)
  • Who ran it, and when? (user identity, UTC timestamp)
  • Can I verify the record hasn't been tampered with? (optional HMAC signature)

Halyard owns the computation layer. Storage guarantees — WORM storage, access control, audit trails — are the responsibility of the surrounding infrastructure.

Enabling the Manifest

The manifest is disabled by default. Enable it in halyard.toml:

toml
[compliance]
enabled = true
user = "ci-service"

With this configuration, every run builds a manifest. To keep it, name the file it is written to.

Where the Manifest Is Written

Name a file in halyard.toml:

toml
[compliance]
enabled = true
output = "logs/halyard-audit.jsonl"

or for a single run, with --audit-log on the halyard run command:

bash
halyard run src/pipeline.hly --audit-log /var/log/halyard-audit.jsonl

Each successful run appends its manifest to the file as one JSON line, so runs accumulate in the same file (the JSON-lines form halyard manifest-diff reads). In the REPL, the TUI and notebooks, every cell that runs appends one line to HALYARD_COMPLIANCE_OUTPUT; these do not read halyard.toml's [compliance] section yet, so set the variable there.

The file is created when the first manifest is written, but its directory never is. A missing directory, a file where the directory should be, a directory in place of the file, an existing file halyard cannot write, or a path whose existence halyard cannot check (a symlink loop, a directory halyard cannot search) stops the run before the program runs. A new file that cannot be created (in a read-only directory, say) is reported when the manifest is written, after the run. A run that fails appends nothing and creates no file; partial runs leave no record.

The destination is chosen in this order, the first one set wins:

  1. halyard run --audit-log <path>, relative to the current directory;
  2. HALYARD_COMPLIANCE_OUTPUT, relative to the current directory;
  3. [compliance] output in halyard.toml, relative to the project root (the directory holding halyard.toml);
  4. none: the manifest is built but not written.

halyard itself writes this file, not your program, so the [permissions.io] sandbox and read-only setting do not apply to it.

The [compliance] Section

Full configuration reference:

toml
[compliance]
enabled = true           # required to emit a manifest
user = "analyst"         # recorded in the manifest; defaults to HALYARD_COMPLIANCE_USER
fields = [               # optional: which fields are filled in; the others are
  "user",                # recorded empty (null or []). If omitted (or empty),
  "source_hash",         # all fields are filled in
  "input_files",
  "output_files",
  "dataframes",
]
output = "logs/audit.jsonl"  # optional: file each run's manifest is appended to
format = "json"          # optional: the only format, and the default
# hmac_key = "00ff..."   # optional: hex-encoded HMAC-SHA256 key for signing

All fields except enabled are optional. fields may name source_hash, user, input_files, output_files and dataframes; halyard_version and timestamp_utc are always included. An hmac_key that is not hex, a fields entry that names no manifest field, a format other than json or an empty output makes the halyard.toml invalid: halyard stops instead of writing an unsigned or incomplete manifest. A key that is a string but not hex is reported by its length only; a halyard.toml that is not valid TOML around it (a key without quotes, say) is reported with the offending line, as any TOML error is. The hmac_key field is sensitive — prefer setting it via the environment variable rather than in halyard.toml.

Environment Variable Overrides

Every [compliance] field can be overridden at runtime with an environment variable. This is useful in CI environments where credentials are injected by the pipeline runner:

Env varOverridesAccepted values
HALYARD_COMPLIANCE_ENABLEDenabled1, 0, true or false
HALYARD_COMPLIANCE_USERusera name, not empty
HALYARD_COMPLIANCE_FIELDSfieldscomma-separated field names; empty means all fields
HALYARD_COMPLIANCE_FORMATformatexactly json
HALYARD_COMPLIANCE_OUTPUToutputa path, not empty; relative to the current directory. halyard run --audit-log overrides it
HALYARD_COMPLIANCE_HMAC_KEYhmac_keyhex-encoded key bytes; spaces around them are ignored

Environment variables take precedence over halyard.toml values. The env vars are read fresh on every execution — they are never cached between runs. A value a variable does not accept, the empty one included (except for HALYARD_COMPLIANCE_FIELDS), stops halyard with an error naming the variable, before anything runs. See Which setting wins.

Manifest Fields

A manifest with all fields looks like this:

json
{
  "halyard_version": "0.0.14",
  "timestamp_utc": "2026-06-22T14:32:00Z",
  "source_hash": "a3f7c2e1d4b9...",
  "user": "ci-service",
  "input_files": [
    {
      "path": "/data/positions.parquet",
      "sha256": "b2c8f1a3d7e9..."
    }
  ],
  "output_files": [
    {
      "path": "/out/report.csv",
      "sha256": "e4d9b1c2f8a7..."
    }
  ],
  "dataframes": [
    {
      "name": "positions",
      "row_count": 4218,
      "source_paths": ["/data/positions.parquet"],
      "operations": ["read_parquet", "filter", "group_by"]
    }
  ],
  "signature": "7f2a1c4d8e3b..."
}

Field reference

FieldCompliance relevance
halyard_versionReproducibility — SR 11-7, GAMP 5 §5.4
timestamp_utcAudit trail — 21 CFR Part 11 §11.10(e), SOX AS 2201
source_hashCode integrity — verify the pipeline that ran matches the reviewed version
userAttribution — 21 CFR Part 11 §11.10(d), ICH E6 R3
input_filesInput provenance — links output to exact input file content via SHA-256
output_filesOutput provenance — links report to the exact file hash recorded at write time
dataframesTransformation traceability — row counts and operation list per dataset
signatureTamper detection — HMAC-SHA256 over the canonical manifest body
replay_logRecorded IO trace — one entry per performed IO operation, with arguments and content hash/bytes; embedded only for --record runs and never field-filterable

Record and Replay

halyard run --record (with compliance enabled) embeds the run's IO trace in the manifest's replay_log: each traced operation appends one entry with its name, arguments, a SHA-256 content hash, and the result inlined under the byte ceiling. halyard replay <manifest> (see CLI) then re-runs the pipeline serving those entries in order. Replay verifies the manifest's signature and that the entry file still hashes to the recorded source_hash, refusing the run if either check fails — an unsigned manifest, or one recorded from a different version of the program, is not replayable.

What is traced. Every file and directory operation in IO, plus Http.send — 19 operations. Three groups are deliberately outside the trace. Console IO (print, println, eprint, eprintln, readLine) is not a data source, and a replay must not answer a prompt somebody is watching. The DataFrame readers and writers are not traced because a dynamic read takes its stated schema from the call site, and an intercepted operation is not that call site — tracing them would quietly disable the schema check that makes DataFrame { id : Int, .. } mean anything. Process.* and DateTime.now are not traced yet (debt #847). So a pipeline that loads a DataFrame, stamps the clock or reads the environment is recorded without those steps and is not fully re-derivable.

What replays. A recorded result is stored as data, so strings, numbers, booleans, units, lists, tuples and enums — including Ok/Err/Just/Nothing and an IOError variant — all replay as themselves. A failed read replays as the same failure, which is what makes an error path reproducible. An entry with no inlined result — a content-address strategy, or a result over the ceiling — is refused rather than served as something of the wrong type.

Strategies and the inline ceiling are configured in halyard.toml:

toml
[compliance.replay]
strategies = { "data/**" = "content-address", "logs/**" = "inline" }
max_inline_bytes = 10485760

A glob matches the operation's first argument — the path, for every file operation. ** spans directory separators, * does not, and every other character is literal, so data/x.csv means that file and not data/xycsv. The first matching rule in the table wins, and a path no rule matches is inlined. content-address keeps the hash and no bytes, which makes the entry proof of what was read rather than a copy of it: replay refuses such an entry rather than guessing. A result over max_inline_bytes (10 MB by default) is downgraded to content-address with a warning, so the manifest cannot grow without bound.

Environment variables override the table: HALYARD_COMPLIANCE_REPLAY_STRATEGIES (glob=strategy;…) and HALYARD_COMPLIANCE_REPLAY_MAX_INLINE. Both are validated when a run starts, so an unknown strategy name or a malformed pair stops it rather than being ignored.

HMAC Signing

When HALYARD_COMPLIANCE_HMAC_KEY is set (a hex-encoded key), the manifest body is signed with HMAC-SHA256. The signature field contains the hex-encoded MAC. To verify:

  1. Remove the signature field from the manifest JSON.
  2. Re-serialise the remaining fields in the same order.
  3. Compute HMAC-SHA256 over the canonical JSON using your key.
  4. Compare the result to the recorded signature.

The line halyard appends to the output file is exactly that canonical body with "signature" added as its last field, so the signature covers everything written except the signature itself.

The key must be shared with anyone who needs to verify. For public verifiability without key sharing, consider an asymmetric scheme at the infrastructure layer (halyard does not currently implement asymmetric signing).

What Halyard Does Not Own

The compliance manifest documents what happened during computation. It does not:

  • Authenticate users. The user field is a string from configuration or an environment variable. Halyard does not verify identity — that is the responsibility of the CI system or orchestration layer that sets HALYARD_COMPLIANCE_USER.
  • Guarantee storage integrity. Writing a manifest to a file is not the same as tamper-proof storage. Use WORM storage (e.g. S3 Object Lock) or a content-addressed store for regulatory guarantees.
  • Audit database reads. If a pipeline reads from a database rather than a file, halyard cannot hash the source data. Database audit trails are the responsibility of the database layer.
  • Provide field-level transformation traces. The operations list in each DataFrameRecord names the operations applied; it does not record intermediate row counts at each step. Per-step traceability is a planned future extension.

Example: SOX Audit Pipeline

Add [compliance] to your project manifest:

toml
[project]
name = "pnl-pipeline"
version = "1.0.0"
main = "src/main.hly"

[permissions.dataframe]
enabled = true
sandbox = "./data"

[compliance]
enabled = true

Set the signing key and user identity in CI:

bash
export HALYARD_COMPLIANCE_HMAC_KEY=<your-hex-key>
export HALYARD_COMPLIANCE_USER=ci-service
halyard run --audit-log /var/log/halyard-audit.jsonl

After each run, halyard-audit.jsonl gains one line. Ship the file to WORM storage to create an immutable record of every pipeline execution.

Example: Selective Fields for Pharma Submission

For a 21 CFR Part 11 submission package, you may want only the fields required by the submission:

toml
[compliance]
enabled = true
fields = ["user", "source_hash", "input_files", "dataframes"]

This leaves output_files empty ([]) in the manifest; halyard_version and timestamp_utc are always included, and signature is present exactly when an hmac_key is set. A field name that is not one of source_hash, user, input_files, output_files and dataframes is an error, so a misspelt name never drops a field silently.

See Also

  • Projects — halyard.toml structure and permissions
  • Data Lineage — Column-level lineage tracking that feeds the dataframes field in the manifest