Skip to content

mxcli check/exec silently accept validation rules on non-persistent entities; real compile fails with CE0070 #832

Description

@MendixMau

Environment: mxcli v0.16.0 (official release) and Engalar fork commit 26f2866, Mendix 11.12.0 Beta, macOS arm64.

Mendix does not allow validation rules (inline not null/unique/range/regex, or a standalone VALIDATION RULE ... FOR ...) on attributes of a non-persistent entity — Studio Pro's compiler rejects this with CE0070: "Validations rules are not allowed on entity '', because it is not persistable." This is expected/correct Mendix behavior; the problem is that neither mxcli check (with or without --references) nor mxcli exec catches it — the script is accepted and the entity is created with the (invalid) validation attached, and the failure is only surfaced later by a real mx check/Studio Pro compile.

Steps to reproduce:

create module ZWLS44;
create non-persistent entity ZWLS44.NpEntity (
    "Name": string(100) not null error 'Name is required'
);
  1. mxcli check script.mdl -p app.mpr --references → passes clean.
  2. mxcli exec script.mdl -p app.mpr → succeeds, entity created.
  3. mx check app.mpr (or mxcli docker check) → [CE0070] Validations rules are not allowed on entity 'ZWLS44.NpEntity', because it is not persistable.

Expected: mxcli check (or at minimum exec) should flag this before it reaches a full compile, the same way it already flags other CE-shaped invalid constructs via its MDLxxx lint rules (e.g. MDL047 for = empty on associations, MDL048 for id = <string> XPath constraints — see mdl/executor/validate_microflow.go).

Actual: both mxcli check and exec are silent; only a real compile catches it. Reproduced identically on the official v0.16.0 release and on the Engalar fork (26f2866) — not fixed on either side.

Suggested fix location: domain-model statement validation (parallel to the existing validate_microflow.go MDL-rule family) — reject/warn on any validation construct (not null, unique, range, regex, or standalone VALIDATION RULE ... FOR ...) targeting a NON-PERSISTENT entity, with a fix hint pointing at making the entity persistent or moving the rule.

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