Skip to content

Record artifact labels - #5

Merged
quietflareco-sudo merged 1 commit into
mainfrom
record-artifact-labels
Sep 2, 2026
Merged

quietflareco-sudo merged 1 commit into
mainfrom
record-artifact-labels

Conversation

@quietflareco-sudo

Copy link
Copy Markdown
Contributor

A workflow author writes this on an artifact:

outputs:
  - id: scored
    kind: file
    path: batch_017.parquet
    labels: {subject: batch_017, role: measurement}

and it reaches the record verbatim, so a reader can answer "everything derived from subject batch_017" with a lookup instead of parsing filenames or consulting a sheet that uses a different vocabulary in every field of study.

What changed

labels_of() reads an artifact's labels, applied at both points that describe an artifact: the resolved entry in each task record, and the declared entry in definition.json.

Recorded verbatim and never interpreted. String keys and values only, because a reader indexes on them and a value it cannot compare is worse than an absent one. Omitted entirely when empty, so an unlabelled run's records are byte-identical to before.

Why it reads through getattr

BaseArtifact.labels is approved upstream in temple-compute/horus-runtime#181 but not in a release yet. Reading defensively means this ships now, reports no labels on today's engine, and starts working the moment a release carries the field. A recorder that raised on an older engine would fail the run it exists to observe.

Tests

Seven added, 67 total, coverage 93.40%.

Five unit tests on the reader: an engine without the field, an unlabelled artifact, strings surviving, non-string values filtered out, and something that is not a mapping at all.

Two end to end: labels reach the record, and an unlabelled run gains no empty keys. The first patches labels_of because the pinned engine has no field to set; the patch goes away when the dependency moves.

Also

Known limits now name the upstream PR each one waits on. source is still null, but temple-compute/horus-runtime#184 is merged and _copy_source already reads through getattr, so that one also fixes itself on the next release with no change here.

A workflow author writes labels: {subject: batch_017} on an artifact and
a reader can group by subject without parsing filenames or consulting a
per-domain sheet.

Recorded verbatim on both the declared and the resolved artifact, never
interpreted, string keys and values only. Omitted when empty so an
unlabelled run reads exactly as before.

Read through getattr: BaseArtifact.labels is approved upstream but not
released, so this ships now and starts working when a release carries it.
@quietflareco-sudo
quietflareco-sudo merged commit a93c210 into main Sep 2, 2026
6 checks passed
@quietflareco-sudo
quietflareco-sudo deleted the record-artifact-labels branch September 2, 2026 10:00
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.

2 participants