{{ message }}
fix: resolve page context tree for ALTER PAGE and check --references#158
Merged
ako merged 1 commit intomendixlabs:mainfrom Apr 9, 2026
Merged
fix: resolve page context tree for ALTER PAGE and check --references#158ako merged 1 commit intomendixlabs:mainfrom
ako merged 1 commit intomendixlabs:mainfrom
Conversation
…endixlabs#122, mendixlabs#157) ALTER PAGE REPLACE/INSERT operations failed when widgets referenced page parameters (DataSource: $Param) or sibling widgets (DataSource: SELECTION widget) because buildWidgetsBson created an empty pageBuilder context. Now extractPageParamsFromBSON and extractWidgetScopeFromBSON pre-populate the builder's paramScope and widgetScope from the raw page BSON. Also adds validatePageContextTree to mxcli check --references, catching: - PARAMETER DataSource refs to undeclared page params - SELECTION DataSource refs to nonexistent widget names - Attribute bindings outside any data container context
ako
approved these changes
Apr 9, 2026
Collaborator
ako
left a comment
There was a problem hiding this comment.
Clean fix with clear root cause. Two well-separated parts:
-
ALTER PAGE context resolution: Extracts param scope and widget scope from existing page BSON before building new widgets. The BSON walker correctly handles page/snippet formats and nested containers (LayoutGrid, TabPages, CustomWidget properties, FooterWidgets).
-
check --references validation:
validatePageContextTreeis a clean AST-only pass — no MPR needed. Catches undeclared parameter refs, nonexistent selection refs, and attribute bindings without data container context.
Good test coverage (14 tests) including nil/edge cases.
LGTM.
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.

Summary
DataSource: $Param) or sibling widgets (DataSource: SELECTION widget) becausebuildWidgetsBsoncreated apageBuilderwith emptyparamScopeandwidgetScopemxcli check --referenceshad no validation for page-internal context consistency (parameter refs, selection refs, attribute bindings without data container)Changes
buildWidgetsBsonnow accepts the raw page BSON and pre-populates context viaextractPageParamsFromBSON(page params →paramScope/paramEntityNames) andextractWidgetScopeFromBSON(widget tree →widgetScope)validatePageContextTreeinmxcli check --referencescatches:Addresses #122, #157 (§1 ALTER PAGE REPLACE param resolution, §2 ALTER PAGE INSERT SELECTION resolution)
Test plan
extractPageParamsFromBSON,extractWidgetScopeFromBSON)validatePageContextTree)mxcli check --referencesverified with valid and invalid MDL scripts against baseline project