Skip to content

Numeric guards leak OverflowError for very large inputs #739

Closed

Description

@kstonekuan

Problem

The shared numeric guards can raise an unlabelled OverflowError while checking caller input. On main at 7d202bc:

from fractions import Fraction
from hflow.batching import plan_batches
from hflow.transform import TransformConfig

TransformConfig(gop_seconds=10**400)
# OverflowError: int too large to convert to float

plan_batches({'item': 1}, batch_count=1, stagger_interval_s=Fraction(10**400, 1))
# OverflowError: integer division result too large for a float

src/hflow/_field_guards.py:67 and :91 pass these values to math.isfinite, which converts them to float. Other invalid values already raise ValueError naming the field.

Done when

  • Values too large for the floating-point check raise a field-specific ValueError at both public entry points, including a large integer and a large Fraction.
  • Valid integer, float, and Fraction inputs keep their existing behavior, including exact fractional batch delays.
  • Extend the boundary tests in tests/test_batching.py:129 and the transform settings tests. The existing guards in src/hflow/_field_guards.py show the error-message pattern.

Validation

uv sync --locked
uv run ruff check --fix
uv run ruff format
uv run ty check
uv run pytest -q

Activity

  1. yoveneim commented on Oct 27, 2026

    @yoveneim
    Contributor

    Hi , I would like to work on this one .

  2. kstonekuan commented on Oct 27, 2026

    @kstonekuan
    ContributorAuthor

    thanks, assigned

  3. added a commit that references this issue on Nov 5, 2026
    0369048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions