Implement independent error storage system and comprehensive improvements

Major Features:
• Add persistent error tracking for timeout/network failures that bypasses PayloadCMS output limitations
• Implement smart error classification (timeout, DNS, connection, network) with duration-based detection
• Add comprehensive test infrastructure with MongoDB in-memory testing and enhanced mocking
• Fix HTTP request handler error preservation with detailed context storage
• Add independent execution tracking with success/failure status and duration metrics

Technical Improvements:
• Update JSONPath documentation to use correct $.trigger.doc syntax across all step types
• Fix PayloadCMS job execution to use runByID instead of run() for reliable task processing
• Add enhanced HTTP error handling that preserves outputs for 4xx/5xx status codes
• Implement proper nock configuration with undici for Node.js 22 fetch interception
• Add comprehensive unit tests for WorkflowExecutor with mocked PayloadCMS instances

Developer Experience:
• Add detailed error information in workflow context with URL, method, timeout, attempts
• Update README with HTTP error handling patterns and enhanced error tracking examples
• Add test helpers and setup infrastructure for reliable integration testing
• Fix workflow step validation and JSONPath field descriptions

Breaking Changes: None - fully backward compatible

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-04 18:03:30 +02:00
parent 04100787d7
commit 74217d532d
26 changed files with 2472 additions and 565 deletions

90
pnpm-lock.yaml generated
View File

