@camunda8/cli 4.6.0-alpha.5 → 4.6.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -170,7 +170,8 @@ c8ctl element-template update old.id process.bpmn --dry-run --json
170
170
  - Without `--in-place` the BPMN goes to stdout and the report to stderr.
171
171
  - Lossy in-place writes and refused embedded-recipe fallbacks require `--allow-lossy`.
172
172
  Preview with `--dry-run` first. Unusable explicit `--recipe` files always fail,
173
- even with authorization; correct the source entry or source-version floor.
173
+ even with authorization; correct the source entry. A floor that no compatible
174
+ source version reaches also fails, and `--allow-lossy` does not override it.
174
175
  - In-place migrations take a sibling `.migration.lock` and check original input
175
176
  contents before temporary-file preparation and again immediately before rename.
176
177
  Changes observed during preparation are rejected. Replacement uses a sibling
@@ -224,7 +225,8 @@ values are carried over by binding identity and the rest is dropped; the report
224
225
  lists each drop with its old value, subject to sensitivity redaction. Unusable
225
226
  explicit recipes fail even with `--allow-lossy`; refused embedded recipes require
226
227
  authorization except when previewing. Diagnostics distinguish malformed recipes,
227
- coverage refusal, wrong source IDs and unmet reached-version floors. Coverage
228
+ coverage refusal and wrong source IDs. A source-version floor that cannot be reached
229
+ fails the element instead (see below). Coverage
228
230
  covers every step, including the change to another template: an entry that reads
229
231
  a path the reached source version does not define refuses the recipe. Guard
230
232
  paths count as reads, including `exists` and negated guards. An empty
@@ -282,9 +284,16 @@ values, including FEEL normalization, rather than claiming planner intent as suc
282
284
 
283
285
  A source with `kind: "upgrade"` requires `toVersion` and the recipe owner's ID: an element climbs
284
286
  each destination above its applied version in ascending order. A `kind: "change"` source must name
285
- a different ID and may require `minSourceVersion`, a floor on the version actually reached by
286
- source upgrades. Merely loading a newer template does not satisfy that floor. The highest reachable
287
- floor wins; an omitted floor is the fallback. File recipes replace only the target recipe.
287
+ a different ID and may require `minSourceVersion`, a floor on the source version. When the element
288
+ is below the best floor, the plan adds one implicit version step, with no recipe
289
+ entries; values are carried by binding. The step lands on the lowest compatible version at or above the best floor. The best floor is the highest one at most the newest source
290
+ version compatible with the BPMN's `modeler:executionPlatformVersion`; the plan never goes above
291
+ it. An omitted floor is the fallback entry: it never causes a bump itself and applies only when no declared floor is reachable. When a declared floor is reachable, an element below it is bumped to that floor and the fallback entry is not used. The element fails (no file is
292
+ written, and `--allow-lossy` does not override it) when the newest compatible version is below
293
+ the lowest floor. The report marks
294
+ the step: `The element is on vA, which is too old for this recipe. Updating it to vN first.` (vN is the version landed on) in text and `implicit: true` on the
295
+ step in `report.steps` of `--json`. File recipes replace only the target recipe and follow the
296
+ same rules.
288
297
  This revised dialect keeps `schemaVersion: 1` but rejects legacy `minVersion` recipes and requires
289
298
  `kind` on every source. Older strict readers reject the new fields. See
290
299
  [`migration/migrates-from.schema.json`](./migration/migrates-from.schema.json) for the full format.
@@ -10035,13 +10035,26 @@ function validateLocalTemplates(id, entries) {
10035
10035
  const logger = c8ctl2.getLogger();
10036
10036
  modeler.get("eventBus").on("elementTemplates.errors", (event) => {
10037
10037
  const errors = isRecord(event) && Array.isArray(event.errors) ? event.errors : [];
10038
+ const duplicates = [];
10038
10039
  for (const error3 of errors) {
10039
10040
  const file = isRecord(error3) ? fileOf.get(error3.template) : void 0;
10040
10041
  const message = error3 instanceof Error ? error3.message : String(error3);
10042
+ if (message.includes("already used")) {
10043
+ duplicates.push(isRecord(error3) ? error3.template : void 0);
10044
+ continue;
10045
+ }
10041
10046
  logger.warn(
10042
10047
  `Ignoring element template${file ? ` in ${file}` : ""}: ${message}`
10043
10048
  );
10044
10049
  }
10050
+ if (duplicates.length > 0) {
10051
+ const versions = duplicates.flatMap(
10052
+ (t) => isRecord(t) && t.version !== void 0 ? [String(t.version)] : []
10053
+ );
10054
+ logger.warn(
10055
+ `Ignoring ${duplicates.length} element template(s) for ${id} whose id and version are already used (${versions.join(", ")}); the nearest one wins.`
10056
+ );
10057
+ }
10045
10058
  });
10046
10059
  modeler.get("elementTemplatesLoader").setTemplates(entries.map((e) => e.template));
10047
10060
  return modeler.get("elementTemplates").getAll(id) ?? [];
@@ -11421,11 +11434,18 @@ function mergeFacts(all) {
11421
11434
  const after = facts.after;
11422
11435
  const surviving = (field, value) => {
11423
11436
  const actual = find2(after, field.key, field.bindingType);
11424
- return actual !== void 0 && (value === void 0 || actual.value === value);
11437
+ const replaced = (facts.reset ?? []).some(
11438
+ (r) => sameField(r, field) && r.from === value
11439
+ );
11440
+ return actual !== void 0 && (value === void 0 || actual.value === value || actual.value === `=${value}` && !replaced);
11425
11441
  };
11442
+ const stored = (field, value) => value === void 0 ? value : find2(after, field.key, field.bindingType)?.value ?? value;
11426
11443
  failedWrites ||= moved.some((move) => !surviving(move.to, move.value)) || set2.some((write) => !surviving(write, write.value));
11427
- moved = moved.filter((move) => surviving(move.to, move.value));
11428
- set2 = set2.filter((write) => surviving(write, write.value));
11444
+ moved = moved.filter((move) => surviving(move.to, move.value)).map((move) => ({ ...move, value: stored(move.to, move.value) }));
11445
+ set2 = set2.filter((write) => surviving(write, write.value)).map((write) => ({
11446
+ ...write,
11447
+ value: stored(write, write.value) ?? write.value
11448
+ }));
11429
11449
  snapshot = after;
11430
11450
  }
11431
11451
  failedWrites ||= Boolean(facts.failedWrites);
@@ -11523,7 +11543,10 @@ function buildReport({
11523
11543
  after,
11524
11544
  facts,
11525
11545
  usedRecipe,
11526
- refusal
11546
+ refusal,
11547
+ steps = [],
11548
+ lostInImplicitSteps = [],
11549
+ implicitTemplates = []
11527
11550
  }) {
11528
11551
  const survivingMoves = facts.moved.filter((m) => {
11529
11552
  const source = find2(before, m.from.key, m.from.bindingType);
@@ -11536,6 +11559,7 @@ function buildReport({
11536
11559
  const addedSets = survivingSets.filter(
11537
11560
  (s) => !find2(before, s.key, s.bindingType)
11538
11561
  );
11562
+ const claimedByMap = (v) => survivingMoves.some((m) => m.map && sameTarget(v, m.from));
11539
11563
  const claimedFrom = (v) => survivingMoves.some(
11540
11564
  (m) => sameTarget(v, m.from) && (m.read === void 0 || m.read === v.value)
11541
11565
  );
@@ -11577,19 +11601,24 @@ function buildReport({
11577
11601
  const reset = hiddenIn(toTemplate, v, "some") || (facts.reset ?? []).some((r) => sameTarget(v, r) && r.from === v.value);
11578
11602
  if (reset && !hiddenIn(fromTemplate, v, "every")) return "hidden";
11579
11603
  };
11580
- const dropped = before.filter((v) => v.value !== "").flatMap((v) => {
11604
+ const droppedValues = before.filter(
11605
+ (v) => v.value !== "" && (causeOf(v) || !claimedFrom(v) && !find2(after, v.key, v.bindingType) || lostBySource(v))
11606
+ );
11607
+ const dropped = [
11608
+ ...droppedValues,
11609
+ ...lostInImplicitSteps.filter(
11610
+ (v) => !find2(droppedValues, v.key, v.bindingType) && // A surviving map that carries the original value on is not a loss.
11611
+ !(claimedByMap(v) && find2(before, v.key, v.bindingType)?.value === v.value)
11612
+ )
11613
+ ].map((v) => {
11581
11614
  const cause = causeOf(v);
11582
- if (!cause && (claimedFrom(v) || find2(after, v.key, v.bindingType)) && !lostBySource(v))
11583
- return [];
11584
11615
  const field = fieldOf(fromTemplate, v.key, v.bindingType);
11585
- return [
11586
- {
11587
- ...field,
11588
- value: v.value,
11589
- ...withNames(fromTemplate, field, v.value),
11590
- ...cause ? { cause } : {}
11591
- }
11592
- ];
11616
+ return {
11617
+ ...field,
11618
+ value: v.value,
11619
+ ...withNames(fromTemplate, field, v.value),
11620
+ ...cause ? { cause } : {}
11621
+ };
11593
11622
  });
11594
11623
  const added = after.filter(
11595
11624
  (v) => v.value !== "" && !find2(before, v.key, v.bindingType) && !isHidden(toTemplate, v.key, v.bindingType) && !claimedTo(v)
@@ -11638,13 +11667,18 @@ function buildReport({
11638
11667
  template: facts.templateSkipped,
11639
11668
  noMatch: facts.noMatch,
11640
11669
  feel: facts.feelSkipped,
11641
- unchecked: uncheckedFields(fromTemplate, via)
11670
+ unchecked: [...via, ...implicitTemplates].flatMap((template) => uncheckedFields(fromTemplate, [template])).filter(
11671
+ (f, i, all) => all.findIndex(
11672
+ (g) => g.key === f.key && g.bindingType === f.bindingType
11673
+ ) === i
11674
+ )
11642
11675
  };
11643
11676
  return {
11644
11677
  from: templateRef(fromTemplate),
11645
11678
  to: templateRef(toTemplate),
11646
11679
  usedRecipe,
11647
11680
  refusal,
11681
+ steps,
11648
11682
  dropped: inTemplateOrder(fromTemplate, dropped, (item) => item),
11649
11683
  added: inTemplateOrder(toTemplate, added, (item) => item),
11650
11684
  changed: inTemplateOrder(toTemplate, changed, (item) => item),
@@ -12096,13 +12130,42 @@ function reachableHop(recipe, sourceId, drainedVersion) {
12096
12130
  }
12097
12131
  return best;
12098
12132
  }
12133
+ function implicitFloor({
12134
+ recipe,
12135
+ sourceId,
12136
+ reachedVersion,
12137
+ newest,
12138
+ engineVersion
12139
+ }) {
12140
+ const changes = recipeSourcesFor(recipe, sourceId).filter(
12141
+ (s) => s.kind === "change"
12142
+ );
12143
+ const floors = changes.flatMap(
12144
+ (s) => s.kind === "change" && s.minSourceVersion !== void 0 ? [s.minSourceVersion] : []
12145
+ );
12146
+ const reachable = floors.filter((f) => newest !== void 0 && f <= newest);
12147
+ if (reachable.length === 0) {
12148
+ const hasFallback = changes.length > floors.length;
12149
+ if (floors.length > 0 && !hasFallback && reachedVersion < Math.min(...floors)) {
12150
+ const camunda = engineVersion ? `Camunda ${engineVersion} (from the BPMN executionPlatformVersion)` : "the BPMN Camunda version";
12151
+ throw new Error(
12152
+ `Template '${sourceId}' v${Math.min(...floors)} or later is required, but ${newest === void 0 ? `no version compatible with ${camunda} is available` : `the newest version compatible with ${camunda} is v${newest}`}.`
12153
+ );
12154
+ }
12155
+ return void 0;
12156
+ }
12157
+ const best = Math.max(...reachable);
12158
+ return best > reachedVersion ? best : void 0;
12159
+ }
12099
12160
  function resolveSteps({
12100
12161
  appliedId,
12101
12162
  appliedVersion,
12102
12163
  appliedShapeKnown = true,
12103
12164
  target,
12104
12165
  templates,
12105
- recipe
12166
+ recipe,
12167
+ engineVersion,
12168
+ isCompatible = () => true
12106
12169
  }) {
12107
12170
  templates = resolveCatalog(templates, [target]);
12108
12171
  const sameId = target.id === appliedId;
@@ -12121,7 +12184,23 @@ function resolveSteps({
12121
12184
  if (!sameId || rung.toVersion !== targetVersion)
12122
12185
  loaded(templates, appliedId, rung.toVersion);
12123
12186
  }
12124
- const reachedVersion = rungs.at(-1)?.toVersion ?? appliedVersion;
12187
+ let reachedVersion = rungs.at(-1)?.toVersion ?? appliedVersion;
12188
+ const compatibleVersions = templates.filter(
12189
+ (t) => t.id === appliedId && isCompatible(t) && // A stand-in for an unavailable applied template has no real definition.
12190
+ (appliedShapeKnown || (versionOf(t) ?? 0) !== appliedVersion)
12191
+ ).map((t) => versionOf(t) ?? 0).sort((a, b) => a - b);
12192
+ const floor = sameId ? void 0 : implicitFloor({
12193
+ recipe: targetRecipe,
12194
+ sourceId: appliedId,
12195
+ reachedVersion,
12196
+ newest: compatibleVersions.at(-1),
12197
+ engineVersion
12198
+ });
12199
+ if (floor !== void 0) {
12200
+ const landing = compatibleVersions.find((v) => v >= floor) ?? floor;
12201
+ rungs.push({ toVersion: landing, entries: [], implicit: true });
12202
+ reachedVersion = landing;
12203
+ }
12125
12204
  const hop = sameId ? void 0 : reachableHop(targetRecipe, appliedId, reachedVersion);
12126
12205
  const refusal = findCoverageGap(
12127
12206
  rungs,
@@ -12138,7 +12217,8 @@ function resolveSteps({
12138
12217
  kind: "version",
12139
12218
  templateId: appliedId,
12140
12219
  version: rung.toVersion,
12141
- entries: rung.entries
12220
+ entries: rung.entries,
12221
+ ...rung.implicit ? { implicit: true } : {}
12142
12222
  }));
12143
12223
  if (!sameId) {
12144
12224
  if (hop) {
@@ -12149,21 +12229,18 @@ function resolveSteps({
12149
12229
  entries: hop.entries
12150
12230
  });
12151
12231
  } else if (targetRecipe) {
12152
- const sources = recipeSourcesFor(targetRecipe, appliedId).filter(
12153
- (source) => source.kind === "change"
12154
- );
12155
- const floor = Math.min(
12156
- ...sources.map((source) => source.minSourceVersion ?? 0)
12157
- );
12158
12232
  return {
12159
12233
  steps: [],
12160
- refusal: sources.length === 0 ? `wrong source ID: the recipe has no change entry for "${appliedId}"` : `unmet source floor: the recipe requires source version ${floor}, but reached version is ${reachedVersion}; update the element to version ${floor} or later first`
12234
+ refusal: `wrong source ID: the recipe has no change entry for "${appliedId}"`
12161
12235
  };
12162
12236
  }
12163
12237
  } else if (targetRecipe && steps.length === 0 && targetVersion !== appliedVersion) {
12238
+ const known = recipeSourcesFor(targetRecipe, appliedId).length > 0;
12239
+ if (known && appliedVersion < targetVersion)
12240
+ return { steps, refusal: null };
12164
12241
  return {
12165
12242
  steps: [],
12166
- refusal: recipeSourcesFor(targetRecipe, appliedId).length === 0 ? `wrong source ID: the recipe has no upgrade entry for "${appliedId}"` : `no applicable upgrade: the recipe has no upgrade above applied version ${appliedVersion} through target version ${targetVersion}`
12243
+ refusal: known ? `no applicable upgrade: the recipe has no upgrade above applied version ${appliedVersion} through target version ${targetVersion}` : `wrong source ID: the recipe has no upgrade entry for "${appliedId}"`
12167
12244
  };
12168
12245
  }
12169
12246
  return { steps, refusal: null };
@@ -12292,6 +12369,60 @@ function resolveMapWrites(maps, before, fromTemplate, target) {
12292
12369
  }
12293
12370
  return result;
12294
12371
  }
12372
+ function advanceLineage(lineage, moved, after, implicit, reset = []) {
12373
+ const lost = [];
12374
+ for (const entry of lineage) {
12375
+ if (entry.places.length === 0) continue;
12376
+ const previous = entry.places;
12377
+ const candidates = [
12378
+ ...previous,
12379
+ ...moved.flatMap(
12380
+ (m) => previous.some(
12381
+ (p) => p.key === m.from.key && p.bindingType === m.from.bindingType
12382
+ ) ? [
12383
+ {
12384
+ key: m.to.key,
12385
+ bindingType: m.to.bindingType,
12386
+ value: m.value ?? ""
12387
+ }
12388
+ ] : []
12389
+ )
12390
+ ];
12391
+ const survivors = [];
12392
+ const gone = [];
12393
+ for (const place of candidates) {
12394
+ const now = after.find(
12395
+ (a) => a.key === place.key && a.bindingType === place.bindingType
12396
+ );
12397
+ if (now && (place.value === "" || now.value === place.value || // A Hidden reset is a replacement, not normalization.
12398
+ now.value === `=${place.value}` && !reset.some(
12399
+ (r) => r.key === place.key && r.bindingType === place.bindingType && r.from === place.value
12400
+ ))) {
12401
+ if (!survivors.some(
12402
+ (s) => s.key === now.key && s.bindingType === now.bindingType
12403
+ ))
12404
+ survivors.push({
12405
+ key: now.key,
12406
+ bindingType: now.bindingType,
12407
+ value: now.value
12408
+ });
12409
+ } else if (previous.includes(place)) {
12410
+ gone.push(place);
12411
+ }
12412
+ }
12413
+ entry.places = survivors;
12414
+ if (implicit && survivors.length === 0) {
12415
+ lost.push(
12416
+ ...gone.map((p) => ({
12417
+ ...p,
12418
+ bindingType: p.bindingType ?? "",
12419
+ isFeel: false
12420
+ }))
12421
+ );
12422
+ }
12423
+ }
12424
+ return lost;
12425
+ }
12295
12426
  function valuesOf(element) {
12296
12427
  return enumerateElementValues(getExtensionElements(element.businessObject));
12297
12428
  }
@@ -12355,7 +12486,11 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
12355
12486
  current = modeler.elementTemplates.applyTemplate(current, clone) ?? current;
12356
12487
  const after = valuesOf(current);
12357
12488
  const reset = values.filter(
12358
- (v) => v.value !== "" && !stepWrites.some((w) => sameTarget(v, w)) && findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
12489
+ (v) => v.value !== "" && !stepWrites.some((w) => sameTarget(v, w)) && // An active editable property owns the field, so a Hidden duplicate
12490
+ // is a conditional alternative, not a reset.
12491
+ !findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
12492
+ (property) => property.type !== "Hidden" && active.has(property)
12493
+ ) && findPropertiesByTarget(clone.properties, v.key, v.bindingType).some(
12359
12494
  (property) => property.type === "Hidden"
12360
12495
  ) && !after.some((a) => sameTarget(a, v) && a.value === v.value)
12361
12496
  ).map(({ key, bindingType, value }) => ({ key, bindingType, from: value }));
@@ -12372,6 +12507,14 @@ function applyApplication(modeler, catalog, element, application, mapWrites = []
12372
12507
  };
12373
12508
  return {
12374
12509
  element: current,
12510
+ activeTemplate: {
12511
+ ...clone,
12512
+ // Unconditional properties are always active. A conditional one counts only
12513
+ // when a write reached it, so an unknown condition never hides a loss.
12514
+ properties: clone.properties.filter(
12515
+ (property) => active.has(property) || !("condition" in property && property.condition)
12516
+ )
12517
+ },
12375
12518
  facts: {
12376
12519
  ...facts,
12377
12520
  after,
@@ -12398,6 +12541,8 @@ function migrateElement({
12398
12541
  target,
12399
12542
  templates,
12400
12543
  recipe,
12544
+ engineVersion,
12545
+ isCompatible,
12401
12546
  maps = []
12402
12547
  }) {
12403
12548
  const applied = readAppliedTemplate(element.businessObject);
@@ -12413,7 +12558,9 @@ function migrateElement({
12413
12558
  appliedShapeKnown: sourceKnown,
12414
12559
  target,
12415
12560
  templates,
12416
- recipe
12561
+ recipe,
12562
+ engineVersion,
12563
+ isCompatible
12417
12564
  });
12418
12565
  const applications = resolveApplications(templates, steps, target);
12419
12566
  for (const { step, template } of applications) {
@@ -12434,6 +12581,11 @@ function migrateElement({
12434
12581
  };
12435
12582
  const mapPlan = resolveMapWrites(maps, before, fromTemplate, target);
12436
12583
  const allFacts = [];
12584
+ const lineage = before.filter((v) => v.value !== "" && !hiddenIn(fromTemplate, v, "every")).map((v) => ({
12585
+ places: [{ key: v.key, bindingType: v.bindingType, value: v.value }]
12586
+ }));
12587
+ const lostInImplicitSteps = [];
12588
+ const implicitTemplates = [];
12437
12589
  let current = element;
12438
12590
  let mapsApplied = false;
12439
12591
  for (const [index, application] of applications.entries()) {
@@ -12449,6 +12601,17 @@ function migrateElement({
12449
12601
  if (result) {
12450
12602
  current = result.element;
12451
12603
  allFacts.push(result.facts);
12604
+ if (application.step?.implicit)
12605
+ implicitTemplates.push(result.activeTemplate);
12606
+ lostInImplicitSteps.push(
12607
+ ...advanceLineage(
12608
+ lineage,
12609
+ result.facts.moved,
12610
+ valuesOf(current),
12611
+ application.step?.implicit === true,
12612
+ result.facts.reset
12613
+ )
12614
+ );
12452
12615
  mapsApplied ||= isFinal;
12453
12616
  }
12454
12617
  }
@@ -12481,10 +12644,27 @@ function migrateElement({
12481
12644
  after: allFacts.at(-1)?.after ?? before,
12482
12645
  facts,
12483
12646
  usedRecipe: steps.length > 0,
12484
- refusal
12647
+ refusal,
12648
+ lostInImplicitSteps,
12649
+ implicitTemplates,
12650
+ steps: reportSteps(steps, fromTemplate.version ?? 0)
12485
12651
  });
12486
12652
  return { element: current, report };
12487
12653
  }
12654
+ function reportSteps(steps, appliedVersion) {
12655
+ let reached = appliedVersion;
12656
+ return steps.map((step) => {
12657
+ const reportStep = {
12658
+ kind: step.kind,
12659
+ templateId: step.templateId,
12660
+ fromVersion: reached,
12661
+ toVersion: step.version,
12662
+ ...step.implicit ? { implicit: true } : {}
12663
+ };
12664
+ if (step.kind === "version") reached = step.version;
12665
+ return reportStep;
12666
+ });
12667
+ }
12488
12668
 
12489
12669
  // src/core/config.ts
12490
12670
  import { homedir, platform } from "node:os";
@@ -12989,6 +13169,13 @@ function renderReportText(report, {
12989
13169
  } else {
12990
13170
  lines.push(s.dim(" no recipe: values carried over by key"));
12991
13171
  }
13172
+ for (const step of report.steps.filter((step2) => step2.implicit)) {
13173
+ lines.push(
13174
+ s.dim(
13175
+ ` The element is on v${step.fromVersion}, which is too old for this recipe. Updating it to v${step.toVersion} first.`
13176
+ )
13177
+ );
13178
+ }
12992
13179
  const { rows, dropped } = rowsOf(report, targetTemplate, s);
12993
13180
  const all = [...rows, ...dropped];
12994
13181
  const labelWidth = Math.min(
@@ -13138,6 +13325,7 @@ function reportToJson(report, {
13138
13325
  kept: report.kept.length
13139
13326
  },
13140
13327
  report: {
13328
+ steps: report.steps,
13141
13329
  moved: report.moved,
13142
13330
  added: report.added,
13143
13331
  changed: report.changed,
@@ -13496,9 +13684,18 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
13496
13684
  });
13497
13685
  redaction.templates = [...lineages([templateId, target.id]), target];
13498
13686
  const targetRecipe = recipe ?? embeddedRecipe(target);
13499
- const floors = (targetRecipe?.sources ?? []).flatMap(
13500
- (s) => s.kind === "change" && s.sourceTemplateId === templateId ? [s.minSourceVersion ?? 0] : []
13687
+ const changes = (targetRecipe?.sources ?? []).filter(
13688
+ (s) => s.kind === "change" && s.sourceTemplateId === templateId
13689
+ );
13690
+ const floors = changes.flatMap(
13691
+ (s) => s.kind === "change" && s.minSourceVersion !== void 0 ? [s.minSourceVersion] : []
13501
13692
  );
13693
+ const hasFallback = changes.length > floors.length;
13694
+ const localCompatibleVersions = compatibleTemplates(
13695
+ pool2.localOf(templateId),
13696
+ engineVersion
13697
+ ).flatMap((t) => t.id === templateId ? [t.version ?? 0] : []);
13698
+ const newestLocal = Math.max(-1, ...localCompatibleVersions);
13502
13699
  const localLatest = latestOf(
13503
13700
  compatibleTemplates(pool2.localOf(templateId), engineVersion),
13504
13701
  templateId
@@ -13518,7 +13715,7 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
13518
13715
  const reached = reachedLocally(
13519
13716
  readAppliedTemplate(element.businessObject)?.version ?? 0
13520
13717
  );
13521
- return floors.every((floor) => floor > reached);
13718
+ return !hasFallback && floors.some((floor) => floor > newestLocal && floor > reached);
13522
13719
  })) {
13523
13720
  pool2.cache();
13524
13721
  }
@@ -13631,6 +13828,8 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
13631
13828
  target,
13632
13829
  templates,
13633
13830
  recipe,
13831
+ engineVersion,
13832
+ isCompatible: (template) => isEngineCompatible(template, engineVersion),
13634
13833
  maps
13635
13834
  });
13636
13835
  redaction.values = [
@@ -13638,10 +13837,8 @@ async function runMigrateInternal({ parsed, templateId, elementId, bpmnFilePath
13638
13837
  ...valuesOf2(result.element)
13639
13838
  ];
13640
13839
  const { report } = result;
13641
- if (recipe && (!report.usedRecipe || report.refusal)) {
13642
- throw new Error(
13643
- `Explicit recipe cannot be used: ${report.refusal ?? "no applicable source entry"}.`
13644
- );
13840
+ if (recipe && report.refusal) {
13841
+ throw new Error(`Explicit recipe cannot be used: ${report.refusal}.`);
13645
13842
  }
13646
13843
  outcomes.push({
13647
13844
  status: "updated",
@@ -266,8 +266,12 @@ that moved.
266
266
  - **Steps.** An element on an old version climbs the version steps of its own
267
267
  template in order, then makes at most one hop onto a different template. A
268
268
  source entry declares `kind: "upgrade"` with a destination `toVersion`, or
269
- `kind: "change"` with an optional `minSourceVersion` floor. Floors use actual
270
- selected source applications, never the latest catalog version. The revised
269
+ `kind: "change"` with an optional `minSourceVersion` floor. A floor above
270
+ the reached version adds one implicit version step (no entries, values carried
271
+ by binding). The best floor is the highest one at most the newest source version
272
+ compatible with the BPMN's `modeler:executionPlatformVersion`; the step lands on
273
+ the lowest compatible version at or above it. An unreachable floor throws
274
+ rather than refusing, so it is never authorizable with `--allow-lossy`. The revised
271
275
  dialect keeps schema version 1 and rejects legacy `minVersion` fields.
272
276
  Owner-relative ID/version rules and duplicate markers are semantic checks.
273
277
  Every selected intermediate template must exist before application; the supplied
@@ -321,8 +325,8 @@ that moved.
321
325
  precedes a no-op return.
322
326
  - **Authorization.** Lossy in-place migrations and refused embedded-recipe fallback
323
327
  require `--allow-lossy`. Explicit unusable recipes cannot be authorized. Diagnostics
324
- distinguish syntax, coverage (version steps and the change hop), source-ID and
325
- reached-floor refusal; empty recipe
328
+ distinguish syntax, coverage (version steps, the implicit floor step and the
329
+ change hop) and source-ID refusal; unreachable floors fail the element; empty recipe
326
330
  flags fail. Preview/authorized reports retain refusal and authorization status.
327
331
  - **Sensitivity.** Rendering uses credential-like field identity and template
328
332
  property/group metadata to redact report values. Known sensitive before/after,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camunda8/cli",
3
- "version": "4.6.0-alpha.5",
3
+ "version": "4.6.0-alpha.7",
4
4
  "description": "Camunda 8 CLI - minimal-dependency CLI for Camunda 8 operations",
5
5
  "type": "module",
6
6
  "engines": {