Skip to content

check: explain that XPath constraints can't compute values - #35

Merged
ako merged 1 commit into
mainfrom
fix/xpath-arithmetic
Jul 26, 2026
Merged

check: explain that XPath constraints can't compute values#35
ako merged 1 commit into
mainfrom
fix/xpath-arithmetic

Conversation

@ako

@ako ako commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Sudoku-app finding #8: retrieve … where [Seq = $Game/MoveSeq + 1] fails with a bare mismatched input '+' expecting ']', with no hint about the actual cause.

This is a Mendix limitation, not an mxcli bug: XPath constraints take a literal / token / variable / path on the value side, never an arithmetic expression. So adding grammar support would be the wrong fix — it would let through XPath that mxbuild then rejects. The right fix (matching the finding's own framing — "the failure is a parse error rather than a message about XPath") is a clear diagnostic.

Fix

Add an error hint keyed on mismatched input '<+|*|div|mod>' expecting ']'. The expecting ']' shape only occurs inside a bracketed constraint, so the signal is precise — a normal-expression arithmetic error (e.g. expecting ';') does not trigger it. The hint names the limitation and shows the workaround:

Mendix XPath constraints cannot compute values (no +, -, *, div, mod).
Compute the value into a variable first, then compare against it:
  $Next = $Game/MoveSeq + 1;
  retrieve $M from Mod.Move where [Seq = $Next] limit 1;   (correct)

Tests & docs

  • Visitor test: the hint fires for +/*/div/mod inside a constraint and not for a normal-expression arithmetic error.
  • Negative-test example f8-xpath-arithmetic.fail.mdl.
  • xpath-constraints.md gains an "arithmetic on value" row + workaround note; fix-issue.md symptom row.

🤖 Generated with Claude Code


Generated by Claude Code

@ako
ako force-pushed the fix/xpath-arithmetic branch from c047c69 to 766b697 Compare July 26, 2026 04:40
`retrieve … where [Seq = $Game/MoveSeq + 1]` failed with a bare
`mismatched input '+' expecting ']'`, with no hint that Mendix XPath
constraints take a literal/token/variable/path on the value side — never
an arithmetic expression. This is a Mendix limitation, not an mxcli bug,
so adding grammar support would only let through XPath that mxbuild
rejects.

Add an error hint keyed on `mismatched input '<+|*|div|mod>' expecting
']'` (the `expecting ']'` shape only occurs inside a bracketed
constraint) that names the limitation and the workaround: compute the
value into a variable first, then compare against it. Documented in
xpath-constraints.md; visitor test + negative bug-test example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
@ako
ako force-pushed the fix/xpath-arithmetic branch from 766b697 to f8f6f76 Compare July 26, 2026 04:58
@ako
ako merged commit 26aa537 into main Jul 26, 2026
3 checks passed
ako pushed a commit that referenced this pull request Jul 31, 2026
…s (TraceOps #35)

CATALOG.WIDGETS records a widget's action/datasource flow (MicroflowRef /
NanoflowRef), but the linter's Widget projection dropped those fields, so a
custom Starlark rule could not detect e.g. a microflow-datasource ListView (no
database pushdown) — a rule keyed on the flow ref returned zero hits at any
threshold.

Carry MicroflowRef/NanoflowRef from the catalog through the Widget struct and
the Widgets() query, and expose microflow_ref / nanoflow_ref on the Starlark
widget struct (mirroring entity_ref). Documented in the write-lint-rules skill's
widget field table.

Test: TestWidgets_ProjectsMicroflowNanoflowRef.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants