fix #595: PublishedODataService EntityTypePointer wired by qualified entity name#596
Open
ako wants to merge 1 commit into
Open
fix #595: PublishedODataService EntityTypePointer wired by qualified entity name#596ako wants to merge 1 commit into
ako wants to merge 1 commit into
Conversation
`serializePublishedODataService` keyed `entityTypeIDMap` by `et.ExposedName` (e.g. "Customers") but looked it up by `es.EntityTypeName` (e.g. "OdTest.Customer"). The two values are different, so the lookup always returned an empty string and the `if entityTypeID != ""` guard in `serializePublishedEntitySet` meant `EntityTypePointer` was never written. Without that pointer, Studio Pro's `EntitySet.Check` can't navigate from a set to its type, NREs on the missing reference, and aborts the entire background project checker — hiding all other problems in the project, not just the published OData service. Key the map by `et.Entity` (the qualified entity name), matching how `EntityTypeName` is populated on `PublishedEntitySet` in `astEntityDefToModel`. Extend `TestSerializePublishedODataService` to assert `EntityTypePointer` matches the corresponding EntityType's `$ID`. The prior test covered other fields but not this pointer, which is why the bug landed undetected — the existing assertions only checked the EntitySet's own fields, never the cross-reference. Add `mdl-examples/bug-tests/595-published-odata-entitytypepointer.mdl` as the end-to-end fixture: applying it to a project must yield a project that opens in Studio Pro without the `EntitySet.Check` NRE. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AI Code ReviewReview SummaryCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove the PR. The fix is correct, tests are improved, and the bug test fixture is properly added. All validation checks pass. No changes needed. Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
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.
Summary
Fixes #595.
serializePublishedODataServicekeyedentityTypeIDMapbyet.ExposedName(e.g."Customers") but looked it up byes.EntityTypeName(e.g."OdTest.Customer"). The lookup always returned an empty string, soEntityTypePointerwas never written onODataPublish$EntitySetBSON. Studio Pro'sEntitySet.Checkthen NREs dereferencing the missing pointer and aborts the entire background project checker.One-line fix in
sdk/mpr/writer_odata.go: key the map byet.Entityto match whatastEntityDefToModelstores on the entity set.Why the test missed this
TestSerializePublishedODataServicechecked all the EntitySet's own fields (ExposedName,UsePaging,ReadMode, etc.) but never the cross-reference back to the EntityType. The PR adds that assertion. It also switches the test entity-typeBaseElement.IDfrom the placeholder"et-1"to a real UUID soidToBsonBinarydoesn't silently fall back to random IDs, making the pointer comparison meaningful.Test plan
make test— all packages passmake lint— Go + TypeScript pass./bin/mxcli check mdl-examples/bug-tests/595-published-odata-entitytypepointer.mdl→✓ Syntax OK (3 statements)NullReferenceExceptioninEntitySet.Checkand the project checker emits real problems normallyRelated
CallExternalAction.SchemaAction), fixed in PR fix #590: rewrite OData example Level 9.1 to use TripPin schema actions #592 as an MDL example-file changeODataRemoteEntitySource.RemoteId), example-file workaround in PR fix #590: rewrite OData example Level 9.1 to use TripPin schema actions #592; executor fix pending🤖 Generated with Claude Code