fix: preserve manual while-true loop roundtrips#354
Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Open
fix: preserve manual while-true loop roundtrips#354hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Conversation
Symptom: MDL that represents an unbounded retry-style while true loop with a continue could be rebuilt as a LoopedActivity or could fall through into a synthetic EndEvent, changing the model shape and sometimes producing invalid control flow. Root cause: the flow builder parsed while/break/continue syntax but did not build BreakEvent or ContinueEvent objects, and it treated continue as a normal fallthrough statement instead of a terminal branch or manual back-edge. Fix: add builder support for break/continue events, detect while true bodies that should be represented as a manual ExclusiveMerge back-edge, route continue to that merge, and mark terminal manual loops as already ending the flow. Tests: add synthetic builder regressions for break/continue terminal detection, normal loop break/continue events, manual while true back-edge reconstruction, and avoiding a fallthrough EndEvent for terminal manual loops.
34 tasks
AI Code ReviewCritical IssuesNone found. Moderate Issues
Minor IssuesNone found. What Looks Good
RecommendationRequest changes to add an MDL test script in The core fix is technically sound and ready aside from the missing bug test artifact. Adding a simple test like: would sufficiently validate the fix in Studio Pro. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Adds an MDL script under mdl-examples/bug-tests/ exercising a manual `while true` retry loop with `continue` and a terminal `return` inside an IF. After exec, `mx check` reports 0 errors and the rebuild does not produce a `LoopedActivity` or a synthetic fallthrough EndEvent. Addresses moderate review feedback on PR mendixlabs#354 requesting an MDL test artifact. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Closes #350.
Part of #332.
Summary
This extracts the manual
while trueloop preservation from the audit staging branch into a focused fix.The builder already accepted
while,break, andcontinuesyntax, but it did not materialize break/continue events and it treatedcontinueas a normal fallthrough path. For retry-stylewhile trueloops this could rebuild the flow as aLoopedActivityor synthesize an invalid fallthroughEndEvent.Changes
BreakEventandContinueEventobjects for parsed break/continue statements.while truebodies that need a graph-level back-edge and build them as anExclusiveMergeloop header.continueinside that manual loop back to the merge instead of emitting a standaloneContinueEvent.Validation
make buildmake lint-gomake test