Skip to content

fix #590: rewrite OData example Level 9.1 to use TripPin schema actions#592

Open
ako wants to merge 2 commits into
mainfrom
fix/590-odata-examples-call-external-action
Open

fix #590: rewrite OData example Level 9.1 to use TripPin schema actions#592
ako wants to merge 2 commits into
mainfrom
fix/590-odata-examples-call-external-action

Conversation

@ako
Copy link
Copy Markdown
Collaborator

@ako ako commented May 23, 2026

Summary

Fix two distinct Studio Pro crashes triggered by running mdl-examples/doctype-tests/10-odata-examples.mdl against a project.

Commit 1 — fixes #590 (CallExternalAction.SchemaAction NRE in project checker):
The call external action demonstration in Level 9.1 referenced fictional actions on OdTest.SalesforceAPI. SalesforceAPI's MetadataUrl doesn't resolve, so its cached $metadata is empty, and Studio Pro NREs trying to resolve the action name against the empty schema. The crash aborts the entire background checker, hiding all other problems.

  • Move the microflow definition from Level 9.1 to a new Level 10.4.1, after the TripPin client is created and its $metadata cached.
  • Use GetNearestAirport(lat=…, lon=…) (Function, parameters + return) and ResetDataSource() (Action, parameterless + on error continue) — both are unbound entries in TripPin's real schema, so Studio Pro resolves them correctly.
  • Keep the microflow in OdTest so show external actions in OdTest (Level 9.2) still returns a row.

Commit 2 — fixes #594 (ODataRemoteEntitySource.RemoteId NRE in Integration Pane):
Level 8.6c was relying on create or modify external entity preserving the RemoteName previously set by 8.6a/8.6b. The executor actually overwrites omitted properties with empty strings, so the resulting BSON had RemoteName: "". Studio Pro's Integration Pane visualiser then NREs with ArgumentNullException("EntityTypeName") because its C# property aliases the BSON RemoteName field.

Why two fixes in one PR

