Skip to content

chore: migrate to Effect v4 - #16

Closed
antonin-morel-spiko wants to merge 1 commit into
mainfrom
chore/effect-v4
Closed

antonin-morel-spiko wants to merge 1 commit into
mainfrom
chore/effect-v4

Conversation

@antonin-morel-spiko

@antonin-morel-spiko antonin-morel-spiko commented Sep 26, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Migrates the library, tests and docs to Effect v4 (effect@4.0.0-rc.117), following the effect-v3-to-v4 migration reference.

The example app migration is stacked in #17, to merge after 2.0.0 is published.

Breaking change

v4 removed Runtime.Runtime<R>. The runtime option now accepts a Context.Context<R> or a ManagedRuntime. A major changeset is included.

Library

  • Runner dispatch: Context.isContext → Effect.runPromiseExitWith(context), otherwise runtime.runPromiseExit.
  • Cancellation: dropped the hand-rolled raceFirst + Effect.async abort race and pass { signal } to the run functions (v4 interrupts the fiber on abort, including an already-aborted signal).
  • Cause.isInterruptedOnly → Cause.hasInterruptsOnly.
  • Peer dependency: effect@^4.0.0-rc.117.

Tests / docs

  • Context.Tag → Context.Service, Layer.toRuntime → Layer.build, Schema.Record(key, value).

Copilot AI lite review requested due to automatic review settings September 26, 2026 10:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The example lockfile is stale relative to its manifest, and documentation still contains removed v3 runtime references.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Migrates the library, tests, documentation, and example application from Effect v3 to v4.

Changes:

  • Replaces runtime APIs with Context/ManagedRuntime.
  • Updates cancellation and error handling.
  • Migrates example HTTP APIs and dependencies.
  • Adds a major-release changeset.
File Description
test/​useInfiniteEffectSuspenseQuery.test.ts Updates infinite suspense query tests for Effect v4.
test/​useInfiniteEffectQuery.test.ts Updates infinite query tests for Effect v4.
test/​useEffectSuspenseQuery.test.ts Updates suspense query tests.
test/​useEffectSuspenseQueries.test.ts Updates suspense batch query tests.
test/​useEffectQuery.test.ts Updates query tests.
test/​useEffectQueries.test.ts Updates multi-query tests.
test/​useEffectMutation.test.ts Updates mutation tests.
test/​toQueryOptions.test.ts Migrates query option test fixtures.
test/​infiniteEffectQueryOptions.test.ts Migrates infinite query option tests.
test/​effectQueryOptions.test.ts Migrates query option tests.
src/​useInfiniteEffectSuspenseQuery.ts Updates infinite suspense runtime types.
src/​useInfiniteEffectQuery.ts Updates infinite query runtime types.
src/​useEffectSuspenseQuery.ts Updates suspense query runtime types.
src/​useEffectSuspenseQueries.ts Updates suspense batch runtime types.
src/​useEffectQuery.ts Updates query runtime types.
src/​useEffectQueries.ts Updates multi-query runtime types.
src/​useEffectMutation.ts Migrates mutation runtime handling.
src/​types.ts Updates public runtime option types.
src/​internal/​createEffectQueryFn.ts Updates runtime execution and cancellation.
pnpm-lock.yaml Locks Effect v4 dependencies.
package.json Updates the Effect peer dependency.
example/​src/​client.ts Migrates HTTP client imports.
example/​src/​backend.ts Migrates server setup.
example/​src/​App.tsx Updates v4 error handling.
example/​src/​api.ts Migrates HTTP API definitions.
example/​package.json Updates example dependencies.
docs/​index.md Updates dependency-injection documentation.
bun.lock Updates dependency metadata.
.changeset/​effect-v4.md Adds the major-release changeset.
Files not reviewed (1)
  • pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread example/package.json Outdated
Comment thread docs/index.md
- runtime option accepts Context.Context<R> or ManagedRuntime (Runtime.Runtime removed in v4)
- use native RunOptions signal for cancellation instead of a raceFirst/async abort race
- migrate tests (Context.Service, Layer.build, Schema.Record) and docs
- use test variables flagged as unused by lint
@antonin-morel-spiko

Copy link
Copy Markdown
Collaborator Author

Upgrade to stable version in #18 instead of release candidate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants