Skip to content

Commit 2da92c2

Browse files
akoclaude
andcommitted
feat(pages): author all three of a widget's icon elements (#1059)
`Icon: image <qn>` and `Icon: glyph <n>` on page widgets, completing the round trip the previous commit could only make honest. actionbutton btnEdit (Caption: 'Edit', Icon: 'Atlas_Core.Atlas_Filled.pencil') actionbutton btnLogo (Caption: 'Logo', Icon: image MyModule.Images.logo) actionbutton btnHome (Caption: 'Home', Icon: glyph 57377) The bare form stays the icon-collection icon, so no existing script changes meaning; a name may also be written unquoted, as every other reference into the model is. The keyword is the whole point: the first two forms are spelled identically and point into DIFFERENT documents, so nothing else separates them. Same vocabulary as navigation's `icon image` / `icon glyph`, and the same ANTLR ordering trap (qualifiedName accepts a keyword as a name segment, so the keyword-led alternatives must come first). One vocabulary, not a third. `pages.Icon` carried its own three-value enum for the same three Mendix elements, which is exactly the drift that produced the bug; it now uses types.MenuIconKind, and both writers dispatch on it instead of inferring from a payload that cannot distinguish the two named kinds. The legacy engine wrote `Icon: nil` on every action button unconditionally. A button icon has been authorable since #602 and only the modelsdk engine ever wrote one, so under `--engine legacy` it was dropped on every write — silently, because a null Icon is what an iconless button stores. Both engines now write all three. Validation caught up with the kinds: - `check --references` resolves each kind against its OWN collection. Before, an image reference was checked against the icon collections and reported as a typo — the same conflation, pointed the other way. When the kind is wrong the message names the remedy instead of leaving a correct name looking misspelt. - MDL078 (undefined glyph code) now covers widget glyphs. It walked the statements itself and knew only about menus, so every widget glyph would have passed in silence. Both it and the reference check now consume the package's single icon walk. Measured on 11.13.0 against a real project: all three authored, `mx check` 0 errors, `mxbuild --target=deploy` BUILD SUCCEEDED, and the three elements on disk with the right $Type and payload. The controls pin it — the same page with `image` dropped gives exactly `[CE1613] "The selected custom icon 'MyFirstModule.Images.workflow' no longer exists." at Action button 'btnImage'`, and a widget `Icon: glyph 57562` fails the deploy build with `System.InvalidOperationException: Sequence contains no matching element`, naming the PAGE — so MDL078's message no longer promises "layout". Corpus sweep clean at 531 scripts. Not covered: NavigationList item and DropDownButton icons are still not read at all, so they are dropped as silently as a widget glyph used to be. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017s476QkXr9CFMvKspVzcvu
1 parent 2f330b5 commit 2da92c2

26 files changed

