Skip to content

Retrieve roundtrip loses XPath predicate boundaries #499

@hjotha

Description

@hjotha

Problem

A microflow retrieve can use multiple XPath predicates, for example:

retrieve $Items from Sample.Item
  where [CreatedAt > $Token/CreatedAt or (CreatedAt = $Token/CreatedAt and ItemId > $Token/ItemId)]
  [CreatedAt < '[%CurrentDateTime%]']
  [ExternalId != empty];

During describe -> exec -> describe, mxcli parsed those predicates into one chained and expression and wrote a single XPath constraint. That can turn [A or B][C][D] into [A or B and C and D], which changes XPath operator precedence.

Expected behavior

The roundtrip should preserve the predicate boundaries and write the same [predicate][predicate] XPathConstraint shape back to the model.

Actual behavior

The parser discarded the original predicate boundaries when building the retrieve AST, and the writer wrapped the combined expression as one predicate.

Proposed fix

Preserve bracketed predicate source for retrieve where clauses that contain multiple XPath predicates, and write already-bracketed XPath source without adding another pair of brackets.

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