Skip to content

Fix empty struct union candidate selection - #6635

Merged
gcanti merged 1 commit into
mainfrom
fix/schema-empty-struct-union
Jul 25, 2026
Merged

Fix empty struct union candidate selection#6635
gcanti merged 1 commit into
mainfrom
fix/schema-empty-struct-union

Conversation

@gcanti

@gcanti gcanti commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes

    • Corrected schema handling for empty object structures in unions.
    • Empty object schemas now correctly accept all non-nullish values while continuing to reject undefined.
  • Tests

    • Expanded coverage across primitive values, objects, arrays, functions, symbols, bigints, and null.

@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jul 25, 2026
@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: b27cb01

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

@effect-slopcop effect-slopcop Bot added 4.0 bug Something isn't working labels Jul 25, 2026
@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f6f3e48e-6848-43fd-92bd-5538c29c5022

📥 Commits

Reviewing files that changed from the base of the PR and between 30effdb and b27cb01.

📒 Files selected for processing (2)
  • packages/effect/src/SchemaAST.ts
  • packages/effect/test/schema/Schema.test.ts

📝 Walkthrough

Walkthrough

Changes

Empty Struct Union Semantics

Layer / File(s) Summary
Broaden empty object candidates and validate unions
packages/effect/src/SchemaAST.ts, packages/effect/test/schema/Schema.test.ts
Empty object AST nodes now include primitive and function candidate types, with tests covering successful decoding of non-undefined values and rejection of undefined.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.64 KB 6.64 KB 0.00 KB (0.00%)
batching.ts 9.42 KB 9.42 KB 0.00 KB (0.00%)
brand.ts 6.25 KB 6.25 KB 0.00 KB (0.00%)
cache.ts 10.13 KB 10.13 KB 0.00 KB (0.00%)
config.ts 19.08 KB 19.08 KB +0.00 KB (+0.01%)
differ.ts 18.38 KB 18.38 KB -0.00 KB (-0.01%)
http-client.ts 20.73 KB 20.73 KB 0.00 KB (0.00%)
logger.ts 10.30 KB 10.30 KB 0.00 KB (0.00%)
metric.ts 8.56 KB 8.56 KB 0.00 KB (0.00%)
optic.ts 7.41 KB 7.41 KB 0.00 KB (0.00%)
pubsub.ts 14.17 KB 14.17 KB 0.00 KB (0.00%)
queue.ts 11.10 KB 11.10 KB 0.00 KB (0.00%)
schedule.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
schema-class.ts 18.16 KB 18.16 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 27.86 KB 27.86 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 24.14 KB 24.14 KB +0.00 KB (+0.01%)
schema-string-transformation.ts 12.68 KB 12.68 KB 0.00 KB (0.00%)
schema-string.ts 10.36 KB 10.36 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.38 KB 14.38 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 20.93 KB 20.93 KB -0.00 KB (-0.01%)
schema-toCodeDocument.ts 23.34 KB 23.34 KB -0.00 KB (-0.01%)
schema-toCodecJson.ts 18.27 KB 18.27 KB -0.00 KB (-0.01%)
schema-toEquivalence.ts 18.01 KB 18.01 KB -0.00 KB (-0.01%)
schema-toFormatter.ts 17.86 KB 17.86 KB -0.00 KB (-0.01%)
schema-toJsonSchemaDocument.ts 21.47 KB 21.47 KB -0.00 KB (-0.00%)
schema-toRepresentation.ts 18.55 KB 18.55 KB -0.00 KB (-0.01%)
schema.ts 17.43 KB 17.43 KB +0.00 KB (+0.01%)
stm.ts 12.07 KB 12.07 KB 0.00 KB (0.00%)
stream.ts 9.36 KB 9.36 KB 0.00 KB (0.00%)

@nikelborm

Copy link
Copy Markdown
Contributor

Would I need to update #6434 after this lands?

@gcanti
gcanti merged commit 0c2db15 into main Jul 25, 2026
15 checks passed
@gcanti
gcanti deleted the fix/schema-empty-struct-union branch July 25, 2026 21:22
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants