Skip to content

feat: named merge slots - #15

Merged
psyinf merged 1 commit into
mainfrom
feature/named-merge-slots
Sep 19, 2026
Merged

psyinf merged 1 commit into
mainfrom
feature/named-merge-slots

Conversation

@psyinf

@psyinf psyinf commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Implements TODO item 1.

What

A fan-in group can name the slots of a merge and is then matched by name, in any order:

(after: current, before: baseline) -> Compare -> verdict

Slot types can't tell two slots of the same type apart, so swapping them used to pass validation and run silently wrong. With names, the merge always receives its slots in the order it declares them.

API

  • MergeStage::mergeInputNames() — override in a TypedMergeFilter / UniformMergeFilter (or hand-written) merge. mergeInputTypes() is no longer pure, so a merge can declare names only.
  • registerTypedMergeFilter<Out, Ins...>(name, slotNames, merger) and registerMergeFilter<Out>(name, slotNames, combiner) overloads.
  • AnyMessageFilter::mergeInputNames() (defaults to none); MergeFilter now implements MergeStage.
  • dsl::StageNode::slotNames; toMermaid labels the links with slot names.

Rules

  • Named group + named merge: matched by name. Unknown names (with a did-you-mean) and slots the group doesn't feed are diagnostics.
  • Positional group + named merge: matched by position, as before; the names fix the slot count.
  • A group names all its slots or none; naming slots of a merge that declares none is an error.
  • Type mismatches name the slot: slot 'raw' of 'Merge' expects ....

Both parsers (lexy and the deprecated hand-written one) accept the syntax and still produce identical results.

Docs / tests

README (new "Named slots" section), EXAMPLE.md section 4 + textPipeline demo 3c, CHANGELOG, TODO (item removed, rest renumbered). New NamedSlotTests.cpp, plus parser-agreement cases. All 96 tests pass (MSVC debug, ASan).

A fan-in group can name the slots of a merge, `(raw: msg, checked: valid)
-> Merge`, and is then matched by name, in any order; the merge receives
its slots in the order it declares them. This catches two same-typed
slots wired the wrong way round, which slot types alone cannot.

Merges declare names with MergeStage::mergeInputNames(), or with new
registerTypedMergeFilter / registerMergeFilter overloads taking the
names. Positional groups keep working. Unknown or missing names, partly
named groups and names on a merge without declared names are build-time
diagnostics; toMermaid labels the links with the slot names.

Implements TODO item 1.
@psyinf
psyinf merged commit 056bcba into main Sep 19, 2026
3 checks passed
@psyinf
psyinf deleted the feature/named-merge-slots branch September 19, 2026 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant