Skip to content

Preserve prototype-named keys in Effect Schema maps - #3524

Closed
schani wants to merge 3 commits into
fix/zod-prototype-recordfrom
probe/effect-prototype-record
Closed

Preserve prototype-named keys in Effect Schema maps#3524
schani wants to merge 3 commits into
fix/zod-prototype-recordfrom
probe/effect-prototype-record

Conversation

@schani

@schani schani commented Sep 8, 2026

Copy link
Copy Markdown
Member

Effect Schema records rebuild decoded maps through ordinary object assignment, so an own __proto__ key changes the prototype instead of becoming data. Decode maps as validated entry tuples and rebuild them with Object.fromEntries, preserving prototype-named keys, nested value transformations, schema context, and inferred record types.

This complete fix changes 24 production lines; the user explicitly approved that exception. Depends on #3522. The shared class-map-union.5.json runtime regression lands in downstream #3519, where all TypeScript schema backends run it.

Validation: full TypeScript Effect Schema fixtures 145/145; focused class-map-union.schema 6 files; invalid Boolean map rejection and own __proto__ descriptor probe; build and lint.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

47 files differ — 47 modified, 0 new, 0 deleted
1138 changed lines — +992 / −146

Open the generated-output report →

@schani
schani force-pushed the probe/effect-prototype-record branch from 523f339 to e589247 Compare September 8, 2026 03:04
@schani

schani commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

Superseded by #3519, which now contains this Effect fix and the shared regression fixture in the same PR.

@schani schani closed this Sep 8, 2026
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.

1 participant