Repository navigation
Conversation
…its context (mendixlabs#1571) `describe page` printed the association as the context entity of a data container bound over an association: dataview dvInner (DataSource: $currentObject/Shop.Order_Customer) { -- Context: $currentObject (Shop.Order_Customer) <- the association dataSourceEntityContext used the datasource reference as the entity for every kind but a flow. The reference means a different thing per kind: the entity for a database source, the flow for a microflow/nanoflow source (fixed in 6e59e0e), the association for an association source. The page was always correct; only the comment, and the association-name spelling that depends on the context, was wrong. The entity an association source reaches is stored on its last hop (EntityRef.Steps[last].DestinationEntity), which is already right from either end of the association, for a reference set, and for a specialization of the association's end, so it is read instead of re-derived from the domain model. associationSourcePath saw each step's destination but kept only the association names; rawDataSource.Destination now carries the last one, set where both association sources are built (Forms$AssociationSource / data view and the pluggable XPath source). A source with no stored destination keeps the reference, as the flow fix does. The `DataSource:` text is unchanged. Tests: owner-to-child reference, the reverse direction, reference set with its selection variable, specialization, two hops, a page-parameter start, the pluggable source, the no-destination fallback, and database/flow controls. Against upstream/main the association cases fail with the reported symptom. Verified on a Mendix 11.12.5 project: both directions describe the entity, describe -> exec reports "Unchanged page", mx check 0 errors. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove the PR. The change is correct, well-tested, and fully addresses issue #1571 while maintaining backward compatibility and following project conventions. No blocking issues identified. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
This branch has not been deployed
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 #1571.
What it fixes
A data view, list view, gallery or data grid bound over an association printed the association as its context,
-- Context: $currentObject (Shop.Order_Customer), instead of the entity the association reaches,(Shop.Customer). The datasource line itself is unchanged.How
dataSourceEntityContextgets anassociationcase, following 6e59e0e for flow sources. It returns the destination when the stored source has one, and otherwise the old reference.rawDataSource.Destinationis filled byassociationSourceDestination, which readsEntityRef.Steps[last].DestinationEntity. Studio Pro and mxcli both store that value, and I confirmed it withbson dumpfor a reference, the reverse direction and a reference set. It is correct in both directions, for reference sets, and for a destination that specializes the association's end.alter page'sentityFromEntityRefalready reads it.dsTypeAssociationandparseContextSource. The second also covers the DataViewSource and the pluggable XPath source (DESCRIBE PAGE emits 'database from' for non-database datasources, producing invalid MDL #941).associationRefForContext, the one consumer that compares the context's module, now sees the destination's module. That only differs for a cross-module association, and the result can only be better.findings/mdl-executor/, andmdl-examples/bug-tests/1571-describe-context-association.mdl(expected lines in the header; the Go tests carry the assertion).Evidence
Tests:
cmd_pages_describe_assoc_context_test.gohas six describe cases covering:It also has a pluggable-source case, a fallback (no stored destination), and database and flow controls.
Control run: against the code on
main, the seven association and pluggable cases fail with the reported symptom, and the controls and fallback pass. All pass with the fix.Real run (Mendix 11.12.5 scratch app):
Order_Customer(Shop.Order_Customer)(Shop.Customer)Order_Line(Shop.Order_Line)(Shop.OrderLine)(Shop.Order_Customer)(Shop.Order)The
DataSource:text is identical. Re-running the describe output reportsUnchanged page, andmx checkreports 0 errors.Tests and vet:
go test ./mdl/conformance/passes.go test ./mdl/executor/shows the same 28 pre-existing Windows failures asmain(identical lists).go vetandgofmtare clean.Linux (
golang:1.26.6-bookworm, ANTLR 4.13.2):make grammar build test check-mdl check-findings check-conformance check-migration-reference lint-goall pass.Noticed, not changed
-- Context: $currentObject (Order), rather than the qualified entityShop.Order, although the source storesShop.Order. That looks like the same class of issue, but changing it rewrites the most common context line on every page, so I left it for you to decide.alter page … insert … (Attribute: NoSuchAttr)reports "Altered page", and the page then failsmx checkwith CE1613. That's a separate, pre-existing gap.🤖 Generated with Claude Code