Add compound AND/OR switch conditions #24
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Issue #12 added a canonical typed single-comparison condition model for Switch cases while preserving advanced expressions. Users now need a structured way to combine several typed comparisons without dropping down to a hand-authored expression.
Scope
all(AND) andany(OR) groups containing typed output comparisons and nested groups.Non-goals
Acceptance
A AND B,A OR B, and grouped combinations such asA AND (B OR C)from typed prior outputs.Dependency
Builds on #12.
Delivered on
mainin3bdfca3, with096863bandabcf262falling out of the same work.Model
SwitchCondition.Group(operator, conditions)combines children underallorany, wire form{"kind":"group","operator":"all","conditions":[…]}. Theexpressionandcomparisonkinds are byte-identical, so saved workflows round-trip untouched and the format version stays at 4; an older build fails closed on the unknown kind rather than mis-routing, which has its own test.Bounds are three nested groups and thirty-two conditions per branch, enforced while decoding rather than only in validation — conditions arrive from imported workflows and the authoring contract, and an unbounded tree exhausts the stack before validation runs. Validation is one recursive collector carrying the path to the failing leaf, so a runtime error names which condition broke.
Everything named in scope was reused rather than duplicated: the route-aware output picker, the type-constrained operator catalog, the typed comparison editors, the validation boundary, the evaluator, the persistence format and the authoring contract.
Editor
Summary rows with all-of/any-of headers, nested groups indented beneath. Opening a condition replaces the sheet body with a focused output/operator/value editor rather than expanding in place. A branch holding one condition shows no grouping, and deleting back to one removes it again — the collapse is enforced in the edit model, not left to callers. Bound breaches are refused at the moment of the edit, so the editor cannot build a branch that will not save.
Acceptance
A AND B,A OR BandA AND (B OR C)from typed prior outputs — built and verified on a Pixel 9 emulator, not only in tests.Two bugs found while building this
096863b— the Switch descriptor seededitem.value == true, so a freshly added Switch failed the run on any record without avaluekey. Predates #12. Now defaults totrue: a new branch matches everything until narrowed.abcf262— the node debugger always passed an empty upstream map, so every output-based condition failed withOutput <node>/<port> is not available. This affected any node with an output binding, not just Switch; #12 just made it visible. Filed separately for the record.Carried refactors
EditorScreen.ktsplit (1324 → ~730 lines) into the switch editor and the schema-field renderer; four scattered operator-id branches collapsed to one dispatch; four copies of the output-comparison-type derivation reduced to one function, which had to agree for a type-mismatch diagnostic to be correct.Not done
Nothing in scope. Non-goals were respected: no expression fragments inside structured groups, no node-specific operators or coercion, no visual programming canvas.