Skip to content

Refactor zodToEffect for improved type inference and add tests#1559

Merged
Adammatthiesen merged 6 commits into
mainfrom
fix-zod-to-effect
Jul 11, 2026
Merged

Refactor zodToEffect for improved type inference and add tests#1559
Adammatthiesen merged 6 commits into
mainfrom
fix-zod-to-effect

Conversation

@Adammatthiesen

@Adammatthiesen Adammatthiesen commented Jul 10, 2026

Copy link
Copy Markdown
Member

This pull request improves the type inference and correctness of the zodToEffect function, which converts Zod schemas to Effect schemas. It introduces a new type-safe approach for mapping Zod schemas to Effect schemas, ensuring that the input and output types are preserved accurately. Additionally, comprehensive tests are added to verify the correctness of the type mappings for complex and nested schemas.

Type inference and API improvements:

  • Refactored the zodToEffect function in zod.ts to use a new type alias EffectSchemaFromZod, ensuring that the resulting Effect schema preserves the input and output types of the original Zod schema. The function signature is now generic and type-safe, and the implementation uses Schema.Schema.AnyNoContext to avoid previous type mangling issues.
  • Removed an outdated and misleading comment block that described the previous type inference problems and example outputs, reflecting the improved implementation.

Testing and validation:

  • Added a new test suite zod.types.test.ts that verifies zodToEffect produces Effect schemas with the correct input and output types for both complex ("kitchen-sink") and nested object schemas, using expectTypeOf assertions for type equality.

Summary by CodeRabbit

  • New Features

    • Improved Zod-to-Effect conversion so generated schemas preserve accurate input and output types, including nested and complex schemas.
    • Updated the playground to use the appropriate site URL based on the environment.
  • Tests

    • Added coverage validating type accuracy for common and complex Zod schemas.
  • Chores

    • Refreshed automated build, validation, release, and deployment tooling references.

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d5d3880

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
effectify Minor
@withstudiocms/api-spec Major
@withstudiocms/auth-kit Major
@withstudiocms/effect Patch
@withstudiocms/sdk Major
studiocms Patch
@studiocms/auth0 Major
@studiocms/discord Major
@studiocms/github Major
@studiocms/google Major
@studiocms/devapps Major
@studiocms/wysiwyg Major

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c8394235-d6b5-40da-acc2-d3c4fec74ebb

📥 Commits

Reviewing files that changed from the base of the PR and between f7646fe and d5d3880.

📒 Files selected for processing (13)
  • .changeset/grumpy-swans-lose.md
  • .github/actions/effect-check/action.yml
  • .github/actions/type-check/action.yml
  • .github/workflows/ci-bot-changesets.yml
  • .github/workflows/ci-check-changeset.yml
  • .github/workflows/ci-checks.yml
  • .github/workflows/ci-crowdin-report-bot.yml
  • .github/workflows/ci-pull-request.yml
  • .github/workflows/ci-push-main.yml
  • .github/workflows/ci-testing.yml
  • packages/effectify/src/zod.ts
  • packages/effectify/test/zod.types.test.ts
  • playground/astro.config.mts

📝 Walkthrough

Walkthrough

The PR updates zodToEffect type inference and adds type-level tests, refreshes pinned GitHub automation references, derives the playground Astro site from environment configuration, and adds a minor changeset entry.

Changes

Zod conversion typing

Layer / File(s) Summary
Zod schema type mapping and validation
packages/effectify/src/zod.ts, packages/effectify/test/zod.types.test.ts, .changeset/grumpy-swans-lose.md
zodToEffect now maps Zod input/output types to Effect Schema types, with tests covering complex and nested schemas and a minor release changeset.

Automation reference updates

