fix: rejoin empty error handlers inside branch bodies#496
fix: rejoin empty error handlers inside branch bodies#496ako merged 1 commit intomendixlabs:mainfrom
Conversation
Symptom: an empty custom error handler inside a structured branch could round-trip as an explicit `return;` handler even though the authored handler should continue to the next branch action. Root cause: the top-level flow builder routes pending empty error handlers when connecting one statement to the next, but IF and enum-split branch builders connected sequential branch statements directly and skipped that pending handler rejoin step. Fix: when branch builders connect a statement that owns an empty no-output custom handler to the next branch statement, run the same pending error-handler routing used by the top-level graph builder. Output-dependent handlers are left to the existing skip-var path so they still avoid unsafe success tails. Tests: added a synthetic IF-branch regression test; `go test ./mdl/executor -run 'EmptyNoOutputHandler.*Branch|EmptyNoOutputHandlerRejoins|OutputHandlerInReturningBranch' -v`; `make build`; `make lint-go`; `make test`.
Review: fix: rejoin empty error handlers inside branch bodiesVerdict: Approve with minor note What the PR doesFixes issue #495: when a No blockersMinor: outer guard is redundant, creates inconsistency with the top-level patternThe three new blocks read: if fb.emptyErrorHandlerFrom == lastThenID {
fb.addPendingErrorHandlerFlowForStatement(...)
}But if state.emptyFrom != "" {
if state.emptyFrom != originID {
return state // no-op
}Calling it when there's no pending handler, or when the handler is from a different origin, is already a safe no-op. The top-level loop in Could drop the outer check to mirror the top-level pattern. Not a blocker — the code is correct either way. Positive notes
|
Closes #495.
Summary
Validation
go test ./mdl/executor -run 'EmptyNoOutputHandler.*Branch|EmptyNoOutputHandlerRejoins|OutputHandlerInReturningBranch' -vmake buildmake lint-gomake test