Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hflow/curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ def stale_episodes(
comparison. Feed each result's ``source_uri`` back into ingestion
(``hflow ingest`` / ``app.process``) to reprocess it.
"""
if not pipeline_version.strip():
# A blank version differs from every cataloged one, so it would
# report the whole corpus as stale and queue all of it for re-ingest.
raise ValueError("pipeline_version must not be blank")
connection = open_catalog_connection(catalog_root)
try:
predicate = "pipeline_version IS DISTINCT FROM ?"
Expand Down
38 changes: 38 additions & 0 deletions tests/test_catalog_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,44 @@ def test_cli_stale_prints_source_uris_for_ingest(
assert "1 episode(s)" in captured.err


@pytest.mark.parametrize("blank_version", ["", " "])
def test_cli_stale_rejects_a_blank_pipeline_version(
tmp_path: Path, capsys: pytest.CaptureFixture[str], blank_version: str
) -> None:
catalog = Catalog(tmp_path / "catalog")
catalog.append_episode(
canonical_path=write_fake_canonical(tmp_path),
stamps=FAKE_STAMPS,
episode_metadata={},
check_rows=[],
source_uri="episodes-in/run_0001.mcap",
)
exit_code = cli_main(
[
"stale",
"--catalog",
str(tmp_path / "catalog"),
"--pipeline-version",
blank_version,
]
)
assert exit_code == 2
captured = capsys.readouterr()
# A blank version differs from every cataloged one, so it would list the
# whole corpus for re-ingest. Nothing pipeable may reach stdout.
assert captured.out == ""
assert "pipeline_version must not be blank" in captured.err


@pytest.mark.parametrize("blank_version", ["", " "])
def test_stale_episodes_rejects_a_blank_pipeline_version(
tmp_path: Path, blank_version: str
) -> None:
Catalog(tmp_path / "catalog")
with pytest.raises(ValueError, match="pipeline_version must not be blank"):
hflow.stale_episodes(tmp_path / "catalog", pipeline_version=blank_version)


def test_cli_stale_rejects_pipeline_and_pipeline_version_together(
tmp_path: Path, capsys: pytest.CaptureFixture[str]
) -> None:
Expand Down