Skip to content

Place building blocks with a styled dynamic text or a list view without a source - #2198

Merged
ako merged 5 commits into
mainfrom
fix/2183-bb-inline-style-and-sourceless-listview
Nov 12, 2026
Merged

ako merged 5 commits into
mainfrom
fix/2183-bb-inline-style-and-sourceless-listview

Conversation

@ako

@ako ako commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Closes #2183 (upstream mendixlabs#1836).

Two refusals meant for hand-written MDL blocked whole building blocks. Each has its own commit.

1. Inline style on a block's dynamic text (4f9721012)

applyWidgetAppearance (MDL-WIDGET03) refuses any dynamictext with a style. use building block expands a block by re-parsing its rendered MDL, so a style Studio Pro wrote looked exactly like hand-written MDL. That blocked PDS Icon_After_Text and the Wizard_* blocks.

  • Measured on 11.12.1: the refusal's premise ("crashes MxBuild") does not reproduce. testdata/testapp already has a Studio Pro-authored styled dynamic text. Two styled dynamic texts written by this engine, including the block's --icon-size: auto;, pass mx check with 0 errors and build with mxcli docker build. History records no measurement for the original claim.
  • Fix: the expander marks the widgets it copies in (ast.WidgetV3.FromBuildingBlock), and the refusal skips them, so the block's stored style is carried through verbatim. Hand-written MDL is still refused at check and exec. Whether to lift that refusal too, given the measurement, is left as a separate decision.

2. List view without a data source (b31e469a0)

listViewSourceToGen had no case for a missing source, so it returned the generic "not supported by either engine — please file an issue" error. That blocked PDS Avatar_Group_*, and a hand-written listview without DataSource: passed check and then failed at exec the same way.

  • Fix: a missing source is written the way Studio Pro stores an unconfigured list view:
    Forms$ListViewXPathSource {EntityRef: null, ForceFullObjects: false, Search{SearchRefs:[2]}, SortBar{SortItems:[2]}, SourceVariable: null, XPathConstraint: ""}
    
    EntityRef joins SourceVariable in the type's null-written keys.
  • Reference: every unconfigured list view in the Atlas page templates shipped in testapp, PedApp and EvSpike (13 each) has exactly this key set.
  • exec warns, naming the list view, and adds "(from the building block)" when it came from one. mx check then reports CE0488 "No entity configured…" until a source is set.

Verification

  • Tests:
    • listview_no_source_2183_test.go: before the fix it failed with exactly the reported <nil> error; before the null-key change it failed on the missing EntityRef. A control shows unknown source types are still refused.
    • use_building_block_unauthored_2183_test.go (a mock block): the style test fails with the reported refusal when the block marking is stubbed, and the list-view test fails when the warning is stubbed. Controls: hand-written style is still refused, and a list view with a source doesn't warn.
  • End to end (Mendix 11.12.1, a copy of a test app; PDS can't be downloaded here):
    • The Atlas_Web_Content.Card block in a copy was patched with the PDS style and a Studio Pro sourceless list view. The patched block builds on its own.
    • Main: the style refusal; a hand-written sourceless list view fails with the <nil> error.
    • This branch:
      • the block is placed with a warning, and mx check reports only CE0488;
      • with a data source set, 0 errors and docker build succeeds;
      • a hand-written sourceless list view gets only CE0488;
      • hand-written styled dynamic text is still refused.
  • Checks: build, vet and tests for mdl/ast, mdl/executor, mdl/backend/modelsdk and mdl/roundtrip, plus fmt-check, check-findings and check-skill-index, pass. main was merged in to resolve a CHANGELOG conflict.

Docs

  • Two finding records and a CHANGELOG entry.
  • The building-block exception is noted in theme-styling, create-page and atlas-design (and its building-blocks.md reference).

Not in this PR

  • Lifting the hand-written MDL-WIDGET03 refusal.
  • A check-time warning for a hand-written list view without a source; only exec warns.

Generated by Claude Code

`use building block PlatformDesignSystem.Icon_After_Text as b_` (and the
three Wizard blocks) failed with `dynamictext "b_text13": an inline
`style` crashes MxBuild`. The block's text is styled `--icon-size: auto;`.

Cause: MDL-WIDGET03 (#673) refuses any dynamictext with a style in
applyWidgetAppearance. A block is expanded by rendering its stored widgets
to MDL and re-parsing them, so a style Studio Pro wrote reached the guard
looking exactly like hand-written MDL.

Fix: the expander marks every widget it copies in
(ast.WidgetV3.FromBuildingBlock, kept by cloneWidget's struct copy), and the
guard skips marked widgets. The block's style is written as stored.
Hand-written MDL is still refused by both check and exec.

Measured with Mendix 11.12.1 mxbuild:
- testdata/testapp has a Studio Pro-authored dynamic text styled
  'word-wrap: break-word;'.
- A dynamic text with an inline style written by this engine (hand-written,
  guard stubbed, --no-check) passes mx check and `mxcli docker build`. The
  #673 NullReferenceException did not reproduce. The refusal for
  hand-written MDL may be obsolete, but it is not lifted here.
- A copy of EvSpike whose Card block was patched to carry the styled text:
  main refuses the page; this branch places it, and the page builds.

Tests: use_building_block_unauthored_2183_test.go. The block test fails with
the reported error when markFromBuildingBlock is stubbed. A control checks
that the hand-written refusal still applies.

Refs #2183, mendixlabs#1836

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiMsnXa9crge2qnSk9S7Zn
`use building block PlatformDesignSystem.Avatar_Group_SM as b_` (and
Avatar_Group_XS) failed with `CreatePage: encode: ListView source <nil> is not
supported by either engine`. The block's list view has no data source
configured. A hand-written `listview` with no `DataSource:` passed
`mxcli check` and then failed the same way at exec.

Cause: listViewSourceToGen had no case for a nil source, so it hit the
refusal meant for unknown source types (in place since the ListView writer
was added). Forms$ListViewXPathSource also registered only SourceVariable as
a null field, so an XPath source with no entity left out the EntityRef key.

Fix: a nil source is written as Studio Pro's unconfigured source,
Forms$ListViewXPathSource with:
- EntityRef and SourceVariable null
- XPathConstraint ""
- ForceFullObjects false
- an empty SortBar and Search (marker 2)
This applies to block and hand-written list views alike. exec warns, and
mx check reports CE0488 until the author binds a source.

Reference: all 13 unconfigured List Views in the Atlas page templates of
testdata/testapp (and 13 in PedApp's) have this exact key set. The new test
pins it.

Measured with Mendix 11.12.1 mxbuild, on a copy of EvSpike whose Card block
carries a Studio Pro list view with no source (grafted in with $IDs and
pointers renumbered):
- main refuses the page.
- This branch places it with a warning. mx check reports only CE0488 "No
  entity configured for the data source of this list view".
- With `(datasource: database from Administration.Account)` mx check reports
  0 errors and `mxcli docker build` succeeds.

Also updates the skills that stated the refusals without the
building-block exception, and adds the CHANGELOG entry covering both fixes.

Tests: listview_no_source_2183_test.go (writer, plus a control that unknown
source types are still refused) and use_building_block_unauthored_2183_test.go
(the block is placed with a warning; a list view with a source does not
warn). Before the fix both fail with the reported error or with no warning.

Refs #2183, mendixlabs#1836

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QiMsnXa9crge2qnSk9S7Zn
…yle-and-sourceless-listview

# Conflicts:
#	CHANGELOG.md
…yle-and-sourceless-listview

# Conflicts:
#	CHANGELOG.md
…yle-and-sourceless-listview

# Conflicts:
#	CHANGELOG.md
@ako
ako merged commit aa8f07d into main Nov 12, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[up#1836] A building block is refused as a whole when one widget inside it has an inline style or a list view without a data source

2 participants