Skip to content

Commit aaadd61

Browse files
committed
Merge remote-tracking branch 'origin/main' into submit/audit-all-fixes-staging
# Conflicts: # .claude/skills/mendix/write-microflows.md # cmd/mxcli/lsp_completions_gen.go # docs/01-project/MDL_QUICK_REFERENCE.md # docs/11-proposals/PROPOSAL_microflow_call_web_service_statement.md # docs/11-proposals/PROPOSAL_microflow_download_file_statement.md # docs/11-proposals/README.md # mdl/ast/ast_expression.go # mdl/ast/ast_microflow.go # mdl/executor/bugfix_regression_test.go # mdl/executor/cmd_microflows_anchor_if_test.go # mdl/executor/cmd_microflows_builder.go # mdl/executor/cmd_microflows_builder_actions.go # mdl/executor/cmd_microflows_builder_annotations.go # mdl/executor/cmd_microflows_builder_annotations_test.go # mdl/executor/cmd_microflows_builder_calls.go # mdl/executor/cmd_microflows_builder_control.go # mdl/executor/cmd_microflows_builder_flows.go # mdl/executor/cmd_microflows_builder_graph.go # mdl/executor/cmd_microflows_builder_terminal_test.go # mdl/executor/cmd_microflows_builder_validate.go # mdl/executor/cmd_microflows_create.go # mdl/executor/cmd_microflows_format_action.go # mdl/executor/cmd_microflows_format_action_test.go # mdl/executor/cmd_microflows_show.go # mdl/executor/cmd_microflows_show_helpers.go # mdl/executor/cmd_microflows_split_incoming_anchor_test.go # mdl/executor/cmd_microflows_traverse_test.go # mdl/executor/cmd_microflows_unpaired_merge_test.go # mdl/executor/validate.go # mdl/executor/validate_microflow.go # mdl/grammar/MDLLexer.g4 # mdl/grammar/MDLParser.g4 # mdl/grammar/parser/MDLLexer.interp # mdl/grammar/parser/MDLLexer.tokens # mdl/grammar/parser/MDLParser.interp # mdl/grammar/parser/MDLParser.tokens # mdl/grammar/parser/mdl_lexer.go # mdl/grammar/parser/mdl_parser.go # mdl/grammar/parser/mdlparser_base_listener.go # mdl/grammar/parser/mdlparser_listener.go # mdl/visitor/visitor_microflow_actions.go # mdl/visitor/visitor_microflow_statements.go # mdl/visitor/visitor_test.go # mdl/visitor/visitor_webservice_test.go # sdk/microflows/microflows_actions.go # sdk/mpr/microflow_call_writer_test.go # sdk/mpr/parser_microflow.go # sdk/mpr/parser_microflow_actions.go # sdk/mpr/parser_microflow_test.go # sdk/mpr/showpage_roundtrip_test.go # sdk/mpr/writer_microflow_actions.go
2 parents cb2eba2 + 34ac3ae commit aaadd61

129 files changed

Lines changed: 9866 additions & 156 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/debug-bson.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Use when encountering:
99
- **Studio Pro crash on open** with `RevStatusCache.CreateDeleteStatusItem` in stack trace
1010
- **`mx diff` crash** with "Sequence contains no matching element"
1111
- **CE1613** "The selected attribute/enumeration no longer exists"
12+
- **CE0115** "The arguments that are passed to page X do not match the expected parameters"
1213
- **CE0463** "The definition of this widget has changed"
1314
- **CE0642** "Property X is required"
1415
- **CE0091** validation errors on widget properties
@@ -306,6 +307,51 @@ for t, props in crash_props.items():
306307

307308
**Fix**: Extract a fresh template from a project with `mx update-widgets` applied. The Type section must match the installed widget version exactly.
308309

310+
### CE0115: Arguments Passed to Page Do Not Match Expected Parameters
311+
312+
**Symptom**: `mx check` reports `[CE0115] "The arguments that are passed to page 'X' do not match the expected parameters."` on an action button that uses `show_page TargetPage (Param: $currentObject)`.
313+
314+
**Root cause**: The BSON array type indicator rule. Every Mendix BSON array must begin with an `int32` **type indicator** of `2` or `3`. This indicator is skipped by `extractBsonArray` and by Studio Pro's reader. Writing `int32(len(items))` as the first element instead produces an invalid indicator when `len ≠ 2` and `len ≠ 3` — Studio Pro cannot recognise the array and reads 0 parameter mappings.
315+
316+
**Type indicator values**:
317+
| First element | Meaning |
318+
|---------------|---------|
319+
| `int32(3)` | Initialized array — used for `Items`, `DesignProperties`, and most non-empty lists |
320+
| `int32(2)` | Initialized empty array — used for `ParameterMappings`, `PagesForSpecializations`, `Parameters` |
321+
| Any other value | **Invalid** — Studio Pro ignores the entire array |
322+
323+
**How Studio Pro stores page parameter mappings**: Studio Pro does **not** store explicit `Forms$PageParameterMapping` objects in BSON. It always writes `ParameterMappings: [2]` (type indicator only, no inline objects) and infers `$currentObject` at runtime from the enclosing widget context — DataGrid row, DataView datasource, etc. No matter what the MDL source specifies for `(Param: $currentObject)`, the correct serialization is always the empty `[2]` array.
324+
325+
**Correct writer pattern for `Forms$FormAction`**:
326+
```go
327+
formSettings := bson.D{
328+
{Key: "$ID", Value: idToBsonBinary(generateUUID())},
329+
{Key: "$Type", Value: "Forms$FormSettings"},
330+
{Key: "Form", Value: pageName}, // BY_NAME_REFERENCE
331+
{Key: "ParameterMappings", Value: bson.A{int32(2)}}, // always empty; runtime infers mapping
332+
{Key: "TitleOverride", Value: nil},
333+
}
334+
return bson.D{
335+
{Key: "$ID", Value: idToBsonBinary(id)},
336+
{Key: "$Type", Value: "Forms$FormAction"},
337+
{Key: "DisabledDuringExecution", Value: true},
338+
{Key: "FormSettings", Value: formSettings},
339+
{Key: "NumberOfPagesToClose2", Value: ""},
340+
{Key: "PagesForSpecializations", Value: bson.A{int32(2)}},
341+
}
342+
```
343+
344+
**What NOT to do**:
345+
```go
346+
// WRONG: produces [1, {mapping}] — invalid type indicator 1
347+
paramMappings := bson.A{int32(len(a.ParameterMappings))}
348+
for _, pm := range a.ParameterMappings {
349+
paramMappings = append(paramMappings, bson.D{...Forms$PageParameterMapping...})
350+
}
351+
```
352+
353+
**Diagnostic check**: Inspect the raw `ParameterMappings` array in a Python BSON dump. If it shows `[1, {...}]` instead of `[2]`, the type indicator is wrong. Studio Pro-generated pages always show `[2]`.
354+
309355
## Key Principles
310356

311357
1. **Template cloning > building from scratch**: Clone properties from a known-good template Object, then modify only specific values. Building from scratch produces subtly different structures.

.claude/skills/mendix/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Detailed syntax for each MDL document type:
1919
|-------|---------|----------|
2020
| [mdl-entities.md](mdl-entities.md) | Entity, attribute, association syntax | Creating domain models |
2121
| [write-microflows.md](write-microflows.md) | Microflow syntax reference | Writing microflow logic |
22+
| [write-nanoflows.md](write-nanoflows.md) | Nanoflow syntax reference | Writing client-side nanoflow logic |
2223
| [write-oql-queries.md](write-oql-queries.md) | OQL query syntax | Creating VIEW entities |
2324
| [create-page.md](create-page.md) | Page and widget syntax | Creating pages |
2425
| [fragments.md](fragments.md) | Fragment (reusable widget group) syntax | Reusing widget patterns across pages |

