Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sim/executor/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export const DEFAULTS = {
BLOCK_TITLE: 'Untitled Block',
WORKFLOW_NAME: 'Workflow',
DEFAULT_LOOP_ITERATIONS: 1000,
MAX_PARALLEL_BRANCHES: 20,
MAX_PARALLEL_BRANCHES: 100,
MAX_NESTING_DEPTH: 10,
/** Maximum child workflow depth for propagating SSE callbacks (block:started, block:completed). */
MAX_SSE_CHILD_DEPTH: 3,
Expand Down
5 changes: 3 additions & 2 deletions apps/sim/executor/orchestrators/parallel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,15 @@ describe('ParallelOrchestrator', () => {
'parallel-1'
)

expect(oversizedBatchScope.batchSize).toBe(50)
expect(oversizedBatchScope.currentBatchSize).toBe(9)
})

it.each([
['oversized numeric batch size', 999, DEFAULTS.MAX_PARALLEL_BRANCHES],
['negative batch size', -1, 1],
['undefined batch size', undefined, DEFAULTS.MAX_PARALLEL_BRANCHES],
['nonnumeric batch size', 'not-a-number', DEFAULTS.MAX_PARALLEL_BRANCHES],
['undefined batch size', undefined, 20],
['nonnumeric batch size', 'not-a-number', 20],
Comment thread
royalpinto007 marked this conversation as resolved.
Outdated
])('normalizes %s', async (_name, batchSize, expectedBatchSize) => {
const dag = createDag()
const parallelConfig = dag.parallelConfigs.get('parallel-1')!
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/hooks/use-collaborative-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1906,7 +1906,7 @@ export function useCollaborativeWorkflow() {
const currentCount = currentBlock.data?.count || 5
const currentDistribution = currentBlock.data?.collection || ''
const currentParallelType = currentBlock.data?.parallelType || 'count'
const clampedBatchSize = Math.max(1, Math.min(20, batchSize))
const clampedBatchSize = Math.max(1, Math.min(100, batchSize))
Comment thread
royalpinto007 marked this conversation as resolved.
Outdated

const config = {
id: parallelId,
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/workflows/search-replace/replacements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1658,14 +1658,14 @@ describe('buildWorkflowSearchReplacePlan', () => {
blocks: workflow.blocks,
matches,
selectedMatchIds: new Set(matches.map((match) => match.id)),
defaultReplacement: '25',
defaultReplacement: '101',
})

expect(plan.subflowUpdates).toEqual([])
expect(plan.conflicts).toEqual([
{
matchId: 'subflow-text:parallel-1:subflowBatchSize:0:0',
reason: 'Parallel batch size must be between 1 and 20',
reason: 'Parallel batch size must be between 1 and 100',
},
])
})
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/lib/workflows/search-replace/subflow-fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export function parseWorkflowSearchSubflowReplacement({
}

const count = Number.parseInt(trimmed, 10)
const maxBatchSize = 20
const maxBatchSize = 100
if (
count < 1 ||
(fieldId === WORKFLOW_SEARCH_SUBFLOW_FIELD_IDS.batchSize && count > maxBatchSize)
Expand Down
10 changes: 8 additions & 2 deletions apps/sim/stores/workflows/workflow/store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ describe('workflow store', () => {
expect(state.blocks.parallel1?.data?.count).toBe(1)
})

it('should clamp parallel batch size between 1 and 20', () => {
it('should clamp parallel batch size between 1 and 100', () => {
const { updateParallelBatchSize } = useWorkflowStore.getState()

addBlock(
Expand All @@ -625,7 +625,13 @@ describe('workflow store', () => {

updateParallelBatchSize('parallel1', 50)
state = useWorkflowStore.getState()
expect(state.blocks.parallel1?.data?.batchSize).toBe(20)
expect(state.blocks.parallel1?.data?.batchSize).toBe(50)
expect(state.parallels.parallel1.batchSize).toBe(50)

updateParallelBatchSize('parallel1', 101)
state = useWorkflowStore.getState()
expect(state.blocks.parallel1?.data?.batchSize).toBe(100)
expect(state.parallels.parallel1.batchSize).toBe(100)

updateParallelBatchSize('parallel1', 0)
state = useWorkflowStore.getState()
Expand Down
2 changes: 1 addition & 1 deletion apps/sim/stores/workflows/workflow/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { BlockState, Loop, Parallel } from '@/stores/workflows/workflow/typ

const DEFAULT_LOOP_ITERATIONS = 5
const DEFAULT_PARALLEL_BATCH_SIZE = 20
const MAX_PARALLEL_BATCH_SIZE = 20
const MAX_PARALLEL_BATCH_SIZE = 100

export function clampParallelBatchSize(batchSize: unknown): number {
const parsed = typeof batchSize === 'number' ? batchSize : Number.parseInt(String(batchSize), 10)
Expand Down
2 changes: 1 addition & 1 deletion packages/workflow-persistence/src/subflow-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BlockState, Loop, Parallel } from '@sim/workflow-types/workflow'

const DEFAULT_LOOP_ITERATIONS = 5
const DEFAULT_PARALLEL_BATCH_SIZE = 20
const MAX_PARALLEL_BATCH_SIZE = 20
const MAX_PARALLEL_BATCH_SIZE = 100

export function clampParallelBatchSize(batchSize: unknown): number {
const parsed = typeof batchSize === 'number' ? batchSize : Number.parseInt(String(batchSize), 10)
Expand Down