Lines changed: 1478 additions & 237 deletions

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,3 +611,4 @@
611611
{"area":"mdl-executor","date":"2026-09-13","symptom":"DESCRIBE renders a microflow whose branches cross as `c1 and c2` when the activity actually runs on `not(c1) or c2` — a program that always logs described as one that never does, with mx check clean","cause":"Nested if/then/else is single-entry/single-exit; a Mendix microflow is an arbitrary digraph. When an inner split's branch lands where an outer split's branch lands, the describer walks the graph as a tree and emits the conjunction of the guards along one path.","file":"mdl/executor/cmd_microflows_normalize.go","fix":"DESCRIBE MICROFLOW ... NORMALIZED (Mode 3): fold the branch guards into one condition via mdl/microflownorm and rewrite a COPY of the graph into the equivalent nested one, then let the existing describer render it. Refuses per-decision when the region holds an activity, a rule-based split, or genuinely interleaved branches.","insight":"Do not write a second describer for a second rendering mode — rewrite the GRAPH and reuse the one describer, or the two drift and every activity renderer is implemented twice. Two verification lessons. (1) A boolean simplifier needs a truth-table equivalence test over generated formulas, not per-rule unit tests: an unsound rewrite produces a pretty WRONG guard, which is the original bug from the other direction. Run it with a rule deliberately broken as the control — mine caught it at the first assignment. (2) Algebra is not behaviour: build the original and the microflow rebuilt from its normalized description side by side and compare return values over the whole input truth table on a real runtime. The rows that matter are the ones the OLD rendering got wrong, so make the fixture's return value distinguish them (a `log` activity is invisible to a test; a `$Result` string is not). Also: the fold leaves the entry merge with in-degree 1, which describe->exec would then silently delete, so splice it out in the transform — otherwise Mode 3's output does not describe the graph its own re-execution builds."}
612612
{"area":"mdl/executor","date":"2026-09-13","symptom":"CATALOG.GRAPH_CYCLES returns 0 rows on a project whose CATALOG.GRAPH_MODULE_COUPLING lists mutual Source/Target module pairs, so a user reads 'no circular dependencies' from a table that was never computed (mendixlabs/mxcli#1060)","cause":"graph_cycles_data is written only by the graph-analysis pass (REFRESH CATALOG COMMUNITIES), while graph_module_coupling is a plain SQL view over refs that any full-mode catalog answers. GRAPH_CYCLES and its four siblings appeared in neither fullOnlyTables nor sourceOnlyTables, so no warning fired; and the recorded build mode is only fast/full/source, so a communities-augmented cache is indistinguishable from a plain full one — which also let a later `refresh catalog full` drop the graph tables silently","file":"`mdl/executor/cmd_catalog.go` (`communitiesOnlyTables`, `warnIfCatalogModeInsufficient`, `tableRequiredMode`, `carryGraphAnalysis`, `cachedCatalogInfo`), `mdl/catalog/catalog.go` (`MetaGraphAnalysis`), `mdl/catalog/builder_graph.go`, `mdl/catalog/builder.go`","insight":"**An empty analytic table is only an answer once something distinguishes 'computed and empty' from 'never computed'.** The mode ladder could not carry that bit: fast/full/source is a LEVEL, and the graph pass is orthogonal to it (it augments any level), so folding it in makes 'source' and 'full+graph' incomparable — it has to be a flag, not a rank. Guard it by MEASUREMENT, not a second hand-written list: run the pass on a synthetic refs graph and diff which tables went from empty to non-empty, then compare that set to the classification map. Shape the fixture so every table fills — two clusters for the community split and the integration surface, one MUTUAL pair for cycles — or the guard silently skips the very table the bug was about","fix":"Record MetaGraphAnalysis/MetaGraphResolution when the pass runs; classify the six tables in communitiesOnlyTables and warn 'requires refresh catalog communities (not run for this catalog)'; report it in SHOW CATALOG STATUS; re-run the pass when a full rebuild replaces a cache that had it"}
613613
{"area": "mdl/executor", "date": "2026-09-13", "symptom": "describe page -> create or replace page broke a button's icon. An icon into an IMAGE collection came back as `Icon: 'DesignSystem.Icons_SVG.edit'` and the build failed [CE1613] \"The selected custom icon 'DesignSystem.Icons_SVG.edit' no longer exists.\" A GLYPH icon produced no describe output at all -- no clause, no comment -- and replay DELETED it at exit 0.", "cause": "Mendix stores three icon elements and two put a qualified name under the same BSON key: Forms$IconCollectionIcon{Image}->CustomIcons$CustomIcon, Forms$ImageIcon{Image}->Images$Image, Forms$GlyphIcon{Code}. extractIconRef read `Image` off whichever element was there and threw the $Type away, and the page builder writes Forms$IconCollectionIcon unconditionally -- so the two named variants were spelled identically on the way out and collapsed into one on the way back in.", "file": "mdl/executor/cmd_pages_describe_output.go (extractButtonIcon, widgetIconMDL, widgetIconNote), mdl/executor/cmd_pages_describe.go (rawWidget.IconType/IconCode), mdl/executor/cmd_pages_describe_parse.go; tests mdl/executor/cmd_pages_describe_icon_test.go", "insight": "The identical three-variant defect was fixed in NAVIGATION eight days earlier (2026-09-05, same area file) and the page path never received it -- so the cheapest possible diagnosis was `grep MenuIconKindOf`, and the fix reuses that resolver rather than adding a second one. **Generalisable: when a fix teaches a layer to distinguish polymorphic variants, grep for every OTHER reader of the same element.** The find was one `git grep Forms\\$ImageIcon` away all along. Two things the report got understandably wrong and that the fix depends on getting right: it is not about third-party vs native collections (a third-party ICON collection round-trips fine -- and CE1613 naming the reference is itself proof the name was never a custom icon, since mxbuild would otherwise have resolved it), and the reported image-icon case is the CHEAPER half -- the glyph case is silent on both sides, so nothing in the output even hints at the loss. **Measure the silence, not the wrong answer**: `grep -c icon` over describe output of a stock marketplace project's FeedbackModule pages returned 0 before and 3 after, which is the only form the glyph bug has. The note has to fire on an UNRECOGNISED $Type too, not a known-bad list, or the next variant Mendix adds is dropped the same way. Controls that matter: an icon-collection icon must still emit a bare `Icon:` and NO note (else the fix passes by flagging everything), and an iconless button must emit neither. No .mdl repro is possible -- mxcli cannot author an image or glyph icon on a button, so the input to the round trip cannot be constructed in MDL; the reproduction is a stored-widget map in the unit test. Also observed in passing and NOT fixed: a nameless `statictext` makes describe output unparseable (pre-existing, confirmed against the base binary), and NavigationList item / DropDownButton icons are never read at all, so they are dropped as silently as the glyph was.", "refs": ["#1059", "#1008", "#602"], "ce": ["CE1613"]}
614+
{"area": "mdl/executor", "date": "2026-09-13", "symptom": "Follow-on to #1059: a widget's image and glyph icons were readable but unwritable, so describe -> exec could only be made honest (a `-- NOT re-executable` note), not lossless. Authoring them needed the kind to reach the element $Type through grammar, AST, visitor, builder and BOTH engines.", "cause": "Three separate vocabularies for the same three Mendix icon elements: types.MenuIconKind (navigation), pages.IconType (the page model's own three-value enum), and a bare string in the widget property map. The page path had no kind at all, so it could not express one.", "file": "mdl/grammar/domains/MDLPage.g4 (widgetIconV3), mdl/ast/ast_page_v3.go (WidgetIcon), mdl/visitor/visitor_page_v3.go (buildWidgetIconV3), mdl/executor/cmd_pages_builder_v3_widgets.go (buildWidgetIcon), mdl/backend/modelsdk/widget_write.go (iconToGen), sdk/mpr/writer_widgets_display.go (buildWidgetIconBson), mdl/executor/validate_icon_refs.go, mdl/executor/validate_glyph_codes.go", "insight": "**Delete the second vocabulary as part of the fix, not after it.** pages.IconType existed for exactly the same three kinds as types.MenuIconKind and had drifted to a different value set; replacing it (2 call sites) is what made the writers a dispatch rather than an inference. A feature that adds a third copy would have re-created the bug in a new place. **The pre-existing tests of the OLD feature are the safety net for the new one**: MDL078's menu tests caught a python replace of mine that silently no-opped (anchor did not match, no assert), which nothing else would have. Always assert on the replacement count when editing by script. **Measure the premise, don't reason by analogy** — extending MDL078 to widget glyphs assumed mxbuild resolves a widget glyph the same way it resolves a menu one. It does, measured: `Icon: glyph 57562` fails `mxbuild --target=deploy` with `System.InvalidOperationException: Sequence contains no matching element` — but it names the **page**, not a layout, so the rule's own message was wrong and had to be corrected from the measurement. **The reference check had the mirror-image bug waiting**: resolving an image reference against the ICON collections reports a correct name as a typo, which is the same conflation pointed the other way — per-kind resolution plus an `otherKindHint` naming the remedy. **An empty listing is 'could not establish', not 'none'** — each half of the index is independent, so a project that yields icon collections but no image collections still resolves what it can. Verified on 11.13.0: all three authored, mx check 0 errors, deploy BUILD SUCCEEDED, right $Type on disk; controls reproduce CE1613 (image written without `image`) and the glyph build failure. Corpus sweep 531 clean.", "refs": ["#1059", "#1008", "#602"], "ce": ["CE1613"]}

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,41 @@ image imgRemote (ImageType: imageUrl, ImageUrl: 'https://example.com/logo.svg')
380380
image imgIcon (ImageType: icon)
381381
```
382382

383+
### A button's icon is one of three elements
384+
385+
Mendix stores **three different icon elements**, and the keyword picks which:
386+
387+
```sql
388+
actionbutton btnEdit (Caption: 'Edit', Action: nothing, Icon: 'Atlas_Core.Atlas_Filled.pencil')
389+
actionbutton btnLogo (Caption: 'Logo', Action: nothing, Icon: image MyFirstModule.Images.logo)
390+
actionbutton btnHome (Caption: 'Home', Action: nothing, Icon: glyph 57377)
391+
```
392+
393+
| form | element | holds |
394+
|------|---------|-------|
395+
| bare name | `Forms$IconCollectionIcon` | a name in an **icon** collection |
396+
| `image <name>` | `Forms$ImageIcon` | a name in an **image** collection |
397+
| `glyph <code>` | `Forms$GlyphIcon` | a font character code, no name |
398+
399+
The first two are spelled identically and point into **different documents**, so
400+
the `image` keyword is the only thing separating them. Write an image reference
401+
without it and mxcli stores a custom-icon reference, which fails the build with
402+
*CE1613 "The selected custom icon … no longer exists."* `mxcli check -p app.mpr
403+
--references` resolves each kind against its own collection and names the remedy
404+
when the kind is wrong, which is cheaper than a build.
405+
406+
Any icon collection works, third-party ones included — `show icon collections`
407+
lists them and `describe icon collection Atlas_Core.Atlas_Filled` lists the names
408+
(they are non-obvious: it is `add`, not `plus`).
409+
410+
A glyph has a code and no name. The codes are **sparse**, and an undefined one
411+
fails only at `mxbuild --target=deploy` — with *"An exception occurred while
412+
exporting page '<name>'"*, naming the page and never the icon — so `mxcli check`
413+
reports it as **MDL078** first. Browse them with `show glyphs`.
414+
415+
`describe page` emits all three forms, so describe → exec round-trips a button's
416+
icon whichever kind it is.
417+
383418
### Binding across modules and to audit members
384419

385420
An attribute path may cross module boundaries, including into the platform's

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1212

1313
- **`CATALOG.GRAPH_ANALYSIS_SCOPE` — which reference kinds reach the computed graph.** The two graph families disagree by construction and there was no way to see it from SQL: `GRAPH_MODULE_COUPLING` and friends read every kind straight off `refs`, while the computed pass (communities, cycles, layers, centrality) is restricted to the structural kinds. On a stock 11.14 app that is 110 of 316 edges. One row per kind with its edge count and whether it is in the asset graph; the `IN` list is generated from the filter itself, so the view cannot drift from what it describes.
1414

15+
- **`Icon: image <qn>` and `Icon: glyph <n>` on page widgets** (mendixlabs/mxcli#1059) — Mendix stores three icon elements on a button and MDL could spell one, so the other two were readable and unwritable. DESCRIBE learned to flag them rather than destroy them (see *Fixed*, below); this makes them authorable, so the round trip is lossless rather than merely honest.
16+
17+
```sql
18+
actionbutton btnEdit (Caption: 'Edit', Action: nothing, Icon: 'Atlas_Core.Atlas_Filled.pencil')
19+
actionbutton btnLogo (Caption: 'Logo', Action: nothing, Icon: image MyModule.Images.logo)
20+
actionbutton btnHome (Caption: 'Home', Action: nothing, Icon: glyph 57377)
21+
```
22+
23+
The bare form stays the icon-collection icon, so no existing script changes meaning; a name may also be written unquoted, as every other reference into the model is. The keyword is the whole point: the first two forms are spelled identically and point into **different documents**, so nothing else can separate them. Same vocabulary and same ordering trap as navigation's `icon image` / `icon glyph`, and the shared resolver (`types.MenuIconKind`) rather than a second copy — `pages.Icon` carried its own three-value enum for the same three things, which is precisely the drift that produced the bug.
24+
25+
`mxcli check --references` now resolves **each kind against its own collection**, which it could not do before: an image reference was checked against the icon collections and reported as a typo. When the kind is wrong it names the remedy — *"`MyFirstModule.Images` IS an image collection — write `Icon: image MyFirstModule.Images.workflow`"* — rather than leaving a correct name looking misspelt. **MDL078** (undefined glyph code) now covers widget glyphs too: it read the statements through its own walk, so the day a widget could carry a glyph every one of them would have passed in silence; both it and the reference check now consume the package's single icon walk.
26+
27+
The legacy engine wrote `Icon: nil` on every action button unconditionally — a button icon has been authorable since #602 and only the modelsdk engine ever wrote one, so under `--engine legacy` it was dropped on every write, silently, since a null Icon is what an iconless button stores. Both engines now write all three.
28+
29+
Measured on 11.13.0 against a real project: all three authored, `mx check` 0 errors, `mxbuild --target=deploy` **BUILD SUCCEEDED**, and the three elements on disk with the right `$Type` and payload. The controls are what pin it — the same page with `image` dropped produces exactly `[error] [CE1613] "The selected custom icon 'MyFirstModule.Images.workflow' no longer exists." at Action button 'btnImage'`, and a widget `Icon: glyph 57562` fails the deploy build with `System.InvalidOperationException: Sequence contains no matching element`, naming the **page** (so MDL078's message no longer promises "layout"). Corpus sweep clean at 531 scripts.
30+
1531
### Fixed
1632

1733
- **An empty graph-analysis table could not be told apart from one that was never computed** (mendixlabs/mxcli#1060). `CATALOG.GRAPH_CYCLES` answered `0 rows` on a project whose `CATALOG.GRAPH_MODULE_COUPLING` listed mutual module pairs, so it read as "no circular dependencies". The two are built by different things: coupling is a plain view over `refs` that any full catalog answers, while the cycles/communities/layers/centrality tables are written only by `REFRESH CATALOG COMMUNITIES` — and those six were in neither `fullOnlyTables` nor `sourceOnlyTables`, so nothing warned.

0 commit comments

Comments
 (0)