Skip to content

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

Merged
ako merged 3 commits into
claude/microflow-mandatory-semicolonsfrom
claude/microflow-commit-flag-779
Aug 1, 2026
Merged

feat(microflows): expose the Commit flag on create/change activities (#779)#67
ako merged 3 commits into
claude/microflow-mandatory-semicolonsfrom
claude/microflow-commit-flag-779

Conversation

@ako

@ako ako commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Fixes mendixlabs#779.

Stacked on #66 — base is claude/microflow-mandatory-semicolons, not main. Merge #66 first; this will then retarget to main on its own. The dependency is real: mandatory statement semicolons are what make the commit modifier unambiguous against the standalone commit $Var activity.

The issue asks for a display feature. The actual defect is a write bug.

mendixlabs#779 reports that DESCRIBE MICROFLOW cannot 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:

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

Every create/change mxcli authored was written as Commit: No regardless 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. CommitType declared "YesWithEvents" and "NoEvent", neither of which exists in the metamodel; the canonical set is Yes / 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 was mdl/backend/mcp, whose mfCommitType had to translate CommitTypeNoEvent into "YesWithoutEvents", mapping a constant named "no events" onto "yes, without events". A new test pins the set against the generated CommitEnum in both directions.

8704b58 — the syntax. Follows the existing refresh modifier on change:

$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 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 is commit [without events] then refresh, 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

  • Parse: all three values on create and change, with and without member lists, with on error, with refresh, and refresh alone.
  • Ambiguity guards — a create followed by commit $O; must yield two statements with the create flagged No; a create carrying the modifier and followed by a commit activity must keep both.
  • Round-trip (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.mdl covering 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.md create/change rows, write-microflows.md CREATE and CHANGE sections, and the microflow.object-operations syntax topic. Each spells out that commit on create/change is a modifier, not the standalone commit $Var; activity — the thing most likely to be confused.

🤖 Generated with Claude Code

https://claude.ai/code/session_012XR649rKk68z6gBpngu6MA


Generated by Claude Code

claude added 3 commits July 31, 2026 14:22
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 661c5c0 into claude/microflow-mandatory-semicolons Aug 1, 2026
3 checks passed
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
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.

2 participants