Skip to content

Commit e739fd2

Browse files
authored
Merge pull request #551 from ako/claude/funny-keller-rrm17w
Stop describe losing a password field, its validation and three more (#550)
2 parents 5f0c218 + c2755df commit e739fd2

22 files changed

Lines changed: 729 additions & 21 deletions

‎.claude/skills/fix-issue/findings/mdl-executor.jsonl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,3 +660,4 @@
660660
{"area":"mdl/executor","date":"2026-09-20","symptom":"`CREATE OR MODIFY EXTERNAL ENTITIES FROM` marks NON-KEY attributes of a top-level external entity Updatable=true when the entity set's UpdateRestrictions say the set is updatable. `mx check` reports one CE6630 per attribute: \"'Label' is marked Updatable=False in the OData service, but True in the app.\" The sibling of the key-attribute defect fixed the same day; fixing only the key took the reported repro from 2 errors to 1, not to 0","cause":"`createExternalEntities` derived `defaultUpdatable` from `entitySet.Updatable`. Mendix does not: it computes Updatable as a function of whether the entity has an entity set at all — never for a top-level entity, always for a non-top-level one, which is written through its parent's flow. The annotation is irrelevant to it","file":"`mdl/executor/cmd_contract.go` (`defaultUpdatable := !isTopLevel`, replacing the UpdateRestrictions override; the key-specific guard added earlier becomes subsumed)","insight":"**The positive control that closes this is a contract whose `NonUpdatableProperties` names ONLY the key.** That service is asserting, by name, that every other property IS updatable — and mxbuild still answers False. Ten top-level shapes were probed in three rounds and all answered False (inline record, typed `<Record Type=…>`, UpdateMethod=PATCH, +NonUpdatableProperties +DeleteRestrictions, unannotated, external `<Annotations Target=…>`, Core.Permissions/ReadWrite, Core.OptimisticConcurrency/ETag, DeepUpdateSupport, and the key-only exclusion list); the first seven were NOT enough to act on, because 'no shape produces True' is the uniform-negative shape that means the probe is wrong — what made it actionable was a shape that states the opposite explicitly and is still refused. **Two false leads, each cheap and each worth skipping.** (1) ETag/optimistic concurrency, suggested by a comment in this very function about the service that motivated #729 — no effect. (2) The model's `AllowCreateChangeLocally`: the intuition is that Mendix would permit attribute changes once local changes are allowed, and it is wrong — setting it Yes on a top-level entity left the expectation at False. **That second control is the one that explains the rule rather than just fitting it**: an external object CAN be changed in memory and handed to an external OData action, and that is what the local-change flag governs; the attribute's `Updatable` mirrors only what the endpoint itself accepts on a PATCH. Domain knowledge from the maintainer, not derivable from the metamodel — worth asking for before probing an eleventh contract shape. The Insert/Update asymmetry that makes this look like a parser bug is real and is not one: mxbuild reads `InsertRestrictions` from the same document, in the same shapes, and honours it — so `Creatable` follows the contract and `Updatable` does not, which is also why 'the entity is read-only' is the wrong summary and why every test here asserts Creatable as its control. **A stale test encoded the old belief and had to be corrected, not worked around**: #1118's `TestCreateExternalEntities_FlattenedAttributesAreReadOnly` asserted `Label` was Creatable AND Updatable as its control; the Updatable half had been assumed from the contract rather than measured, while the flattened-attribute half it was controlling for HAD been. The control still works on Creatable alone. Verified end to end on a real 11.12.1 project: 2 errors before any fix, 1 after the key-only fix, **0 errors** now; TripPin (`-run 'TestMxCheck_DoctypeScripts/10-odata-examples'`, ~26s locally) is the other-direction control and stays green, since every entity it flags is non-top-level. Repro `mdl-examples/bug-tests/odata-key-attribute-updatable.mdl`; tests `mdl/executor/cmd_contract_key_updatable_test.go`","file_refs":["mdl/executor/cmd_contract.go"],"ce":["CE6630"]}
661661
{"area":"mdl/linter","date":"2026-09-20","symptom":"mxcli happily authors `staticimage`/`dynamicimage` with nothing warning the author, and #518/#538 had just made both MORE capable (Image:, DataSource:, DefaultImage:, thumbnail, enlarge all newly reachable). The only signal that these widgets do not work was CE0582 at the far end of a build. Separately, three places in code comments and user-facing help claimed the deprecation was 'Mendix 11's React client'","cause":"Two things. (1) No validator or lint rule mentioned either widget (measured: `grep -rln deprecat mdl/executor/validate*.go` matched only an unrelated test), so the deprecation lived entirely in prose. (2) The version claim was inherited from a pre-existing comment and repeated without checking the doc: docs.mendix.com/refguide/image-viewer/ says the React client was added in **10.7**, so CE0582 fires on 10.7+ wherever that client is enabled, not only on 11","file":"`mdl/linter/rules/legacy_image_widget.go` (new, MPR012) + registration in `mdl/executor/cmd_lint.go` (x2) and `cmd/mxcli/cmd_lint.go`; wording in `mdl/backend/modelsdk/widget_write_legacy_gaps.go`, `.claude/skills/mendix/create-page/reference/widgets.md`, `cmd/mxcli/syntax/features_page.go`; table row in `.claude/commands/mendix/lint.md`","insight":"**A deprecation warning belongs in `lint`, not in `check`.** `check` validates a script, and `describe page` -> `exec` of a legacy page is a legitimate lossless operation — a check warning would fire on correct work every time, which is the noise trap MDL-WIDGET23's own history records. `lint` audits the project, where 'this page holds a widget your client cannot render' is wanted once. **The marketplace exclusion came free and is the control worth measuring**: `ctx.Widgets()` filters any module with a Source (notPlatformModule), so the rule never fires on the Studio Pro static images a blank app inherits from FeedbackModule — content the reader cannot fix and an update would replace. Measured: 8 legacy image widgets in the project, 7 indexed by the catalog, 5 in the user's own module, and lint reported exactly those 5. **A deny-list of two, never an allow-list**: the one widget such a rule must never fire on is the pluggable Image, i.e. the replacement it recommends. **'Deprecated in version X' needs the vendor doc, not the previous comment** — this repo had carried 'Mendix 11' for as long as the widgets had been written, and one fetch of the reference guide moved it to 10.7. A version boundary copied from a sibling comment is the same class of error as a floor copied from a proposal's sample output (mendixlabs/mxcli#1121)","refs":["mendixlabs/mxcli#1057"],"ce":["CE0582"],"rules":["MPR012"]}
662662
{"area": "mdl/backend/pagemutator", "date": "2026-09-20", "symptom": "`alter page … { set DataSource = DATABASE Mod.Entity on dvCust; }` passes `check`, prints `Altered page …` with exit 0, and leaves the DataView with no datasource: `describe page` renders `dataview dvCust {` with the property gone, and the only other signal is CE7007 at `mx check`", "cause": "`serializeDataSourceBson` mapped every `*pages.DatabaseSource` to a `Forms$DataViewSource` — the *context* source — with the entity in `EntityRef` and `SourceVariable` left null. A DATABASE source has no single stored shape: the widget holding it decides (`Forms$ListViewXPathSource` on a list view, `CustomWidgets$CustomWidgetXPathSource` on a pluggable widget, `Forms$GridXPathSource` on a grid), and a DATA VIEW has no database form at all — which is why CREATE PAGE's `dataViewSourceToGen` already refused that pairing while SET wrote it silently", "file": "`mdl/backend/pagemutator/mutator.go` (`SetWidgetDataSource`, new `databaseSourceRefusal`, `serializeDataSourceBson`)", "insight": "**The \"gone entirely\" in the report was DESCRIBE, not the document.** The DataSource was present and well-formed BSON; `parseContextSource` returns nil for a `Forms$DataViewSource` with no `SourceVariable`, so the reader rendered nothing. Chasing a deleted property would have been the wrong hunt — diff the stored BSON before believing a describe-shaped symptom. **The refusal belongs in the mutator, not the validator**: `validateAlterSetProperties` dry-runs the real setter against a `pagemutator.Probe()` copy, so one refusal makes `check -p --references` and `exec` agree by construction; a second copy of the rule in the validator is the duplicate-resolver drift CLAUDE.md warns about. **Refusing beat rebuilding the shapes here** — writing ListViewXPathSource in raw BSON would duplicate `listViewSourceToGen` in a second currency, and REPLACE already reaches the real builder. **Two remedies, not one**: on a data view `use REPLACE` is a dead end (CREATE PAGE refuses it too), so the message names the sources a data view can take; on a list view REPLACE genuinely works, so it names REPLACE. Getting that backwards sends the author in a circle. **Same generalisable shape as #855/#1101**: when SET and REPLACE express different vocabularies for one property, SET is a whitelist extended one bug report at a time. **`make check-mdl` runs `mxcli check` WITHOUT `-p`**, so a document-dependent refusal cannot be a `.fail.mdl` — it would be reported as a negative test that unexpectedly passed. Write the passing shape and comment the refused statements, as #1063 does. Measured on two copies of a real 11.13.0 app: faulty → `Check passed!`, exit 0, `mx check` 1 error CE7007 at Data view 'dvCust'; fixed → both refuse with exit 1, datasource unchanged, `mx check` 0 errors. Tests `mdl/backend/pagemutator/mutator_datasource_test.go`, `mdl/executor/validate_alter_set_test.go`; example `mdl-examples/bug-tests/1032-alter-page-set-database-datasource.mdl`. upstream #1032", "refs": ["#855", "#1032"], "ce": ["CE7007"]}
663+
{"area": "mdl/executor", "date": "2026-09-20", "symptom": "`describe page` → `exec` over a **Studio Pro-authored** page silently drops six things, `mx check` 0 errors throughout. The one that matters: `IsPasswordBox True → False` — a **password field round-trips into a plaintext text box**, and describe → rename → exec is mxcli's copy operation. Also `Validation.Expression` blanked, a DataView's `ReadOnlyStyle Text → Control`, `PopupCloseAction` wiped, and two typed-array markers", "cause": "Four different causes behind one symptom, which is why triage came first: (1) IsPasswordBox — model and writer carried it, nothing parsed it, nothing emitted it; (2) Validation — `widgetValidationToGen()` wrote a DEFAULT EMPTY Forms$WidgetValidation over whatever was stored, on five widget types; (3) ReadOnlyStyle — wired for CheckBox only, and a DataView's draws no MDL-WIDGET07 warning because `staticWidgetKnownProps` is deliberately a union across widget types; (4) PopupCloseAction — `pageToGen` wrote \"\" unconditionally. Plus ParameterMappings/OutputMappings markers", "file": "`mdl/executor/cmd_pages_describe_parse.go` + `_output.go` (extract/emit), `cmd_pages_builder_v3_widgets.go` (consume), `cmd_pages_builder_v3.go`, `mdl/visitor/visitor_page_v3.go`, `mdl/ast/ast_page_v3.go`, `sdk/pages/*`, `mdl/backend/modelsdk/widget_write.go` + `page_write.go`, `mdl/executor/validate_widgets.go` (describe vocabulary)", "insight": "**Triage the layer before writing anything** — describer / grammar / builder have different fixes and this one issue had all three. The quickest probe is to run the property through `mxcli check`: MDL-WIDGET07 names an unrecognised one, and *silence is not acceptance* — the known-props list is a union across widget types, so a DataView's ReadOnlyStyle passed check and was dropped anyway. **Emit an expression QUOTED, not bracketed**: `[...]` is the XPath-constraint spelling and `propertyValueV3` parses it as an ARRAY, so `GetStringProp` yields \"\" — the emitter's own unit test was green while the real round trip still lost the value (storage form is not input form). **Measure the default before keeping it**: a DataView's ReadOnlyStyle is Control on 47 of 56, never Inherit, so the 'obvious' Inherit that every other input widget uses would have been wrong. Markers likewise measured, not assumed: ParameterMappings is marker 2 on 220 of 220 lists in every parent type, OutputMappings present on 91 of 91 — and an EMPTY list needs `MandatoryListMarkers` since `RegisterListMarker` keys on a child that is not there. Result 17 → 9 differences, the 9 being ako/mxcli#549", "refs": ["#550", "#541", "#549", "#490"]}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ Both are optional and can be changed later with `alter page … { set Class = '
6767
| Widget name | Required after type | `textbox txtName (...)` |
6868
| Attribute binding | `attribute: AttrName` | `textbox txt (label: 'Name', attribute: Name)` |
6969
| Attribute over an association | `attribute: Assoc/Attr` (bare association name, multi-hop OK) | `textbox txt (label: 'Rule', attribute: RuleAction_BusinessRule/Name)` |
70+
| Password field | `Password: true` | `textbox tbPw (attribute: Secret, Password: true)` |
71+
| Widget validation | `Validation: '<expr>'` + `ValidationMessage: '<text>'` | `Validation: 'length(toString($value)) > 0'` — quoted, not `[bracketed]` |
7072
| Variable binding | `datasource: $Var` | `dataview dv (datasource: $Product) { ... }` |
7173
| Action binding | `action: type` | `actionbutton btn (caption: 'Save', action: save_changes)` |
7274
| Database source | `datasource: database entity` | `datagrid dg (datasource: database Module.Entity)` |
@@ -433,6 +435,11 @@ DATAVIEW dv (DataSource: $Issue) {
433435

434436
A bare association name is qualified with the module of the entity the widget
435437
sits on. On a ComboBox that matters: its `DataSource:` is the *option list*, but
438+
A text box that holds a secret needs `Password: true`. It is not cosmetic: without
439+
it the field renders the value in plaintext, and before ako/mxcli#550 a
440+
`describe page` → `exec` round trip silently turned every stored password field
441+
into an ordinary one — so copying a login or change-password page lost it.
442+
436443
An input widget can also *traverse* an association to show a value from the
437444
other side: `attribute: Assoc/Attr` binds the far attribute and stores the hops,
438445
which is what Studio Pro does. It works on textbox, textarea, datepicker,

‎cmd/mxcli/syntax/features_page.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func init() {
1212
"page", "pages", "form", "UI", "user interface",
1313
"widget", "layout", "screen",
1414
},
15-
Syntax: "CREATE PAGE Module.Name\n (\n Title: 'Page Title',\n Layout: Module.LayoutName\n [, Params: { $Param: Module.Entity }]\n [, Url: 'page-url']\n [, Folder: 'FolderPath']\n [, Variables: { $var: Boolean = 'true' }]\n [, PopupWidth: 800, PopupHeight: 480, PopupResizable: true]\n [, Class: 'css-class', Style: 'css: rule']\n )\n {\n -- widgets\n }",
15+
Syntax: "CREATE PAGE Module.Name\n (\n Title: 'Page Title',\n Layout: Module.LayoutName\n [, Params: { $Param: Module.Entity }]\n [, Url: 'page-url']\n [, Folder: 'FolderPath']\n [, Variables: { $var: Boolean = 'true' }]\n [, PopupWidth: 800, PopupHeight: 480, PopupResizable: true]\n [, PopupCloseAction: cancelButton1]\n [, Class: 'css-class', Style: 'css: rule']\n )\n {\n -- widgets\n }",
1616
Example: "CREATE PAGE MyModule.EditCustomer\n (\n Params: { $Customer: MyModule.Customer },\n Title: 'Edit Customer',\n Layout: Atlas_Core.PopupLayout,\n Class: 'container-fluid'\n )\n {\n DATAVIEW dvCustomer (DataSource: $Customer) {\n TEXTBOX txtName (Label: 'Name', Attribute: Name)\n FOOTER footer1 {\n ACTIONBUTTON btnSave (Caption: 'Save', Action: SAVE_CHANGES, ButtonStyle: Primary)\n ACTIONBUTTON btnCancel (Caption: 'Cancel', Action: CANCEL_CHANGES)\n }\n }\n }",
1717
SeeAlso: []string{"page.create", "page.widgets", "page.alter", "snippet"},
1818
})

‎docs/01-project/MDL_QUICK_REFERENCE.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,8 @@ MDL uses explicit property declarations for pages:
13791379
|---------|-----------|---------|
13801380
| Page properties | `(key: value, ...)` | `(title: 'Edit', layout: Atlas_Core.Atlas_Default)` |
13811381
| Pop-up dimensions | `PopupWidth: n, PopupHeight: n, PopupResizable: bool` | `(Layout: Atlas_Core.PopupLayout, PopupWidth: 800, PopupHeight: 480, PopupResizable: true)` — case-sensitive; default 600×600 |
1382+
| Pop-up close button | `PopupCloseAction: <widgetName>` | `(Layout: Atlas_Core.PopupLayout, PopupCloseAction: cancelButton1)` — names a widget on this page. Not carried from the stored document on a rewrite: the statement rebuilds the widget tree, so a carried name could dangle |
1383+
| DataView read-only style | `ReadOnlyStyle: Inherit\|Control\|Text` | `dataview dv (datasource: $O, ReadOnlyStyle: Text)` — a DataView's own, distinct from a checkbox's. **Control** is Studio Pro's default here, not Inherit |
13821384
| Page CSS class / style | `Class: 'css-class', Style: 'css: rule'` | `(Title: 'Home', Class: 'container-fluid bg-light', Style: 'min-height: 100vh')` — the page's Appearance |
13831385
| Page variables | `variables: { $name: type = 'expr' }` | `variables: { $show: boolean = 'true' }` |
13841386
| Repeated widget entries | `<container> <name> ( … )` **in the widget body** | A repeatable property (FileUploader `allowedFileFormats`, HTML Element `attributes`, a chart's `series`) is a block, never a property value. `attributes: [(attributeName: 'x')]` is **MDL-WIDGET27** — it used to check clean, exec, and vanish from storage. `describe widget <name> -p app.mpr` lists the container keywords |
@@ -1388,6 +1390,8 @@ MDL uses explicit property declarations for pages:
13881390
| Widget name | Required after type | `textbox txtName (...)` |
13891391
| Attribute binding | `attribute: AttrName` | `textbox txt (label: 'Name', attribute: Name)` |
13901392
| Attribute over an association | `attribute: Assoc/Attr` (bare association name, multi-hop OK) | `textbox txt (label: 'Rule', attribute: RuleAction_BusinessRule/Name)` — works on textbox, textarea, datepicker, dropdown, checkbox and radiobuttons, the same as on a data grid column |
1393+
| Password field | `Password: true` on a textbox | `textbox tbPw (attribute: Secret, Password: true)` — omitted when false. Without it a describe → exec round trip turns a password field into a plaintext one |
1394+
| Widget validation | `Validation: '<expression>'`, `ValidationMessage: '<text>'` | `Validation: 'length(toString($value)) > 0'` — a Mendix expression over `$value`, QUOTED not bracketed (`[...]` is the XPath spelling and parses as an array) |
13911395
| Variable binding | `datasource: $Var` | `dataview dv (datasource: $Product) { ... }` |
13921396
| Action binding | `action: type` | `actionbutton btn (caption: 'Save', action: save_changes)` — the forms are a closed set (`mxcli syntax page.action`); anything else is **MDL-WIDGET28** |
13931397
| No action | `action: nothing` | `actionbutton btn (caption: 'Decorative', action: nothing)` — an explicitly inert control. Write it deliberately: an action keyword **short its argument** (`action: open_link` with no URL) is now an error rather than a widget silently written with no action at all |

0 commit comments

Comments
 (0)