Skip to content

Backport #2387: test: e2e coverage for run-idempotency conflict-handling strategies#2402

Merged
pranaygp merged 4 commits into
stablefrom
backport/pr-2387-to-stable
Jun 14, 2026
Merged

Backport #2387: test: e2e coverage for run-idempotency conflict-handling strategies#2402
pranaygp merged 4 commits into
stablefrom
backport/pr-2387-to-stable

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Automated backport of #2387 to stable (backport job run).

Triggered manually via workflow_dispatch.

…2387)

* test: e2e coverage for run-idempotency conflict-handling strategies

Covers the patterns documented in foundations/idempotency:
- claim-only hook mutex: token claimed and held with no payload data,
  duplicate identifies the owner, token released after completion
- adopt the owner's result via conflict.returnValue
- signal the owner: duplicate forwards its payload via resumeHook
- supersede: duplicate cancels the owner and reclaims the token
- route-side resume-or-start retry pattern reaching the started run

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: fix adopt-owner-result race — gate owner completion on observed conflict

On slow runtimes the duplicate's first invocation could land after the
owner completed and released the token, making the duplicate a fresh
owner that waits forever for a payload (90s timeout across CI matrices).
Poll the duplicate's event log for hook_conflict before resuming the
owner, and widen the test timeout for the added gate budget.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* review: assert superseded owner's returnValue rejection; empty changeset

- Await run1.returnValue and assert WorkflowRunCancelledError so the
  cancellation is verified end-to-end and no rejection leaks from the
  supersede test.
- Test-only PR: use an empty changeset.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci: retrigger preview deployments (turbopack deployment for 2e9d000 wedged in esbuild hang)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci: bust poisoned turbo cache entry for nextjs-turbopack build

The 2e9d000 deployment's next build crashed in an esbuild hang but its
task (70724907c9dd3a29) was recorded into the turbo remote cache anyway,
so every subsequent build with the same input hash replays the broken
artifact (missing routes-manifest). Change a build input to force a
fresh execution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Pranay Prakash <pranay.gp@gmail.com>
@changeset-bot

changeset-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 92d02ee

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
example-nextjs-workflow-turbopack Ready Ready Preview, Comment Jun 13, 2026 9:53pm
example-nextjs-workflow-webpack Ready Ready Preview, Comment Jun 13, 2026 9:53pm
example-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-astro-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-express-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-fastify-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-hono-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-nitro-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-nuxt-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-sveltekit-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-tanstack-start-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workbench-vite-workflow Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workflow-swc-playground Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workflow-tarballs Ready Ready Preview, Comment Jun 13, 2026 9:53pm
workflow-web Ready Ready Preview, Comment Jun 13, 2026 9:53pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
workflow-docs Skipped Skipped Jun 13, 2026 9:53pm

Comment thread workbench/example/workflows/99_e2e.ts Outdated
Comment thread workbench/example/workflows/99_e2e.ts
pranaygp and others added 2 commits June 13, 2026 14:27
…-stable

* origin/stable:
  [test] Fix stable e2e hookGetConflict test to use waitForHookState (#2405)
  Update queue client to 0.3.1 (#2399) (#2401)
  fix(deps): upgrade esbuild to 0.28.1 (GHSA-gv7w-rqvm-qjhr) (#2395) (#2404)
…getRun API

The backport of #2387 used APIs that only exist on `main`, breaking the
nextjs-turbopack/webpack builds and the e2e suite on `stable`:

- `hookAdoptOwnerResultWorkflow`/`hookSupersedeOwnerWorkflow` read
  `conflict.returnValue`/`conflict.cancel()`, but on `stable`
  `getConflict()` resolves with `{ runId }`. Resolve the owning run via
  `getRun(conflict.runId)` inside a step (the documented stable pattern)
  to await its result / cancel it.
- Import `resumeHook` from `workflow/api` in 99_e2e.ts (was used by
  `forwardPayloadToOwner` but never imported).
- Convert the backported `waitForHook(token, { runId })` call sites to
  `waitForHookState(token, predicate)`; `waitForHook` does not exist on
  `stable` (#2405 standardized on `waitForHookState`).

Both workbench builds and `biome check` pass locally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

🧪 E2E Test Results

Some tests failed

Summary

Passed Failed Skipped Total
✅ ▲ Vercel Production 1033 0 67 1100
✅ 💻 Local Development 1114 0 86 1200
✅ 📦 Local Production 1114 0 86 1200
✅ 🐘 Local Postgres 1114 0 86 1200
✅ 🪟 Windows 100 0 0 100
❌ 🌍 Community Worlds 75 96 6 177
✅ 📋 Other 564 0 36 600
Total 5114 96 367 5577

❌ Failed Tests

🌍 Community Worlds (96 failed)

redis (18 failed):

  • hookWorkflow | wrun_01KV1FGFNPBYT5DE89W6SX1C75
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV1FGQHMM3854GXG1P95YR2K
  • sleepingWorkflow | wrun_01KV1FH32V2DVWXSXP182VJ98D
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV1FRMVD4ZJ4ZGPZQC34M54F
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV1FS18FBY70Z85R4TMN7PV8
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV1FS94TTPFC9FSH1WVZPE3W
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1FSQBTXZX6J67V9NMNNPTV
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KV1FTK0YHX8912QZ12E7Y8TJ
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KV1FTQXDBZKAMD8W2CV2X1XV
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KV1FTZTZKTP3AYHBJ07FHRT7
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KV1FV5MP1ZGJ0JB5VRA588TS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KV1FVEQ808MHV2VZAEH7F1QD
  • pages router sleepingWorkflow via pages router
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV1G1DXX0MN9V1TPNGF9Y17V

turso (78 failed):

  • addTenWorkflow | wrun_01KV1FFGC0DZZ4Y1T2EZ71SHE6
  • addTenWorkflow | wrun_01KV1FFGC0DZZ4Y1T2EZ71SHE6
  • wellKnownAgentWorkflow (.well-known/agent) | wrun_01KV1FGQEZQWSJQK1E5CD1HB9J
  • should work with react rendering in step
  • promiseAllWorkflow | wrun_01KV1FFQX10ZE7CH65WSJDT6T7
  • promiseRaceWorkflow | wrun_01KV1FFWFH4S4H5ZTDBVQYKTKQ
  • promiseAnyWorkflow | wrun_01KV1FG01797XZBFCNAXF6CSGF
  • importedStepOnlyWorkflow | wrun_01KV1FH0WTNMBGJ49ZB81MCR17
  • readableStreamWorkflow | wrun_01KV1FG2AAM87P0XQJ5MCYYTMN
  • hookWorkflow | wrun_01KV1FGFNPBYT5DE89W6SX1C75
  • hookWorkflow is not resumable via public webhook endpoint | wrun_01KV1FGQHMM3854GXG1P95YR2K
  • webhookWorkflow | wrun_01KV1FGW6PN83ZPEC7Y3296PYE
  • sleepingWorkflow | wrun_01KV1FH32V2DVWXSXP182VJ98D
  • parallelSleepWorkflow | wrun_01KV1FHJM2WDTPT6BQPWW9HFZJ
  • nullByteWorkflow | wrun_01KV1FHP34JY6VHVG1SSWDVBVF
  • workflowAndStepMetadataWorkflow | wrun_01KV1FHR95H0D0GVGV12NX9VY9
  • outputStreamWorkflow no startIndex (reads all chunks)
  • outputStreamWorkflow positive startIndex (skips first chunk)
  • outputStreamWorkflow negative startIndex (reads from end)
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns correct index after stream completes
  • outputStreamWorkflow - getTailIndex and getStreamChunks getTailIndex returns -1 before any chunks are written
  • outputStreamWorkflow - getTailIndex and getStreamChunks getStreamChunks returns same content as reading the stream
  • outputStreamInsideStepWorkflow - getWritable() called inside step functions | wrun_01KV1FM2K14460SP2RB7KH8QCS
  • writableForwardedFromWorkflowWorkflow | wrun_01KV1FMFRRAWAPEP15BBDSV398
  • writableForwardedFromStepWorkflow | wrun_01KV1FMKVJCMPPDDNEHY707AF4
  • fetchWorkflow | wrun_01KV1FMQBBPJ8X3JTXR8F2NNX4
  • promiseRaceStressTestWorkflow | wrun_01KV1FMTTBK15W4WBSB4E3EYFP
  • error handling error propagation workflow errors nested function calls preserve message and stack trace
  • error handling error propagation workflow errors cross-file imports preserve message and stack trace
  • error handling error propagation step errors basic step error preserves message and stack trace
  • error handling error propagation step errors cross-file step error preserves message and function names in stack
  • error handling retry behavior regular Error retries until success
  • error handling retry behavior FatalError fails immediately without retries
  • error handling retry behavior RetryableError respects custom retryAfter delay
  • error handling retry behavior maxRetries=0 disables retries
  • error handling catchability FatalError can be caught and detected with FatalError.is()
  • error handling not registered WorkflowNotRegisteredError fails the run when workflow does not exist
  • error handling not registered StepNotRegisteredError fails the step but workflow can catch it
  • error handling not registered StepNotRegisteredError fails the run when not caught in workflow
  • hookCleanupTestWorkflow - hook token reuse after workflow completion | wrun_01KV1FR8BHGS9NQWPCP4QKT7E4
  • concurrent hook token conflict - two workflows cannot use the same hook token simultaneously | wrun_01KV1FRMVD4ZJ4ZGPZQC34M54F
  • hookGetConflictWorkflow - awaiting hook.getConflict() registers hook without payload | wrun_01KV1FS18FBY70Z85R4TMN7PV8
  • 'hookGetConflictWithPriorStepWorkflow' - hook.getConflict() does not block step execution | wrun_01KV1FS3S40TBV8CVJAVAY0CEF
  • 'hookGetConflictWithParallelStepWorkfl…' - hook.getConflict() does not block step execution | wrun_01KV1FS69AV4S43J8B77BAH86D
  • hookGetConflictThenStepParallelWorkflow - hook.getConflict() continuation step runs alongside other steps | wrun_01KV1FS94TTPFC9FSH1WVZPE3W
  • hookGetConflictWorkflow - hook.getConflict() resolves with the conflicting run when token is already registered | wrun_01KV1FSQBTXZX6J67V9NMNNPTV
  • hookClaimOnlyMutexWorkflow - hook works as a pure run mutex without payload data | wrun_01KV1FTK0YHX8912QZ12E7Y8TJ
  • hookAdoptOwnerResultWorkflow - duplicate adopts the owner result via conflict.returnValue | wrun_01KV1FTQXDBZKAMD8W2CV2X1XV
  • hookSignalOwnerWorkflow - duplicate forwards its payload to the owner via resumeHook | wrun_01KV1FTZTZKTP3AYHBJ07FHRT7
  • hookSupersedeOwnerWorkflow - duplicate cancels the owner and claims the released token | wrun_01KV1FV5MP1ZGJ0JB5VRA588TS
  • resume-or-start route pattern - resumeHook retried after start() reaches the new run | wrun_01KV1FVEQ808MHV2VZAEH7F1QD
  • hookDisposeTestWorkflow - hook token reuse after explicit disposal while workflow still running | wrun_01KV1FVQ209SCPEX69BAHZNVTE
  • stepFunctionPassingWorkflow - step function references can be passed as arguments (without closure vars) | wrun_01KV1FW6XAAE08E2CB06R58B6B
  • stepFunctionWithClosureWorkflow - step function with closure variables passed as argument | wrun_01KV1FWHPTCX58HN17BM9PY9RS
  • closureVariableWorkflow - nested step functions with closure variables | wrun_01KV1FWQH1S58XHYP9SX231EFS
  • spawnWorkflowFromStepWorkflow - spawning a child workflow using start() inside a step | wrun_01KV1FWSSS66AS1K3G4WKT0G2R
  • health check (queue-based) - workflow and step endpoints respond to health check messages
  • health check (CLI) - workflow health command reports healthy endpoints
  • pathsAliasWorkflow - TypeScript path aliases resolve correctly | wrun_01KV1FXAEY1E9WS5Q6C8Q95ZQP
  • Calculator.calculate - static workflow method using static step methods from another class | wrun_01KV1FXGBNPT8FEW4MVJ2CN6PV
  • AllInOneService.processNumber - static workflow method using sibling static step methods | wrun_01KV1FXQG9JBNFM4CHTZFR1BJN
  • ChainableService.processWithThis - static step methods using this to reference the class | wrun_01KV1FXYH3D9TS9NA6YRY2J0GE
  • thisSerializationWorkflow - step function invoked with .call() and .apply() | wrun_01KV1FY5JKPTMWKFXGFK58Y61Q
  • customSerializationWorkflow - custom class serialization with WORKFLOW_SERIALIZE/WORKFLOW_DESERIALIZE | wrun_01KV1FYCJANPRMJCJAPSZC03XQ
  • instanceMethodStepWorkflow - instance methods with "use step" directive | wrun_01KV1FYMXRMY6Q4HZBJB194DX4
  • crossContextSerdeWorkflow - classes defined in step code are deserializable in workflow context | wrun_01KV1FZ258D7630QTZ8PZ1BQF4
  • stepFunctionAsStartArgWorkflow - step function reference passed as start() argument | wrun_01KV1FZA898NKK8053QCB8DPND
  • cancelRun - cancelling a running workflow | wrun_01KV1FZH7759ZFBH6WNTRC4XWC
  • cancelRun via CLI - cancelling a running workflow | wrun_01KV1FZTS49BEY6G7008KZ16Q5
  • pages router addTenWorkflow via pages router
  • pages router promiseAllWorkflow via pages router
  • pages router sleepingWorkflow via pages router
  • hookWithSleepWorkflow - hook payloads delivered correctly with concurrent sleep | wrun_01KV1G0755FHR77NMS8XCV48E5
  • sleepInLoopWorkflow - sleep inside loop with steps actually delays each iteration | wrun_01KV1G0QVAA80DSFCY6YW4C1JA
  • sleepWithSequentialStepsWorkflow - sequential steps work with concurrent sleep (control) | wrun_01KV1G12GN74HM2WVVKNN91QSJ
  • importMetaUrlWorkflow - import.meta.url is available in step bundles | wrun_01KV1G19G6D871S1TNFZ6TGN7M
  • metadataFromHelperWorkflow - getWorkflowMetadata/getStepMetadata work from module-level helper (#1577) | wrun_01KV1G1BQYA88K15PMC9KWW8C3
  • resilient start: addTenWorkflow completes when run_created returns 500 | wrun_01KV1G1DXX0MN9V1TPNGF9Y17V

Details by Category

✅ ▲ Vercel Production
App Passed Failed Skipped
✅ astro 93 0 7
✅ example 93 0 7
✅ express 93 0 7
✅ fastify 93 0 7
✅ hono 93 0 7
✅ nextjs-turbopack 98 0 2
✅ nextjs-webpack 98 0 2
✅ nitro 93 0 7
✅ nuxt 93 0 7
✅ sveltekit 93 0 7
✅ vite 93 0 7
✅ 💻 Local Development
App Passed Failed Skipped
✅ astro-stable 94 0 6
✅ express-stable 94 0 6
✅ fastify-stable 94 0 6
✅ hono-stable 94 0 6
✅ nextjs-turbopack-canary 81 0 19
✅ nextjs-turbopack-stable 100 0 0
✅ nextjs-webpack-canary 81 0 19
✅ nextjs-webpack-stable 100 0 0
✅ nitro-stable 94 0 6
✅ nuxt-stable 94 0 6
✅ sveltekit-stable 94 0 6
✅ vite-stable 94 0 6
✅ 📦 Local Production
App Passed Failed Skipped
✅ astro-stable 94 0 6
✅ express-stable 94 0 6
✅ fastify-stable 94 0 6
✅ hono-stable 94 0 6
✅ nextjs-turbopack-canary 81 0 19
✅ nextjs-turbopack-stable 100 0 0
✅ nextjs-webpack-canary 81 0 19
✅ nextjs-webpack-stable 100 0 0
✅ nitro-stable 94 0 6
✅ nuxt-stable 94 0 6
✅ sveltekit-stable 94 0 6
✅ vite-stable 94 0 6
✅ 🐘 Local Postgres
App Passed Failed Skipped
✅ astro-stable 94 0 6
✅ express-stable 94 0 6
✅ fastify-stable 94 0 6
✅ hono-stable 94 0 6
✅ nextjs-turbopack-canary 81 0 19
✅ nextjs-turbopack-stable 100 0 0
✅ nextjs-webpack-canary 81 0 19
✅ nextjs-webpack-stable 100 0 0
✅ nitro-stable 94 0 6
✅ nuxt-stable 94 0 6
✅ sveltekit-stable 94 0 6
✅ vite-stable 94 0 6
✅ 🪟 Windows
App Passed Failed Skipped
✅ nextjs-turbopack 100 0 0
❌ 🌍 Community Worlds
App Passed Failed Skipped
✅ mongodb-dev 3 0 2
✅ redis-dev 3 0 2
❌ redis 63 18 0
✅ turso-dev 3 0 2
❌ turso 3 78 0
✅ 📋 Other
App Passed Failed Skipped
✅ e2e-local-dev-nest-stable 94 0 6
✅ e2e-local-dev-tanstack-start-stable 94 0 6
✅ e2e-local-postgres-nest-stable 94 0 6
✅ e2e-local-postgres-tanstack-start-stable 94 0 6
✅ e2e-local-prod-nest-stable 94 0 6
✅ e2e-local-prod-tanstack-start-stable 94 0 6

📋 View full workflow run

The backported conflict tests call `HookNotFoundError.is()` in
`hookClaimOnlyMutexWorkflow` (token-release wait) and the resume-or-start
route test, but the import was never carried into the stable test file —
causing a runtime `ReferenceError: HookNotFoundError is not defined`.
Import it from `@workflow/errors` (matches `main`).

Verified locally against nextjs-turbopack: the two previously-failing
tests plus the adopt/signal/supersede rewrites all pass (5/5).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel vercel Bot temporarily deployed to Preview – workflow-docs June 13, 2026 21:49 Inactive
@pranaygp pranaygp merged commit ffa053e into stable Jun 14, 2026
94 of 97 checks passed
@pranaygp pranaygp deleted the backport/pr-2387-to-stable branch June 14, 2026 08:00
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.

1 participant