Skip to content

Schema.toArbitrary throws fc.float constraints.min must be a 32-bit float for numeric refinements with non-float32-representable bounds (v3 regression) #7419

Closed

Description

@notprolands

What version of Effect is running?

[email protected]

What steps can reproduce the bug?

import { Schema } from "effect"
import { FastCheck } from "effect/testing"

const S = Schema.Number.check(Schema.isGreaterThan(0.1))
FastCheck.sample(Schema.toArbitrary(S)(FastCheck), 3)

Any bounded numeric refinement whose bound is not exactly representable as a 32-bit float (0.1, 99.9, ...) triggers it. The constraint values reach fast-check in toFloatConstraints (packages/effect/src/internal/schema/toArbitrary.ts, ~L312-329), which passes the refinement's minimum/maximum into fc.float's min/max; fast-check validates those as 32-bit floats.

What is the expected behavior?

Sampling succeeds and draws numbers satisfying the refinement.

What do you see instead?

The derived arbitrary throws at first sample:

Error: fc.float constraints.min must be a 32-bit float - you can convert any double to a 32-bit float by using `Math.fround(myDouble)`

Additional information

Seems a regression from v3: [email protected] applies Math.fround to numeric bounds before passing them to fc.float (packages/effect/src/Arbitrary.ts:114-121, in makeNumberConstraints), handling that was originally introduced for this exact failure in the predecessor schema repo (commit 6b48589, "Arbitrary: use Math.fround when creating number constraints, closes #484"). The v4 toArbitrary rewrite does not carry it.

Im aware that draft PR #7254 (Native Arbitraries) removes Schema.toArbitrary and this code path entirely; filing since it is unmerged and the crash affects current rc users.

Activity

  1. added
    bug
    on Aug 23, 2026
  2. self-assigned this
    on Aug 23, 2026
  3. linked a pull request that will close this issueNative Arbitraries #7254on Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions