fix: rejoin empty custom error handler at IF ELSE first activity#504
Conversation
When a call activity has an empty custom error handler (`on error
without rollback { }`) and is followed by an IF that tests the call's
output variable with both branches terminating, Studio Pro authors the
error edge into the fallback path — specifically, a merge shared with
the split's `false` branch that feeds the first ELSE activity. Without
this rejoin, terminatePendingErrorHandlersAtEnd synthesises a phantom
EndEvent at the microflow tail, and naively wiring the error edge
directly to the IF split bypasses the output-variable declaration and
triggers CE0108 "variable not in scope" on subsequent activities.
addIfStatement now captures the pending empty-handler state when the
follow-up IF references the output variable, both branches return, and
the first ELSE statement is a plain activity. The rejoin is emitted
via addEmptyErrorHandlerRejoinFlowFrom(splitID, errorOrigin, firstElseID)
which creates the shared merge topology: split→false→merge, error→merge,
merge→firstElse — preserving variable scope through the split→merge edge.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
AI Code ReviewCritical IssuesNone found. Moderate Issues
Minor IssuesNone found. What Looks Good
RecommendationRequest changes to add the missing MDL bug test script in Automated review via OpenRouter (Nemotron Super 120B) — workflow source |
Review: fix: rejoin empty custom error handler at IF ELSE first activityVerdict: Approve with minor note What the PR doesFollow-on to #503. That PR wired the error edge directly to the IF split, which caused CE0108 "variable not in scope" — because the error path bypasses the call activity that declares The ELSE body is the fallback/error path that handles both "no value" and "error" cases without needing No blockersMinor: bypasses the state abstraction rather than using
|
Summary
on error without rollback { }) and is followed by an IF that tests the call's output variable with both branches terminating, Studio Pro authors the error edge into the fallback path — into a merge shared with the split'sfalsebranch that feeds the first ELSE activity. The describer/builder now emits that topology instead of leaving the handler dangling.addEmptyErrorHandlerRejoinFlowFrom(splitID, errorOrigin, firstElseID), preserving scope through the split→merge edge.Validation
TestEmptyErrorHandlerRejoinsAtIfElseFirstActivityverifies: 2 EndEvents (no phantom), error flow from call reaches a merge, merge receives the split's false branch AND flows to the first ELSE activity.go test ./mdl/executor/passes;go test -tags integration ./...passes.mx checkerrors = 0 andmpr checkerrors = 0; residual roundtrip diff is cosmetic (10 lines, unrelated to this fix).Test plan
TestEmptyErrorHandlerRejoinsAtIfElseFirstActivity-tags integration)🤖 Generated with Claude Code