Skip to content

Commit 7d7ce0e

Browse files
committed
fix(chat): label workflow dry runs as validation
1 parent aa57e02 commit 7d7ce0e

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
@@ -71,6 +71,27 @@ describe('humanizeToolName', () => {
7171
})
7272

7373
describe('getToolDisplayTitle natural-language coverage', () => {
74+
it.each(['cli_workflows_operations_apply', 'cli_workflows_state_replace'])(
75+
'distinguishes validation from mutation for %s',
76+
(name) => {
77+
const command =
78+
name === 'cli_workflows_operations_apply' ? ['operations', 'apply'] : ['state', 'replace']
79+
const args = ['--output', 'json', 'workflows', ...command, 'workflow-id']
80+
const title = getToolDisplayTitle(name, { args: [...args, '--dry-run'] })
81+
expect(title).toBe('Validating workflow changes')
82+
expect(getToolStatusDisplayTitle(title, 'success', name)).toBe('Validated workflow changes')
83+
expect(getToolStatusDisplayTitle(title, 'error', name)).toBe(
84+
'Failed validating workflow changes'
85+
)
86+
expect(getToolDisplayTitle(name, { args })).toBe(
87+
name === 'cli_workflows_operations_apply' ? 'Editing workflow' : 'Rewriting workflow'
88+
)
89+
expect(
90+
getToolDisplayTitle(name, { args: [...args, '--operations', '["--dry-run"]'] })
91+
).not.toBe('Validating workflow changes')
92+
}
93+
)
94+
7495
it('gives gerund titles to tools that previously fell through to humanize', () => {
7596
expect(getToolDisplayTitle('deploy_as_api')).toBe('Deploying as API')
7697
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
@@ -816,6 +816,12 @@ export function getToolDisplayTitle(name: string, args?: Record<string, unknown>
816816
}
817817

818818
switch (name) {
819+
case 'cli_workflows_operations_apply':
820+
case 'cli_workflows_state_replace':
821+
if (stringArrayArg(args, 'args').includes('--dry-run')) {
822+
return 'Validating workflow changes'
823+
}
824+
return CLI_TOOL_TITLES[name] ?? humanizeToolName(name)
819825
case 'deploy_as_api':
820826
return deploymentTitle(args, 'API')
821827
case 'deploy_as_chat':

0 commit comments

Comments
 (0)