Skip to content

Commit 8d3812f

Browse files
committed
fix(sim-cli): chat redeploy hint names the sim_cli test run; chat guide deploys only after a completed run
1 parent 9a5156c commit 8d3812f

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎packages/sim-cli/src/commands/protocol/workflow-dir.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ const ADVANCED_TEST_AND_DEPLOY: Record<
268268
"Batch it: write every file first, then run steps 2 and 4 as one chained command in run_code's shell, `sim workflows source check --dir . && sim workflows source apply --dir . --yes`, and fix what it reports in the next step.",
269269
testRun: "sim_cli's `workflows run <workflowId> --dry --input '{…}' --dir <dir>`",
270270
applyStep:
271-
"Then test it with sim_cli, as the shell refuses runs: `workflows run <workflowId> --dry --input '{…}' --dir <dir>` (`--dir` maps a failure to file:line), and deploy only the draft that run tested with `workflows deploy <id> --expected-draft-fingerprint <fingerprint>` (the fingerprint in `.sim/base.json`).",
271+
"Then test it with sim_cli, as the shell refuses runs: `workflows run <workflowId> --dry --input '{…}' --dir <dir>` (`--dir` maps a failure to file:line), and only if that run completed, deploy the draft it tested with `workflows deploy <id> --expected-draft-fingerprint <fingerprint>` (the fingerprint in `.sim/base.json`).",
272272
},
273273
}
274274

‎packages/sim-cli/src/commands/protocol/workflow-source-apply.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,18 @@ describe('sim workflows source apply', () => {
12701270
)
12711271
})
12721272

1273+
it('inside Mothership, names the test run through sim_cli, never --run or --deploy, in the reason', async () => {
1274+
setTerminal(false)
1275+
vi.stubEnv('SIM_CLI_HOST', 'mothership')
1276+
request.mockResolvedValue(outcome())
1277+
1278+
await apply(WORKFLOW_ID, '--dir', dir, '--yes')
1279+
1280+
const reason = String(toRecord(stdoutJson().next).reason)
1281+
expect(reason).toContain(`sim_cli (\`workflows run ${WORKFLOW_ID} --dry`)
1282+
expect(reason).not.toMatch(/--run|--deploy/)
1283+
})
1284+
12731285
it.each([
12741286
[null, false, 'not deployed'],
12751287
[3, false, 'version 3, matches the draft'],

‎packages/sim-cli/src/commands/protocol/workflow-source-apply.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,8 @@ async function writeWorkflowSource<Operation extends SourceWriteOperation>(args:
327327
verb,
328328
machine: findings.machine,
329329
// Read only without --deploy: an untested draft's next names the tested deploy too.
330-
// Mothership's shell refuses runs: its chat tests through sim_cli, then deploys by fingerprint.
331330
testedDeploy:
332-
run === undefined && !creating && primerSurface() === 'cli'
331+
run === undefined && !creating
333332
? `${args.savedCommand} --yes --run '{…}' --deploy`
334333
: undefined,
335334
})
@@ -462,7 +461,10 @@ async function deployStep(
462461
return {
463462
next: {
464463
command: deployCommand,
465-
reason: `The workflow is deployed and its draft now differs from the live version: deploy to make the change live (or ${options.verb} with --deploy).${options.testedDeploy ? ` The draft is untested: \`${options.testedDeploy}\` tests and deploys it in one step.` : ''}`,
464+
reason:
465+
primerSurface() === 'chat'
466+
? `The workflow is deployed and its draft now differs from the live version: test the draft with sim_cli (\`workflows run ${data.workflowId} --dry --input '{…}'\`), then deploy it if that run completed.`
467+
: `The workflow is deployed and its draft now differs from the live version: deploy to make the change live (or ${options.verb} with --deploy).${options.testedDeploy ? ` The draft is untested: \`${options.testedDeploy}\` tests and deploys it in one step.` : ''}`,
466468
},
467469
}
468470
}

0 commit comments

Comments
 (0)