Skip to content

feat(microflows): expose the Commit flag on create/change activities (#779) — recovered from #67 - #71

Merged
ako merged 3 commits into
mainfrom
claude/commit-flag-779-recover
Aug 1, 2026
Merged

feat(microflows): expose the Commit flag on create/change activities (#779) — recovered from #67#71
ako merged 3 commits into
mainfrom
claude/commit-flag-779-recover

Conversation

@ako

@ako ako commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Fixes mendixlabs#779. Re-opens the content of #67, whose commits never reached main.

Why this PR exists

#67 was stacked on #66 (claude/microflow-mandatory-semicolons). #66 merged into main at 00:34:26; #67 merged into claude/microflow-mandatory-semicolons 17 seconds later, at 00:34:43. Its base branch had already been merged, so the three commits landed on a branch that was no longer going anywhere — main never received them.

GitHub retargets a stacked child PR to main only when the base branch is deleted. The base still existed, so #67 kept pointing at it and merged there. Verified before opening this:

4ba3cbc  on main: NO   on semicolons-branch: yes
8704b58  on main: NO   on semicolons-branch: yes
34a93ed  on main: NO   on semicolons-branch: yes

The three commits are cherry-picked onto current main here, unchanged in content. Worth deleting claude/microflow-mandatory-semicolons once this lands, so the stranded copies can't be picked up again.

What it does

mendixlabs#779 asks for the Commit flag to be visible in DESCRIBE MICROFLOW. The larger half is that MDL had no syntax for it and the builder hardcoded it:

mdl/executor/cmd_microflows_builder_actions.go:95   Commit: microflows.CommitTypeNo,
mdl/executor/cmd_microflows_builder_actions.go:241  Commit: microflows.CommitTypeNo,

So every create/change mxcli authored was written as Commit: No regardless of intent, and a describe → edit → re-exec round-trip silently converted committing activities into non-committing ones — the object-orphaning failure mode the reporter describes chasing in Studio Pro.

68f290aCommitType declared "YesWithEvents" and "NoEvent", neither of which exists in the Mendix metamodel; the canonical set is Yes / YesWithoutEvents / No. The giveaway was mdl/backend/mcp translating CommitTypeNoEvent into "YesWithoutEvents" to stay correct. A test now pins the set against the generated CommitEnum in both directions.

d55832d — the syntax, following the existing refresh modifier:

$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;  -- YesWithoutEvents
change $Order (Status = 'Paid') commit refresh;

The default stays unwritten, so existing scripts are unaffected. Two tests pin the ambiguity against the standalone commit $Var activity — mandatory semicolons (#66, already on main) are what make that decidable.

50515be — DESCRIBE emission. TestFormatAction_CommitRoundTrips formats each value, re-parses the emitted MDL, and requires the flag back identical, which is mendixlabs#779's second acceptance criterion.

Verification on current main

Parser regenerated, full Go suite green, example corpus at 236 / 39 — one more passing file than before, which is this PR's 779-commit-flag.mdl.

🤖 Generated with Claude Code

https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA


Generated by Claude Code

claude added 3 commits August 1, 2026 04:53
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
ako merged commit efa3de4 into main Aug 1, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Expose Commit flag on CREATE/CHANGE activities in DESCRIBE MICROFLOW

2 participants