fix(workflows): deduplicate generated workflow names - #6935
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Tests cover the client flag, suffix selection, and the concurrent-claim retry path. Reviewed by Cursor Bugbot for commit 9ab4733. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR enables server-side deduplication for generated workflow names created from both root and folder sidebar actions and adds focused tests for the new request and lifecycle behavior.
Confidence Score: 4/5The PR should not merge until deduplicated creation handles concurrent name collisions instead of silently dropping one creation after navigation. Both changed UI paths expose a non-atomic read-before-insert deduplication flow whose unique-conflict handler returns an error without retrying, leaving the optimistic caller on a workflow ID that was never created. Files Needing Attention: apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workflow-operations.ts, apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workflow-operations.ts | Enables deduplication for root workflow creation, but concurrent requests can still conflict after navigating optimistically. |
| apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/folder-item/folder-item.tsx | Enables the same deduplication behavior for folder-scoped creation and shares the unresolved concurrent-create failure. |
| apps/sim/lib/workflows/orchestration/workflow-lifecycle.test.ts | Covers successful deduplication but does not exercise the unique-constraint race or retry behavior. |
| apps/sim/lib/workflows/utils.test.ts | Adds focused coverage for choosing the next available numerical suffix. |
| apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workflow-operations.test.tsx | Verifies that generated root workflow creation requests server-side deduplication. |
Reviews (1): Last reviewed commit: "fix(workflows): deduplicate generated wo..." | Re-trigger Greptile
- recompute generated names after workflow-name conflicts - preserve exact-name and unrelated constraint behavior - cover the concurrent-create retry path
Addressed in 9ab4733: deduplicated creates now retry the workflow-name unique-index race with a freshly computed name, bounded to eight attempts. Exact-name creates retain conflict behavior, and unrelated |
Summary
Generated workflows now request server-side name deduplication in both root and folder creation paths, so concurrent or repeated creation does not surface avoidable name conflicts. Deduplicated creates retry workflow-name unique-index races with a freshly computed name, while exact-name conflicts and unrelated database violations keep their existing behavior. Folder creation also depends on the stable mutation function, which keeps its callback stable when mutation state changes.
This is the foundation of a two-PR stack. #6906 adds the new generated-name vocabulary on top.
Type of Change
Testing
bun run --cwd apps/sim test -- lib/workflows/utils.test.ts lib/workflows/orchestration/workflow-lifecycle.test.ts 'app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workflow-operations.test.tsx'(25 tests passed)bun run --cwd apps/sim test -- lib/workflows/orchestration/workflow-lifecycle.test.ts(5 tests passed after the race-retry fix)bun run check:api-validationbun run lint(passes with one pre-existing unused-suppression warning)bun run checkChecklist
Screenshots/Videos
Not applicable; this changes workflow creation behavior without changing the interface.