Add DOMException to VM context and first-class serialization support#1512
Add DOMException to VM context and first-class serialization support#1512TooTallNate merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 6599b23 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (61 failed)mongodb (3 failed):
redis (2 failed):
turso (56 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
|
There was a problem hiding this comment.
Pull request overview
Adds first-class DOMException support to the @workflow/core devalue-based serialization pipeline so DOMExceptions retain identity and key fields when crossing workflow/step boundaries (including VM contexts).
Changes:
- Add
DOMExceptionreducer/reviver to the common devalue reducers/revivers, preservingmessage,name, andstack. - Add tests covering DOMException round-trips (AbortError, NotFoundError, default name), serialization key selection, and cross-VM hydration.
- Add a changeset to release the update as a patch for
@workflow/core.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/core/src/serialization.ts | Introduces DOMException reducer/reviver and adds DOMException to SerializableSpecial. |
| packages/core/src/serialization.test.ts | Adds DOMException-focused test coverage alongside existing built-in Error serialization tests. |
| .changeset/domexception-serialization.md | Publishes a patch changeset for @workflow/core describing DOMException serde support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c735685 to
a30a601
Compare
|
Addressed the review feedback in a30a601: DOMException in Serializable type (comment on line 596): Fixed. Added Missing fallback path test (comment on line 1150): Fixed. Added a test that hydrates a DOMException with a context where |
7a43bf9 to
909f31f
Compare
- Pass DOMException through to the workflow VM context alongside other Web APIs (Headers, URL, TextEncoder, etc.) - Add DOMException reducer/reviver to the serialization pipeline, preserving message, name, derived code, and cause when present - Add DOMException to the Serializable type union - 8 new tests: round-trip for AbortError, NotFoundError, default name, cause preservation, cause absence, serialization key, cross-VM boundaries, and VM context availability
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 50 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.all with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) Promise.race with 50 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 25 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 50 sequential data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) workflow with 10 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro workflow with 25 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 50 concurrent data payload steps (10KB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Next.js (Turbopack) | Express stream pipeline with 5 transform steps (1MB)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) 10 parallel streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) fan-out fan-in 10 streams (1MB each)💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
|
Addressing the remaining review comments: cause not serialized for DOMException (line 748): Fixed. The DOMException reducer now serializes constructor name string check (line 745): Acknowledged — this is the same cross-VM safety pattern used for all Error subclass reducers. A custom class named |
Summary
DOMExceptionthrough to the workflow VM context alongside other Web APIs (Headers,URL,TextEncoder, etc.)DOMExceptionreducer/reviver to the devalue serialization pipeline, preservingmessage,name, and derivedcodeDOMExceptionto theSerializabletype unionContext
This is PR 2 of 5 in a series to improve error handling in Workflow DevKit. Stacked on top of #1511.
DOMExceptionVM context + serde supportWORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZEforFatalErrorandRetryableErrorDesign notes
DOMExceptionis a standard Web API available in Node.js since v17. It was previously missing from the workflow VM context, which meant deserialization would have needed a fallback. This PR adds it tocreateContext()alongside the other Web API passthroughs, so the reviver can always construct a properDOMException.Key differences from regular Error subclasses:
new DOMException(message, name)— no options bagcodeproperty is read-only and automatically derived from thename(e.g.AbortError→20,NotFoundError→8)types.isNativeError()returnstrueandinstanceof ErroristrueTest plan
built-in Error subclass serializationdescribe blocktsc