Skip to content

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

Closed

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

  1. chiruu12 commented on Aug 20, 2026

    @chiruu12
    Contributor

    Happy to take this one. Plan: add --exit-code (store_true) to the stale subparser and return 1 from _command_stale when it's set and at least one stale episode was printed. Default stays 0 so the xargs hflow ingest pipe in docs/CATALOG.md is unaffected. I'll cover the behind and up-to-date cases against the existing fixtures in test_catalog_curation.py and document the flag.

  2. kstonekuan commented on Aug 20, 2026

    @kstonekuan
    ContributorAuthor

    Yours, @chiruu12, assigned. The plan: store_true on the stale subparser, return 1 from _command_stale only when the flag is set and at least one stale episode printed, default exit code unchanged so the xargs pipe in docs/CATALOG.md keeps working.

  3. kstonekuan commented on Aug 21, 2026

    @kstonekuan
    ContributorAuthor

    Heads-up @chiruu12: #30 is still yours, but someone else opened a pull request for it (#76, now closed since you have the assignment). No pressure and no deadline, I just wanted you to know there is interest, in case you would rather hand it off than hold it.

    If you have hit a snag, say so here and I will help. If you would rather do something else, that is completely fine too, just let me know and I will unassign so it goes back in the pool.

  4. chiruu12 commented on Aug 21, 2026

    @chiruu12
    Contributor

    Thanks @kstonekuan, and thanks for handling #76 the way you did.

    No snag, I want to keep it. The reason there was no PR yet is that I wanted the change verified rather than just written. The flag itself is a few lines, but the part worth getting right is that the default path stays exactly what it was, since docs/CATALOG.md pipes stale into xargs hflow ingest and a changed exit code there breaks that quietly. So I checked the new tests fail on current main with unrecognized arguments: --exit-code before checking they pass on the change, and I ran the whole suite on main as well as on the branch so the comparison is against a measured base rather than an assumed one.

    PR is up now: #81

    Local run on macOS with uv sync --locked --all-extras:

    • uv run pytest -q tests/test_catalog_curation.py -k cli_stale, 4 passed
    • uv run pytest -q, 301 passed, 5 failed, 6 skipped. The same 5 fail on unmodified main on this host, all ffmpeg related, and base sits at 299 passed, so the change adds two and moves nothing else
    • uv run ruff check and uv run ruff format --check, clean
    • uv run ty check, clean
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