Skip to content

Commit 10878e2

Browse files
committed
fix(chat): label workflow dry runs as validation
1 parent 973d01a commit 10878e2

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

‎apps/sim/lib/mothership/tools/tool-display.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ describe('humanizeToolName', () => {
7272
})
7373

7474
describe('getToolDisplayTitle natural-language coverage', () => {
75+
it.each(['cli_workflows_operations_apply', 'cli_workflows_state_replace'])(
76+
'distinguishes validation from mutation for %s',
77+
(name) => {
78+
const command =
79+
name === 'cli_workflows_operations_apply' ? ['operations', 'apply'] : ['state', 'replace']
80+
const args = ['--output', 'json', 'workflows', ...command, 'workflow-id']
81+
const title = getToolDisplayTitle(name, { args: [...args, '--dry-run'] })
82+
expect(title).toBe('Validating workflow changes')
83+
expect(getToolStatusDisplayTitle(title, 'success', name)).toBe('Validated workflow changes')
84+
expect(getToolStatusDisplayTitle(title, 'error', name)).toBe(
85+
'Failed validating workflow changes'
86+
)
87+
expect(getToolDisplayTitle(name, { args })).toBe(
88+
name === 'cli_workflows_operations_apply' ? 'Editing workflow' : 'Rewriting workflow'
89+
)
90+
expect(
91+
getToolDisplayTitle(name, { args: [...args, '--operations', '["--dry-run"]'] })
92+
).not.toBe('Validating workflow changes')
93+
}
94+
)
95+
7596
it('gives gerund titles to tools that previously fell through to humanize', () => {
7697
expect(getToolDisplayTitle('deploy_as_api')).toBe('Deploying as API')
7798
expect(getToolDisplayTitle('list_workspace_mcp_servers')).toBe('Listing MCP servers')

‎apps/sim/lib/mothership/tools/tool-display.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,12 @@ export function getToolDisplayTitle(name: string, args?: Record<string, unknown>
824824
}
825825

826826
switch (name) {
827+
case 'cli_workflows_operations_apply':
828+
case 'cli_workflows_state_replace':
829+
if (stringArrayArg(args, 'args').includes('--dry-run')) {
830+
return 'Validating workflow changes'
831+
}
832+
return CLI_TOOL_TITLES[name] ?? humanizeToolName(name)
827833
case 'deploy_as_api':
828834
return deploymentTitle(args, 'API')
829835
case 'deploy_as_chat':

0 commit comments

Comments
 (0)