feat(openworkflow): add auto-indexing for duplicate step names#344
Conversation
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds automatic collision handling for duplicate step names in OpenWorkflow by deterministically indexing repeated names (name, name:1, name:2, …) during a single workflow execution pass, updating tests and documentation to reflect the new behavior.
Changes:
- Introduces step-name resolution logic in
StepExecutorand applies it acrossstep.run,step.sleep, andstep.invokeWorkflow. - Updates worker/executor tests to assert distinct results and persisted step attempt names for duplicate base names (including cross-step-type collisions and parallel invokes).
- Updates docs and architecture notes to describe auto-disambiguation of duplicate step names and dynamic-step guidance.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openworkflow/worker/worker.test.ts | Updates worker-level test to assert duplicate step names are auto-indexed and both executions run. |
| packages/openworkflow/worker/execution.ts | Implements deterministic step-name auto-indexing and refactors failure handling via a shared helper. |
| packages/openworkflow/worker/execution.test.ts | Updates/adds tests covering duplicate naming across run/sleep/invoke, including parallel invoke scenarios. |
| packages/docs/docs/steps.mdx | Revises step-naming guidance to describe auto-disambiguation behavior. |
| packages/docs/docs/dynamic-steps.mdx | Updates dynamic-steps docs to rely on auto-indexing and adds guidance around stable IDs. |
| ARCHITECTURE.md | Documents the new “durable key” collision/indexing behavior across step APIs. |
Comments suppressed due to low confidence (1)
packages/openworkflow/worker/execution.test.ts:55
- The new auto-indexing behavior has an important edge case when user-provided names already contain numeric suffixes (e.g.,
"foo:1"). It would be good to add a test covering a sequence like"foo","foo:1","foo"to ensure the resolver still produces unique durable names (and doesn’t collide/reuse cached state).
test("auto-indexes duplicate step.run names", async () => {
const backend = await createBackend();
const client = new OpenWorkflow({ backend });
let executionCount = 0;
const workflow = client.defineWorkflow(
{ name: "executor-cached" },
async ({ step }) => {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7568faf to
f2e0eda
Compare
f2e0eda to
2cf6f76
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
this PR adds automatic collision handling for duplicate step names.
table to demonstrate what it looks like: