You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
check --references ignores alter page … add parameters earlier in the same script, so a show page passing the new parameter is refused #1736
Environment: mxcli v0.30.0-47-g6094f471f (built from 6094f471f, the current main), Mendix 11.16.1 project (MPR v2), macOS.
Summary: In one script, alter page … { add parameters $X: … } followed by a show page that passes X is refused by check --references and by exec ("page … has no parameter "X""). The same two statements pass when run as two separate scripts. So the check reads the page as stored before the script, not as the script leaves it.
$ mxcli check addparam.mdl -p InventoryAdmin.mpr --references
Reference errors:
statement 2: microflow 'Main.ZZ_OpenConfirm' has reference errors:
- page Main.District_Edit_ConfirmVersion has no parameter "Extra" (declared parameters: District, VersionChoice). Mendix build fails CE1613 "The selected page parameter … no longer exists".
✗ 1 reference error(s) found
$ mxcli exec addparam.mdl -p InventoryAdmin.mpr
Refusing to execute: 1 unresolved reference(s) above. Nothing was written.
Split into two files and run one after the other, the same statements succeed:
$ mxcli exec a.mdl -p InventoryAdmin.mpr # the alter page
Altered page Main.District_Edit_ConfirmVersion
$ mxcli exec b.mdl -p InventoryAdmin.mpr # the create microflow
Created microflow: Main.ZZ_OpenConfirm
Expected behavior: A parameter added by alter page … add parameters earlier in the script counts as declared for later show page arguments. A drop parameters earlier in the script likewise removes the name. The real case is the common one: add a parameter to a page and update the flow that opens it, in one script.
Actual behavior: The script is refused. The only ways through are splitting the script or --no-check. --no-check also turns off the checks that would catch a real mistake.
Root cause:
validateShowPageParams (mdl/executor/validate_show_page_params.go:18) looks first in sc.pageParamNames, then in buildPageParamNames, which is built from the stored pages.
sc.pageParamNames is filled only by recordPageParamNames, which is called only from the *ast.CreatePageStmtV3 case (mdl/executor/validate.go:333).
Nothing records *ast.AddParameterOp (mdl/ast/ast_alter_page.go:202) or the drop operation from an AlterPageStmt. So for an altered page the lookup falls through to the stored parameter list.
Suggested fix: In the same pre-pass, handle AlterPageStmt. Seed sc.pageParamNames[page] from the stored list (or from an earlier create page in the script). Then apply each AddParameterOp and drop-parameter operation in order. Snippets have the same shape, if alter snippet allows add parameters. A test with both statements in one script would cover it.
Activity
Merge pull request mendixlabs#1736 from ako/fix/1683-templates-java-a…