Refuse an input binding with no object to bind to (MDL-WIDGET34) - #694
Merged
Merged
Conversation
…L-WIDGET34) `textbox t (Attribute: FullName)` at the top of a page, snippet or plain container has no entity to qualify the name with; the writer stores anything shorter than Module.Entity.Attribute as `AttributeRef: null`. Plain `check` passed, `exec --no-check` and `alter page … insert` said success, and mxbuild 11.13.0 failed the page: CE0544 + CE7005 on text box, text area, date picker, check box, radio buttons and drop-down, CE0402 on a dynamic text, CE0642 on a combo box. A qualified attribute there is stored and fails as well (CE0544 / CE2421 / CE1365 / CE7247 + CE7006). `Attribute: $P/Name` and `$currentObject/Name` parse as a data-source expression no builder reads, so they were dropped even inside a data view. - check: MDL-WIDGET34 in the widget-tree walk (no project needed), using the MDL-PAGEARG01 three-state context — refuses bare and qualified bindings at a document root outside any data widget, and the `$x/Attr` spelling anywhere. ALTER's subtree walk (unknown context) stands down. - build: the six input builders, dynamic text and the pluggable engine's primary `Attribute:` mapping refuse with the widget named, so nothing is written; with an unknown context only a bare name with no entity is refused, so qualified bindings inside an unresolvable flow source (excluded ShareFeedback_Logo) keep building. Two unit tests built inputs with no entity in scope and one asserted the bare `Title` reference counted as bound; they now set an entity context. Verified on a copy of a Mendix 11.13.0 project: 22 mxbuild errors before, every case refused after with nothing written; controls (data view, list view, gallery, data grid, snippet data view, ALTER into a data view) build at 0 errors; describe -> exec round trip 17/17 pages, 4/4 snippets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hout-context # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
An input widget bound to an attribute with no object to bind to, such as
textbox t (Attribute: FullName)on a page outside any data container, reported success and was written withAttributeRef: null. The binding was silently dropped.Every input kind does this. Measured on a copy of the stock 11.13.0 project with
exec --no-check,bson dumpandmx check(22 errors for the page):Attribute:container; ALTER PAGE insert at top level; snippet top levelAN.Person.FullNameHow
checkbehaved before:-p --references: already refused CREATE PAGE and CREATE SNIPPET, viavalidate_page_context.go.exec --no-checkand ALTER PAGE.Also broken, inside a data view:
Attribute: $P/FullNameandAttribute: $currentObject/FullNamenever parsed as attribute paths. They became a data-source expression no builder reads, so they were dropped inside data views too.Fix
The logic is in
mdl/executor/cmd_pages_input_binding_context.go.$x/Attranywhere.Attribute:return an error naming the widget, e.g.:ShareFeedback_Logo).describewrites qualified names there and they must keep building (Round-trip a page over a flow the project lacks: keep bindings qualified #678). So where context is unknown (ALTER), only a bare name with no entity is refused, since that one is always written as null.Evidence
Control. With the fix stubbed out, 12 tests or subtests fail with the reported symptom.
Two existing tests built input widgets with no entity in scope.
TestBuildDynamicTextV3_AttributeBindscounted a bareTitlereference as "bound", so it was asserting the bug. Both now set an entity, and the dynamictext test checks the stored reference isM.Item.Title.Real run (copy of the project):
checkreports MDL-WIDGET34 for all 11 CREATE cases.exec --no-check --continue-on-errorrefuses every bad statement, the ALTER insert included, and writes none of them.mx check:Bug-tests:
mdl-examples/bug-tests/input-binding-without-context.mdl(valid; execs to 0 errors) andinput-binding-without-context.fail.mdl(refused). CHANGELOG entry added.Not covered
$P/Attr) looks legal in Mendix, going by CE0544's wording, but mxcli can't write it. It's refused rather than silently dropped.Checklist
make check-mdlpassesmake check-findingspassesmake build && make test && make lintpass, each exit code checked separately🤖 Generated with Claude Code