Skip to content

Commit 4cd9d06

Browse files
hjothamendixclaude
andcommitted
test: add bug-test reproducer for compact reverse-association retrieve
Adds an MDL script under mdl-examples/bug-tests/ exercising a retrieve sourced through `from $Var/Module.Association`. After exec, the describe output must keep the compact form and `mx check` must report 0 errors. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 9481789 commit 4cd9d06

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
-- ============================================================================
2+
-- Bug #352 (part): Compact reverse-association retrieve formatter
3+
-- ============================================================================
4+
--
5+
-- Symptom (before fix):
6+
-- Some Mendix models store a compact association retrieve as a
7+
-- `DatabaseRetrieveSource` with a single XPath predicate of the form
8+
-- [Module.Association = $Variable]
9+
-- and `Range = All`. When described, the formatter emitted the verbose
10+
-- shape
11+
-- retrieve $Domains from Module.Domain
12+
-- where Module.Domain_Runtime = $Runtime;
13+
-- On `mxcli exec`, that verbose shape is rebuilt as XPath. Studio Pro
14+
-- then accepts it but `describe → exec → describe` is no longer a
15+
-- fixpoint, and tooling that expects the compact form sees drift.
16+
--
17+
-- After fix:
18+
-- When the source is a database retrieve over a single equality
19+
-- predicate against a known association whose other side matches the
20+
-- start variable's type, and `Range = All`, the formatter emits the
21+
-- compact form `retrieve $Out from $Var/Module.Association`.
22+
--
23+
-- Usage:
24+
-- mxcli exec mdl-examples/bug-tests/352-retrieve-compact-reverse-association.mdl -p app.mpr
25+
-- mxcli -p app.mpr -c "describe microflow BugTest352a.MF_FetchDomains"
26+
-- The describe output must use the compact `from $Runtime/Mod.Assoc`
27+
-- form, and `mx check` must report 0 errors.
28+
-- ============================================================================
29+
30+
create module BugTest352a;
31+
32+
create entity BugTest352a.Runtime (
33+
Name : string(100)
34+
);
35+
/
36+
37+
create entity BugTest352a.Domain (
38+
Name : string(100)
39+
);
40+
/
41+
42+
create association BugTest352a.Domain_Runtime
43+
from BugTest352a.Domain
44+
to BugTest352a.Runtime;
45+
/
46+
47+
-- Compact reverse-association retrieve. Describe → exec → describe must
48+
-- preserve the `from $Runtime/BugTest352a.Domain_Runtime` shape.
49+
create microflow BugTest352a.MF_FetchDomains (
50+
$Runtime: BugTest352a.Runtime
51+
)
52+
returns list of BugTest352a.Domain as $Domains
53+
begin
54+
retrieve $Domains from $Runtime/BugTest352a.Domain_Runtime;
55+
end;
56+
/

0 commit comments

Comments
 (0)