mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(tables): prevent legacy group auto-run dispatch (#6595)
This commit is contained in:
@@ -378,6 +378,28 @@ describe('workflow and enrichment Table application commands', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('does not start auto-run when the generic update saves a legacy enabled group', async () => {
|
||||
await updateTableGroupUseCase.execute({
|
||||
principal,
|
||||
input: {
|
||||
tableId: table.id,
|
||||
workspaceId: table.workspaceId,
|
||||
groupId: group.id,
|
||||
autoRun: true,
|
||||
},
|
||||
})
|
||||
|
||||
expect(mocks.updateGroup).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
autoRun: true,
|
||||
suppressAutoRunDispatch: true,
|
||||
}),
|
||||
'request-1'
|
||||
)
|
||||
expect(mocks.runDetached).not.toHaveBeenCalled()
|
||||
expect(mocks.runWorkflowColumn).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('rejects an invalid output before constructing or mutating the group', async () => {
|
||||
await expect(
|
||||
createWorkflowTableGroup.execute({
|
||||
@@ -513,6 +535,28 @@ describe('workflow and enrichment Table application commands', () => {
|
||||
expect(mocks.signal).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not start auto-run when the workflow update saves a legacy enabled group', async () => {
|
||||
await updateWorkflowTableGroup.execute({
|
||||
principal,
|
||||
input: {
|
||||
tableId: table.id,
|
||||
workspaceId: table.workspaceId,
|
||||
groupId: group.id,
|
||||
autoRun: true,
|
||||
},
|
||||
})
|
||||
|
||||
expect(mocks.updateGroup).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
autoRun: true,
|
||||
suppressAutoRunDispatch: true,
|
||||
}),
|
||||
'request-1'
|
||||
)
|
||||
expect(mocks.runDetached).not.toHaveBeenCalled()
|
||||
expect(mocks.runWorkflowColumn).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('passes authorized output type and ordering to the add-output mutation', async () => {
|
||||
await addWorkflowTableGroupOutput.execute({
|
||||
principal,
|
||||
|
||||
@@ -635,7 +635,7 @@ export const updateTableGroupUseCase = defineAuthorizedTableUseCase({
|
||||
changed:
|
||||
JSON.stringify(context.table.schema) !== JSON.stringify(table.schema) ||
|
||||
JSON.stringify(context.table.metadata) !== JSON.stringify(table.metadata),
|
||||
startAutoRun: previousGroup?.autoRun !== true && input.autoRun === true,
|
||||
startAutoRun: previousGroup?.autoRun === false && input.autoRun === true,
|
||||
actorUserId,
|
||||
}
|
||||
},
|
||||
@@ -824,7 +824,7 @@ export const updateWorkflowTableGroup = defineAuthorizedTableUseCase({
|
||||
changed:
|
||||
JSON.stringify(context.table.schema) !== JSON.stringify(table.schema) ||
|
||||
JSON.stringify(context.table.metadata) !== JSON.stringify(table.metadata),
|
||||
startAutoRun: previousGroup.autoRun !== true && input.autoRun === true,
|
||||
startAutoRun: previousGroup.autoRun === false && input.autoRun === true,
|
||||
actorUserId,
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user