|
| 1 | +-- ============================================================================ |
| 2 | +-- Bug #367: Retrieve sort items lost indirect entity references |
| 3 | +-- ============================================================================ |
| 4 | +-- |
| 5 | +-- Symptom (before fix): |
| 6 | +-- A retrieve source can sort by an attribute whose owning entity differs |
| 7 | +-- from the retrieved entity, as long as Studio Pro has an association |
| 8 | +-- path for that attribute. Example: retrieve DeploymentTarget sorted by |
| 9 | +-- ApplicationView.CreatedAt through DeploymentTarget_ApplicationView. |
| 10 | +-- The SDK shape only stored the final attribute reference, so parser/ |
| 11 | +-- writer roundtrip dropped the `DomainModels$IndirectEntityRef` steps, |
| 12 | +-- and the MDL builder rejected qualified sort attributes when the |
| 13 | +-- attribute entity differed from the retrieve entity. |
| 14 | +-- |
| 15 | +-- After fix: |
| 16 | +-- - Parser/writer now preserve `DomainModels$IndirectEntityRef` steps. |
| 17 | +-- - The MDL builder infers a one-hop association sort reference and |
| 18 | +-- emits the IndirectEntityRef path. Unrelated qualified attributes |
| 19 | +-- are still rejected. |
| 20 | +-- |
| 21 | +-- Usage: |
| 22 | +-- mxcli exec mdl-examples/bug-tests/367-retrieve-sort-indirect-entity-ref.mdl -p app.mpr |
| 23 | +-- mxcli -p app.mpr -c "describe microflow BugTest367.MF_FetchSorted" |
| 24 | +-- `mx check` against the resulting MPR must report 0 errors and the |
| 25 | +-- describe output must keep the qualified `Module.Entity.Attribute` |
| 26 | +-- sort form. |
| 27 | +-- ============================================================================ |
| 28 | + |
| 29 | +create module BugTest367; |
| 30 | + |
| 31 | +create entity BugTest367.ApplicationView ( |
| 32 | + CreatedAt : datetime |
| 33 | +); |
| 34 | +/ |
| 35 | + |
| 36 | +create entity BugTest367.DeploymentTarget ( |
| 37 | + Name : string(100) |
| 38 | +); |
| 39 | +/ |
| 40 | + |
| 41 | +create association BugTest367.DeploymentTarget_ApplicationView |
| 42 | + from BugTest367.DeploymentTarget |
| 43 | + to BugTest367.ApplicationView; |
| 44 | +/ |
| 45 | + |
| 46 | +-- Sort uses an attribute on a related entity. The builder must emit the |
| 47 | +-- IndirectEntityRef step through DeploymentTarget_ApplicationView so the |
| 48 | +-- BSON parses cleanly in Studio Pro. |
| 49 | +create microflow BugTest367.MF_FetchSorted () |
| 50 | +returns list of BugTest367.DeploymentTarget as $Targets |
| 51 | +begin |
| 52 | + retrieve $Targets from BugTest367.DeploymentTarget |
| 53 | + sort by BugTest367.ApplicationView.CreatedAt desc, Name asc; |
| 54 | +end; |
| 55 | +/ |
0 commit comments