Skip to content

fix: emit "empty" keyword for typed Java action arguments#521

Open
hjotha wants to merge 3 commits intomendixlabs:mainfrom
hjotha:submit/empty-java-action-list-arg
Open

fix: emit "empty" keyword for typed Java action arguments#521
hjotha wants to merge 3 commits intomendixlabs:mainfrom
hjotha:submit/empty-java-action-list-arg

Conversation

@hjotha
Copy link
Copy Markdown
Contributor

@hjotha hjotha commented May 5, 2026

Summary

When a Java action parameter is typed as a BasicParameterType (any inner type other than entity-type or microflow-type — String, Integer, Boolean, ListType, ParameterizedEntityType, DateTime, Decimal, …) and the MDL author binds it to empty, Studio Pro authors the BSON BasicCodeActionParameterValue with Argument: "empty" — the literal MDL keyword. The current builder collapses every empty primitive binding to Argument: "" (the unbound marker), regardless of parameter type. For typed parameters that substitution triggers mx check CE0126 "Missing value for parameter X" because the model treats the parameter as missing rather than explicitly empty.

Fix

When the Java action definition is resolvable via the backend, classify each parameter:

  • EntityTypeParameterType → already handled separately (EntityTypeCodeActionParameterValue).
  • MicroflowType → already handled separately (MicroflowParameterValue with empty Microflow).
  • Anything else (BasicParameterType — primitives, lists, parameterized-entity types) → emit Argument: "empty" for the MDL empty literal.

When jaDef == nil (no backend or action not resolvable) the builder keeps the prior Argument: "" behaviour to preserve the documented "intentionally unbound" semantics from PROPOSAL_microflow_empty_java_action_argument.md. The describer already maps both shapes to the MDL empty keyword so round-trip stays symmetric.

Reproduction

A Java action call that binds a typed parameter to empty:

call java action M.MyAction(items = empty);          -- ListType
call java action M.MyAction(key = empty);            -- StringType
call java action M.MyAction(microflowArgument = empty); -- ParameterizedEntityType

Before this PR: mx check reports CE0126 "Missing value for parameter X". After this PR: mx check reports 0 errors.

Test plan

  • Existing test TestBuildJavaAction_EmptyArgumentPreservesEmptyBasicValue continues to pass — without backend (jaDef == nil) primitives still emit Argument: "".
  • New parametrized test TestBuildJavaAction_EmptyResolvedBasicArgumentEmitsEmptyKeyword covers ListType and StringType — both must emit Argument: "empty" once the parameter type is resolved.
  • Existing test TestBuildJavaAction_EmptyMicroflowArgumentUsesMicroflowParameterValue continues to pass.
  • go test ./... passes.
  • Roundtrip audit on a 20-microflow random sample: previously failing DataLake.X (ParameterizedEntityType) and MxKafka.X (StringType) microflows now match, 18/18 unaffected microflows held their prior status — no regressions.

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • The fix correctly addresses the CE0126 error by distinguishing list-typed parameters when emitting the empty keyword in BSON.
  • The change is minimal and focused, adding only the necessary logic to track list-typed parameters and conditionally set the Argument field.
  • Test coverage is adequate: new test verifies the fix, existing tests continue to pass, and roundtrip audit confirms no regressions.
  • Comments clearly explain the rationale and the distinction between list-typed and primitive parameters.
  • The solution maintains symmetry with the describer (which already maps both shapes to MDL empty).
  • No changes to MDL syntax, grammar, or AST were needed since this is an execution-layer fix for existing syntax.

Recommendation

Approve the PR. The change is correct, well-tested, and maintains backward compatibility for primitive parameters while fixing the specific issue with list-typed Java action arguments.


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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

AI Code Review

What Looks Good

  • The PR correctly identifies and fixes a specific bug where list-typed Java action parameters bound to empty were incorrectly emitted as unbound markers
  • The solution is minimal and targeted, only affecting the specific case that was broken
  • Test coverage is adequate: adds a new test for the fix while ensuring existing tests still pass
  • The PR maintains round-trip symmetry as noted (the describer already handled both cases)
  • Code is well-commented explaining why the distinction between list-typed and primitive parameters matters
  • No unnecessary changes or scope creep - stays focused on the single issue
  • Follows existing code patterns and style in the file

Recommendation

Approve the PR. It addresses a concrete bug with a minimal, well-tested fix that doesn't modify MDL syntax or require full-stack pipeline changes. The change is strictly in the executor layer to correct BSON emission for a specific case, and all relevant checklist items are satisfied for this type of bug fix. No syntax design or full-stack consistency considerations apply since no MDL syntax is being added or modified.


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

