Fix: normalize $workflowContext in workflow DECISION expressions (CE0117) - #93
Merged
Merged
Conversation
The workflow context parameter is stored as "WorkflowContext" and Mendix
expressions are case-sensitive on 11.9+, so a user-written
`$workflowContext` is an undefined variable. mx check reports:
[error] [CE0117] "Error(s) in expression." at Decision 'Decision'
normalizeWorkflowContextExpr already existed and was unit-tested, but was
only applied in autoBindCallMicroflow (the FINDINGS #39 fix).
buildExclusiveSplit stored the authored expression verbatim. That the
identical spelling works in a CALL MICROFLOW ... WITH clause is what
disguised the bug — the user reasonably concludes the casing is fine.
Apply the same normalizer in buildExclusiveSplit, and in the sibling
buildWaitForTimer whose delay expression may reference a date attribute
on the workflow context — the third and last expression site in the
workflow writer, and subject to the identical failure.
Also fix the documentation that taught the broken form: the bundled
write-workflows skill used lowercase in its DECISION example, and is
synced into every user project by `mxcli init`, so following the shipped
docs produced a project that would not build.
Verified end to end on Mendix 11.13.0: the repro script went from
1 error (CE0117) to 0 errors under mx check.
Closes mendixlabs#845
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LUToAkUx54bNkNjsBpufRH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes mendixlabs#845. A workflow
DECISIONwhose expression uses the documented lowercase$workflowContextproduced a project that would not build:The context parameter is named
WorkflowContext, and Mendix expressions are case-sensitive on 11.9+, so$workflowContextis an undefined variable.Root cause
normalizeWorkflowContextExpralready existed and was unit-tested — it was simply never called frombuildExclusiveSplit. OnlyautoBindCallMicroflow(the FINDINGS #39 fix) applied it.That asymmetry is what disguised the bug: the same spelling works in a
CALL MICROFLOW … WITHclause and fails in aDECISION, so a user reasonably concludes the casing is fine.mxcli checkandmxcli execboth report success; onlymx checkcatches it.Changes
buildExclusiveSplitruns the authored expression through the existingnormalizeWorkflowContextExpr.buildWaitForTimerdoes the same. This is the third and last expression site in the workflow writer, and a delay may reference a date attribute on the workflow context — the identical defect. Fixing one and knowingly leaving its twin didn't seem defensible; both are covered by tests.write-workflowsskill taught the broken lowercase form in its ownDECISIONexample. That file is synced into every user project bymxcli initviacmd/mxcli/skills/, so following the shipped docs produced a project that would not build. Corrected both examples and added the casing rule to Platform rules..claude/skills/fix-issue.md.Validation
make test,make check-mdl(257 pass),make lint-go— all cleanMendix validation — 11.13.0,
mx check: the repro script went from 1 error (CE0117) → 0 errors. Repro:mdl-examples/bug-tests/845-workflow-decision-context-casing.mdl.The same run independently confirmed mendixlabs#844 and mendixlabs#846 are already fixed on
main(the stored BSON showsWorkflows$CallMicroflowActivityand a correctly non-doubled parameter reference) — those two are release-lag, not code bugs.🤖 Generated with Claude Code
https://claude.ai/code/session_01LUToAkUx54bNkNjsBpufRH
Generated by Claude Code