The best way to control Claude Code, Codex and more from any computer or phone

main
md 245 KB

@effect/vitest

4.1.2

Patch Changes

4.1.1

Patch Changes

4.1.0

Patch Changes

4.0.7

Patch Changes

4.0.6

Patch Changes

4.0.5

Patch Changes

4.0.4

Patch Changes

4.0.3

Patch Changes

4.0.2

Patch Changes

4.0.1

Patch Changes

4.0.0

Patch Changes

  • #8633 2c552f2 Thanks @IMax153! - Effect 4.0 is the first stable release of Effect v4. It replaces the 4.0.0 beta and release-candidate series, whose per-release notes remain below under the 4.0.0-beta.* and 4.0.0-rc.* headings. To upgrade from Effect 3, follow the migration guide.

Packaging and versioning

  • All Effect packages share one version number and are released together. Use the same version of effect and every @effect/* package.
  • @effect/platform, @effect/rpc, @effect/cluster, @effect/cli, @effect/ai, @effect/sql, @effect/workflow, @effect/experimental and similar packages are merged into effect. Separate packages remain only for platforms (@effect/platform-*), SQL drivers (@effect/sql-*), AI providers (@effect/ai-*), framework bindings (@effect/atom-*), OpenTelemetry, Vitest and tooling.
  • Modules such as effect/http, effect/http-api, effect/rpc, effect/cluster, effect/workflow, effect/ai, effect/cli, effect/sql and effect/schema import from effect/<area>. APIs tagged @stability unstable may have breaking changes in minor releases. APIs without a stability tag follow semver.
  • APIs that expose a third-party dependency are tagged @stability unstable, because that dependency's releases can change them. This covers NodeRedis, DenoRedis, BunRedis, @effect/platform-node/Undici and the undici dispatcher APIs, the ws options and re-exports in the platform packages, driver-specific options and clients in @effect/sql-clickhouse, @effect/sql-d1, @effect/sql-libsql, @effect/sql-mssql, @effect/sql-mysql2, @effect/sql-pglite and @effect/sql-sqlite-do, the provider clients, models and generated schemas in the @effect/ai-* packages, @effect/opentelemetry, and the vitest re-export in @effect/vitest.
  • effect has no runtime dependencies.
  • New packages in v4: @effect/platform-deno, @effect/sql-pglite, @effect/ai-openai-compat, @effect/ai-typesafe, @effect/atom-react, @effect/atom-solid, @effect/atom-vue, @effect/openapi-generator and @effect/doctest. @effect/docgen now lives in this repository.

Core

  • The fiber runtime was rewritten for lower memory use and faster execution, with smaller bundles and better tree-shaking.
  • Services are defined with Context.Service, FiberRef is replaced by Context.Reference, Cause has a flat structure, and many combinators were renamed. See the migration guide for the full list.
  • Software transactional memory is built into Effect.tx, with TxRef, TxQueue, TxHashMap, TxPubSub, TxSemaphore and related Tx* data types.
  • Clock separates wall-clock time from monotonic time.
  • New modules include Semaphore, Latch, LayerRef, ErrorReporter, ByteSize, Newtype and Crypto. Arbitrary is now a native property-based testing module and no longer depends on fast-check.

Schema

  • Schema v4 is a new implementation with faster parsing, class-based schemas, make constructors on every schema, and effectful decoding with services.
  • SchemaRepresentation powers JSON Schema (Draft-04, Draft-07, 2020-12 and OpenAPI 3.0/3.1) import and export, TypeScript code generation, and AI structured output.
  • SchemaBinary provides a compact binary codec and is the default wire format for cluster transports.
  • Optional JIT and AOT schema compilers are available as experimental modules.

Platform, HTTP and RPC

  • HttpApi supports typed response headers, streaming and SSE responses, the HTTP QUERY method, HttpApiTest for in-memory testing, and much faster type checking for large APIs.
  • The HTTP modules add static file serving, response compression, rate-limited clients and graceful server shutdown.
  • Socket has a pull-based reader with backpressure and STARTTLS support. Network addresses are modeled by effect/net.
  • RPC serialization is schema-aware and supports server-originated requests and notifications.
  • @effect/platform-deno adds full Deno support. The Node, Bun, Deno and browser packages all provide the platform Crypto service, and the browser package adds IndexedDB support.

Cluster and Workflow

  • Workflows can be declared with class syntax, and DurableQueue and an in-memory WorkflowEngine are available.
  • Runner memory can be bounded with ShardingConfig limits. Shutdown, entity movement and persisted replies are more reliable.

SQL

  • @effect/sql-pg uses a built-in PostgreSQL client with pipelining, prepared statements and binary codecs, and no longer depends on pg.
  • @effect/sql-sqlite-node uses Node's built-in node:sqlite and requires Node 22.16 or newer.
  • SqlError exposes structured reasons such as UniqueViolation.

AI

  • effect/ai adds EmbeddingModel, the DecisionModel classification and rating API, dynamic tools and tool approvals.
  • The MCP server supports protocol versions 2024-11-05 through 2026-07-28, including elicitation, sampling with tools, resource subscriptions and typed tool output.
  • Provider packages cover Anthropic, OpenAI, OpenAI-compatible APIs and OpenRouter.

CLI, Atom, observability and testing

  • effect/cli adds global flags, command aliases and examples, an interactive wizard mode, and shell completions for Bash, Zsh and Fish.
  • effect/reactivity and the @effect/atom-* bindings add SSR hydration, stale-while-revalidate atoms and serializable RPC and HttpApi queries.
  • The OTLP exporters can be configured with standard OpenTelemetry environment variables, and @effect/opentelemetry aligns logs and spans with the OpenTelemetry specification.
  • @effect/vitest runs property tests with the native Arbitrary module and supports Vitest fixtures.

Requirements

4.0.0-rc.118

Patch Changes

  • #8354 1b4461e Thanks @tim-smart! - Move unstable modules from effect/unstable/* to effect/* and remove the old export paths. Drop the unstable segment from imports. These APIs remain @stability unstable.

Move Arbitrary to the top level and update @effect/vitest to use the new entrypoint. Replace imports from effect/arbitrary or effect/arbitrary/Arbitrary with import { Arbitrary } from "effect" or import * as Arbitrary from "effect/Arbitrary".

4.0.0-rc.117

Patch Changes

4.0.0-rc.116

Patch Changes

4.0.0-rc.115

Patch Changes

4.0.0-rc.114

Patch Changes

4.0.0-rc.113

Patch Changes

  • #7254 a63dcbf Thanks @gcanti! - Add the experimental Schema-first effect/unstable/arbitrary/Arbitrary module for native generation without fast-check. Arbitrary.schema derives an opaque arbitrary from the decoded Schema Type, Arbitrary.sampleEffect provides interruptible sampling with typed exhaustion, and Arbitrary.checkEffect returns structured property results. The initial implementation supports bounded discards, shrinking, replay, and recursive and mutually recursive Schemas. SampleError and Exhausted include the effective seed so discarded runs remain reproducible even when the caller did not provide one. Arbitrary.isArbitrary identifies values through the module's nominal protocol. Numeric constraints retain NaN when it is accepted by their supported Order.Number bounds. Union derivation validates oneOf exclusivity and isolates lazy cross-member shrinking from unrelated random generation. Object derivation keeps optional-property selection constructive when candidate fields have different recursive costs. Struct, Record, JSON-object, and record-shaped Arbitrary.all outputs periodically use a null prototype as an edge case, preserving that prototype throughout shrinking and replay without perturbing structural PRNG choices. The change adds 0.01–0.03 KB gzip to representative Arbitrary fixtures and leaves production-only bundle sentinels unchanged.

Add Arbitrary.map, Arbitrary.flatMap, Arbitrary.filter, Arbitrary.filterMap, and Arbitrary.all for composing derived Arbitraries without exposing a second catalog of primitive constructors. Filtering remains bounded and promotes valid shrink descendants through rejected nodes. maxShrinks bounds every inspected shrink candidate, including candidates rejected before property evaluation, while retaining the best shrunk input found when the budget is exhausted. flatMap provides deterministic dependent generation, source-first shrinking, post-source PRNG checkpoints, and one shared residual recursion budget. all combines tuples, iterables, and records with a shared budget, randomized internal generation order, stable output shape, and independent member shrinking. Arbitrary values implement Pipeable for composition with data-last combinators.

Add the experimental Schema arbitraryConstraint and toCodecArbitrary annotations and their Schema.Annotations.ToArbitrary types. Declarations can provide a Schema Link optimized for generation, while filters can contribute native semantic constraints. The callback receives decoded type parameters and normalized constraints. The compiler owns efficient representations for common built-ins, including JSON, RegExp, URL, Date, byte arrays, ReadonlyMap, and ReadonlySet. Effect-specific HashMap, HashSet, Chunk, Graph, BigDecimal, and date-time declarations keep local generation Links, while declarations with productive canonical codecs require no arbitrary-specific annotation. Schema.isUniqueKey provides key-based Map uniqueness for explicit array representations.

The same ownership policy applies to formatter and equivalence derivation: implementations for common declarations live in their compiler, while domain-specific and dynamically constructed declarations retain local annotations. Declarations whose intrinsic Equal implementation already matches their Schema equivalence need no annotation or compiler special case. This keeps unused common callbacks out of production Schema bundles.

Against the previous layout, schema-toArbitrary decreases from 36.68 KB to 33.24 KB gzip and arbitrary-combinators decreases from 37.16 KB to 33.70 KB. schema-toFormatter increases from 18.92 KB to 19.49 KB and schema-toEquivalence increases from 19.05 KB to 19.39 KB because callers that explicitly derive these capabilities now retain the common declaration handlers. Generic production fixtures remain unchanged; an equivalence-specific production fixture using common declarations decreases from 20.75 KB to 20.48 KB, while declarations whose intrinsic equality is sufficient decrease from 23.42 KB to 23.34 KB. An Arbitrary-specific production fixture using common declarations decreases from 20.35 KB to 19.61 KB, while one using the locally annotated BigDecimal and date-time declarations increases from 18.34 KB to 23.01 KB. The complete 31-scenario native Arbitrary comparison reports no statistically classified runtime regression; the five moved BigDecimal and date-time scenarios remain within measurement noise.

Add SchemaGetter.forbiddenEncoding, a reusable getter for the encode side of decode-only Schema transformations.

Remove the fast-check bridge from the effect package, including Schema.toArbitrary and effect/testing/FastCheck. Replace the legacy Schema.Annotations.ToArbitrary callback contract with the native Schema-first types. The effect package no longer depends on fast-check.

Migrate TestSchema.Asserts.verifyLosslessTransformation and TestSchema.Asserts.arbitrary().verifyGeneration to the native runner. Both methods now accept native check options directly, bound unsuccessful generation, and include the shrunk input and replay token in property failures.

Use the Arbitrary runner for all @effect/vitest property tests. Property inputs may combine Schemas and Arbitraries, and are composed directly with Arbitrary.all; check options are available through arbitrary. Raw fast-check arbitraries and the fastCheck options object are no longer supported. As with the previous fast-check adapter, thrown exceptions, defects, and typed failures from a property are shrinkable falsifications; Effect interruption remains an interruption.

Optimize constructive regular-expression generation by caching feasible lengths on the compiled pattern, computing sequence-suffix feasibility once, and precomputing character-class metadata. Seeded generation, shrinking, and replay remain unchanged.

Optimize BigDecimal.Order and BigDecimal.Equivalence with a shared hybrid comparator. Ordinary scale differences use cached, bounded coefficient alignment, while large differences are compared without materializing their decimal zeroes. BigDecimal.make now rejects scales that are not safe integers.

Before its removal, the materialized fast-check bridge fixture schema-toArbitrary-materialized-fast-check.ts measured 79.00 KB minified and gzipped.

Representative runtime measurements against corresponding hand-written fast-check 4.9.0 arbitraries are shown below. Values are median latency on Node 24.12.0 and Apple M3; lower is better. Both implementations validate the same output domains, although their generation distributions are not identical. Native speedup is fast-check latency divided by Native latency, so higher is better.

| Scenario | fast-check | Native | Native speedup | | ----------------------------------- | ---------: | ------: | -------------: | | 32 recursive samples | 150 µs | 103 µs | 1.45x | | 128 optional Struct samples | 244 µs | 86.0 µs | 2.84x | | 128 constrained strings | 742 µs | 49.7 µs | 14.86x | | RegExp derivation and first sample | 13.4 ms | 30.8 µs | 429.02x | | 64 RegExp strings | 595 µs | 919 µs | 0.64x | | RegExp failure and shrinking | 168 µs | 88.2 µs | 1.91x | | 128 bounded numbers | 68.9 µs | 21.8 µs | 3.18x | | 128 Uint8Array samples | 98.3 µs | 74.4 µs | 1.32x | | 128 BigDecimal samples | 66.6 µs | 56.3 µs | 1.18x | | 128 DateTime.Utc samples | 71.2 µs | 50.5 µs | 1.42x | | 128 named time zones | 52.2 µs | 27.9 µs | 1.85x | | 128 time zones | 63.7 µs | 33.8 µs | 1.89x | | 128 zoned date-times | 130 µs | 112 µs | 1.16x | | 32 samples through Schema filter | 65.9 µs | 49.4 µs | 1.33x | | 32 unique arrays | 156 µs | 132 µs | 1.18x | | 128 literal samples | 40.0 µs | 3.70 µs | 10.78x | | 128 mapped samples | 59.0 µs | 14.1 µs | 4.21x | | 128 samples through passing filter | 58.9 µs | 13.9 µs | 4.23x | | 32 samples through selective filter | 66.1 µs | 42.9 µs | 1.54x | | 128 filterMap samples | 75.7 µs | 31.5 µs | 2.40x | | Filtered failure and shrinking | 12.7 µs | 7.71 µs | 1.66x | | 128 all tuple samples | 43.5 µs | 18.5 µs | 2.35x | | 128 all record samples | 81.0 µs | 30.4 µs | 2.66x | | 128 dependent flatMap samples | 125 µs | 67.2 µs | 1.86x | | flatMap failure and shrinking | 20.1 µs | 6.71 µs | 2.99x | | Replay flatMap shrink path | 14.3 µs | 6.57 µs | 2.17x | | Passing property, 100 runs | 42.3 µs | 27.1 µs | 1.56x | | TestSchema, 100 generations | 44.5 µs | 35.9 µs | 1.24x | | First failure plus one shrink | 8.77 µs | 1.30 µs | 6.75x | | Replay recorded failure | 6.35 µs | 1.19 µs | 5.36x |

Cold recursive derivation is not included because the native fixture constructs and compiles a Schema, while the fast-check fixture constructs a hand-written arbitrary; it is not a like-for-like warm-generator comparison.

Add a guide for the native module and a migration guide from the fast-check bridge published in effect@4.0.0-rc.109.

  • #8154 3993340 Thanks @tim-smart! - Await asynchronous test and layer finalizers after an Effect test times out before starting the next test.

  • #8104 e9915d5 Thanks @tim-smart! - Require Vitest >=5.0.0 <6.0.0 and Node.js ^22.12.0 || ^24.0.0 || >=26.0.0.

### Breaking changes

  • Replace .sequential and { sequential: true } with { concurrent: false }.
  • Use bench from the test context and await bench(name, fn).run(). The top-level benchmark API is removed.
  • Use Assertion<void, T> or Assertion<Promise<void>, T>. Define custom matchers through vitest.Matchers, not @vitest/expect.
  • Import reporter types from vitest/node and environment/snapshot APIs from vitest/runtime. Set outputFile when consuming JSON reports.
  • Await asynchronous assertions. Mock history now clears before each test.

See the Vitest migration guide for removed types and other upstream changes.

4.0.0-rc.112

Patch Changes

4.0.0-rc.111

Patch Changes

4.0.0-rc.110

Patch Changes

4.0.0-rc.109

Patch Changes

4.0.0-rc.108

Patch Changes

4.0.0-beta.107

Patch Changes

4.0.0-beta.106

Patch Changes

4.0.0-beta.105

Patch Changes

4.0.0-beta.104

Patch Changes

4.0.0-beta.103

Minor Changes

  • #6668 83c7497 Thanks @tim-smart! - Require Vitest 4.1 or later and read suite state from TestRunner, removing the direct @vitest/runner import and support for Vitest 3 and 4.0.

Patch Changes

4.0.0-beta.102

Patch Changes

4.0.0-beta.101

Patch Changes

4.0.0-beta.100

Patch Changes

4.0.0-beta.99

Patch Changes

4.0.0-beta.98

Patch Changes

4.0.0-beta.97

Patch Changes

4.0.0-beta.96

Patch Changes

4.0.0-beta.95

Patch Changes

4.0.0-beta.94

Patch Changes

4.0.0-beta.93

Patch Changes

4.0.0-beta.92

Patch Changes

4.0.0-beta.91

Patch Changes

4.0.0-beta.90

Patch Changes

4.0.0-beta.89

Patch Changes

4.0.0-beta.88

Patch Changes

4.0.0-beta.87

Patch Changes

4.0.0-beta.86

Patch Changes

4.0.0-beta.85

Patch Changes

4.0.0-beta.84

Patch Changes

4.0.0-beta.83

Patch Changes

4.0.0-beta.82

Patch Changes

4.0.0-beta.81

Patch Changes

4.0.0-beta.80

Patch Changes

4.0.0-beta.79

Patch Changes

4.0.0-beta.78

Patch Changes

4.0.0-beta.77

Patch Changes

4.0.0-beta.76

Patch Changes

4.0.0-beta.75

Patch Changes

4.0.0-beta.74

Patch Changes

4.0.0-beta.73

Patch Changes

4.0.0-beta.72

Patch Changes

4.0.0-beta.71

Patch Changes

4.0.0-beta.70

Patch Changes

4.0.0-beta.69

Patch Changes

4.0.0-beta.68

Patch Changes

4.0.0-beta.67

Patch Changes

4.0.0-beta.66

Patch Changes

4.0.0-beta.65

Patch Changes

4.0.0-beta.64

Patch Changes

4.0.0-beta.63

Patch Changes

4.0.0-beta.62

Patch Changes

4.0.0-beta.61

Patch Changes

4.0.0-beta.60

Patch Changes

4.0.0-beta.59

Patch Changes

4.0.0-beta.58

Patch Changes

4.0.0-beta.57

Patch Changes

4.0.0-beta.56

Patch Changes

4.0.0-beta.55

Patch Changes

4.0.0-beta.54

Patch Changes

4.0.0-beta.53

Patch Changes

4.0.0-beta.52

Patch Changes

4.0.0-beta.51

Patch Changes

4.0.0-beta.50

Patch Changes

4.0.0-beta.49

Patch Changes

4.0.0-beta.48

Patch Changes

4.0.0-beta.47

Patch Changes

4.0.0-beta.46

Patch Changes

4.0.0-beta.45

Patch Changes

4.0.0-beta.44

Patch Changes

4.0.0-beta.43

Patch Changes

4.0.0-beta.42

Patch Changes

4.0.0-beta.41

Patch Changes

4.0.0-beta.40

Patch Changes

4.0.0-beta.39

Patch Changes

4.0.0-beta.38

Patch Changes

4.0.0-beta.37

Patch Changes

4.0.0-beta.36

Patch Changes

4.0.0-beta.35

Patch Changes

4.0.0-beta.34

Patch Changes

4.0.0-beta.33

Patch Changes

4.0.0-beta.32

Patch Changes

4.0.0-beta.31

Patch Changes

4.0.0-beta.30

Patch Changes

4.0.0-beta.29

Patch Changes

4.0.0-beta.28

Patch Changes

4.0.0-beta.27

Patch Changes

4.0.0-beta.26

Patch Changes

4.0.0-beta.25

Patch Changes

4.0.0-beta.24

Patch Changes

4.0.0-beta.23

Patch Changes

4.0.0-beta.22

Patch Changes

4.0.0-beta.21

Patch Changes

4.0.0-beta.20

Patch Changes

4.0.0-beta.19

Patch Changes

4.0.0-beta.18

Patch Changes

4.0.0-beta.17

Patch Changes

4.0.0-beta.16

Patch Changes

4.0.0-beta.15

Patch Changes

4.0.0-beta.14

Patch Changes

4.0.0-beta.13

Patch Changes

4.0.0-beta.12

Patch Changes

4.0.0-beta.11

Patch Changes

4.0.0-beta.10

Patch Changes

4.0.0-beta.9

Patch Changes

4.0.0-beta.8

Patch Changes

4.0.0-beta.7

Patch Changes

4.0.0-beta.6

Patch Changes

4.0.0-beta.5

Patch Changes

4.0.0-beta.4

Patch Changes

4.0.0-beta.3

Patch Changes

4.0.0-beta.2

Patch Changes

4.0.0-beta.1

Patch Changes

4.0.0-beta.0

Major Changes

Patch Changes