Skip to content

RETRIEVE WHERE with string literal on enumeration field should error, not silently return empty #176

@engalar

Description

@engalar

Problem

When a RETRIEVE statement compares an enumeration attribute against a string literal, mxcli silently accepts it — both at parse time (mxcli check) and execution time (mxcli exec). The query returns zero results without any warning, making the bug very hard to diagnose.

-- Silently returns empty list (Status is an enumeration, not a string)
RETRIEVE $IssueList FROM OrderManagement.OrderIssue
  WHERE Status = 'Open';

Expected behavior

mxcli should detect the type mismatch and raise an error with a clear message, e.g.:

Error: Cannot compare enumeration attribute 'Status' (OrderManagement.ENUM_IssueStatus) 
with string literal 'Open'. Use fully qualified enum value: 
  OrderManagement.ENUM_IssueStatus.Open

Ideally this should be caught at check time (mxcli check --references), but at minimum it should error at execution time.

Correct syntax

RETRIEVE $IssueList FROM OrderManagement.OrderIssue
  WHERE Status = OrderManagement.ENUM_IssueStatus.Open;

Impact

This caused a production dashboard to show all-zero KPI counters (Open Issues, In Production, Shipped) with no indication of why. The root cause — string vs enum comparison — took manual analysis to find.

Suggested scope

  1. mxcli check --references: validate RETRIEVE WHERE operand types match attribute types
  2. mxcli exec: reject type-mismatched comparisons at runtime with actionable error message

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