Skip to content

CLI: add hflow stale --exit-code so CI can gate on stale episodes #30

Description

@kstonekuan

Current behavior

_command_stale (src/hflow/cli.py:268) prints stale episode URIs and always returns 0 (src/hflow/cli.py:318), regardless of how many episodes are behind the current pipeline version. That means hflow stale cannot gate a CI job or a pre-training checklist, while hflow doctor already exits 1 on findings.

Proposed change

Add an --exit-code flag (named after git diff --exit-code): when passed, exit 1 if any stale episode was printed. Keep the default at 0 so existing pipes keep working (docs/CATALOG.md documents piping the output into xargs hflow ingest).

Definition of done

  • hflow stale --exit-code ... exits 1 when at least one stale episode exists and 0 when none do.
  • Without the flag, behavior is unchanged.
  • Test with the existing catalog fixtures in tests/test_catalog_curation.py.

Validation

uv run pytest -q
uv run ruff check --fix && uv run ruff format
uv run ty check

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions