Skip to content

Add labels to BaseArtifact - #183

Merged
chdominguez merged 3 commits into
temple-compute:mainfrom
quietflareco-sudo:add-artifact-labels
Sep 2, 2026
Merged

Add labels to BaseArtifact#183
chdominguez merged 3 commits into
temple-compute:mainfrom
quietflareco-sudo:add-artifact-labels

Conversation

@quietflareco-sudo

@quietflareco-sudo quietflareco-sudo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #181.

labels: dict[str, str] = Field(default_factory=dict)
outputs:
  - id: scored
    kind: file
    path: batch_017.parquet
    labels: {subject: batch_017, role: measurement}

The runtime never interprets them. They travel with the artifact through serialization and exist for whatever reads a workflow afterwards: a UI grouping nodes, or a lineage reader answering "everything derived from subject X". A domain expresses its own structure through labels instead of the runtime growing a field per domain.

Docstring shortened per review.

Not a cache concern

HorusTask._fingerprint hashes artifact content digests plus a hash of the runtime and executor models. Artifact models are not in it, so labels cannot reach a cache decision. Relabelling describes an artifact differently, it does not make its contents stale.

Why str values

Strings stay serializable in YAML and JSON without surprises and can be used directly as index keys. Easy to widen to dict[str, Any] later, hard to narrow. Happy to change it.

Tests

Four: defaults to empty, not shared between instances (a mutable default would leak one artifact's labels into every other), survives a model_dump / model_validate round trip, rejects non-string values.

737 passed, coverage 91.29%, make lint clean.

Documentation impact

If a user, plugin, or GUI can observe the difference, it requires documentation.

  • No documentation update required
  • Documentation updated / will be updated

horus-docs PR: to follow.

This is a new field workflow authors write in YAML, so it belongs in sdk/core/artifact.mdx and guides/writing-workflows-yaml.mdx. Happy to write it, or leave it to you.

Free-form key/value metadata that travels with an artifact through
serialization. The runtime never interprets it.

A domain expresses its own structure through labels instead of the
runtime growing a field per domain, so one mechanism serves any of
them. Not part of any cache key: _fingerprint hashes artifact content
digests rather than artifact models.

Closes temple-compute#181
@quietflareco-sudo

Copy link
Copy Markdown
Contributor Author

@chdominguez FYI! Could you please review this? Thanks!

@chdominguez chdominguez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change on the docstring and ready to go!

Comment thread src/horus_runtime/core/artifact/base.py
Review feedback: the field needs a line and an example, not the
rationale. That lives in temple-compute#181 and the PR.

@chdominguez chdominguez left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chdominguez

Copy link
Copy Markdown
Member

Docs PR: temple-compute/horus-docs#58

chdominguez added a commit to temple-compute/horus-docs that referenced this pull request Sep 2, 2026
Companion to temple-compute/horus-runtime#183, which adds
BaseArtifact.labels: free-form string metadata the runtime never
interprets or uses for caching, for whatever reads the workflow
afterwards (a UI, a lineage query).
@chdominguez
chdominguez merged commit 6651c53 into temple-compute:main Sep 2, 2026
4 checks passed
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.

Add labels: dict[str, str] to BaseArtifact for domain metadata

3 participants