Skip to content

Commit e9a84f1

Browse files
hjothamendixclaude
andcommitted
test: add bug-test reproducer for nearest split-merge pairing fix
Adds an MDL script under mdl-examples/bug-tests/ exercising sequential if-without-else blocks. The describe → exec → describe fixpoint confirms the first split is paired with its nearest merge, keeping the ifs as siblings rather than nesting the continuation inside the first if's body. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 8b6845f commit e9a84f1

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
-- ============================================================================
2+
-- Bug #326: Describer paired splits with downstream merge instead of nearest
3+
-- ============================================================================
4+
--
5+
-- Symptom (before fix):
6+
-- When a microflow had two sequential `if ... end if;` blocks, the
7+
-- describer could pair the FIRST split with the SECOND merge, nesting
8+
-- the continuation between the two ifs (and even the second if) inside
9+
-- the first if's body. A describe → exec → describe cycle then mutated
10+
-- the structure even though the original graph was valid:
11+
-- -- before fix, after first describe:
12+
-- if $Logo != empty then
13+
-- log info node 'App' 'logo';
14+
-- log info node 'App' 'after logo'; -- wrong: was outside first if
15+
-- if $Cover != empty then -- wrong: was sibling, not nested
16+
-- log info node 'App' 'cover';
17+
-- end if;
18+
-- end if;
19+
--
20+
-- Root cause:
21+
-- Split/merge pairing picked any common downstream merge reachable from
22+
-- both branches, not the nearest one. Error-handler flows were included
23+
-- in the search, biasing it further.
24+
--
25+
-- After fix:
26+
-- `findMergeForSplit` now uses shortest-path distances per branch and
27+
-- selects the nearest common merge, ignoring error-handler flows for
28+
-- structural pairing.
29+
--
30+
-- Usage:
31+
-- mxcli exec mdl-examples/bug-tests/326-describer-pair-split-with-nearest-merge.mdl -p app.mpr
32+
-- mxcli -p app.mpr -c "describe microflow BugTest326.MF_SequentialIfs"
33+
-- The describe output must keep the two `if ... end if;` blocks as
34+
-- siblings (with the `log` between them at top level), and the
35+
-- describe → exec → describe cycle must be a fixpoint.
36+
-- ============================================================================
37+
38+
create module BugTest326;
39+
40+
create microflow BugTest326.MF_SequentialIfs (
41+
$Logo: string,
42+
$Cover: string
43+
)
44+
begin
45+
if $Logo != empty then
46+
log info node 'BugTest326' 'logo';
47+
end if;
48+
49+
log info node 'BugTest326' 'after logo';
50+
51+
if $Cover != empty then
52+
log info node 'BugTest326' 'cover';
53+
end if;
54+
end;
55+
/

0 commit comments

Comments
 (0)