Skip to content

fix: preserve prototype-named map keys - #3519

Open
schani wants to merge 9 commits into
fix/zod-prototype-recordfrom
agent/javascript-prototype-key
Open

fix: preserve prototype-named map keys#3519
schani wants to merge 9 commits into
fix/zod-prototype-recordfrom
agent/javascript-prototype-key

Conversation

@schani

@schani schani commented Sep 7, 2026

Copy link
Copy Markdown
Member

JavaScript, Elm, and Effect Schema rebuilt decoded maps through ordinary object assignment, so an own __proto__ key changed or disappeared from the result instead of remaining data.

JavaScript assigns through a null-prototype object before restoring Object.prototype. Elm encodes dictionary entries into JSON text and parses the complete object; its helper name is reserved only when maps use the helper. Effect Schema validates entry tuples and rebuilds them with Object.fromEntries, preserving nested transforms, schema context, and inferred record types.

Depends on the Zod map fix #3522 because the shared regression runs across all TypeScript schema backends. The 24-line Effect fix has the explicitly approved size exception.

Production diff: Effect Schema 24 lines; JavaScript 4 lines; Elm 14 lines.

Tests:

  • shared class-map-union.5.json round-trip with an own __proto__ key
  • shared makeDictEncoder keyword case
  • JavaScript API unit verifies the returned object retains Object.prototype
  • Effect invalid-value, nested-transform, context, and descriptor probes
  • build and lint
  • full Effect fixtures: 145/145
  • full JavaScript/TypeScript/Flow fixtures: 506 passed
  • full Elm/schema-Elm fixtures: 145 passed
  • focused Elm keyword fixtures: JSON 1/1; schema 2/2

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Generated-output differences

1023 files differ — 1023 modified, 0 new, 0 deleted
4092 changed lines — +2046 / −2046

Open the generated-output report →

@schani
schani force-pushed the agent/javascript-prototype-key branch from 173ef9b to 841417d Compare September 7, 2026 17:52
@schani schani changed the title fix(javascript): preserve prototype-named map keys fix(javascript, elm): preserve prototype-named map keys Sep 7, 2026
@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

Generated-output differences

1320 files differ — 1320 modified, 0 new, 0 deleted
6730 changed lines — +4553 / −2177

Open the generated-output report →

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

1214 files differ — 1173 modified, 41 new, 0 deleted
23677 changed lines — +16838 / −6839

Open the generated-output report →

@schani
schani changed the base branch from master to probe/effect-prototype-record September 8, 2026 01:34
@schani
schani force-pushed the agent/javascript-prototype-key branch from 6d7da60 to 5ae1275 Compare September 8, 2026 01:34
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

1073 files differ — 1073 modified, 0 new, 0 deleted
4734 changed lines — +2547 / −2187

Open the generated-output report →

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

1073 files differ — 1073 modified, 0 new, 0 deleted
4734 changed lines — +2547 / −2187

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 force-pushed the agent/javascript-prototype-key branch from fb6e8dc to 4d7f7db Compare September 8, 2026 03:04
@schani
schani changed the base branch from probe/effect-prototype-record to fix/zod-prototype-record September 8, 2026 03:05
@schani schani changed the title fix(javascript, elm): preserve prototype-named map keys fix: preserve prototype-named map keys Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Generated-output differences

1231 files differ — 1222 modified, 9 new, 0 deleted
21585 changed lines — +12464 / −9121

Open the generated-output report →

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