Both are one-line example-file changes that unblock the same end-to-end validation (run example → open in Studio Pro → checker + integration pane work). The underlying executor and Studio Pro robustness issues are tracked in separate issues (#594, plus #590 itself notes the upstream gap).

Test plan

  • make build — passes
  • make test — passes (nothing in this PR touches Go code)
  • ./bin/mxcli check mdl-examples/doctype-tests/10-odata-examples.mdl✓ Syntax OK
  • Manual validation in Studio Pro (requires the user to apply the file to a blank project): open the project, confirm:
    • Background project checker runs without NREing in CallExternalAction.SchemaAction
    • Integration Pane renders consumed-service entities without NREing in ODataRemoteEntitySource.RemoteId

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

AI Code Review

What Looks Good

  • The PR correctly addresses the core issue: moving the problematic call external action microflow to a level after TripPin client creation where its $metadata is resolvable.
  • Uses real TripPin schema actions (GetNearestAirport with parameters/return, ResetDataSource parameterless with on error continue) that Studio Pro can resolve without NRE.
  • Maintains the educational purpose: keeps microflow in OdTest module so show external actions in OdTest (Level 9.2) still returns a row for demonstration.
  • Preserves correct cleanup order: Level 8.8a drops the microflow before Level 8.8c drops the TripPin client (unchanged from original).
  • Comments clearly explain the reasoning (SalesforceAPI metadata issue, TripPin resolution) and reference the GitHub issue.
  • Example remains syntactically valid (mxcli check passes) and follows existing MDL patterns in the file.

Recommendation

Approve. The PR is a targeted fix that resolves the Studio Pro NRE issue in the example without modifying code or introducing new syntax. It maintains all educational value while using a functional OData service. Manual Studio Pro validation is pending but the changes are logically sound and address the root cause.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

ako and others added 2 commits May 23, 2026 16:35
The original Level 9.1 created a microflow `OdTest.ACT_CallExternalAction`
that called `OdTest.SalesforceAPI.GetAccounts(...)` and
`OdTest.SalesforceAPI.NotifyUpdate(...)`. SalesforceAPI's MetadataUrl is a
placeholder that doesn't return $metadata, so the ConsumedODataService BSON
is written with an empty `Metadata` cache. Studio Pro's project checker
then resolves the Name fields against an empty schema, gets null, and the
checker aborts with a NullReferenceException in
`Mendix.Modeler.Integration.CallExternalAction.get_SchemaAction()` →
`ExternalActionParameterMapping.get_SchemaParameter()`. The crash blocks
all in-IDE error reporting, not just for this microflow.

Move the microflow definition to a new Level 10.4.1, right after the
TripPin client is created (Level 10.1) and its $metadata is actually
cached. Use unbound TripPin entries `GetNearestAirport` (Function with
lat/lon parameters and a Trippin.Airport return) and `ResetDataSource`
(parameterless Action) so both the parameter-mapping and the
`on error continue` variants are still demonstrated.

The microflow stays in `OdTest` so `show external actions in OdTest`
(Level 9.2) still returns a row. The existing drop in Level 8.8a already
runs before Level 8.8c (TripPin client drop), so cleanup order is correct.

Issue #590 separately documents the upstream Studio Pro robustness gap
(`SchemaAction` should null-check instead of NREing) so it can be
escalated to Mendix support.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ration pane NRE

`create or modify external entity` overwrites `RemoteEntityName` (BSON field
`RemoteName`) with the empty string when the `RemoteName` property is
omitted from the statement (see mxcli#594). Level 8.6c was relying on
preservation of the value set by 8.6a/8.6b, but the resulting BSON ended up
with `RemoteName: ""`. Studio Pro's Integration Pane visualiser then NREs
in `ODataRemoteEntitySource.get_RemoteId()` with
`ArgumentNullException("EntityTypeName")` because the C# property aliases
the BSON `RemoteName` field.

Repeat `RemoteName: 'Account'` in 8.6c. The underlying executor bug is
tracked separately in #594 and will be fixed in its own PR; this commit
keeps the example file usable today.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ako ako force-pushed the fix/590-odata-examples-call-external-action branch from 154045f to 2f2465a Compare May 23, 2026 16:36
@github-actions
Copy link
Copy Markdown

AI Code Review

Critical Issues

  • None found

Moderate Issues

  • None found

Minor Issues

What Looks Good

  • Issue Resolution: Directly addresses 10-odata-examples.mdl Level 9.1 crashes Studio Pro project check (NRE in CallExternalAction.SchemaAction) #590 by replacing fictional SalesforceAPI actions with real TripPin actions that have resolvable metadata, preventing Studio Pro's background checker NRE.
  • Correct Placement: Moves the microflow to Level 10.4.1 (after TripPin client creation) ensuring metadata is cached before use.
  • Preserves Intent: Keeps the microflow in OdTest module so Level 9.2 (show external actions in OdTest) still returns a row for demonstration.
  • Cleanup Consistency: Updates Level 8.8a comment to reflect the new dependency (TripPin instead of SalesforceAPI) while maintaining correct drop order.
  • Documentation: Excellent explanatory comments clarifying why the change was made (metadata resolution issues) and what actions were chosen (real TripPin schema entries).
  • Test Plan: Includes automated validation (make build, make test, mxcli check) and acknowledges the need for manual Studio Pro verification.
  • No Syntax Changes: Purely fixes example content without touching MDL grammar, AST, or executor - no risk of pipeline inconsistencies.
  • Atomic Scope: Focuses solely on fixing the broken example; no unrelated changes mixed in.

Recommendation

Approve. The PR correctly fixes the reported issue by replacing non-functional example actions with real, resolvable ones from a working OData service (TripPin), positioned correctly in the example sequence to ensure metadata availability. All automated checks pass, and the manual validation step is appropriately acknowledged. The changes are minimal, well-documented, and maintain the example's educational value while resolving the Studio Pro checker crash.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant