Skip to content

download file is parsed and built but never written: activity lands in the .mpr with no action (CE0008) #850

Description

@dimenus

Environment: mxcli v0.16.0-410-g4fda072f (built from 4fda072f), Mendix 11.13.0 project, macOS.

Steps to reproduce:

create or modify persistent entity ZZD.Doc extends System.FileDocument (
);
/
create or modify microflow ZZD.ACT_Download (
  $Doc: ZZD.Doc
)
returns Boolean
begin
  download file $Doc;
  return true;
end;
/

Run mxcli exec script.mdl -p project.mpr, then describe microflow ZZD.ACT_Download and mx check project.mpr.

Expected behavior: The activity is stored as a Microflows$DownloadFileAction and round-trips as download file $Doc;.

Actual behavior: mxcli check passes and mxcli exec reports Created microflow with no warning. The activity is written with no action at all:

begin
  ...
  -- Empty action
  return true;
end;

mx check then reports:

[error] [CE0008] "No action defined." at Action activity 'Activity'

The statement is accepted at every stage that reports anything, and disappears at the one stage that does not. download file $Doc show in browser; behaves the same.

Root cause: the write path has no case for it. actionToGen in mdl/backend/modelsdk/microflow_write.go switches on *microflows.<Action> and covers ~80 action types; DownloadFileAction is not among them (grep -c DownloadFileAction microflow_write.go → 0), so the ActionActivity is emitted with a nil Action.

Everything either side of the writer is already in place, which is what makes this easy to miss:

  • grammar/visitor: downloadFileStatementast.DownloadFileStmt (mdl/visitor/visitor_microflow_actions.go:1193)
  • flow builder: addDownloadFileAction builds a correct microflows.DownloadFileAction (mdl/executor/cmd_microflows_builder_calls.go:845)
  • read path: actionFromGen handles it (mdl/backend/modelsdk/microflow_read_actions.go:376), covered by TestActionFromGen_DownloadFile
  • formatter: mdl/executor/cmd_microflows_format_action.go:737

So there is a builder test and a reader test, and the only untested link is the one that is missing. docs/11-proposals/PROPOSAL_microflow_download_file_statement.md:53 lists "Builder/writer coverage for DownloadFileAction" as required — the builder half landed, the writer half did not.

Suggested fix: add a case *microflows.DownloadFileAction to actionToGen in microflow_write.go, writing FileDocumentVariableName, ShowFileInBrowser and ErrorHandlingType. Note the storage key is ShowFileInBrowser, not ShowInBrowser — the reader test above documents that legacy reads the wrong key.

A round-trip test (execdescribe) would catch this class generally; a reader-only test cannot, because it starts from BSON that the writer never had to produce.

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