.claude/skills/mendix/create-page.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ actionbutton widgetName (caption: 'Caption', action: ACTION_TYPE [, buttonstyle:
194194
- `action: delete` - Delete object
195195
- `action: microflow Module.MicroflowName` - Call microflow
196196
- `action: microflow Module.MicroflowName(Param: $value)` - Call microflow with parameters
197+
- `action: nanoflow Module.NanoflowName` - Call nanoflow (client-side)
198+
- `action: nanoflow Module.NanoflowName(Param: $value)` - Call nanoflow with parameters
197199
- `action: show_page Module.PageName` - Navigate to page
198200
- `action: show_page Module.PageName(Param: $value)` - Navigate with parameters
199201
- `action: show_page Module.PageName($Param = $value)` - Also accepted (microflow-style)
@@ -341,6 +343,7 @@ column colActions (caption: 'Actions') {
341343
| `datasource: database from Module.Entity` | Direct database query |
342344
| `datasource: $Variable` | Variable bound (requires DATAVIEW parent with entity) |
343345
| `datasource: microflow Module.GetData()` | Microflow datasource |
346+
| `datasource: nanoflow Module.GetData()` | Nanoflow datasource (client-side, no server roundtrip) |
344347
| `datasource: selection widgetName` | Listen to selection from another widget |
345348
| `datasource: association path` | Retrieve by association from context (ByAssociation) |
346349
| `datasource: $currentObject/Module.Assoc` | Sugar for `association` — same semantics, reads more naturally |

.claude/skills/mendix/java-actions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public IMendixObject executeAction() throws Exception
123123
| `Core.delete(context, object)` | Delete object |
124124
| `Core.rollback(context, object)` | Discard uncommitted changes |
125125
| `Core.retrieveId(context, id)` | Retrieve by GUID |
126-
| `Core.retrieveXPathQuery(context, xpath)` | Query with XPath |
126+
| `Core.createXPathQuery(xpath).execute(context)` | Query with XPath |
127127
| `Core.microflowCall(name).execute(context)` | Call microflow |
128128

129129
### Reading and Writing Attributes
@@ -146,8 +146,8 @@ order.setValue(context, "ProcessedDate", new java.util.Date());
146146

147147
```java
148148
// set association (reference)
149-
IMendixObject customer = Core.retrieveXPathQuery(context,
150-
"//Sales.Customer[CustomerCode = 'CUST001']").get(0);
149+
IMendixObject customer = Core.createXPathQuery("//Sales.Customer[CustomerCode = 'CUST001']")
150+
.execute(context).get(0);
151151
order.setValue(context, "Sales.Order_Customer", customer.getId());
152152

153153
// get associated object
@@ -162,8 +162,8 @@ if (customerId != null) {
162162

163163
```java
164164
// retrieve list
165-
list<IMendixObject> orders = Core.retrieveXPathQuery(context,
166-
"//Sales.Order[status = 'Pending']");
165+
list<IMendixObject> orders = Core.createXPathQuery("//Sales.Order[status = 'Pending']")
166+
.execute(context);
167167

168168
// Process list
169169
java.math.BigDecimal total = java.math.BigDecimal.ZERO;
@@ -1068,7 +1068,7 @@ int offset = 0;
10681068
int batchSize = 1000;
10691069
list<IMendixObject> batch;
10701070
do {
1071-
batch = Core.retrieveXPathQuery(context, xpath, batchSize, offset, null);
1071+
batch = Core.createXPathQuery(xpath).setAmount(batchSize).setOffset(offset).execute(context);
10721072
// Process batch
10731073
offset += batchSize;
10741074
} while (batch.size() == batchSize);
@@ -1187,7 +1187,7 @@ Core.commit(context, obj);
11871187
Core.delete(context, obj);
11881188

11891189
// query
1190-
list<IMendixObject> results = Core.retrieveXPathQuery(context, "//Module.Entity[attr = 'value']");
1190+
list<IMendixObject> results = Core.createXPathQuery("//Module.Entity[attr = 'value']").execute(context);
11911191

11921192
// log
11931193
Core.getLogger("ModuleName").info("message");

.claude/skills/mendix/manage-security.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,21 @@ grant execute on microflow MyModule.ACT_Customer_Create to MyModule.User, MyModu
109109
revoke execute on microflow MyModule.ACT_Customer_Create from MyModule.User;
110110
```
111111

112+
### Nanoflow Access
113+
114+
```sql
115+
-- Grant execute access (same syntax as microflows)
116+
grant execute on nanoflow MyModule.NF_ValidateCart to MyModule.User, MyModule.Admin;
117+
118+
-- Revoke from specific roles
119+
revoke execute on nanoflow MyModule.NF_ValidateCart from MyModule.User;
120+
121+
-- Show current access
122+
show access on nanoflow MyModule.NF_ValidateCart;
123+
```
124+
125+
> **Note:** Security roles persist through DROP+CREATE of the same nanoflow name within a session (by design, for refactor-in-place workflows).
126+
112127
### Page Access
113128

114129
```sql

.claude/skills/mendix/validation-microflows.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Use this skill when:
1010
- Building conditional validation chains
1111
- Creating action microflows that call validation microflows
1212

13+
> **Nanoflow validation:** The same patterns apply to nanoflows (`create nanoflow` instead of `create microflow`). Use nanoflows for client-side validation when server roundtrips are unnecessary — validation feedback renders instantly without a network call.
14+
1315
## The Validation Pattern
1416

1517
Mendix validation follows a two-microflow pattern:

0 commit comments

Comments
 (0)