Skip to content

Preserve accessors with loose object spread - #6659

Merged
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/807a4a18
Jul 27, 2026
Merged

Preserve accessors with loose object spread#6659
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/807a4a18

Conversation

@tim-smart

@tim-smart tim-smart commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • preserve prototype accessors when packages are compiled with loose object spread transforms
  • reorder base prototype spreads in Effect exits, AI models, SQL statements, and IndexedDB APIs
  • add patch changesets for effect and @effect/platform-browser

Verification

  • pnpm lint
  • pnpm check
  • pnpm --filter effect test --run test/Exit.test.ts test/unstable/ai/Model.test.ts test/unstable/sql/Statement.test.ts
  • pnpm --filter @effect/platform-browser test --run test/IndexedDbDatabase.test.ts test/IndexedDbQueryBuilder.test.ts
  • unmodified Expo reproduction: 9/9 tests pass with the makeExit reorder
  • repository AST audit: no getter or setter remains after an object spread under packages/**/src

A native Object.getOwnPropertyDescriptor assertion was not added because it also passes with the broken ordering: standard object spread preserves the accessor in either position, while only Babel's loose transform loses it.

Consumer Workaround

Until this reaches a release, consumers can run a strict spread transform before babel-preset-expo:

plugins: [["@babel/plugin-transform-object-rest-spread", {
  loose: false,
  useBuiltIns: false
}]],
presets: ["babel-preset-expo"]

Closes EFF-114
Fixes #6578

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where prototype accessors could be overwritten when compiled with loose object spread transforms.
    • Improved consistency and reliability across Effect, browser platform, AI model, SQL statement, and IndexedDB components.
  • Chores
    • Added patch release entries for the affected packages.

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

changeset-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 494bfda

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

This PR includes changesets to release 28 packages
Name Type
effect Patch
@effect/platform-browser Patch
@effect/opentelemetry Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

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 27, 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: e9feab21-0a42-4260-89be-be94ed88487b

📥 Commits

Reviewing files that changed from the base of the PR and between 205ebc7 and 494bfda.

📒 Files selected for processing (6)
  • .changeset/polite-cameras-rest.md
  • packages/effect/src/internal/core.ts
  • packages/effect/src/unstable/ai/Model.ts
  • packages/effect/src/unstable/sql/Statement.ts
  • packages/platform-browser/src/IndexedDbDatabase.ts
  • packages/platform-browser/src/IndexedDbQueryBuilder.ts

📝 Walkthrough

Walkthrough

This change reorders shared prototype spreads and local accessors across core Effect, AI, SQL, and IndexedDB implementations. It also adds patch changesets for effect and @effect/platform-browser.

Changes

Prototype ordering updates

Layer / File(s) Summary
Core primitive prototype ordering
packages/effect/src/internal/core.ts, .changeset/polite-cameras-rest.md
makeExit defines its type, tag, and computed accessor before shared primitive properties; patch release metadata records the fix.
Effectable prototype composition
packages/effect/src/unstable/ai/Model.ts, packages/effect/src/unstable/sql/Statement.ts, packages/platform-browser/src/IndexedDbDatabase.ts
Model, SQL Statement, and IndexedDB schema prototype fragments are repositioned without changing their described behavior.
IndexedDB query builder composition
packages/platform-browser/src/IndexedDbQueryBuilder.ts
CommonProto is moved after the clear and clearAll accessors in the relevant prototypes.

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

Suggested labels: bug, 4.0

Suggested reviewers: gcanti

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The prototype spread reordering matches the Babel loose-spread bug fix and targets the affected decode/encode path in #6578.
Out of Scope Changes check ✅ Passed All code changes are limited to the prototype-order bug fix and release notes; no unrelated functionality was introduced.

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

@coderabbitai coderabbitai Bot added 4.0 bug Something isn't working labels Jul 27, 2026
@tim-smart
tim-smart enabled auto-merge (squash) July 27, 2026 03:28
@tim-smart
tim-smart merged commit cc27b19 into main Jul 27, 2026
15 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/807a4a18 branch July 27, 2026 03:30
@github-project-automation github-project-automation Bot moved this from Discussion Ongoing to Done in PR Backlog Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.63 KB 6.63 KB +0.00 KB (+0.02%)
batching.ts 9.37 KB 9.37 KB -0.00 KB (-0.01%)
brand.ts 6.26 KB 6.25 KB +0.00 KB (+0.05%)
cache.ts 10.12 KB 10.11 KB +0.00 KB (+0.02%)
config.ts 19.21 KB 19.21 KB +0.00 KB (+0.01%)
differ.ts 18.42 KB 18.42 KB +0.00 KB (+0.01%)
http-client.ts 20.76 KB 20.76 KB 0.00 KB (0.00%)
logger.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
metric.ts 8.55 KB 8.55 KB 0.00 KB (0.00%)
optic.ts 7.41 KB 7.41 KB +0.00 KB (+0.03%)
pubsub.ts 14.20 KB 14.19 KB +0.00 KB (+0.02%)
queue.ts 11.08 KB 11.08 KB 0.00 KB (0.00%)
schedule.ts 10.28 KB 10.27 KB +0.00 KB (+0.03%)
schema-class.ts 18.16 KB 18.16 KB +0.00 KB (+0.02%)
schema-fromJsonSchemaDocument.ts 28.02 KB 28.02 KB +0.00 KB (+0.01%)
schema-representation-roundtrip.ts 24.33 KB 24.33 KB +0.00 KB (+0.02%)
schema-string-transformation.ts 12.69 KB 12.69 KB +0.00 KB (+0.02%)
schema-string.ts 10.35 KB 10.35 KB +0.00 KB (+0.02%)
schema-template-literal.ts 14.49 KB 14.48 KB +0.00 KB (+0.02%)
schema-toArbitraryLazy.ts 20.93 KB 20.93 KB +0.00 KB (+0.01%)
schema-toCodeDocument.ts 23.38 KB 23.38 KB +0.00 KB (+0.01%)
schema-toCodecJson.ts 18.32 KB 18.32 KB +0.00 KB (+0.02%)
schema-toEquivalence.ts 18.00 KB 18.00 KB +0.00 KB (+0.02%)
schema-toFormatter.ts 17.88 KB 17.88 KB +0.00 KB (+0.01%)
schema-toJsonSchemaDocument.ts 21.51 KB 21.51 KB +0.00 KB (+0.01%)
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.02%)
stm.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
stream.ts 9.36 KB 9.36 KB +0.00 KB (+0.03%)

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.

effect@4-beta — Schema decode completely broken when transformed by babel-preset-expo (Jest)

1 participant