Skip to content

fix: a column ELSE is measured once, so a decision chain describes in linear time - #2712

Merged
ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv
Nov 30, 2026
Merged

ako merged 1 commit into
mainfrom
claude/issue-triage-prioritization-24rqgv

Conversation

@ako

@ako ako commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Closes #2704 (upstream mendixlabs#1989)

What was wrong

With flows: preset: true-right-false-down, describe microflow took time that doubled with every nested decision. A chain of 58 if … then return …; else if … never finished, and describe module --all stopped at the first such flow.

MXCLI_CPUPROFILE on a 20-deep chain put 86% of the time under layoutMeasurer.measureIf → measureColumn. Under IfElseColumn, measureIf measured the ELSE body twice:

  • once with measureBranch, a result the column measurement then replaced;
  • once with measureColumn.

Both recurse into the nested IF, so a chain of N cost 2^N. The default style measures it once, which is why it stayed at 0.3 s.

Fix

mdl/executor/layout.go: the ELSE body is measured once, as a column under IfElseColumn and as a branch otherwise. The widths and heights computed are the same as before.

Measured (scratch TestApp copy, the issue's chain shape)

decisions before after
20 3.1 s 0.37 s
58 did not finish 0.25 s

describe output is byte-identical, old build vs new, on three of the flows.

Tests

  • TestMeasureColumnElseChainIsLinear_2704 measures a 40-decision chain under a 5 s deadline. 2^40 cannot finish in that time; a linear measurement takes microseconds, so there is no timing flake.
  • The default style is the control.
  • Revert proof: it times out without the fix.
  • make ci-local passed. The first run ran out of disk; I cleaned up leftover test temp dirs and re-ran.

#2705 (a Studio Pro-drawn 57-decision flow that hangs) is not closed here. Its reporter says the same chain created by mxcli describes in 0.4 s, which points away from the preset. It needs their flow or confirmation of the config.


Generated by Claude Code

… linear time

Under IfElseColumn (preset true-right-false-down), measureIf measured the
ELSE body as a branch, discarded that, and measured it again as a column.
Each nested IF did both, so a chain of N decisions cost 2^N: 20 took 3s and
58 never finished, describe module --all included. The ELSE body is now
measured once, the way the style draws it; describe output is unchanged.

Closes #2704

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011oK82qrr1WnXxq1eRn7qRJ
@ako
ako merged commit b9d2d47 into main Nov 30, 2026
19 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.

[up#1989] describe is exponential in nested decisions with a layout-config preset

2 participants