Skip to content

change with qualified association loses member name on describe when variable entity type is unknown #282

@hjotha

Description

@hjotha

Problem

A CHANGE $var (Module.AssocName = $other) statement roundtrips through describe→exec→describe as change $var ( = $other) — invalid MDL that cannot be re-executed — when the builder cannot determine the entity type of $var.

Repro

Control Centre (Mendix 9.24), microflow MxKafka.IVK_RetrieveMessages:

$Messages = call java action MxKafka.GetMessagesFromOffset(...);
loop $IteratorMessage in $Messages begin
  change $IteratorMessage (MxKafka.Message_MessageOverview = $MessageOverview);
end loop;

After describeexecdescribe, the change line becomes:

change $IteratorMessage ( = $MessageOverview);

The BSON written to the MPR has "Association": "" (empty string) and no "Attribute" key at all.

Root cause

resolveMemberChange in mdl/executor/cmd_microflows_builder_actions.go returns early when entityQN == "", leaving both AssociationQualifiedName and AttributeQualifiedName empty. The writer then emits the empty Association field, and the describer has no name to render.

The empty-entity case is hit whenever a variable's type isn't in fb.varTypes — typically when the variable is the iterator of a loop whose list came from a java action (or any other action) whose return type the builder didn't register.

Trigger conditions

  • Any CHANGE $var (...) where:
    • $var is not a parameter / not a DECLARE-d variable / not the output of a retrieve/create
    • OR $var comes from a call whose return type the builder doesn't track
  • AND the changed member is a qualified association name (Module.AssocName)

Bare-attribute names (Offset, Name, etc.) don't hit the same path — they resolve by default.

Fix

PR #TODO proposes a shape-based fallback in resolveMemberChange for the unknown-entity case:

  • 0 dots → bare attribute name (preserved on AttributeQualifiedName)
  • 1 dot → Module.Assoc → association (preserved on AssociationQualifiedName)
  • ≥2 dots → Module.Entity.Attribute → qualified attribute (preserved on AttributeQualifiedName)

Five regression tests in cmd_microflows_change_unknown_entity_test.go cover each branch plus the empty-member-name defensive guard.

Validation

  • go test ./... passes
  • go test -race ./mdl/executor/ passes
  • Control Centre (Mendix 9.24) describeexecdescribe of MxKafka.IVK_RetrieveMessages now preserves the full member name bit-exactly on the change line. Other residual drifts in the same microflow (retrieve compact/expanded form ambiguity, loop-begin missing keyword) are pre-existing and unrelated to this fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions