Skip to content

fix: infer java action result variable types#357

Open
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:submit/java-action-return-type-inference
Open

fix: infer java action result variable types#357
hjotha wants to merge 2 commits intomendixlabs:mainfrom
hjotha:submit/java-action-return-type-inference

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented Apr 27, 2026

Closes part of #352.
Part of #332.

Summary

This extracts the Java action result-type inference fix from the audit staging branch.

The builder already looks up Java action definitions to format entity-typed parameters, but it did not register the output variable type from the Java action return metadata. Downstream statements could therefore see Java action outputs as unknown even when the action returns a concrete entity/list/file type.

Changes

  • Register result variable types for Java actions returning concrete entity and list types.
  • Register System.FileDocument for Java actions returning FileDocument.
  • Infer generic list-return types from list-typed input arguments when the Java action return type is a list without a concrete entity.

Validation

  • make build
  • make lint-go
  • make test

Symptom: after rebuilding a Java action call, downstream statements could treat the result variable as unknown even when the Java action definition exposes a concrete return type such as FileDocument, Entity, or List.

Root cause: addCallJavaActionAction built the action and parameter mappings but did not register the output variable type from the Java action metadata. Generic list-return actions also lost the list entity type available from their input list argument.

Fix: register concrete Java action return types on the flow builder and infer an entity list type for generic list-return actions from the first list-typed input argument.

Tests: add synthetic builder regressions for FileDocument returns, concrete list returns, and generic list returns that inherit the input list type.
Adds an MDL script under mdl-examples/bug-tests/ exercising a Java
action with an entity return type and a downstream `change` on the
result variable. After exec, `mx check` reports 0 errors,
confirming the result variable's type is inferred from the Java
action signature so dependent activities resolve.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants