|
| 1 | +-- ============================================================================ |
| 2 | +-- Bug #373: Writer emitted invalid ChangeActionItem list markers |
| 3 | +-- ============================================================================ |
| 4 | +-- |
| 5 | +-- Symptom (before fix): |
| 6 | +-- The microflow BSON writer serialized `CreateChangeAction.Items` and |
| 7 | +-- `ChangeAction.Items` arrays with the COUNT of member changes as the |
| 8 | +-- first BSON array element. Mendix storage lists use a constant |
| 9 | +-- storage-list MARKER there. For ChangeActionItem lists this marker is |
| 10 | +-- `2`, independent of how many items the list contains. Writing the |
| 11 | +-- item count produced unstable microflow BSON for create/change object |
| 12 | +-- actions and could lead to invalid action payloads when Studio Pro |
| 13 | +-- re-loaded the model. |
| 14 | +-- |
| 15 | +-- Additionally, `ChangeAction` was missing its default |
| 16 | +-- `ErrorHandlingType: Rollback` field, so the written shape did not |
| 17 | +-- match the expected action payload. |
| 18 | +-- |
| 19 | +-- After fix: |
| 20 | +-- - Writer emits `bson.A{int32(2)}` for both CreateChangeAction.Items |
| 21 | +-- and ChangeAction.Items. |
| 22 | +-- - Writer emits the default `ErrorHandlingType: Rollback` for |
| 23 | +-- ChangeAction. |
| 24 | +-- |
| 25 | +-- Usage: |
| 26 | +-- mxcli exec mdl-examples/bug-tests/373-change-action-items-storage-list.mdl -p app.mpr |
| 27 | +-- mxcli -p app.mpr -c "describe microflow BugTest373.MF_CreateAndChange" |
| 28 | +-- `mx check` against the resulting MPR must report 0 errors. |
| 29 | +-- ============================================================================ |
| 30 | + |
| 31 | +create module BugTest373; |
| 32 | + |
| 33 | +create entity BugTest373.Order ( |
| 34 | + Name : string(100), |
| 35 | + Status : string(50) |
| 36 | +); |
| 37 | +/ |
| 38 | + |
| 39 | +-- Create-with-members and change-with-members both exercise the |
| 40 | +-- ChangeActionItem storage list. After exec, the MPR must load cleanly |
| 41 | +-- in Studio Pro (`mx check` reports 0 errors). |
| 42 | +create microflow BugTest373.MF_CreateAndChange ( |
| 43 | + $Name: string |
| 44 | +) |
| 45 | +returns BugTest373.Order as $Order |
| 46 | +begin |
| 47 | + $Order = create BugTest373.Order (Name = $Name); |
| 48 | + change $Order (Status = 'Processed'); |
| 49 | +end; |
| 50 | +/ |
0 commit comments