Skip to content

fix(pages): ALTER PAGE/SNIPPET SET RenderMode on a dynamic text (closes #1228) - #1229

Open
MendixMau wants to merge 1 commit into
mendixlabs:mainfrom
MendixMau:fix/1228-alter-page-set-rendermode
Open

MendixMau wants to merge 1 commit into
mendixlabs:mainfrom
MendixMau:fix/1228-alter-page-set-rendermode

Conversation

@MendixMau

Copy link
Copy Markdown
Contributor

Closes #1228

What it does

alter page / alter snippet can now set RenderMode on a dynamic text:

alter page Mod.Page { set RenderMode = H2 on txtTitle };

create page already writes this property and the MCP backend's mutator already sets it. The MPR backend's fixed property list in setRawWidgetPropertyMut did not include it, so the statement fell through to the pluggable-widget setter and was refused. The new case:

  • applies only to a dynamic text (Forms$DynamicText); other widgets keep the previous path
  • accepts Text, Paragraph and H1–H6 in any casing, and stores the canonical spelling
  • refuses anything else and writes nothing, e.g. invalid RenderMode "H7" for dynamic text "title": expected one of Text, Paragraph, H1, H2, H3, H4, H5, H6

check -p picks this up too, since it dry-runs the same setter.

Testing

  • make test on upstream main 9509176: 84 packages ok, 0 FAIL
  • make lint: clean (exit 0)
  • New unit tests in mdl/backend/pagemutator/dynamictext_rendermode_test.go. They fail without the mutator.go change and pass with it.
  • Bug-test mdl-examples/bug-tests/alter-page-set-rendermode-dynamictext.mdl covers a page and a snippet.

Mendix validation (11.12.2, fresh blank app)

  • The bug-test script: on main 9509176 it stops at the first set RenderMode (exit 1). With this branch it prints Altered page and Altered snippet, and describe shows RenderMode: H2, Paragraph and H4.
  • mx check: 0 errors.
  • set RenderMode = H7: refused with the message above, exit 1, and the page still reads H2.
  • Runtime (mxcli run --local --db-type hsqldb): set RenderMode = H5 on the blank app's home-page heading (text1, H1). In the browser, "Welcome to your homepage" renders as an <h5>, and the page has no <h1> left.

Docs: skill alter-page, docs-site alter-page.md, MDL_QUICK_REFERENCE.md, mxcli syntax page.alter, and a finding in .claude/skills/fix-issue/findings/mdl-backend.jsonl.

Out of scope: set Content / ContentParams on a dynamic text (grammar-level), RenderMode on a container, RenderType on a button.

Not tested: opening the model in Studio Pro.

🤖 Generated with Claude Code

mendixlabs#1228)

`alter page P { set RenderMode = H2 on <dynamictext> }` was refused as "not a
property of this built-in widget", although CREATE PAGE and REPLACE accept
RenderMode on a dynamictext and the MCP backend's mutator already sets it.
setRawWidgetPropertyMut had no case for it, so it fell through to the
pluggable-property setter.

Add a RenderMode case dispatched on the stored $Type (Forms$DynamicText): the
value is validated case-insensitively against Text, Paragraph and H1-H6 and
written in its canonical spelling; anything else is refused with the accepted
list, leaving the document untouched. Other widgets keep the previous path.
`check -p` picks this up too, since it dry-runs the same setter.

Docs: alter-page skill, docs-site alter-page.md, MDL_QUICK_REFERENCE.md,
`mxcli syntax page.alter`, and a fix-issue finding.

Tested: make test (84 packages ok, 0 FAIL), make lint. The new unit tests fail
without the mutator change (8 subtests) and pass with it.
Mendix 11.12.2, fresh blank app: the bug-test script exits 1 on main and
applies on this branch (describe: H2, Paragraph, H4); mx check 0 errors; H7
refused with nothing written; at runtime the home-page heading set to H5
renders as <h5>.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

  • The LSP wiring check in the full-stack consistency section is not addressed in the diff. However, since this change only adds a new value for an existing property (RenderMode) in an existing SET statement context, and does not introduce new syntax keywords or statement types, LSP updates are not strictly required. The existing LSP infrastructure should handle property completion and diagnostics for RenderMode as it does for other widget properties.

What Looks Good

  • The change is scoped precisely to the reported issue: adding RenderMode support for dynamic text in ALTER PAGE/SNIPPET SET statements.
  • The implementation correctly:
    • Limits the feature to Forms$DynamicText widgets only
    • Accepts case-insensitive values (Text, Paragraph, H1-H6) and stores canonical spelling
    • Provides clear error messages listing valid options for invalid inputs
    • Preserves existing behavior for other widgets and properties
  • Test coverage is strong:
    • Unit tests validate both valid and invalid inputs
    • Bug test MDL covers both page and snippet contexts
    • Mendix validation confirms runtime behavior matches expectations
  • Documentation updates are comprehensive:
    • Skill reference altered
    • Quick reference updated
    • Syntax documentation enhanced
    • Alter-page language guide updated
  • The fix follows the established pattern in the pagemutator (similar to other widget property setters)
  • Error handling properly preserves existing values on failed writes

Recommendation

Approve the PR. The change is fully compliant with the project's architectural requirements, includes adequate test coverage, updates all necessary documentation, and correctly implements the requested feature without introducing regressions. The minor LSP concern does not block approval as no new syntax was added requiring LSP updates.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

This branch has not been deployed

No deployments
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.

ALTER PAGE / ALTER SNIPPET cannot SET RenderMode on a dynamic text ("not a property of this built-in widget")

1 participant