Skip to content

describe/MDL formatter silently drops trailing XPath constraint brackets on Retrieve actions #772

Description

@RivanoCLCC

Summary

describe (and the shared MDL formatter used by context/diff-local) silently drops
trailing XPath constraint brackets from a Retrieve action when the XpathConstraint
combines an association-nested bracket with additional top-level attribute brackets on
the retrieved entity itself. The rendered MDL is materially less restrictive than the
actual stored constraint, with no warning that anything was omitted.

Environment

  • mxcli version: nightly-20260720-88077af1 (2026-07-20T06:06:00Z), windows/amd64
  • Mendix version: 10.24.2.75382
  • MPR format: v2 (mprcontents/ present)

Scenario

Reading a microflow via describe to review its logic (no Studio Pro open):

mxcli describe -p "The Company App.mpr" microflow Reminders.SE_Task_SendReminder

Expected output

The Retrieve action's where clause should reflect the full stored XpathConstraint.
Confirmed via mxcli bson dump -p "The Company App.mpr" --type microflow --object Reminders.SE_Task_SendReminder --format json, the actual value of that field is:

[Reminders.Task_TaskGroup/Reminders.TaskGroup
    [EndDate = $EndDateLimit]]
[Status != 'Completed']
[CompletionDate = empty]

So the rendered MDL should read something like:

retrieve $AboutToExpire_TaskList from Reminders.Task
    where Reminders.Task_TaskGroup/Reminders.TaskGroup[EndDate = $EndDateLimit]
    and Status != 'Completed'
    and CompletionDate = empty;

(exact surface syntax is mxcli's call — the point is nothing present in the model should be silently dropped.)

Experienced output

retrieve $AboutToExpire_TaskList from Reminders.Task
    where Reminders.Task_TaskGroup/Reminders.TaskGroup[EndDate = $EndDateLimit];

The [Status != 'Completed'] and [CompletionDate = empty] brackets are gone entirely —
not truncated with an ellipsis, not flagged, just absent.

Impact

Found during a code review performed entirely by reading mxcli describe output: the
missing constraints made a correct, defensive query look like a bug (as if reminders
were sent for already-completed tasks — they aren't). Since mxcli is positioned as the
primary way for AI agents to read Mendix logic without opening Studio Pro, a silent,
un-flagged drop of real constraints is worse than a formatting quirk — it produces
confidently wrong conclusions about what a project actually does, with no signal that
anything was lost in translation.

Suggestion

The XPath-constraint-to-MDL formatter likely reads only the first bracket group when an
association-nested bracket is present. Since XpathConstraint is stored as a single
opaque string (not a structured AST), it probably needs parsing into a sequence of
bracket groups joined by implicit "and" rather than assuming a single bracket. At
minimum until fixed, describe/context/diff-local should detect when the raw
XpathConstraint string doesn't fully round-trip through the renderer and surface a
warning, so the mismatch is visible instead of silent.

AI bug report

Relevant session log lines (mxcli diag --tail), full bundle available on request
(mxcli diag --bundle):

{"time":"...","level":"INFO","msg":"session_start","version":"nightly-20260720-88077af1","go":"go1.26.5","os":"windows","arch":"amd64","mode":"subcommand","args":["mxcli","describe","-p","The Company App.mpr","microflow","Reminders.SE_Task_SendReminder"]}
{"time":"...","level":"INFO","msg":"connect","mpr_path":"The Company App.mpr","mendix_version":"10.24.2.75382","mpr_format":2}
{"time":"...","level":"INFO","msg":"execute","stmt_type":"DescribeStmt","stmt_summary":"describe microflow Reminders.SE_Task_SendReminder"}

BSON dump used to establish ground truth:

mxcli bson dump -p "The Company App.mpr" --type microflow --object "Reminders.SE_Task_SendReminder" --format json | grep -A2 XpathConstraint

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