|
1 | | -# Bug Report: mxcli fails to create microflow with cross-module entity parameter |
2 | | - |
3 | | -## Summary |
4 | | - |
5 | | -When creating a microflow with a parameter whose type is an entity from a different module (e.g., `FeedbackModule.Feedback` in a microflow in `MyFirstModule`), mxcli fails with a misleading error message. |
6 | | - |
7 | | -## Environment |
8 | | - |
9 | | -- **mxcli version**: Current (as of 2026-01-19) |
10 | | -- **Mendix version**: 11.6.0 |
11 | | -- **Platform**: macOS (Darwin 25.2.0) |
12 | | - |
13 | | -## Steps to Reproduce |
14 | | - |
15 | | -1. Connect to a Mendix project: |
16 | | - ```bash |
17 | | - ./mxcli -p MesDemoApp.mpr |
18 | | - ``` |
19 | | - |
20 | | -2. Try to create a microflow with a cross-module entity parameter: |
21 | | - ```sql |
22 | | - CREATE MICROFLOW MyFirstModule.TestMicroflow ( |
23 | | - $Feedback: FeedbackModule.Feedback |
24 | | - ) |
25 | | - RETURNS Boolean AS $IsValid |
26 | | - BEGIN |
27 | | - DECLARE $IsValid Boolean = true; |
28 | | - RETURN $IsValid; |
29 | | - END; |
30 | | - / |
31 | | - ``` |
32 | | - |
33 | | -## Expected Behavior |
34 | | - |
35 | | -The microflow should be created with: |
36 | | -- Parameter `$Feedback` of type `FeedbackModule.Feedback` |
37 | | -- Return type `Boolean` |
38 | | - |
39 | | -## Actual Behavior |
40 | | - |
41 | | -The command fails with the error: |
42 | | -``` |
43 | | -Error: entity '.FeedbackModule' not found for parameter 'Feedback' |
44 | | -``` |
45 | | - |
46 | | -Additionally, parser warnings are shown: |
47 | | -``` |
48 | | -line 2:27 mismatched input '.' expecting ')' |
49 | | -``` |
50 | | - |
51 | | -### Analysis |
52 | | - |
53 | | -The error message `entity '.FeedbackModule' not found` suggests the parser is incorrectly splitting the qualified entity name `FeedbackModule.Feedback`: |
54 | | -- It appears to interpret `FeedbackModule` as `.FeedbackModule` (with a leading dot) |
55 | | -- The entity name `Feedback` is being parsed separately |
56 | | - |
57 | | -The parser seems to expect the parameter type to end at the module name, treating the `.` as an unexpected token. |
58 | | - |
59 | | -## Workaround Attempts |
60 | | - |
61 | | -### Attempt 1: Unqualified entity name |
62 | | -```sql |
63 | | -$Feedback: Feedback |
64 | | -``` |
65 | | -**Result**: Microflow is created, but parameter type becomes `Void` instead of `FeedbackModule.Feedback`. |
66 | | - |
67 | | -### Attempt 2: Single-line command |
68 | | -```bash |
69 | | -./mxcli -p MesDemoApp.mpr -c "CREATE MICROFLOW MyFirstModule.TestParam(\$Feedback: FeedbackModule.Feedback) RETURNS Boolean AS \$IsValid BEGIN DECLARE \$IsValid Boolean = true; RETURN \$IsValid; END; /" |
70 | | -``` |
71 | | -**Result**: Same error - `entity '.FeedbackModule' not found` |
72 | | - |
73 | | -### Attempt 3: Script file execution |
74 | | -```bash |
75 | | -./mxcli -p MesDemoApp.mpr -c "EXECUTE SCRIPT '/tmp/test.mdl'" |
76 | | -``` |
77 | | -**Result**: Same error |
78 | | - |
79 | | -## Evidence |
80 | | - |
81 | | -The `mxcli check` command reports syntax as valid: |
82 | | -``` |
83 | | -Checking syntax: /tmp/val_feedback_simple.mdl |
84 | | -✓ Syntax OK (1 statements) |
85 | | -``` |
86 | | - |
87 | | -But execution still fails, indicating a disconnect between the syntax checker and the executor. |
88 | | - |
89 | | -## Comparison with Working Cases |
90 | | - |
91 | | -Creating a microflow **without** entity parameters works fine: |
92 | | -```sql |
93 | | -CREATE MICROFLOW MyFirstModule.TestMicroflow() |
94 | | -RETURNS Boolean AS $IsValid |
95 | | -BEGIN |
96 | | - DECLARE $IsValid Boolean = true; |
97 | | - RETURN $IsValid; |
98 | | -END; |
99 | | -/ |
100 | | -``` |
101 | | -**Result**: `Created microflow: MyFirstModule.TestMicroflow` |
102 | | - |
103 | | -## Impact |
104 | | - |
105 | | -This bug prevents using mxcli to create microflows that: |
106 | | -- Accept entity parameters from other modules |
107 | | -- Are common patterns like validation microflows (VAL_*) in custom modules that validate Marketplace module entities |
108 | | - |
109 | | -## Suggested Fix |
110 | | - |
111 | | -The parameter type parser should correctly handle fully qualified entity names in the format `Module.Entity`. The `.` should be recognized as a namespace separator, not treated as an unexpected token. |
112 | | - |
113 | | -## Related |
114 | | - |
115 | | -The skill documentation in `.claude/skills/write-microflows.md` shows the syntax: |
116 | | -```mdl |
117 | | --- Entity types |
118 | | -$Customer: Module.Entity |
119 | | -``` |
120 | | - |
121 | | -This confirms the intended syntax supports qualified entity names. |
| 1 | +# Bug Report: mxcli fails to create microflow with cross-module entity parameter |
| 2 | + |
| 3 | +## Summary |
| 4 | + |
| 5 | +When creating a microflow with a parameter whose type is an entity from a different module (e.g., `FeedbackModule.Feedback` in a microflow in `MyFirstModule`), mxcli fails with a misleading error message. |
| 6 | + |
| 7 | +## Environment |
| 8 | + |
| 9 | +- **mxcli version**: Current (as of 2026-01-19) |
| 10 | +- **Mendix version**: 11.6.0 |
| 11 | +- **Platform**: macOS (Darwin 25.2.0) |
| 12 | + |
| 13 | +## Steps to Reproduce |
| 14 | + |
| 15 | +1. Connect to a Mendix project: |
| 16 | + ```bash |
| 17 | + ./mxcli -p MesDemoApp.mpr |
| 18 | + ``` |
| 19 | + |
| 20 | +2. Try to create a microflow with a cross-module entity parameter: |
| 21 | + ```sql |
| 22 | + CREATE MICROFLOW MyFirstModule.TestMicroflow ( |
| 23 | + $Feedback: FeedbackModule.Feedback |
| 24 | + ) |
| 25 | + RETURNS Boolean AS $IsValid |
| 26 | + BEGIN |
| 27 | + DECLARE $IsValid Boolean = true; |
| 28 | + RETURN $IsValid; |
| 29 | + END; |
| 30 | + / |
| 31 | + ``` |
| 32 | + |
| 33 | +## Expected Behavior |
| 34 | + |
| 35 | +The microflow should be created with: |
| 36 | +- Parameter `$Feedback` of type `FeedbackModule.Feedback` |
| 37 | +- Return type `Boolean` |
| 38 | + |
| 39 | +## Actual Behavior |
| 40 | + |
| 41 | +The command fails with the error: |
| 42 | +``` |
| 43 | +Error: entity '.FeedbackModule' not found for parameter 'Feedback' |
| 44 | +``` |
| 45 | + |
| 46 | +Additionally, parser warnings are shown: |
| 47 | +``` |
| 48 | +line 2:27 mismatched input '.' expecting ')' |
| 49 | +``` |
| 50 | + |
| 51 | +### Analysis |
| 52 | + |
| 53 | +The error message `entity '.FeedbackModule' not found` suggests the parser is incorrectly splitting the qualified entity name `FeedbackModule.Feedback`: |
| 54 | +- It appears to interpret `FeedbackModule` as `.FeedbackModule` (with a leading dot) |
| 55 | +- The entity name `Feedback` is being parsed separately |
| 56 | + |
| 57 | +The parser seems to expect the parameter type to end at the module name, treating the `.` as an unexpected token. |
| 58 | + |
| 59 | +## Workaround Attempts |
| 60 | + |
| 61 | +### Attempt 1: Unqualified entity name |
| 62 | +```sql |
| 63 | +$Feedback: Feedback |
| 64 | +``` |
| 65 | +**Result**: Microflow is created, but parameter type becomes `Void` instead of `FeedbackModule.Feedback`. |
| 66 | + |
| 67 | +### Attempt 2: Single-line command |
| 68 | +```bash |
| 69 | +./mxcli -p MesDemoApp.mpr -c "CREATE MICROFLOW MyFirstModule.TestParam(\$Feedback: FeedbackModule.Feedback) RETURNS Boolean AS \$IsValid BEGIN DECLARE \$IsValid Boolean = true; RETURN \$IsValid; END; /" |
| 70 | +``` |
| 71 | +**Result**: Same error - `entity '.FeedbackModule' not found` |
| 72 | + |
| 73 | +### Attempt 3: Script file execution |
| 74 | +```bash |
| 75 | +./mxcli -p MesDemoApp.mpr -c "EXECUTE SCRIPT '/tmp/test.mdl'" |
| 76 | +``` |
| 77 | +**Result**: Same error |
| 78 | + |
| 79 | +## Evidence |
| 80 | + |
| 81 | +The `mxcli check` command reports syntax as valid: |
| 82 | +``` |
| 83 | +Checking syntax: /tmp/val_feedback_simple.mdl |
| 84 | +✓ Syntax OK (1 statements) |
| 85 | +``` |
| 86 | + |
| 87 | +But execution still fails, indicating a disconnect between the syntax checker and the executor. |
| 88 | + |
| 89 | +## Comparison with Working Cases |
| 90 | + |
| 91 | +Creating a microflow **without** entity parameters works fine: |
| 92 | +```sql |
| 93 | +CREATE MICROFLOW MyFirstModule.TestMicroflow() |
| 94 | +RETURNS Boolean AS $IsValid |
| 95 | +BEGIN |
| 96 | + DECLARE $IsValid Boolean = true; |
| 97 | + RETURN $IsValid; |
| 98 | +END; |
| 99 | +/ |
| 100 | +``` |
| 101 | +**Result**: `Created microflow: MyFirstModule.TestMicroflow` |
| 102 | + |
| 103 | +## Impact |
| 104 | + |
| 105 | +This bug prevents using mxcli to create microflows that: |
| 106 | +- Accept entity parameters from other modules |
| 107 | +- Are common patterns like validation microflows (VAL_*) in custom modules that validate Marketplace module entities |
| 108 | + |
| 109 | +## Suggested Fix |
| 110 | + |
| 111 | +The parameter type parser should correctly handle fully qualified entity names in the format `Module.Entity`. The `.` should be recognized as a namespace separator, not treated as an unexpected token. |
| 112 | + |
| 113 | +## Related |
| 114 | + |
| 115 | +The skill documentation in `.claude/skills/write-microflows.md` shows the syntax: |
| 116 | +```mdl |
| 117 | +-- Entity types |
| 118 | +$Customer: Module.Entity |
| 119 | +``` |
| 120 | + |
| 121 | +This confirms the intended syntax supports qualified entity names. |
0 commit comments