chore: idempotent cart operations (#13236)

* chore(core-flows): idempotent cart operations

* changeset

* add tests

* revert

* revert route

* promo test

* skip bugs

* fix test

* tests

* avoid workflow name conflict

* prevent nested workflow from being deleted until the top level parent finishes

* remove unused setTimeout

* update changeset

* rm comments

---------

Co-authored-by: adrien2p <adrien.deperetti@gmail.com>
This commit is contained in:
Carlos R. L. Rodrigues
2025-08-28 15:04:00 +02:00
committed by GitHub
co-authored by adrien2p
parent b111d01898
commit 9412669e65
38 changed files with 890 additions and 64 deletions
@@ -211,6 +211,7 @@ export function createWorkflow<TData, TResult, THooks extends any[]>(
step.__step__ + "-" + (stepContext.transactionId ?? ulid()),
parentStepIdempotencyKey: stepContext.idempotencyKey,
preventReleaseEvents: true,
runId: stepContext.runId,
}
let transaction
@@ -38,6 +38,7 @@ function buildStepContext({
parentStepIdempotencyKey: flowMetadata?.parentStepIdempotencyKey as string,
preventReleaseEvents: flowMetadata?.preventReleaseEvents ?? false,
transactionId: stepArguments.context!.transactionId,
runId: flow.runId,
context: stepArguments.context!,
" stepDefinition": stepDefinition,
" getStepResult"(
@@ -192,6 +192,11 @@ export interface StepExecutionContext {
*/
transactionId?: string
/**
* A string indicating the ID of the current run.
*/
runId?: string
/**
* Get access to the result returned by a named step. Returns undefined
* when step is not found or when nothing was returned.