Skip to content

build: migrate effect v3 → v4 (beta.103) - #747

Open
ryanbas21 wants to merge 2 commits into
mainfrom
chore/effect-v4-migration
Open

build: migrate effect v3 → v4 (beta.103)#747
ryanbas21 wants to merge 2 commits into
mainfrom
chore/effect-v4-migration

Conversation

@ryanbas21

@ryanbas21 ryanbas21 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the entire SDK from effect@^3.20 (v3) to effect@4.0.0-beta.103 (v4 beta).

Changes by package

pnpm-workspace.yaml (catalog)

  • effect: '4.0.0-beta.103'
  • @effect/vitest: '4.0.0-beta.103'
  • @effect/platform-node: '4.0.0-beta.103'
  • Removed @effect/platform and @effect/cli (consolidated into effect core)
  • Bumped vitest catalog to ^4.1.0

packages/sdk-utilities

  • micro.utils.ts: MicroExit/exitIsFail/exitIsSuccess/causeIsDieExit/Cause; renamed handleMicroExithandleExit
  • config.types/utils/effects/test: EitherResult (succeed/fail/isSuccess/isFailure)

packages/journey-client

  • journey.utils.ts: Either.right/leftResult.succeed/fail
  • client.store.ts: Either.matchResult.match (onFailure/onSuccess)
  • Tests: _tag: 'Right'/'Left''Success'/'Failure'; .right/.left.success/.failure

packages/oidc-client (12 files)

  • All Micro.*Effect.*
  • Cause.failureOptionCause.findErrorOption (returns Option<E>)
  • exitIsFail(exit)Cause.findErrorOption(exit.cause) + Option.isSome
  • Tests: added vi.clearAllMocks() in afterEach to fix accumulated mock call counts

packages/davinci-client (5 files)

  • All Micro.*Effect.*
  • Effect.repeat({while})Effect.gen + manual loop (v4 while receives schedule output type, not effect output)
  • password-policy.rules.ts: Array.filterMap now expects Result callbacks; Option.some/none()Result.succeed/failVoid
  • Context.TagContext.Service

e2e/mock-api-v2 (full migration)

  • All from '@effect/platform'from 'effect/unstable/httpapi'
  • Context.TagContext.Service
  • Effect.ifEffect.suspend(() => bool ? ... : ...)
  • Option.fromNullableOption.fromNullishOr
  • Schema.Union(a, b)Schema.Union([a, b])
  • Schema.Record({key, value})Schema.Record(key, value)
  • Schema.Schema<T, T>Schema.Schema<T>
  • HttpApiMiddleware.TagHttpApiMiddleware.Service<Self, {provides: T}>()
  • Fixed build script: nxBuildbuild

Verification

Check Result
TypeScript build (all packages) ✅ clean
Unit tests ✅ 887/887 (79 test files)
Lint ✅ 0 errors
Prettier ✅ clean
E2E journey-suites (uses mock-api-v2) ✅ 15/15 passed (2 skipped, pre-existing)

Summary by CodeRabbit

  • Bug Fixes

    • Improved polling behavior with more reliable delays, timeout handling, and error reporting.
    • Strengthened authorization, session, token, and user-information error handling.
    • Improved mock API request processing, cookie handling, validation, and response behavior.
  • Improvements

    • Updated public client response types to better represent loading, success, and failure states.
    • Improved configuration and journey response parsing while preserving existing behavior.
  • Tests

    • Expanded and updated coverage for authorization, session, logout, token exchange, polling, and configuration scenarios.

Migrate all packages from effect@^3.20 to effect@4.0.0-beta.103.

Key changes:
- Replace Micro with Effect throughout oidc-client and davinci-client
- Migrate Either to Result in sdk-utilities and journey-client
- Migrate MicroExit/exitIsFail/exitIsSuccess to Exit/Cause API
- Update e2e/mock-api-v2 from @effect/platform to effect/unstable/httpapi
- Bump vitest catalog to ^4.1.0 to match @effect/vitest peer requirement
- Remove consolidated packages: @effect/platform, @effect/cli
- Fix handleMicroExit → handleExit (renamed)
- Add vi.clearAllMocks() to oidc-client afterEach (accumulated mock counts)
@changeset-bot

changeset-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0f15944

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3bf9e131-5861-45d4-9990-1a2fd9280d3a

📥 Commits

