fix: emit "empty" keyword for typed Java action arguments#521
fix: emit "empty" keyword for typed Java action arguments#521hjotha wants to merge 3 commits intomendixlabs:mainfrom
Conversation
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove 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 |
AI Code ReviewWhat Looks Good
RecommendationApprove 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 |
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove - 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 |
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>
f42c2b9 to
7b85f18
Compare
AI Code ReviewCritical IssuesNone found. Moderate IssuesNone found. Minor IssuesNone found. What Looks Good
RecommendationApprove 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 |
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 toempty, Studio Pro authors the BSONBasicCodeActionParameterValuewithArgument: "empty"— the literal MDL keyword. The current builder collapses every empty primitive binding toArgument: ""(the unbound marker), regardless of parameter type. For typed parameters that substitution triggersmx checkCE0126 "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 (MicroflowParameterValuewith emptyMicroflow).Argument: "empty"for the MDLemptyliteral.When
jaDef == nil(no backend or action not resolvable) the builder keeps the priorArgument: ""behaviour to preserve the documented "intentionally unbound" semantics fromPROPOSAL_microflow_empty_java_action_argument.md. The describer already maps both shapes to the MDLemptykeyword so round-trip stays symmetric.Reproduction
A Java action call that binds a typed parameter to
empty:Before this PR:
mx checkreportsCE0126 "Missing value for parameter X". After this PR:mx checkreports 0 errors.Test plan
TestBuildJavaAction_EmptyArgumentPreservesEmptyBasicValuecontinues to pass — without backend (jaDef == nil) primitives still emitArgument: "".TestBuildJavaAction_EmptyResolvedBasicArgumentEmitsEmptyKeywordcovers ListType and StringType — both must emitArgument: "empty"once the parameter type is resolved.TestBuildJavaAction_EmptyMicroflowArgumentUsesMicroflowParameterValuecontinues to pass.go test ./...passes.DataLake.X(ParameterizedEntityType) andMxKafka.X(StringType) microflows now match, 18/18 unaffected microflows held their prior status — no regressions.🤖 Generated with Claude Code