Layer / File(s) Summary
Pinned automation references
.github/actions/*, .github/workflows/*
Install actions and reusable workflow calls now reference updated pinned commit hashes without other workflow logic changes.

Playground site configuration

Layer / File(s) Summary
Environment-derived Astro site
playground/astro.config.mts
The Astro site property now uses the previously computed environment-specific site constant instead of a localhost literal.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Multiple workflow SHA bumps and the playground Astro config site change are unrelated to the zodToEffect issue. Move the workflow pin updates and Astro config tweak into a separate maintenance PR, or explain them in the linked issue scope.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: refactoring zodToEffect and adding tests.
Linked Issues check ✅ Passed The refactor directly addresses #1545 by rewriting zodToEffect's type conversion and adding type tests.
✨ 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 fix-zod-to-effect

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.

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Allure Test Report for this PR:

Allure Report | History

@pkg-pr-new

pkg-pr-new Bot commented Jul 10, 2026

Copy link
Copy Markdown
create-studiocms

npm i https://pkg.pr.new/create-studiocms@1559

effectify

npm i https://pkg.pr.new/effectify@1559

studiocms

npm i https://pkg.pr.new/studiocms@1559

@studiocms/auth0

npm i https://pkg.pr.new/@studiocms/auth0@1559

@studiocms/blog

npm i https://pkg.pr.new/@studiocms/blog@1559

@studiocms/cloudinary-image-service

npm i https://pkg.pr.new/@studiocms/cloudinary-image-service@1559

@studiocms/devapps

npm i https://pkg.pr.new/@studiocms/devapps@1559

@studiocms/discord

npm i https://pkg.pr.new/@studiocms/discord@1559

@studiocms/github

npm i https://pkg.pr.new/@studiocms/github@1559

@studiocms/google

npm i https://pkg.pr.new/@studiocms/google@1559

@studiocms/html

npm i https://pkg.pr.new/@studiocms/html@1559

@studiocms/markdoc

npm i https://pkg.pr.new/@studiocms/markdoc@1559

@studiocms/markdown-remark

npm i https://pkg.pr.new/@studiocms/markdown-remark@1559

@studiocms/md

npm i https://pkg.pr.new/@studiocms/md@1559

@studiocms/mdx

npm i https://pkg.pr.new/@studiocms/mdx@1559

@studiocms/s3-storage

npm i https://pkg.pr.new/@studiocms/s3-storage@1559

@studiocms/upgrade

npm i https://pkg.pr.new/@studiocms/upgrade@1559

@studiocms/wysiwyg

npm i https://pkg.pr.new/@studiocms/wysiwyg@1559

@withstudiocms/api-spec

npm i https://pkg.pr.new/@withstudiocms/api-spec@1559

@withstudiocms/auth-kit

npm i https://pkg.pr.new/@withstudiocms/auth-kit@1559

@withstudiocms/cli-kit

npm i https://pkg.pr.new/@withstudiocms/cli-kit@1559

@withstudiocms/component-registry

npm i https://pkg.pr.new/@withstudiocms/component-registry@1559

@withstudiocms/config-utils

npm i https://pkg.pr.new/@withstudiocms/config-utils@1559

@withstudiocms/effect

npm i https://pkg.pr.new/@withstudiocms/effect@1559

@withstudiocms/internal_helpers

npm i https://pkg.pr.new/@withstudiocms/internal_helpers@1559

@withstudiocms/kysely

npm i https://pkg.pr.new/@withstudiocms/kysely@1559

@withstudiocms/sdk

npm i https://pkg.pr.new/@withstudiocms/sdk@1559

@withstudiocms/template-lang

npm i https://pkg.pr.new/@withstudiocms/template-lang@1559

commit: d5d3880

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@Adammatthiesen Adammatthiesen marked this pull request as ready for review July 10, 2026 23:41
@Adammatthiesen Adammatthiesen requested a review from a team as a code owner July 10, 2026 23:41
@Adammatthiesen Adammatthiesen merged commit f3dcee2 into main Jul 11, 2026
31 checks passed
@Adammatthiesen Adammatthiesen deleted the fix-zod-to-effect branch July 11, 2026 01:24
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.

Rework the following type conversion for zod to Effect...

2 participants