ctx.context.timestamp = Date.now() | Non-deterministic, breaks test reproducibility | ctx.context.timestamp = ctx.now.toISOString() |
ctx.context.data = new Map() | Not JSON-serializable | Use plain object {} |
ctx.metadata.status = "done" | ctx.metadata is deepFreezed — under strict mode the assignment throws TypeError; in non-strict contexts it is silently ignored | Write to ctx.context.status instead |
Mandatory event with commands but no errorState | Command failure throws CommandFailureError | Add errorState OR mark non-critical command bestEffort: true |
return { ok: true } after network error catch | Hides infrastructure failure | If non-critical, mark bestEffort: true and return ok:false honestly. If critical, re-throw. |
Compensation command catches and returns { ok: true } | Lies in audit trail; loses error detail | (v1.0.0) Mark bestEffort: true and return the real ok:false — chain still continues |
Math.random() > 0.5 ? "a" : "b" in command | Non-deterministic behavior | Use deterministic logic or external service |
| State context and command writing same key without awareness | State context silently wins on merge | Document or avoid key conflicts |
(v1.0.0) WorkflowModule.forRootAsync({ observers: [...] }) at top level | Field was removed; observers no longer wire up | Return observers from useFactory inside the factory config |
(v1.0.0) forRootAsync injects an observer that's only in the consuming module's providers | DI scope error at startup ("Nest can't resolve dependencies of WORKFLOW_MODULE_OPTIONS") | Put the observer in its own module, export it, add the module to |