Skip to content

Settle the producer publish contract + cozy_convert publish robustness (#374, #375)#50

Merged
PaulFidika merged 2 commits into
masterfrom
issue/374-375-publish-contract
Jul 4, 2026
Merged

Settle the producer publish contract + cozy_convert publish robustness (#374, #375)#50
PaulFidika merged 2 commits into
masterfrom
issue/374-375-publish-contract

Conversation

@PaulFidika

Copy link
Copy Markdown
Contributor

Closes tracker issues #375 and #374 (agents/completed.md).

#375 — the ONE publish contract

Producer endpoints (conversion/dataset/training) write files locally, call cozy_convert.publish_flavors(ctx, flavors) — one Tensorhub /commits commit per ProducedFlavor (path = file or directory) — and return a result struct. The executor stays contract-free.

  • The dead yield ProducedFlavor shape is deleted AND enforced: @endpoint rejects generator handlers for producer kinds at decoration time (TypeError pointing at publish_flavors).
  • examples/from-scratch rewritten to the contract (returns FromScratchResult with revision_ids) + discovery smoke test.
  • Docs: endpoint-authoring.md worked example, decorator/SDK docstrings.

#374 — cozy_convert publish/clone robustness

  • HubClient: bounded retries (backoff + Retry-After) on commit POST, part PUTs, complete, finalize — 429/5xx/network.
  • run_clone: persistent workdir keyed by sha256(provider|source|destination) under $COZY_CONVERT_WORKDIR — retained on failure (retry resumes the HF snapshot; hf local-dir metadata kept for that), deleted on success; partial flavor trees wiped per retry.
  • .cache/huggingface/** filtered from published trees (files_from_tree + _copy_non_weights) — mirrors byte-faithful to the source repo (live-observed junk bug).
  • run_clone raises when nothing was published, unconditionally.
  • Legacy publish_repo_revision (~450 LOC, old /publish route) deleted with its local stub and orphaned helpers — publish_flavors via /commits is the ONE publish path.

Tests

  • root: uv run --extra dev pytest -q186 passed, 1 skipped
  • cozy_convert: uv run --package cozy-convert --extra dev pytest -q -m "not integration"38 passed, 8 deselected; mypy + ruff clean
  • new: producer-generator rejection, from-scratch discovery smoke, publish_flavors + run_clone against a fake /commits server (real HTTP), transient-failure retries, junk filtering, workdir retain/resume/cleanup

🤖 Generated with Claude Code

…avors, no yield shape (#375)

Producer endpoints (conversion/dataset/training) write files locally, call
cozy_convert.publish_flavors(ctx, flavors) — one Tensorhub /commits commit
per ProducedFlavor — and return a result struct. The dead 'yield
ProducedFlavor' generator shape is rejected at decoration time so it fails
loudly instead of silently streaming and publishing nothing.

examples/from-scratch rewritten to the contract with a discovery smoke test;
docs updated (endpoint-authoring, decorator + SDK docstrings).
…unk filtering, no silent empty publish (#374)

- HubClient: bounded retries with backoff + Retry-After on commit POST,
  part PUTs, complete, and finalize (429/5xx/network).
- run_clone: workdir keyed by (provider, source, destination) under
  $COZY_CONVERT_WORKDIR; retained on failure so retries resume the
  snapshot instead of re-downloading multi-GB sources; deleted on success.
- files_from_tree/_copy_non_weights skip .cache/huggingface/** so mirrors
  are byte-faithful to the source repo.
- run_clone raises when nothing was published, unconditionally.
- Delete the legacy publish_repo_revision second publish path (+ local
  stub, orphaned helpers/constants); cozy_convert.publish_flavors via
  /commits is the ONE publish path.

Tests: retry + junk-filter coverage in test_hub.py; publish_flavors and
run_clone lifecycle (fake /commits server, real HTTP) in test_publish.py.
Tracker: #374 + #375 moved to completed.
@PaulFidika PaulFidika force-pushed the issue/374-375-publish-contract branch from 7cccbb4 to 05bda02 Compare July 4, 2026 08:43
@PaulFidika PaulFidika merged commit 3950d27 into master Jul 4, 2026
@PaulFidika PaulFidika deleted the issue/374-375-publish-contract branch July 4, 2026 08:44
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.

1 participant