@hjotha hjotha changed the title fix: emit "empty" keyword for list-typed Java action arguments fix: emit "empty" keyword for typed Java action arguments May 5, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • The fix correctly addresses the core issue: distinguishing between "intentionally unbound" (empty string) and explicitly "empty" literal for typed Java action parameters when backend resolution is available.
  • The implementation cleanly separates parameter types into three categories (entity, microflow, basic) and handles the basic type case with the new resolvedBasicParams map.
  • Test coverage is comprehensive:
    • New parametrized test covers ListType and StringType (representing BasicParameterType) with backend resolution
    • Existing tests preserve behavior for unbound parameters (jaDef == nil) and microflow parameters
    • Roundtrip audit confirms no regressions in real-world microflows
  • Code changes are minimal and focused, with clear comments explaining the rationale and referencing the relevant proposal.
  • The fix maintains backward compatibility by preserving the original "" behavior when backend resolution fails.
  • No modifications to MDL syntax, grammar, AST, or visitor were needed (as this is purely an execution behavior fix), so full-stack consistency checks for new syntax don't apply.

Recommendation

Approve - The PR is ready for merging. It correctly resolves the reported issue with appropriate test coverage and maintains all existing behaviors. The change is minimal, well-documented, and follows the project's architectural patterns.


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

hjothamendix and others added 3 commits May 5, 2026 16:45
When a Java action parameter is list-typed and the MDL author binds it
to `empty`, Studio Pro authors the BSON BasicCodeActionParameterValue
with Argument: "empty" — the literal MDL keyword. The current builder
collapses every empty primitive binding to Argument: "" (the unbound
marker), regardless of parameter type. For list-typed parameters that
substitution triggers `mx check` CE0126 "Missing value for parameter X"
because the model treats the parameter as missing rather than
explicitly empty.

Detect list-typed parameters via the Java action definition
(*javaactions.ListType) when looking up the action; for those
parameters bound to `empty` emit Argument: "empty". Primitive
parameters keep the existing blank-string behaviour. The describer
already maps both to the MDL `empty` keyword so round-trip stays
symmetric.

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

The original fix targeted only ListType parameters, but Studio Pro
authors `Argument: "empty"` for any typed BasicParameterType parameter
(String, Integer, Boolean, ParameterizedEntityType, ListType, …) when
the user explicitly binds it to MDL `empty`. Audit observations
surfaced two further cases beyond list-typed Tags: a microflow
parameter typed as `ParameterizedEntityType` and a Java action
parameter typed as `StringType`, both authored as `Argument: "empty"`
in real Studio Pro projects and both regressing to `Argument: ""`
under our previous fix — triggering the same `mx check` CE0126
"Missing value for parameter X" diagnostic.

Replace the listTypeParams set with resolvedBasicParams: when the
backend resolves a parameter whose type is anything OTHER than entity-
or microflow-type, the parameter goes into the
BasicCodeActionParameterValue branch and the MDL `empty` literal must
be preserved as `Argument: "empty"`. When jaDef is unavailable
(jaDef == nil) we keep the prior `""` behaviour to preserve the
documented "intentionally unbound" semantics of
PROPOSAL_microflow_empty_java_action_argument.md.

The unit test gains a String case alongside the List case — both must
emit `Argument: "empty"` once the parameter type is resolved.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hjotha hjotha force-pushed the submit/empty-java-action-list-arg branch from f42c2b9 to 7b85f18 Compare May 5, 2026 14:46
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

AI Code Review

Critical Issues

None found.

Moderate Issues

None found.

Minor Issues

None found.

What Looks Good

  • The PR correctly addresses the reported issue where typed Java action parameters bound to empty were incorrectly emitting Argument: "" instead of Argument: "empty", causing mx check CE0126 errors.
  • The fix properly distinguishes between parameter types (EntityType, MicroflowType, and BasicParameterType) and only applies the "empty" keyword emission for resolved basic types.
  • The behavior preserves the existing unbound semantics (Argument: "") when the Java action definition is unavailable (jaDef == nil), maintaining compatibility with the documented intention in PROPOSAL_microflow_empty_java_action_argument.md.
  • Test coverage is comprehensive:
    • Existing test for unbound case preserved
    • New parametrized test covers ListType and StringType for resolved basic types
    • Existing microflow argument test preserved
    • Roundtrip audit verified fixes for real-world cases without regressions
  • Code changes are well-commented and maintain clear separation of concerns.
  • No modifications to MDL syntax, grammar, or AST were needed (pure executor fix).
  • Backend abstraction compliance maintained - no direct sdk/mpr imports in executor write paths.
  • The PR is tightly scoped to a single bug fix without extraneous changes.

Recommendation

Approve the PR. The fix is correct, well-tested, and maintains all existing behaviors while resolving the specific issue with typed Java action arguments. No changes are needed.


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

Development

Successfully merging this pull request may close these issues.

2 participants