Skip to content

check --references ignores alter page … add parameters earlier in the same script, so a show page passing the new parameter is refused #1736

Closed

Description

@dimenus

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.

Steps to reproduce:

mdl 1;
alter page Main."District_Edit_ConfirmVersion" {
  add parameters $Extra: Main."DistrictVersionChoice";
};
create microflow Main."ZZ_OpenConfirm" (
  $District: InventoryApi."District",
  $VersionChoice: Main."DistrictVersionChoice"
)
begin
  show page Main."District_Edit_ConfirmVersion"("District" = $District, "VersionChoice" = $VersionChoice, "Extra" = $VersionChoice);
  return;
end;
$ 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

  1. added a commit that references this issue on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions