fix(curation,dataset): query check_runs_latest in coverage and dataset SQL (#676) - #682
Conversation
…t SQL (Hebbian-Robotics#676) - default_dataset_sql and _collect_coverage now query check_runs_latest instead of append-only check_runs. - A noncritical check that passes and later errors on replay is excluded from the default dataset and withdraws its coverage while retaining the coverage denominator. - Adds regression tests in test_catalog_curation.py and test_dataset.py. - Updates dataset policy and coverage documentation in docs/CATALOG.md and dataset.py docstrings. Closes Hebbian-Robotics#676
|
| f""" | ||
| SELECT check_name, count(DISTINCT episode_id) AS episodes_ran | ||
| FROM check_runs WHERE status IN ({status_list}) | ||
| FROM check_runs_latest WHERE status IN ({status_list}) |
There was a problem hiding this comment.
Failed check disappears from coverage
When a check errors on replay for every episode, check_runs_latest has no result that counts as “ran” for that check. This query drops the check entirely, so the report says “no check runs recorded” instead of showing 0/N. Keep checks with zero coverage in the report so teams can see the loss of evidence.
Knowledge Base Used: Datasets, catalog, and curation
Summary
Fixes #676
As identified in #676 and confirmed by maintainer guidance in #676 (comment):
default_dataset_sqlinsrc/hflow/dataset.py:231and_collect_coverageinsrc/hflow/curation.py:752were querying the append-onlycheck_runstable instead ofcheck_runs_latest.default_dataset_sqland falsely retain its coverage.Changes
src/hflow/curation.py: Switched query toFROM check_runs_latestin_collect_coverage.src/hflow/dataset.py: Switched query toFROM check_runs_latestindefault_dataset_sql.docs/CATALOG.md(dataset policy and coverage sections).default_dataset_sqldocstrings insrc/hflow/dataset.pyto clarify latest-run rules.tests/test_dataset.py: Addedtest_a_check_that_errors_on_replay_excludes_its_episodeconfirming that a noncritical check replay error excludes the episode fromdefault_dataset_sqlwhile episode status remainsok.tests/test_catalog_curation.py: Addedtest_a_check_that_errors_on_replay_loses_coverageon a 2-episode corpus, demonstrating that when a check errors on replay for one episode, its coverage decreases from 2/2 (100%) to 1/2 (50%) while cleanly preserving the total coverage denominator.All test suites and ruff formatting/lint checks pass cleanly.