@@ -45,6 +45,9 @@ importers:
'@swc/cli':
specifier: 0.6.0
version: 0.6.0(@swc/core@1.13.4)
'@types/nock':
specifier: ^11.1.0
version: 11.1.0
'@types/node':
specifier: ^22.5.4
version: 22.17.2
@@ -75,6 +78,9 @@ importers:
next:
specifier: 15.4.4
version: 15.4.4(@playwright/test@1.55.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)
nock:
specifier: ^14.0.10
version: 14.0.10
payload:
specifier: 3.45.0
version: 3.45.0(graphql@16.11.0)(typescript@5.7.3)
@@ -96,6 +102,9 @@ importers:
typescript:
specifier: 5.7.3
version: 5.7.3
undici:
specifier: ^7.15.0
version: 7.15.0
vitest:
specifier: ^3.1.2
version: 3.2.4(@types/debug@4.1.12)(@types/node@22.17.2)(jiti@2.5.1)(sass@1.77.4)(tsx@4.20.5)
@@ -1103,6 +1112,10 @@ packages:
'@mongodb-js/saslprep@1.3.0':
resolution: {integrity: sha512-zlayKCsIjYb7/IdfqxorK5+xUMyi4vOKcFy10wKJYc63NSdKI8mNME+uJqfatkPmOSMMUiojrL58IePKBm3gvQ==}
'@mswjs/interceptors@0.39.6':
resolution: {integrity: sha512-bndDP83naYYkfayr/qhBHMhk0YGwS1iv6vaEGcr0SQbO0IZtbOPqjKjds/WcG+bJA+1T5vCx6kprKOzn5Bg+Vw==}
engines: {node: '>=18'}
'@napi-rs/nice-android-arm-eabi@1.1.1':
resolution: {integrity: sha512-kjirL3N6TnRPv5iuHw36wnucNqXAO46dzK9oPb0wj076R5Xm8PfUVA9nAFB5ZNMmfJQJVKACAPd/Z2KYMppthw==}
engines: {node: '>= 10'}
@@ -1278,6 +1291,15 @@ packages:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
engines: {node: '>= 8'}
'@open-draft/deferred-promise@2.2.0':
resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==}
'@open-draft/logger@0.3.0':
resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==}
'@open-draft/until@2.1.0':
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
'@payloadcms/db-mongodb@3.45.0':
resolution: {integrity: sha512-Oahk6LJatrQW2+DG0OoSoaWnXSiJ2iBL+2l5WLD2xvRHOlJ3Ls1gUZCrsDItDe8veqwVGSLrMc7gxDwDaMICvg==}
peerDependencies:
@@ -1596,6 +1618,10 @@ packages:
'@types/ms@2.1.0':
resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==}
'@types/nock@11.1.0':
resolution: {integrity: sha512-jI/ewavBQ7X5178262JQR0ewicPAcJhXS/iFaNJl0VHLfyosZ/kwSrsa6VNQNSO8i9d8SqdRgOtZSOKJ/+iNMw==}
deprecated: This is a stub types definition. nock provides its own type definitions, so you do not need this installed.
'@types/node-cron@3.0.11':
resolution: {integrity: sha512-0ikrnug3/IyneSHqCBeslAhlK2aBfYek1fGo4bP4QnZPmiqSGRK+Oy7ZMisLWkesffJvQ1cqAcBnJC+8+nxIAg==}
@@ -3048,6 +3074,9 @@ packages:
resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==}
engines: {node: '>= 0.4'}
is-node-process@1.2.0:
resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==}
is-number-object@1.1.1:
resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==}
engines: {node: '>= 0.4'}
@@ -3172,6 +3201,9 @@ packages:
json-stable-stringify-without-jsonify@1.0.1:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
json-stringify-safe@5.0.1:
resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==}
jsonpath-plus@10.3.0:
resolution: {integrity: sha512-8TNmfeTCk2Le33A3vRRwtuworG/L5RrgMvdjhKZxvyShO+mBu2fP50OWUjRLNtvw344DdDarFh9buFAZs5ujeA==}
engines: {node: '>=18.0.0'}
@@ -3527,6 +3559,10 @@ packages:
sass:
optional: true
nock@14.0.10:
resolution: {integrity: sha512-Q7HjkpyPeLa0ZVZC5qpxBt5EyLczFJ91MEewQiIi9taWuA0KB/MDJlUWtON+7dGouVdADTQsf9RA7TZk6D8VMw==}
engines: {node: '>=18.20.0 <20 || >=20.12.1'}
node-cron@4.2.1:
resolution: {integrity: sha512-lgimEHPE/QDgFlywTd8yTR61ptugX3Qer29efeyWw2rv259HtGBNn1vZVmp8lB9uo9wC0t/AT4iGqXxia+CJFg==}
engines: {node: '>=6.0.0'}
@@ -3600,6 +3636,9 @@ packages:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
outvariant@1.4.3:
resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==}
own-keys@1.0.1:
resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==}
engines: {node: '>= 0.4'}
@@ -3853,6 +3892,10 @@ packages:
prop-types@15.8.1:
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
propagate@2.0.1:
resolution: {integrity: sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag==}
engines: {node: '>= 8'}
pump@3.0.3:
resolution: {integrity: sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==}
@@ -4197,6 +4240,9 @@ packages:
streamx@2.22.1:
resolution: {integrity: sha512-znKXEBxfatz2GBNK02kRnCXjV+AA4kjZIUxeWSr3UGirZMJfTE9uiwKHobnbgxWyL/JWro8tTq+vOqAK1/qbSA==}
strict-event-emitter@0.5.1:
resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}
string-ts@2.2.1:
resolution: {integrity: sha512-Q2u0gko67PLLhbte5HmPfdOjNvUKbKQM+mCNQae6jE91DmoFHY6HH9GcdqCeNx87DZ2KKjiFxmA0R/42OneGWw==}
@@ -4444,6 +4490,10 @@ packages:
resolution: {integrity: sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw==}
engines: {node: '>=20.18.1'}
undici@7.15.0:
resolution: {integrity: sha512-7oZJCPvvMvTd0OlqWsIxTuItTpJBpU1tcbVl24FMn3xt3+VSunwUasmfPJRE57oNO1KsZ4PgA1xTdAX4hq8NyQ==}
engines: {node: '>=20.18.1'}
unist-util-is@6.0.0:
resolution: {integrity: sha512-2qCTHimwdxLfz+YzdGfkqNlH0tLi9xjTnHddPmJwtIG9MGsdbutfTc4P+haPD7l7Cjxf/WZj+we5qfVPvvxfYw==}
@@ -5625,6 +5675,15 @@ snapshots:
dependencies:
sparse-bitfield: 3.0.3
'@mswjs/interceptors@0.39.6':
dependencies:
'@open-draft/deferred-promise': 2.2.0
'@open-draft/logger': 0.3.0
'@open-draft/until': 2.1.0
is-node-process: 1.2.0
outvariant: 1.4.3
strict-event-emitter: 0.5.1
'@napi-rs/nice-android-arm-eabi@1.1.1':
optional: true
@@ -5739,6 +5798,15 @@ snapshots:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.19.1
'@open-draft/deferred-promise@2.2.0': {}
'@open-draft/logger@0.3.0':
dependencies:
is-node-process: 1.2.0
outvariant: 1.4.3
'@open-draft/until@2.1.0': {}
'@payloadcms/db-mongodb@3.45.0(payload@3.45.0(graphql@16.11.0)(typescript@5.7.3))':
dependencies:
mongoose: 8.15.1
@@ -6264,6 +6332,10 @@ snapshots:
'@types/ms@2.1.0': {}
'@types/nock@11.1.0':
dependencies:
nock: 14.0.10
'@types/node-cron@3.0.11': {}
'@types/node@22.17.2':
@@ -8071,6 +8143,8 @@ snapshots:
is-negative-zero@2.0.3: {}
is-node-process@1.2.0: {}
is-number-object@1.1.1:
dependencies:
call-bound: 1.0.4
@@ -8176,6 +8250,8 @@ snapshots:
json-stable-stringify-without-jsonify@1.0.1: {}
json-stringify-safe@5.0.1: {}
jsonpath-plus@10.3.0:
dependencies:
'@jsep-plugin/assignment': 1.3.0(jsep@1.4.0)
@@ -8653,6 +8729,12 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
nock@14.0.10:
dependencies:
'@mswjs/interceptors': 0.39.6
json-stringify-safe: 5.0.1
propagate: 2.0.1
node-cron@4.2.1: {}
node-domexception@1.0.0: {}
@@ -8728,6 +8810,8 @@ snapshots:
type-check: 0.4.0
word-wrap: 1.2.5
outvariant@1.4.3: {}
own-keys@1.0.1:
dependencies:
get-intrinsic: 1.3.0
@@ -9016,6 +9100,8 @@ snapshots:
object-assign: 4.1.1
react-is: 16.13.1
propagate@2.0.1: {}
pump@3.0.3:
dependencies:
end-of-stream: 1.4.5
@@ -9422,6 +9508,8 @@ snapshots:
optionalDependencies:
bare-events: 2.6.1
strict-event-emitter@0.5.1: {}
string-ts@2.2.1: {}
string-width@4.2.3:
@@ -9691,6 +9779,8 @@ snapshots:
undici@7.10.0: {}
undici@7.15.0: {}
unist-util-is@6.0.0:
dependencies:
'@types/unist': 3.0.3