Skip to content

check --references passes scripts that exec refuses over in-script creation order — exec already prints the diagnosis #955

Description

@MohamedGamalEzzatAli

check --references passes scripts that exec refuses over in-script creation order — and exec already has the diagnosis

Summary

mxcli check --references validates references but skips ordering among objects created
WITHIN the script ("References to objects created within the script are skipped"), so a script
that creates a microflow whose parameter type is an entity created LATER in the same script
passes check cleanly — and then fails at exec. The asymmetry matters more since v0.19 made
check the gate for exec: check green now reads as "exec will honour this", and here it does
not.

The kicker: exec already performs exactly the analysis check lacks, and even prints the
fix —

Error: entity 'Repro.Thing' not found for parameter 'Thing'
  hint: Repro.Thing is defined later in this script — move its create statement before this one

Minimal reproduction (v0.19.0, Mendix 11.12.1 project)

CREATE MODULE Repro;

CREATE MICROFLOW Repro.DS_Label (
  $Thing: Repro.Thing
)
RETURNS String AS $Out
BEGIN
  DECLARE $Out String = 'x';
  RETURN $Out;
END;

CREATE PERSISTENT ENTITY Repro.Thing (
  Name: String(100)
);
  • mxcli check order.mdl -p App.mpr --referencesCheck passed! (exit 0)
  • mxcli exec order.mdl -p App.mpr → the error + hint above (exit 1, correctly), with the
    statements BEFORE the failing one already applied (Created module: Repro) — so a green
    check followed by a red exec also leaves a partial application to clean up.

A second real-world instance of the same shape: an entity with a CALCULATED BY microflow
whose parameter is that entity is inherently cyclic; the working order (entity without the
attribute → microflow → ALTER ENTITY ... ADD ATTRIBUTE ... CALCULATED BY) is only
discoverable by running exec and reading the hint, because check accepts every ordering.

What this is NOT asking for

Not auto-reordering/hoisting — #53 settled that as wontfix, and script order staying literal
is a fine contract. This asks only that check report the ordering violation exec will
report
, using the forward-reference analysis exec demonstrably already has. Then
check-green ⇒ exec-runs holds, which is what the new check-gating implies.

Small adjacent nit (mention rather than a separate issue)

mxcli syntax rule says Unknown topic: rule — the topic lives at microflow rule only,
while entity gets a legacy alias to domain-model.entity. A rule alias would match.

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