fix: gate Mx 9 microflow roundtrip keys by project version#261
fix: gate Mx 9 microflow roundtrip keys by project version#261ako merged 2 commits intomendixlabs:mainfrom
Conversation
Code Review — fix: gate Mx 9 microflow roundtrip keys by project versionOverviewThis PR version-gates several BSON fields and structural shapes that differ between Mendix 9 and Mendix 10+, preventing Studio Pro metamodel errors when mxcli writes to Mx 9 projects. The version is read via Blocker: no tests in the diffThe test plan states:
The diff modifies only Description inaccuracyThe summary mentions gating Code observations
Value/pointer duplication in Mx 9 VerdictThe version-gating logic looks architecturally correct and the
|
Mendix 9 microflows reject ReturnVariableName/StableId/Url/UrlSearchParameters, DefaultValue/IsRequired on parameters, and require NewCaseValue plus Origin/DestinationBezierVector on sequence flows. Detect the project's major version and emit the matching key set; always include Documentation on ExclusiveSplit and ReturnValue on EndEvent so pristine BSON key sets match after roundtrip. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
dc52a21 to
33f385e
Compare
- Replace hardcoded `majorVersion := 11` with `version.DefaultVersion().MajorVersion` so the fallback stays in sync with the project default. - Normalise value-receiver case values in `buildSequenceFlowCase` so EnumerationCase/NoCase are each handled once (pointer promotion before the main switch). - Add `writer_microflow_version_test.go` regression tests exercising Mx 9 vs Mx 10 serialization shapes for SequenceFlow, AnnotationFlow and MicroflowParameter. - Add `mdl-examples/bug-tests/261-mx9-microflow-roundtrip.mdl` reproducer per CLAUDE.md checklist.
|
Thanks @ako — addressed in 33f385e:
On the two remaining notes:
|
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove. The PR is well-implemented, thoroughly tested, and resolves the reported Mx 9 microflow roundtrip issue without introducing regressions. The fix follows established patterns in the codebase for version-dependent BSON serialization. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
33f385e to
971dc43
Compare
- Replace hardcoded `majorVersion := 11` with `version.DefaultVersion().MajorVersion` so the fallback stays in sync with the project default. - Normalise value-receiver case values in `buildSequenceFlowCase` so EnumerationCase/NoCase are each handled once (pointer promotion before the main switch). - Add `writer_microflow_version_test.go` regression tests exercising Mx 9 vs Mx 10 serialization shapes for SequenceFlow, AnnotationFlow and MicroflowParameter. - Add `mdl-examples/bug-tests/261-mx9-microflow-roundtrip.mdl` reproducer per CLAUDE.md checklist.
Summary
Mendix 9 microflows reject several BSON keys that only exist on Mx 10+:
ReturnVariableName,StableId,Url,UrlSearchParametersMicroflows$MicroflowParameter:DefaultValue,IsRequiredSequenceFlow: the modernCaseValuesarray + nestedLine: Microflows$BezierCurvedocumentAnnotationFlow: the same modernLinenestingMendix 9 projects instead expect the legacy shape:
NewCaseValueinstead ofCaseValuesOriginBezierVector/DestinationBezierVectorinstead ofLineDefaultValue/IsRequiredon parametersReturnVariableName/StableId/Url/UrlSearchParameterson the microflowFix reads the major version from the reader (
w.reader.ProjectVersion().MajorVersion, falling back toversion.DefaultVersion().MajorVersionwhen no MPR is attached) and emits the matching key set. Mx 10/11 round-trips are unchanged; Mx 9 round-trips no longer trip the Studio Pro metamodel checker.Part of umbrella #257.
Test plan
sdk/mpr/writer_microflow_version_test.goassert Mx 9 emits legacy shape (NewCaseValue, top-level BezierVectors, no DefaultValue/IsRequired) and Mx 10 emits modern shape (CaseValues, Line, DefaultValue/IsRequired present).mdl-examples/bug-tests/261-mx9-microflow-roundtrip.mdl.go build ./... && go test ./...pass.