Skip to content

fix(Cause): align toJSON key with actual property name#6222

Open
lihan3238 wants to merge 2 commits intoEffect-TS:mainfrom
lihan3238:fix-4683
Open

fix(Cause): align toJSON key with actual property name#6222
lihan3238 wants to merge 2 commits intoEffect-TS:mainfrom
lihan3238:fix-4683

Conversation

@lihan3238
Copy link
Copy Markdown

Closes #4683

Summary

The Fail case in Cause.toJSON used the key "failure" but the actual property name is "error". All other variants (Die, Interrupt, Sequential, Parallel) already use keys matching their property names.

This inconsistency means:

  • console.log(cause) shows { _tag: "Fail", failure: ... }
  • But accessing cause.failure is undefined — the actual property is cause.error

Fix

Changed the toJSON key from "failure" to "error" in the Fail case to match the actual property name.

Test Plan

  • Updated existing toJSON test expectations in Cause.test.ts
  • All 72 Cause tests pass

The Fail case in Cause.toJSON used the key "failure" but the actual
property name is "error". All other variants (Die, Interrupt, Sequential,
Parallel) already use keys matching their property names. This makes
toJSON output consistent with the runtime object shape.

Closes Effect-TS#4683
@lihan3238 lihan3238 requested a review from mikearnaldi as a code owner May 8, 2026 04:02
@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog May 8, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

🦋 Changeset detected

Latest commit: 8771e8e

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

This PR includes changesets to release 36 packages
Name Type
effect Patch
@effect/cli Patch
@effect/cluster Patch
@effect/experimental Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/platform Patch
@effect/printer-ansi Patch
@effect/printer Patch
@effect/rpc Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-drizzle Patch
@effect/sql-kysely Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg 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/sql Patch
@effect/typeclass Patch
@effect/vitest Patch
@effect/workflow Patch
@effect/ai Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-google Patch
@effect/ai-openai Patch
@effect/ai-openrouter 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

Inconsistency between Cause.Fail instance and toJSON

1 participant