mxcli version: v0.24.0 (Mendix 11.12.1, MPR v2, macOS)
Summary
@caption on a while loop passes mxcli check, is accepted by exec, and is gone from describe — with no diagnostic. The same @caption on a loop is reported as MDL042 ("@caption on a loop has no effect … use @annotation"). Both statements build the same element: a Microflows$LoopedActivity, which has no Caption property — while only differs by its WhileLoopCondition.
Repro (blank project)
create or modify microflow MyFirstModule.CountMonths ()
returns Integer as $Months
begin
declare $Months Integer = 0;
@caption 'Are there months left to count?'
while $Months < 3
begin
set $Months = $Months + 1;
end while;
return $Months;
end;
/
mxcli check → Check passed!, no warning
mxcli exec → Created microflow: MyFirstModule.CountMonths
DESCRIBE MICROFLOW MyFirstModule.CountMonths → while $Months < 3 with no caption
The same caption on loop $Item in $Items → ⚠ @caption on a loop has no effect … [MDL042].
Cause
mdl/executor/validate_microflow.go raises MDL042 in the *ast.LoopStmt case only; the *ast.WhileStmt case checks the condition and walks the body but never looks at stmt.Annotations.Caption. addWhileStatement (cmd_microflows_builder_control.go) builds a LoopedActivity like addLoopStatement, so the caption has nowhere to go. @annotation on a while is stored and round-trips through describe.
Suggested fix
Raise MDL042 for a while as well, with the same pointer to @annotation, and say "loop or while loop" in the write-microflows control-flow note. Happy to open the PR.
mxcli version: v0.24.0 (Mendix 11.12.1, MPR v2, macOS)
Summary
@captionon awhileloop passesmxcli check, is accepted byexec, and is gone fromdescribe— with no diagnostic. The same@captionon aloopis reported as MDL042 ("@caption on a loop has no effect … use @annotation"). Both statements build the same element: aMicroflows$LoopedActivity, which has no Caption property —whileonly differs by itsWhileLoopCondition.Repro (blank project)
mxcli check→Check passed!, no warningmxcli exec→Created microflow: MyFirstModule.CountMonthsDESCRIBE MICROFLOW MyFirstModule.CountMonths→while $Months < 3with no captionThe same caption on
loop $Item in $Items→⚠ @caption on a loop has no effect … [MDL042].Cause
mdl/executor/validate_microflow.goraises MDL042 in the*ast.LoopStmtcase only; the*ast.WhileStmtcase checks the condition and walks the body but never looks atstmt.Annotations.Caption.addWhileStatement(cmd_microflows_builder_control.go) builds aLoopedActivitylikeaddLoopStatement, so the caption has nowhere to go.@annotationon awhileis stored and round-trips throughdescribe.Suggested fix
Raise MDL042 for a
whileas well, with the same pointer to@annotation, and say "loop or while loop" in thewrite-microflowscontrol-flow note. Happy to open the PR.