Skip to content

fix: preserve workflow defect details in test diagnostics - #5

Merged
bweis merged 1 commit into
TeamSpringbird:mainfrom
sundaray:fix/decode-workflow-result-error-formatting
Sep 10, 2026
Merged

bweis merged 1 commit into
TeamSpringbird:mainfrom
sundaray:fix/decode-workflow-result-error-formatting

Conversation

@sundaray

Copy link
Copy Markdown
Contributor

Summary

  • Updated decodeWorkflowResult in src/testing.ts to render failed workflow results with Cause.pretty instead of JSON.stringify.
  • Added a regression test in src/__tests__/testing.test.ts for native Error defects round-tripped through the workflow wire codec.

Problem

In src/testing.ts, decodeWorkflowResult currently formats a failed Effect Cause using:

JSON.stringify(exit.cause)

The regression test reproduces the problem by encoding a workflow defect containing a native error:

Exit.die(new Error("boom"))

Native Error properties such as message and stack are non-enumerable, so JSON.stringify omits them. The resulting diagnostic is:

workflow "effectDemo" did not succeed: {"_id":"Cause","failures":[{"_tag":"Die","defect":{}}]}

Notice that defect is rendered as {} even though the original error's message was "boom".

Using Effect's Cause.pretty renderer preserves that message:

workflow "effectDemo" did not succeed: Error: boom

@bweis
bweis added this pull request to the merge queue Sep 10, 2026
Merged via the queue into TeamSpringbird:main with commit c244d1d Sep 10, 2026
2 checks passed
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.

2 participants