Skip to content

MDL-BUTTON02: also flag own-container names in data sources and widget expressions - #1018

Merged
ako merged 2 commits into
mainfrom
fix/1324-own-dataview-name-ce0117
Oct 7, 2026
Merged

ako merged 2 commits into
mainfrom
fix/1324-own-dataview-name-ce0117

Conversation

@ako

@ako ako commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1013 (mendixlabs#1324).

Summary

A data container's widget-name variable ($dvP for dataview dvP) only exists for data containers nested below dvP. In dvP's own context the object is $currentObject. #1013 checked this rule for action arguments only. The same scope applies to every slot evaluated in a widget's enclosing context, and those slots passed check and exec and then failed the build.

Measured on Mendix 11.14.0. Each shape sits directly inside dvP, with a control one data view deeper:

$dvP read in own context control
nested data view's microflow data-source argument CE0117 at dvDsOwn clean
Visible: CE0117 at cVisOwn clean
Editable: CE0117 at the text box clean
DynamicClasses: CE0117 at cClsOwn clean
nested list's XPath where CE0161 at lvXpOwn clean

Changes

  • checkOwnContainerName (mdl/executor/validate_page_button_context.go) now takes the widget and checks its action arguments, data-source arguments, data-source XPath, and its Visible / Editable / DynamicClasses expressions. Each error carries that slot's CE code. Visible: and Editable: are stored as VisibleIf / EditableIf, but the message uses the names the author wrote.
  • Text-template parameters are not covered. MDL-WIDGET24 already refuses a variable path there, for an unrelated reason.
  • Adds the bug test mdl-examples/bug-tests/1324-own-data-container-name-outside-actions.fail.mdl, updates the widgets reference, error cheatsheet and CHANGELOG, and appends a finding to mdl-executor.jsonl.

Evidence

  • Test written first: TestValidatePageButtonContext_OwnContainerName_OutsideActions failed with flagged "" before the change.
  • Control: with the data-source and property checks stubbed out, the test fails with flagged "" again.
  • End to end: the fixed check flags exactly the five failing widgets, and exec refuses them. Rewriting all five to $currentObject builds with The app contains: 0 errors.
  • No false positives: none of the 682 non-negative .mdl scripts in mdl-examples/ and .claude/skills/ triggers MDL-BUTTON02.
  • Repo checks: make build, make test, make lint, make check-mdl and make check-findings pass on the current main. make check-skill-mdl passed before the rebase, which only resolved a CHANGELOG conflict.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QLPboEFUCLXZr6qwX2T9LF


Generated by Claude Code

claude added 2 commits October 7, 2026 18:04
A data container's widget-name variable is in scope only one data
container below it, and that holds for every slot evaluated in a
widget's enclosing context, not only action arguments. Measured on
mxbuild 11.14.0, each against a control one data view deeper that
builds clean: a nested widget's microflow data-source argument,
Visible, Editable and DynamicClasses reading the container they sit in
directly are CE0117, and a nested list's XPath `where` is CE0161. All
five passed check and exec.

checkOwnContainerName now takes the widget and walks its action
arguments, data-source arguments and XPath, and those expression
properties, naming the CE code per slot. Text-template parameters are
left alone: MDL-WIDGET24 already refuses a variable path there.

Refs mendixlabs#1324

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QLPboEFUCLXZr6qwX2T9LF
@ako
ako merged commit db0c13e into main Oct 7, 2026
28 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.

2 participants