Skip to content

fix: validate camera FPS thresholds - #492

Merged
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
MehulNegi:fix/484-camera-fps-validation
Sep 10, 2026
Merged

fix: validate camera FPS thresholds#492
kstonekuan merged 2 commits into
Hebbian-Robotics:mainfrom
MehulNegi:fix/484-camera-fps-validation

Conversation

@MehulNegi

Copy link
Copy Markdown
Contributor

Summary

camera_fps_conformance now validates both max_plausible_fps and downsample_tolerance_fps before processing an episode. Invalid boolean, non-finite, and out-of-range values now raise a clear ValueError.

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_conformance and 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 passed

  • uv run ruff check — passed

  • uv run ruff format --check — passed

  • uv run ty check — passed

  • uv run pytest tests/test_checks.py -k invalid_thresholds -q — passed

  • uv run pytest -q — 1691 passed, 28 failed, 11 skipped

    • The 28 failures are unrelated existing environment/platform failures in packaging tests and the ffmpeg end-to-end test.

Checklist

  • I added or updated outcome-focused tests for changed business logic.
  • I updated documentation for changed behavior, flags, formats, or requirements.
  • I ran uv run ruff check --fix, uv run ruff format, and uv run ty check.
  • I ran the relevant pytest suite.
  • I did not add recordings, generated media, credentials, private URLs, or runtime artifacts.
  • I preserved stored-data compatibility or documented an explicit version change.

@github-actions

Copy link
Copy Markdown

👋 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.

@kstonekuan kstonekuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kstonekuan
kstonekuan merged commit 1a23159 into Hebbian-Robotics:main Sep 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants