Skip to content

feat(alter-page): INSERT INTO container — append widgets as a container's children - #6

Merged
ako merged 1 commit into
mainfrom
claude/mxbuild-diagnostics-spike-emta6h
Jul 21, 2026
Merged

feat(alter-page): INSERT INTO container — append widgets as a container's children#6
ako merged 1 commit into
mainfrom
claude/mxbuild-diagnostics-spike-emta6h

Conversation

@ako

@ako ako commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Adds ALTER PAGE … { insert into <container> { … } } — appending widgets as a container's children. Previously ALTER PAGE could only INSERT BEFORE/AFTER a sibling widget, so there was no way to fill an empty container or add a widget to a container/dataview without an existing sibling to anchor to.

alter page Mod.Home {
  insert into ctnToolbar {                 -- fills an EMPTY container
    actionbutton btnNew (caption: 'New', action: nothing, buttonstyle: primary)
  }
}
alter page Mod.Detail {
  insert into dv {                          -- children take the dataview's entity
    dynamictext dtTitle (content: '{1}', contentparams: [{1} = Title], rendermode: H1)
  }
}

What's included (full-stack)

  • GrammarINSERT INTO widgetRef { pageBodyV3 } (regenerated parser; generated files not committed).
  • AST / visitorInsertWidgetOp.Position = "INTO".
  • Executor — for INTO, the new children take the target's own entity context (e.g. a dataview's entity), not its enclosing container's.
  • Mutators — both the MPR-file pagemutator and the live-Studio-Pro mcp mutator append to the container's Widgets list. An empty container omits that list, so it's created with the Mendix widget-list marker and the (grown) bson.D is written back into its parent.
  • Scope — simple containers (DivContainer, Container, DataView, GroupBox, ScrollContainerRegion, Section). LayoutGrid (Rows/Columns) and TabContainer (TabPages) have no single child list and return a clear error pointing to INSERT BEFORE/AFTER a widget inside the target column/tab.

Testing

  • Verified on Mendix 11.12.1 (mx check 0 errors): insert into an empty container, append to a non-empty one, and insert a data-bound widget into a dataview.
  • Non-container target (e.g. a DynamicText) gives a clear error.
  • Unit test for the mutator INTO path + error case (page_mutator_test.go); doctype example (mdl-examples/doctype-tests/alter-page-insert-into.mdl); full mdl/... + syntax test packages green.
  • Docs: alter-page skill, MDL_QUICK_REFERENCE.md, and mxcli syntax help (page + snippet) updated.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4


Generated by Claude Code

…er's children

ALTER PAGE could only INSERT BEFORE/AFTER a sibling widget, so there was no way to
fill an EMPTY container or add a widget to a container/dataview without an existing
sibling to anchor to. Add:

  alter page Mod.Page { insert into containerName { <widgets> } }

which appends the widgets as the last children of the named container. Full-stack:
grammar (INSERT INTO), visitor (Position "INTO"), executor (children take the
target's own entity context, e.g. a dataview's entity), and both mutators
(pagemutator for MPR files, MCP for live Studio Pro). An empty container omits its
Widgets list, so it is created with the Mendix widget-list marker and written back
into the parent (the bson.D grows). Simple containers are supported (DivContainer,
Container, DataView, GroupBox, ScrollContainerRegion, Section); LayoutGrid and
TabContainer have no single child list and give a clear error pointing to
INSERT BEFORE/AFTER inside the target column/tab.

Verified on 11.12.1: insert into an empty container, append to a non-empty one, and
insert a data-bound widget into a dataview — mx check 0 errors. Unit test for the
mutator INTO path + error case; doctype example; skill / quick-reference / syntax
help updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
@ako
ako force-pushed the claude/mxbuild-diagnostics-spike-emta6h branch from 45b1dbd to 8515ba5 Compare July 21, 2026 23:14
@ako
ako merged commit 84a98a3 into main Jul 21, 2026
3 of 5 checks passed
ako pushed a commit that referenced this pull request Jul 25, 2026
Straggler for finding #6 — the audit-attributes example also showed
`OrderNumber: autonumber` with no seed. Add `default 1` (an autonumber requires
a seed or the build fails CE7247), matching the mdl-entities.md fix and the
already-correct data-types row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
ako pushed a commit that referenced this pull request Jul 27, 2026
…ltiline-string hint

Three separate authoring papercuts from the RSS-reader build:

- #10 The CLAUDE.md/AGENTS.md template that `mxcli init` writes into every
  project contradicted the shipped skills: it listed `DECLARE $Entity
  Module.Entity;` and `DECLARE $List List of ... = empty;` as supported
  (both are rejected — MDL043/CE0053 and MDL040) and listed `CASE … END
  CASE` as NOT supported (it IS — the enum split). Move the two DECLARE
  forms to the NOT-supported table with the correct "use a parameter /
  retrieve / create" guidance, and list CASE as supported.

- #12 write-microflows.md documented the `$latestHttpResponse` body
  attribute as lowercase `content`; the real name is `Content` (inherited
  from System.HttpMessage, so DESCRIBE ENTITY System.HttpResponse doesn't
  list it). Lowercase fails CE0117. Fix both mentions and note why.

- #6 A string literal that runs off the end of its line got the
  "unescaped apostrophe — double your apostrophes" hint, which only makes
  it worse. Detect a newline inside the token-recognition-error payload
  and emit a distinct "string literals cannot span multiple lines" hint
  instead. The single-line apostrophe heuristic is unchanged.

Reported from the RSS-reader build (findings #10, #12, #6).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
ako pushed a commit that referenced this pull request Jul 29, 2026
…NGS LANGUAGE (FINDINGS #6)

`alter settings LANGUAGE DefaultLanguageCode = '<code>'` accepted any string. A code
not configured in the project (e.g. 'nl_NL' on an en_US-only project) was written,
reported success, and the *next* `mx check` died with an unhandled
NullReferenceException — never a model error, so the corruption was invisible until a
later command.

Validate the code against the project's configured languages
(ps.Language.Languages) before writing; reject with the available codes and a
Studio Pro hint. Skipped when the language list is unavailable (empty) to avoid
false rejections. Verified end to end on the vendored fixture: 'nl_NL' rejected,
'en_US' accepted.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
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.

2 participants