unthrown icon indicating copy to clipboard operation
unthrown copied to clipboard

fix(core): qualify and constrain fromNullable absence callbacks

Open btravers opened this issue 1 month ago • 0 comments

Problem

fromNullable directly calls onAbsent outside a boundary. A throwing absence factory escapes instead of returning Defect. An async absence factory compiles as Result<never, Promise>, becomes Err(Promise), and fires an unhandled rejection. Runtime and strict TypeScript reproductions confirmed all three behaviors in 5.12.0.

Locations

packages/core/src/interop.ts: fromNullable

Acceptance

Capture absence-factory throws as Defects and reject thenable callback returns at compile time and runtime. Preserve laziness and behavior for null, undefined and present falsy values. Add runtime and negative type tests.

Found in the deep audit of accounting, btravstack 0.29.0 and unthrown 5.12.0.

btravers avatar Oct 11 '26 23:10 btravers