Add reproduction for Cause issue - #6879
Conversation
🦋 Changeset detectedLatest commit: 4f9ffbe The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Reproduction test for
Cause.mapannotation loss — single test inpackages/effect/test/CauseMapAnnotations.test.tsthat verifiesCause.mappreserves annotations on mappedFailreasons.
The test correctly fails with Service not found: RequestId, confirming the bug. Root cause: causeMap at internal/effect.ts:271 creates new Fail(f(failure.error)) without forwarding failure.annotations.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Applied fix to
causeMap—new Fail(f(failure.error), failure.annotations)now forwards annotations instead of dropping them, addressing the root cause identified in the prior review. - Refined test assertion — changed from
Context.gettoContext.getOrUndefinedper tim-smart's review, a better pattern for this check. - Removed unnecessary
new Map()wrapping — the43b70d2cfix initially wrapped annotations innew Map(failure.annotations); the7e6b7d7commit applied tim-smart's suggestion to passfailure.annotationsdirectly since it already has the expected type. - Added changeset — patch bump for
effect.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
15717dc to
255cc42
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Removed unnecessary
new Map()wrapping incauseMap— passesfailure.annotationsdirectly to theFailconstructor instead of copying vianew Map(). - Added explicit
ReadonlyMaptype annotation toconstEmptyAnnotations— fixes type inference so theFailconstructor parameter isReadonlyMap<string, unknown>rather thanMap<string, unknown>, making it directly compatible withfailure.annotationsfromCause.Failreasons.
DeepSeek Pro (free via Pullfrog for OSS) (Kimi K2 not used — the program covers this model; add its provider key to run your pick) | 𝕏
255cc42 to
4f9ffbe
Compare
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|

Summary
Fix
Cause.mapso transforming typed errors preserves annotations attached toFailreasons.Root cause
Cause.maprebuilt each mappedFailreason with only the transformed error, dropping the original reason's annotations. The mapped reason now receives a copy of those annotations whileDieandInterruptreasons continue to pass through unchanged.Validation
Closes EFF-313