feat(microflows): expose the Commit flag on create/change activities (#779) - #67
Merged
ako merged 3 commits intoAug 1, 2026
Conversation
CommitType declared two values that do not exist in the Mendix metamodel: "YesWithEvents" and "NoEvent". The canonical set is Yes / YesWithoutEvents / No (modelsdk/gen/microflows CommitEnum, generated from Mendix reflection data, and docs/05-mdl-specification/10-bson-mapping.md). Nothing crashed, because the read path passes the stored string through untouched — but the named constants matched nothing in a real project, so any code switching on them fell through to its default. The giveaway was mdl/backend/mcp, whose mfCommitType had to translate CommitTypeNoEvent into "YesWithoutEvents" to produce a correct PED value, mapping a constant named "no events" onto "yes, without events". Replaces the set with the canonical three and simplifies mfCommitType, which no longer needs the translation. A new test pins CommitType against the generated CommitEnum in both directions, so neither a missing value nor an invented one can drift back in. Groundwork for mendixlabs#779 (exposing the flag in DESCRIBE MICROFLOW), which needs a trustworthy value set to render. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA
…mendixlabs#779) MDL had no syntax for the Commit setting, and the builder hardcoded CommitTypeNo at both call sites. Every create/change authored through MDL was therefore written as Commit: No regardless of intent — and a describe → edit → re-exec round-trip silently turned committing activities into non-committing ones. That is a data-fidelity bug, not just a missing feature: it is exactly the object-orphaning failure mode mendixlabs#779 reports chasing in Studio Pro. Syntax follows the existing `refresh` modifier on change, spelling all three values of Mendix's Microflows$Commit enum: $Order = create Sales.Order (Number = 'X'); -- No (default) $Order = create Sales.Order (Number = 'X') commit; -- Yes $Order = create Sales.Order (Number = 'X') commit without events; change $Order (Status = 'Paid') commit refresh; The default stays unwritten, so existing scripts are unaffected and turning the flag on is a one-word diff. `COMMIT` both modifies a create/change and starts a standalone commit activity, so the two could be confused. Mandatory statement semicolons make it decidable: the modifier cannot absorb a following `commit $Var` across a terminator. Two tests pin that specifically — a create followed by a commit activity, and a create carrying the modifier AND followed by one. Wired grammar → AST (CommitFlag) → visitor (buildCommitClause) → builder (commitTypeOf). DESCRIBE emission is the next commit; until then the flag is authorable and persisted but not yet rendered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA
…abs#779) The reported symptom: DESCRIBE rendered a create/change activity with Commit enabled identically to one without, so transaction boundaries were invisible to automated analysis, linting and impact tooling — and confirming them meant opening Studio Pro activity by activity. The value was already read (both engines populate CreateObjectAction.Commit and ChangeObjectAction.Commit); the formatter simply never looked at it. It now renders the modifier introduced in the previous commit, omitting it for Mendix's default (No) so existing describe output is unchanged for the common case. Canonical order on change is `commit [without events]` then `refresh`, matching the grammar, so re-executing the output rebuilds the same activity. Round-trip is asserted rather than assumed: TestFormatAction_CommitRoundTrips formats each of the three values, re-parses the emitted MDL through the visitor, and requires the flag to come back identical — which is mendixlabs#779's second acceptance criterion. A formatter emitting syntax the grammar cannot read would be worse than not emitting it at all. Adds mdl-examples/doctype-tests/779-commit-flag.mdl covering all three values on both create and change, with and without member lists, and the modifier sitting next to a standalone COMMIT activity. Docs: MDL_QUICK_REFERENCE.md create/change rows, write-microflows.md CREATE and CHANGE sections, and the `microflow.object-operations` syntax topic — each distinguishing the modifier from the standalone COMMIT activity, which is the easy thing to confuse. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA
ako
added a commit
that referenced
this pull request
Aug 1, 2026
feat(microflows): expose the Commit flag on create/change activities (mendixlabs#779) — recovered from #67
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#779.
The issue asks for a display feature. The actual defect is a write bug.
mendixlabs#779 reports that
DESCRIBE MICROFLOWcannot distinguish a create/change with Commit enabled from one without. True — but the more serious half is that MDL had no syntax for the flag and the builder hardcoded it:Every create/change mxcli authored was written as
Commit: Noregardless of intent, so a describe → edit → re-exec round-trip silently converted committing activities into non-committing ones. That is the object-orphaning failure mode the reporter describes chasing in Studio Pro — this may explain their original bug, not merely help them find the next one.Three commits
4ba3cbc— declare the Commit values Mendix actually defines.CommitTypedeclared"YesWithEvents"and"NoEvent", neither of which exists in the metamodel; the canonical set isYes/YesWithoutEvents/No. Nothing crashed, because the read path passes the stored string through untouched — but the named constants matched nothing in a real project, so code switching on them fell through to its default. The giveaway wasmdl/backend/mcp, whosemfCommitTypehad to translateCommitTypeNoEventinto"YesWithoutEvents", mapping a constant named "no events" onto "yes, without events". A new test pins the set against the generatedCommitEnumin both directions.8704b58— the syntax. Follows the existingrefreshmodifier on change:The default stays unwritten, so existing scripts are unaffected and enabling the flag is a one-word diff. Wired grammar → AST (
CommitFlag) → visitor (buildCommitClause) → builder (commitTypeOf).34a93ed— DESCRIBE emission. The value was already read by both engines; the formatter simply never looked at it. Canonical order on change iscommit [without events]thenrefresh, matching the grammar.Ordering note
I did grammar before DESCRIBE rather than the other way round. Emitting a modifier the parser could not read would have left describe output unparseable in between — a worse regression than the bug being fixed.
Tests
on error, withrefresh, andrefreshalone.commit $O;must yield two statements with the create flaggedNo; a create carrying the modifier and followed by a commit activity must keep both.TestFormatAction_CommitRoundTrips) — formats each value, re-parses the emitted MDL through the visitor, requires the flag back identical. This is Feature Request: Expose Commit flag on CREATE/CHANGE activities in DESCRIBE MICROFLOW mendixlabs/mxcli#779's second acceptance criterion, asserted rather than assumed.mdl-examples/doctype-tests/779-commit-flag.mdlcovering every variant plus the modifier sitting next to a standalone COMMIT activity.Full suite green. Corpus at 235 / 39 — the +1 over baseline is the new example file.
Docs
MDL_QUICK_REFERENCE.mdcreate/change rows,write-microflows.mdCREATE and CHANGE sections, and themicroflow.object-operationssyntax topic. Each spells out thatcommiton create/change is a modifier, not the standalonecommit $Var;activity — the thing most likely to be confused.🤖 Generated with Claude Code
https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA
Generated by Claude Code