Skip to content

Commit 191a843

Browse files
committed
fix(runtime): New similar on a flow with a live override drops the override declaration
FLOW_CLONE_DROPPED_KEYS now derives OverrideDeclarationFields beside the protection envelope, so the copy is the pair's own item under its new name and the save gate no longer answers 403 NOT_OVERRIDABLE (ADR-0146 D2/D4). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JQwxbYmYA3GtqMUGHGQkR8
1 parent db4ce28 commit 191a843

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,12 @@
9494
* rather than only in an ADR.
9595
*/
9696

97-
import { getMetadataTypeRedactor, METADATA_READ_DECORATIONS, MetadataProtectionFields } from '@objectstack/spec/kernel';
97+
import {
98+
getMetadataTypeRedactor,
99+
METADATA_READ_DECORATIONS,
100+
MetadataProtectionFields,
101+
OverrideDeclarationFields,
102+
} from '@objectstack/spec/kernel';
98103

99104
/**
100105
* The deployment status a clone is created with: switched OFF.
@@ -155,11 +160,22 @@ export const FLOW_CLONE_MUTATED_FIELDS = ['name', 'label', 'status'] as const;
155160
* row stored before that refusal still carries it — `FlowSchema` declares the
156161
* key, so the parse keeps it — and a copy that kept it would be refused over a
157162
* block the admin never sent. Dropping it changes no verdict: it never bound.
163+
*
164+
* [ADR-0146 D2/D4] The override declaration (`OverrideDeclarationFields`, the
165+
* spread `FlowSchema` itself carries) is dropped too, derived the same way.
166+
* With a live override the source is the pair's item under the base's name
167+
* declaring `overrides: { package, basedOn }`, and that is the body the engine
168+
* holds for the name. A declaration names the base item it replaces BY NAME,
169+
* so under the copy's new name it would declare an override of a flow the
170+
* base does not ship, and the save gate refuses it (`403 NOT_OVERRIDABLE`).
171+
* New similar writes the pair's own item: it copies what the source serves
172+
* (the override's definition) and overrides nothing.
158173
*/
159174
export const FLOW_CLONE_DROPPED_KEYS: readonly string[] = Object.freeze([
160175
...METADATA_READ_DECORATIONS,
161176
...Object.keys(MetadataProtectionFields),
162177
'protection',
178+
...Object.keys(OverrideDeclarationFields),
163179
]);
164180

165181
/**

0 commit comments

Comments
 (0)