Reviewing files that changed from the base of the PR and between d65f42a and 0f15944.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (58)
  • e2e/mock-api-v2/package.json
  • e2e/mock-api-v2/src/handlers/authorize.handler.ts
  • e2e/mock-api-v2/src/handlers/capabilities.handler.ts
  • e2e/mock-api-v2/src/handlers/end-session.handler.ts
  • e2e/mock-api-v2/src/handlers/healthcheck.handler.ts
  • e2e/mock-api-v2/src/handlers/open-id-configuration.handler.ts
  • e2e/mock-api-v2/src/handlers/revoke.handler.ts
  • e2e/mock-api-v2/src/handlers/token.handler.ts
  • e2e/mock-api-v2/src/handlers/userinfo.handler.ts
  • e2e/mock-api-v2/src/helpers/match.ts
  • e2e/mock-api-v2/src/main.ts
  • e2e/mock-api-v2/src/middleware/Authorization.ts
  • e2e/mock-api-v2/src/middleware/CookieMiddleware.ts
  • e2e/mock-api-v2/src/middleware/Session.ts
  • e2e/mock-api-v2/src/schemas/authorize.schema.ts
  • e2e/mock-api-v2/src/schemas/capabilities/capabilities.request.schema.ts
  • e2e/mock-api-v2/src/schemas/capabilities/capabilities.response.schema.ts
  • e2e/mock-api-v2/src/schemas/open-id-configuration/open-id-configuration-response.schema.ts
  • e2e/mock-api-v2/src/schemas/return-success-response-redirect.schema.ts
  • e2e/mock-api-v2/src/schemas/revoke/revoke.schema.ts
  • e2e/mock-api-v2/src/schemas/token/token.schema.ts
  • e2e/mock-api-v2/src/services/mock-env-helpers/index.ts
  • e2e/mock-api-v2/src/services/session.service.ts
  • e2e/mock-api-v2/src/services/tokens.service.ts
  • e2e/mock-api-v2/src/services/userinfo.service.ts
  • e2e/mock-api-v2/src/spec.ts
  • package.json
  • packages/davinci-client/api-report/davinci-client.api.md
  • packages/davinci-client/api-report/davinci-client.types.api.md
  • packages/davinci-client/src/lib/client.store.effects.test.ts
  • packages/davinci-client/src/lib/client.store.effects.ts
  • packages/davinci-client/src/lib/client.store.ts
  • packages/davinci-client/src/lib/fido/fido.ts
  • packages/davinci-client/src/lib/password-policy.rules.ts
  • packages/journey-client/src/lib/client.store.ts
  • packages/journey-client/src/lib/journey.utils.test.ts
  • packages/journey-client/src/lib/journey.utils.ts
  • packages/oidc-client/src/lib/authorize.request.micros.test.ts
  • packages/oidc-client/src/lib/authorize.request.micros.ts
  • packages/oidc-client/src/lib/authorize.request.ts
  • packages/oidc-client/src/lib/authorize.request.utils.test.ts
  • packages/oidc-client/src/lib/client.store.ts
  • packages/oidc-client/src/lib/exchange.request.ts
  • packages/oidc-client/src/lib/exchange.utils.test.ts
  • packages/oidc-client/src/lib/exchange.utils.ts
  • packages/oidc-client/src/lib/logout.request.test.ts
  • packages/oidc-client/src/lib/logout.request.ts
  • packages/oidc-client/src/lib/session.micros.test.ts
  • packages/oidc-client/src/lib/session.micros.ts
  • packages/sdk-utilities/src/lib/config/config.effects.ts
  • packages/sdk-utilities/src/lib/config/config.test.ts
  • packages/sdk-utilities/src/lib/config/config.types.ts
  • packages/sdk-utilities/src/lib/config/config.utils.ts
  • packages/sdk-utilities/src/lib/micro.utils.ts
  • pnpm-workspace.yaml
  • tools/release/package.json
  • tools/user-scripts/package.json
  • tools/user-scripts/src/lib/user-scripts.ts
 ________________________________________________
< Doubling as a space heater during code review. >
 ------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/effect-v4-migration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 0f15944

Command Status Duration Result
nx affected -t build lint test typecheck e2e-ci ❌ Failed 2m 25s View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-08-06 14:31:53 UTC

nx-cloud[bot]

This comment was marked as outdated.

Effect.sleep in v4 beta.103 hangs in Vite-bundled browser environments
due to ClockRef/withFiber/clockWith indirection chain. Replace with
delayMs helper using Effect.callback + plain setTimeout to match v3
Micro.sleep behavior.

Also fix:
- pollStatus: use Effect.runPromiseExit(effect) direct call (not pipe)
- pollStatus: add Cause.squash fallback for defect errors
- password-policy.rules.ts: Result.failVoid → Result.fail(undefined)

@nx-cloud nx-cloud Bot 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.

Nx Cloud has identified a possible root cause for your failed CI:

This CI failure appears to be related to the environment or external dependencies rather than your code changes.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant