Skip to content

create or modify microflow refuses to turn a local list into a parameter of the same name ("drop $X: $X is still used by"), although the new parameter provides $X; another name splices fine #2002

Backlog

Description

@julesschilperoort1994

1. mxcli version: nightly-20261130-b8a764c54 (Windows); also seen on v0.34.0
2. Mendix version: 11.12.8
Repro app: a fresh mxcli new app, built by the script below

3. Scenario

A microflow builds a local list ($SaleList = create list of ...), adds to it and commits it. Moving that list to the caller means: add a parameter $SaleList of the same list type, and remove the create list and the commit. create or modify microflow refuses this with MDL-V1-REBUILD, "drop $SaleList: $SaleList is still used by: add $NewSale to $SaleList", although after the change $SaleList is the new parameter, so the add still has its list. With any other parameter name the same change splices fine. Related: #1517 (other splice refusals, including "$Code is still used by" for a return value).

Self-contained repro, run in an empty directory:

#!/usr/bin/env bash
# Repro: create or modify microflow refuses to turn a local list into a parameter of the same name
# ("drop $SaleList: $SaleList is still used by: add ..."), although the new parameter provides it.
# Needs mxcli.
set -e
cd "$(dirname "$0")"
export MXCLI_LOG_DIR="$PWD/logs"   # own log dir: the diag only holds this repro
P=Repro/Repro.mpr
mxcli new Repro --version 11.12.8 --skip-build --skip-init > /dev/null
cat > step1.mdl <<'MDL'
mdl 1;
create persistent entity MyFirstModule.Sale (
  Code: String(200)
);
create microflow MyFirstModule.Sale_Create ()
begin
  $SaleList = create list of MyFirstModule.Sale;
  $NewSale = create MyFirstModule.Sale (Code = 'A');
  add $NewSale to $SaleList;
  commit $SaleList;
end;
MDL
cat > step2.mdl <<'MDL'
mdl 1;
create or modify microflow MyFirstModule.Sale_Create (
  $SaleList: List of MyFirstModule.Sale
)
begin
  $NewSale = create MyFirstModule.Sale (Code = 'A');
  add $NewSale to $SaleList;
end;
MDL
mxcli check step1.mdl -p $P --references | tail -1
mxcli -p $P exec step1.mdl
mxcli check step2.mdl -p $P --references || true
mxcli -p $P exec step2.mdl || true
mxcli -p $P -c "describe microflow MyFirstModule.Sale_Create;"

Output (progress lines left out):

(no module)
-----------
  ℹ 1 commit activity uses the default, which is now WITH EVENTS to match Studio Pro (#895); before this release a bare `commit $X;` wrote events OFF [MDL067]
      at MyFirstModule.Sale_Create
      → Write `commit $X without events;` for any commit here that must NOT run its event handlers; otherwise no change is needed, and spelling the intent out silences this note


1 issues: 0 errors, 0 warnings, 1 info
Check passed!
Connected to: Repro/Repro.mpr (Mendix 11.12.8)
1 info note not shown — run `mxcli check step1.mdl` to see them (or pass --verbose)
Created entity: MyFirstModule.Sale
Created microflow: MyFirstModule.Sale_Create
Checking syntax: step2.mdl
✓ Syntax OK (1 statements)
Connected to: Repro/Repro.mpr (Mendix 11.12.8)

Validating references against: Repro/Repro.mpr
(Note: References to objects created within the script are skipped)
✓ All references valid
Building catalog (fast mode)...
✓ incremental: 2 units rebuilt, 274 carried over: 2
✓ Catalog ready (0.1s)

MyFirstModule
-------------
  ✗ exec would refuse this statement: create or modify microflow MyFirstModule.Sale_Create: this change cannot be spliced into the stored flow: alter microflow MyFirstModule.Sale_Create: drop $SaleList: $SaleList is still used by: add $NewSale to $SaleList. Nothing was written: rebuilding the whole flow instead would reset what Studio Pro drew (curves, merges, element IDs). Change activities with `alter microflow MyFirstModule.Sale_Create { … }`; to rebuild the flow deliberately, drop the microflow and create it in the same script (the drop's module-role grants carry to a create in the same script or session, not to one in a later run) — once, in a run of its own: a drop + create rewrites the flow on every run, so the script you keep should then hold the `create or modify` of the result, which a second run finds unchanged [MDL-V1-REBUILD]
      at MyFirstModule.Sale_Create


1 issues: 1 errors, 0 warnings, 0 info
Connected to: Repro/Repro.mpr (Mendix 11.12.8)
MyFirstModule
-------------
  ✗ exec would refuse this statement: create or modify microflow MyFirstModule.Sale_Create: this change cannot be spliced into the stored flow: alter microflow MyFirstModule.Sale_Create: drop $SaleList: $SaleList is still used by: add $NewSale to $SaleList. Nothing was written: rebuilding the whole flow instead would reset what Studio Pro drew (curves, merges, element IDs). Change activities with `alter microflow MyFirstModule.Sale_Create { … }`; to rebuild the flow deliberately, drop the microflow and create it in the same script (the drop's module-role grants carry to a create in the same script or session, not to one in a later run) — once, in a run of its own: a drop + create rewrites the flow on every run, so the script you keep should then hold the `create or modify` of the result, which a second run finds unchanged [MDL-V1-REBUILD]
      at MyFirstModule.Sale_Create

1 issues: 1 errors, 0 warnings, 0 info

Refusing to execute: 1 flow change(s) above would be refused when reached. Nothing was written.
  exec applies statements one at a time, so the statements before a refused
  change would be written and the ones after it would not.
  Make the change the refusal names, or re-run with --continue-on-error to
  apply every other statement.
mdl 1;
create or modify microflow MyFirstModule.Sale_Create ()
begin
  $SaleList = create list of MyFirstModule.Sale;
  $NewSale = create MyFirstModule.Sale (Code = 'A');
  add $NewSale to $SaleList;
  commit $SaleList;
  @position(1080, 200)
  return;
end;

4. Expected output

  • The change is spliced: the create list and the commit are dropped and the parameter is added, as with another parameter name (see below: spliced: 1 edited in place, 2 dropped; set: parameter $Sales added). The dependency check for dropping $SaleList counts the new parameter that provides the same name.
  • Until then: the refusal names the cause (a local variable is replaced by a parameter of the same name) instead of reporting the add as a dangling use.

5. Experienced output

check --references and exec both refuse, nothing is written, and the flow is unchanged (describe after the script). Each variant was run with check --references against the repro app after the script:

Variant Result
Parameter $SaleList added, create list and commit removed (step2.mdl) refused: drop $SaleList: $SaleList is still used by: add $NewSale to $SaleList
Parameter $SaleList added, create list removed, commit $SaleList kept refused, same message
Parameter $Sales added, create list and commit removed, add $NewSale to $Sales Check passed!; exec: Modified microflow: MyFirstModule.Sale_Create (spliced: 1 edited in place, 2 dropped; set: parameter $Sales added)
Parameter $Sales added, body unchanged Check passed!
No parameter, create list and add removed, commit $NewSale Check passed!

Other spellings tried

  • alter microflow can't add a parameter, so a two-step alter isn't available.
  • drop microflow + create microflow in one script works, but rebuilds the flow (new element IDs, Studio Pro's layout reset), as the refusal text itself says.

6. AI bug report

mxcli diag of the repro run:

  Version:     nightly-20261130-b8a764c54
  Go:          go1.27.4 windows/amd64
  Sessions:    6 (last 7 days)
  Errors:      0 (last 7 days)

Session log of -p Repro/Repro.mpr exec step2.mdl (from mxcli diag --bundle):

{"time":"2026-12-01T11:01:20.6853988+01:00","level":"INFO","msg":"session_start","version":"nightly-20261130-b8a764c54","go":"go1.27.4","os":"windows","arch":"amd64","mode":"mxcli exec","args":["mxcli","-p","Repro/Repro.mpr","exec","step2.mdl"],"pid":36304,"parent_pid":""}

The refused exec logs only session_start: no execute line, no session_end, and mxcli diag counts 0 errors. The refusal itself is in the repro output above.

Why it matters

Moving commits from a helper to its caller (the caller creates the list, passes it in, and commits once) is a common refactor. The natural spelling keeps the list's name, and that is exactly the one that's refused. The only workarounds are a different parameter name or a drop + create that resets the layout drawn in Studio Pro.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions