fix: place a merge, a lane and the next statement where the measurer says - #1159
Closed
tgolembiewski wants to merge 1 commit into
Closed
tgolembiewski wants to merge 1 commit into
tgolembiewski wants to merge 1 commit into
Conversation
…says Three fixed-size disagreements between what measureStatements predicts and where the builder puts things. Every merge, every following statement and every branch lane is positioned from the first and drawn by the second, so a few pixels of disagreement is an overlap rather than a cosmetic difference. Measured on mdl-examples/doctype-tests/02c-complex-layout-examples.mdl: 15 overlapping pairs in 3 of its 6 flows, down to none. mx check reports 0 errors either way, which is why none of this was visible to anything automatic. - A split was measured to its branch rather than to the merge that closes it - 25px short of what a following element has to clear. splitWidthWithMerge now measures from the split's left edge to the merge's right edge. - The advance past a merge came from its centre by what an activity's half width needs: half a pitch is 80px and a merge is 40 wide against an activity's 120, so the next element's left edge landed on the merge's right edge. The enum split's own merge and `merge <label>` now clear the merge first and then leave the ordinary gap, which is what addIfStatement has always done. - A branch lane was placed half the branch's measured HEIGHT below the line, which is only right for content centred on that line. A branch holding a nested IF hangs entirely below its own: measured 160 tall it occupies 30 above and 130 below, so the lane landed 50px inside it. The branch above is already built when the next lane is placed, so lowestBetween measures it instead - the same move separateRows already makes for wrapped rows. Its range is bounded at both ends, because a split's shared merge is appended among its branches. Two tests hold the invariant rather than the pixel values: one asks the measurer and the builder the same question about the same run and compares them, the other asserts directly that no two elements of a built flow overlap, over eight shapes. Each fix was reverted in turn to confirm they fail with the reported symptom. TestEnumSplitGeometryIsUnchanged pinned the advance these fixes change; it is now TestEnumSplitAdvanceClearsItsMerge and pins the gap, with the reason in its comment. Its other half - that the merge does not drift with branch count - is unchanged. Closes mendixlabs#1158 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AI Code ReviewCritical Issues
Moderate Issues
Minor Issues
What Looks Good
RecommendationApprove the PR. The changes are correct, well-tested, and ready for merge. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
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 #1158
What
Three fixed-size disagreements between what
measureStatementspredicts and where the builder places things. Every merge, every following statement and every branch lane is positioned from the first and drawn by the second, so a few pixels of disagreement is an overlap. Geometry only — no MDL syntax, no execution semantics,@positionstill never moved.Measured on
mdl-examples/doctype-tests/02c-complex-layout-examples.mdl(exec, then read the coordinates back withdescribe):merge rejoin2inCX_SYNC_FactoryTelemetry(850,200), next activity(930,200)— edges on the same linecasebranch inCX_ACT_HandleAuthCodeset $Success(2855,200)covering the merge at(2885,200)CX_SYNC_FactoryTelemetrymx check0 errors before and after.The three fixes:
splitWidthWithMerge, from the split's left edge to the merge's right edge. The old measure was 25 px short of what a following element has to clear.MergeSize= 40 against an activity's 120. Thecasestatement's own merge andmerge <label>now usemergeX + MergeSize + HorizontalSpacing/2, which is whataddIfStatementhas always used.ifhangs entirely below its own — measured 160 tall, it occupies 30 above and 130 below. The branch above is already built when the next lane is placed, solowestBetweenmeasures it, the same moveseparateRowsalready makes for wrapped rows. Its range is bounded at both ends because a split's shared merge is appended among its branches.All three predate #1155; they were covered by slack in the spacing that #1155 removed.
Tests
TestMeasuredWidthMatchesWhatIsBuilt— asks the measurer and the builder the same question about the same run and compares. A short measure overlaps the next element; a generous one wastes canvas.TestBuiltElementsDoNotOverlap— the invariant itself, over eight shapes taken from the example file.TestEnumSplitGeometryIsUnchangedpinned the advance that fix 2 changes. It is nowTestEnumSplitAdvanceClearsItsMergeand pins the gap instead, with the reason in its comment; its other half, that the merge does not drift with branch count, is unchanged.make build,make test,make lint-go,make check-mdl,make check-findings,make check-wiki-pages,scripts/check-tunnel-deps.sh,scripts/check-skill-mdl.sh(skills and docs-site),govulncheckandmake test-integrationagainst a realmx11.12.1 all pass locally.Note, not part of this PR
describe→execofCX_SYNC_FactoryTelemetrydoes not round-trip: the shared tail aftermerge shared4is printed twice, labels are renumbered, and the re-executed model failsmx checkwith[error] [CE0773] "Value must be of type Boolean." at Sequence flow. Identical on the v0.23.0 release binary, so it is not from the layout work — the three remainingdescribeoverlap reports on that flow are this duplicate print, one activity at one position, not two elements.