You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Schema.toArbitrary throws fc.float constraints.min must be a 32-bit float for numeric refinements with non-float32-representable bounds (v3 regression) #7419
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