fix: preserve compact reverse-association retrieves#356
Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Open
fix: preserve compact reverse-association retrieves#356hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha wants to merge 2 commits intomendixlabs:mainfrom
Conversation
Symptom: describing a reverse-association retrieve stored as a database retrieve with a simple association XPath expanded it into a verbose where-clause retrieve instead of preserving the compact retrieve-from-association form. Root cause: the formatter only recognized explicit AssociationRetrieveSource values. Some Mendix models encode the same association traversal as a DatabaseRetrieveSource with a single predicate of the form [Module.Association = $Variable] and RangeType All. Fix: detect that narrow database-retrieve shape, verify the association points at the retrieved entity through the backend domain model, and emit retrieve $Result from $Variable/Module.Association when it is safe. Complex predicates, sorting, non-All ranges, non-variable right-hand sides, and non-matching association targets keep the existing database retrieve output. Tests: add synthetic format-action regressions for the compact form, range fallback, target-entity fallback, and parser rejection of complex predicates.
36 tasks
AI Code ReviewWhat Looks Good
RecommendationApprove the PR. The changes are minimal, well-tested, and address the specific issue without violating any architectural guidelines. No modifications to MDL grammar or syntax are needed since this is purely a formatting improvement for existing constructs. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
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>
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 part of #352.
Part of #332.
Summary
This extracts the reverse-association retrieve formatter fix from the audit staging branch.
Some Mendix models store a compact association retrieve as a database retrieve with a single XPath predicate like
[Module.Association = $Variable]and rangeAll. The formatter previously described that as a verbose database retrieve with awhereclause, causing avoidable describe/exec/describe drift.Changes
retrieve $Result from $Variable/Module.Association;only for safeAllrange, unsorted, single-predicate cases.Allranges, and non-matching targets.Validation
make buildmake lint-gomake test