Repository navigation
fix(pages): flow-argument mappings crash Studio Pro's Changes panel and bind the wrong slot (mendixlabs/mxcli#1317) - #1008
Merged
Merged
Conversation
Studio Pro writes Expression, Parameter and Variable on every Forms$MicroflowParameterMapping / Forms$NanoflowParameterMapping and nulls the unused slot. An Expression-bound argument left the gen Variable part unset, so the encoder omitted the key, and opening the change in Studio Pro's Changes panel threw "do not have the same properties. baseNames = Expression, Parameter, Variable; newNames = Parameter, Expression". Register Variable as a null field on both types, which covers the action, nanoflow action and nanoflow data-source writers alike. Refs mendixlabs#1317 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr
convertASTAction built its pageBuilder with no parameter or variable scope, so `set (Action: call microflow M.F(P = $P))` and a pluggable widget's named action slot wrote a page parameter as the Expression "$P" rather than binding it through Variable -> Forms$PageVariable (the mendixlabs#1140 form, which Studio Pro does not resolve). Seed it from the mutator as INSERT/REPLACE already do, including isSnippet. Refs mendixlabs#1317 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr
Regression MDL for mendixlabs#1317 and the finding: `mx diff` reproduces Studio Pro Changes-panel crashes headless. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr
…pet parameter buildWidgetsFromAST and buildColumnSpecsFromAST seeded the stored parameter scope but never isSnippet, so a button inserted into a snippet with `call microflow M.F(P = $P)` wrote Forms$PageVariable.PageParameter instead of SnippetParameter. mxbuild 11.12.2 reports CE0115 on that button only; CREATE SNIPPET and ALTER SNIPPET SET were already correct. Set isSnippet from the mutator's container type, as convertASTAction does. Refs mendixlabs#1317 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr
…labs#1317 snippet case The isSnippet fix also reaches buildColumnSpecsFromAST. Add a column with a flow button inserted into a grid inside a snippet. Measured on mxbuild 11.12.2: before, PageParameter and CE0115 at the button; after, SnippetParameter and 0 errors. Refs mendixlabs#1317 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr
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.
Fixes mendixlabs#1317.
Reported symptom
After
alter page LearningJourney.LearningJourney_Details { set ('onClickAction': call microflow LearningJourney.ACT_ExcludeItemStep(LearningJourney = $LearningJourney)) on pDSLink_ButtonAndTracking8 };on Studio Pro 11.12.2, opening the change in the Changes panel throws:Three defects (five commits)
Variablekey omitted on an Expression-bound argument (the crash). Studio Pro writesExpression,ParameterandVariableon everyForms$MicroflowParameterMapping/Forms$NanoflowParameterMapping, with the unused slot set to null. mxcli leftVariableunset, and the encoder drops an unset part. Because the stored$IDis carried onto the rewritten mapping, the merge library sees one element in two shapes. Same class as Studio Pro crashes when opening Changes details afterALTER ENTITY ... MODIFY ATTRIBUTEmendixlabs/mxcli#1180.Fix: register
Variableas aNullFieldsdefault on both types (mdl/backend/modelsdk/widget_write.go). This covers every writer: actions, nanoflow actions and nanoflow data sources.alter page … setbuilt the action with an empty parameter scope. So$LearningJourney, a page parameter, was stored as the Expression"$LearningJourney"instead ofVariable → Forms$PageVariable. That is the Page parameter not wired in nanoflow argument when button is inside a dataview bound to a different parameter CE1571 mendixlabs/mxcli#1140 form, which Studio Pro does not bind (CE1571).Fix:
convertASTActionseedsparamScope, page variables andisSnippetfrom the mutator, as insert/replace already did.alter snippet … insert/replacebound a snippet-parameter argument as a page parameter.buildWidgetsFromAST/buildColumnSpecsFromASTnever setisSnippet.Fix: set it from
mutator.ContainerType().Evidence
Tests written first:
widget_flow_param_null_variable_test.go: failed withmapping keys = Expression, Parameter.TestAlterPage_SetNamedAction_PageParamBindsThroughVariable: failed with kind"".TestAlterSnippet_InsertedFlowArgBindsSnippetParameter: failed with kind"parameter". Its page-container control passes both ways.Reverting fix 1 made its test fail again with the reported key set.
Real tool, mxbuild 11.12.2, buggy and fixed builds side by side:
mx diff base.mpr new.mpr out.mpr(same comparison code as the Changes panel)Objects with ID … of type Forms$MicroflowParameterMapping do not have the same properties. baseNames = Parameter, Expression, Variable; newNames = Parameter, Expressionbson dumpof the mappingExpression: "$LearningJourney", noVariableVariable: Forms$PageVariable{PageParameter: "LearningJourney"}; the literal argument carriesVariable: nullmx check[CE0115] … at Action button 'btnInsert'SnippetParametermx check[CE0115] … at Action button 'btnCol', bindingPageParameter: "Order"SnippetParameter: "Order"mx checkreports 0 errors for defects 1 and 2 on both builds, so a build does not catch either.Not verified
mx diffstands in for it. My baseline was written by the fixed build, which writes the same three-key shape as Studio Pro.Regression coverage
mdl-examples/bug-tests/1317-flow-arg-mapping-null-variable.mdlmdl-examples/bug-tests/1317-alter-snippet-insert-flow-arg.mdl: the inserted widget and the inserted grid column. The whole file runs on a fresh 11.12.2 project at 0 errors.mdl-backend.jsonlandmdl-executor.jsonl. The main point:mx diffreproduces Changes-panel crashes without Studio Pro.make build,make test,make lint,make check-mdlandmake check-findingsall pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01HamahFUo9MM2xuaNmm5mhr