Keep the file name a node gave an artifact

A run_artifact row is keyed by the message the bytes left on, and that was
also the only name it could answer with — so an `@run:` reference resolved
through the row was the same bytes under a name its producer never chose.
The row now records the file name beside the message name; rows written
before the column answer as they always did.

The fallback also checks the bytes are still in the store, which the bare
digest spelling beside it has always done. A missing blob now fails at
submit rather than in the middle of the run that wanted it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-26 22:45:11 +02:00
co-authored by Claude Opus 5
parent 001ec7b282
commit 2e82367926
4 changed files with 81 additions and 8 deletions
+21 -2
View File
@@ -140,6 +140,7 @@ def made_artifact():
RunArtifact(
run_id=run_id,
name="prepare.dataset",
filename="cities.csv",
node="load",
digest=digest,
size=12,
@@ -159,11 +160,29 @@ def test_a_run_reference_resolves_to_what_that_run_produced(made_artifact):
artifact_flow(), {"dataset": f"@run:{run_id}.dataset"}
)
# The producer's own reference, file name and all — not one rebuilt from
# the row, which carries the message name instead.
# The producer's own reference, whatever type it made it — the row beside
# it is the fallback, not the first answer.
assert resolved["dataset"] == reference
def test_the_artifact_row_answers_with_the_name_the_node_gave_the_file(made_artifact):
"""Bytes the flow never declared as an output are reachable through the row."""
run_id, reference = made_artifact
with Session(db_engine) as session:
run = session.get(Run, run_id)
run.result = {}
session.add(run)
session.commit()
resolved = resolve_references(
artifact_flow(), {"dataset": f"@run:{run_id}.dataset"}
)
assert resolved["dataset"]["digest"] == reference["digest"]
# The file name, not the message it happened to leave on.
assert resolved["dataset"]["name"] == "cities.csv"
def test_a_bare_digest_resolves_to_the_bytes_under_it(made_artifact):
_run_id, reference = made_artifact
resolved = resolve_references(artifact_flow(), {"dataset": reference["digest"]})