fix: publish scratch artifacts to content-addressed storage - #574
harshitethic wants to merge 3 commits into
Conversation
kstonekuan
left a comment
There was a problem hiding this comment.
The fix itself is right, and both halves hold under mutation: forcing artifact_is_scratch_bound = False reddens 1, and dropping artifact_content_digest from the key reddens 1. publish does copy when source and destination differ, so the artifact really does leave scratch rather than just getting a nicer-looking URI.
Two things before this can land.
uv run ruff format --check fails on src/hflow/app.py, so this would turn main red:
- artifact_name_digest = hashlib.sha256(artifact_name.encode()).hexdigest()[:8]
+ artifact_name_digest = hashlib.sha256(artifact_name.encode()).hexdigest()[
+ :8
+ ]
And step_directory and artifact_name_digest are now computed twice, identically, in the two branches. Only the key layout differs between them. Hoist those two out above the if so the next person changing the naming scheme cannot change one copy and miss the other.
Worth a sentence in the code on why the non-scratch fallback stays non-content-addressed, since a reader hitting the second branch will wonder whether that is deliberate.
|
| # must bump the explicit constant above. | ||
| version=media_contact_sheet_step_version(), | ||
| ) | ||
| report.enrichments.append( | ||
| _execute_enrichment(media_step, canonical_episode, quarantine_skip) |
There was a problem hiding this comment.
This replacement reduces hflow.app to an indented 73-line fragment that begins without an enclosing block, so importing it raises IndentationError. The CLI imports this module during startup, and public exports such as App are loaded through it, so the package, CLI, and test suite can no longer start.
kstonekuan
left a comment
There was a problem hiding this comment.
src/hflow/app.py was truncated by the last push. On c28600a it is 72 lines and does not parse:
IndentationError: unexpected indent
line 1: _execute_enrichment(media_step, canonical_episode, quarantine_skip)
The file starts mid-function, so the module docstring, every import, and roughly 3,000 lines above that point are gone. That is what the 7 ruff errors and 81 ty diagnostics are; nothing here is about your actual change.
Sizes across the branch, so you can see where it went:
8d6a134 3158 lines
064f69d 3158 lines
c28600a 72 lines <- the review-feedback commit
main 3131 lines
064f69d is intact, so git checkout 064f69d -- src/hflow/app.py gets the file back, then re-apply the two review points on top: hoist step_directory and artifact_name_digest above the if, and the line-length fix ruff format wants.
The change itself was already right last round. Both halves held under mutation and publish does copy when source and destination differ, so nothing about the approach needs revisiting.
Main has moved since you branched, so merge it in as well once the file is back.
c28600a to
064f69d
Compare
Fixes #545.
Summary
artifacts/storage instead of exposing scratch URIs;Why
Scratch is rewritten across reprocessing. A catalog URI that points into scratch can therefore start resolving to different bytes or disappear entirely. Content-addressed durable keys keep prior catalog URIs bound to the bytes that were published.
Testing