fix: validate camera FPS thresholds - #492
Conversation
|
👋 Hi @MehulNegi — thank you so much for your first contribution to HFlow! A maintainer will review your pull request as soon as possible. In the meantime:
💡 Tip: one open pull request per contributor at a time. Issues with an assignee are taken; everything else is fair game. We are excited to have you here and appreciate your help making the project better! 🙌 |
Tightening downsample_tolerance_fps from >= 0 to > 0 went unnoticed by every existing case, so the decision the issue asked to be argued was silent in the code and in the tests. Zero tolerance asks for an exact rate match, which is meaningful, so the two parameters take different bars and both are pinned now. Also pins a fractional threshold, which is what the int to float widening in this PR is for: 29.97 and 23.976 are real camera rates.
There was a problem hiding this comment.
LGTM, merging.
Pushed one commit pinning two decisions the PR left silent. Zero downsample_tolerance_fps is allowed and a zero plausibility ceiling is not, so the two parameters take different bars; tightening it went unnoticed by all 81 tests. And the int to float widening is right because 29.97 and 23.976 are real rates.
Your 28 failures are environment, not branch. Zero here.
Summary
camera_fps_conformancenow validates bothmax_plausible_fpsanddownsample_tolerance_fpsbefore processing an episode. Invalid boolean, non-finite, and out-of-range values now raise a clearValueError.Why
Previously, both threshold parameters accepted invalid values such as
True, negative values,NaN, and infinity. This could lead to incorrect FPS classification or silently bypass validation, especially for episodes without cameras.This change adds parameter validation at the start of
camera_fps_conformanceand adds regression coverage using a camera-less episode. No valid-argument behavior is changed.Validation
uv run pytest tests/test_checks.py -k "fps_conformance or invalid_thresholds" -q— 2 passeduv run ruff check— passeduv run ruff format --check— passeduv run ty check— passeduv run pytest tests/test_checks.py -k invalid_thresholds -q— passeduv run pytest -q— 1691 passed, 28 failed, 11 skippedChecklist
uv run ruff check --fix,uv run ruff format, anduv run ty check.