fix(workflow): stop naming a jump activity after its target (mendixlabs/mxcli#1005) - #350
Merged
Merged
Conversation
buildJumpTo set the jump's Name to its target's name. Mendix resolves
TargetActivity BY NAME, so the jump could resolve to itself; the build
then fails CE6681 ("not possible to jump to end activities or jump-to
activities"), which describes a different fault than the real one.
Nothing caught it first. A jump target is the only INTRA-document
reference a workflow has: validateWorkflowStatementRefs resolves
microflows, pages and entities, and never looks at activity names. So
`check --references` passed, `exec` reported success, and the defect
surfaced only under the native validator.
The reported trigger is an unresolved target. There is a second case,
not in the report: a FORWARD jump to a target that DOES exist breaks the
same way, because deduplication renames the second activity carrying a
name. Measured:
backward (target first) jump -> StepB2, target keeps StepB worked
forward (jump first) jump KEEPS StepB, target -> StepB2 broke
which is why loops looked fine and the reported table says a valid
target is safe. Fixing only the unresolved case would have left half the
bug in place.
Both ends are fixed. A jump is named JumpTo (deduped: JumpTo, JumpTo2,
...) so it can never carry a target's name, and deduplication now runs
in two passes with jumps LAST, so a jump never claims a name a real
activity wanted whatever it is called.
MDL-WF05 refuses an unresolved target at check time and, via the same
function, in execCreateWorkflow — exec is reachable without check (the
mendixlabs#833 lesson). The valid-target set comes from running the real builders
over the AST rather than re-deriving names, because a `call microflow
M.SUB_X` activity is named SUB_X and a second copy of that rule would
drift into false refusals. The suggestion lists the valid names: they
are not visible in the script, which is most of why the wrong one is
easy to reach.
Reported as mendixlabs#1005.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Fixes
mendixlabs/mxcli#1005. Independent of the two describe PRs — branches offmain.buildJumpToset the jump activity'sNameto its target's name. Mendix resolvesTargetActivityby name, so the jump could resolve to itself, and CE6681 ("not possible to jump to end activities or jump-to activities") then describes a different fault than the real one.Nothing caught it first. A jump target is the only intra-document reference a workflow has —
validateWorkflowStatementRefsresolves microflows, pages and entities, and never looks at activity names. Socheck --referencespassed,execreported success, and the defect surfaced only under the native validator.A second case, not in the report
A forward jump to a target that does exist breaks identically, because deduplication renames the second activity carrying a name:
NameStepB2StepBStepBStepB2Straight from the control run against unfixed code:
Loops jump backwards, which is why the reported table shows a valid target as safe. Fixing only the unresolved-target case would have left half the bug.
The fix, both ends
JumpTo(dedupedJumpTo,JumpTo2, …) so it can never carry a target's name.execCreateWorkflow— exec is reachable without check (themxcli checkdoesn't flagid = <String>XPath retrieve constraints (CE0161 on real compile) — MDL048 exists in source but isn't in a release yet mendixlabs/mxcli#833 lesson).The valid-target set comes from running the real builders over the AST, not from re-deriving names here: a
call microflow M.SUB_Xactivity is namedSUB_X, and a second copy of that rule would drift into exactly the false refusals this rule exists to prevent. No project needed — every name comes from the script. Jumps are excluded from the set, since Mendix refuses a jump to a jump.The suggestion lists the valid names, because they aren't visible in the script — which is most of why the wrong name is easy to reach, and why
describe → edit → execproduces this:Tests
Eight, verified against unfixed code (three fail, including the forward case above). Controls that matter: a valid jump in both directions must not be flagged (otherwise the rule could pass by refusing everything), a target nested in an outcome flow must resolve (otherwise every jump into a branch is refused), and two jumps in one workflow must get distinct names.
That last one earned its place immediately — a careless bulk edit left
if jumpPass { if !jumpPass {in the dedup, silently disabling all jump renaming. Only the uniqueness test caught it; CE0495 would have been the next bug report.🤖 Generated with Claude Code