Skip to content

Commit 42d7a9a

Browse files
committed
fix(runtime): the clone door's notice names the clone's own off-switch, its status
The notice every successful clone answers told the admin to switch the clone off through the activation toggle. A clone carries no package envelope, so the toggle, which switches packaged flows only, refuses it: the notice prescribed a step the platform refuses. It now names the clone's own switch, status 'obsolete' through PUT /api/v1/automation/NAME with the complete definition, and says the toggle is for packaged flows such as the one the clone was copied from. Measured at the dispatcher seam with the real engine: the clone door answered 200 with the old notice, the clone carried no _packageId, and the toggle it named answered RESOURCE_CONFLICT / 409 for it. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H
1 parent ebf3875 commit 42d7a9a

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@objectstack/runtime': patch
3+
---
4+
5+
fix(runtime): the clone door's notice names the clone's own off-switch, its status (#20726)
6+
7+
`POST /api/v1/automation/:name/clone` answers a `notice` saying the clone is armed. It told the admin to switch the clone off through `POST /api/v1/automation/NAME/toggle`. A clone carries no package envelope, so it is a flow authored in the deployment, and that switch refuses it: the switch turns packaged flows on and off only. The notice now names the clone's own switch: send its complete definition with `status: 'obsolete'` to `PUT /api/v1/automation/NAME`. It also says that the toggle switches packaged flows only, such as the flow the clone was copied from. The response shape is unchanged; only the notice text moves.

‎packages/runtime/src/flow-clone.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,23 @@ export const FLOW_CLONE_DROPPED_KEYS: readonly string[] = Object.freeze([
147147
* record-change flow and walks away has two flows running on one trigger,
148148
* and the only thing standing between them and that surprise is this
149149
* sentence.
150+
*
151+
* [#20726, ADR-0126 §7.2] The off-switch it names is the CLONE's own: its
152+
* `status`, published through `PUT /:name`. A clone carries no package
153+
* envelope (see {@link FLOW_CLONE_DROPPED_KEYS}), so it is a flow authored in
154+
* this deployment, and the activation toggle — which switches packaged flows
155+
* only — refuses it. The toggle is named for the flow it was copied from,
156+
* which is the packaged one.
150157
*/
151158
export const FLOW_CLONE_NOTICE =
152159
'References are not re-pointed: this clone calls exactly what the original called '
153160
+ '(subflows, actions and objects are unchanged). It is created with status `draft`, '
154161
+ 'which is a lifecycle label and NOT an off-switch — a cloned record-change or schedule '
155162
+ 'flow is bound to its trigger and will run alongside the flow it was copied from. '
156-
+ 'Disable it (`POST /api/v1/automation/<name>/toggle` with `{"enabled": false}`) if that '
157-
+ 'is not what you want.';
163+
+ 'If that is not what you want, switch the clone off through its own status: send its '
164+
+ 'complete definition with `status: \'obsolete\'` to `PUT /api/v1/automation/<name>`. '
165+
+ 'The activation toggle (`POST /api/v1/automation/<name>/toggle`) switches packaged flows '
166+
+ 'only, such as the one it was copied from, and refuses the clone.';
158167

159168
/** ADR-0112 envelope for the same-name refusal: a status AND a code. */
160169
export const FLOW_CLONE_NAME_TAKEN_STATUS = 409;

0 commit comments

Comments
 (0)