Skip to content

Deepen KnowledgeInteractionContext: move binding dispatch into the context #20

@DaviddeBest-TNO

Description

@DaviddeBest-TNO

Problem

KnowledgeInteractionContext introspects the handler signature to find validation_model and serialization_model, but then does nothing with them. The apply-them logic is duplicated verbatim across three methods in KnowledgeBase: call(), ask(), and post(). Each one independently does: "if serialization_model, convert inputs; call the operation; if validation_model, convert outputs."

The module that holds the knowledge about binding models doesn't use it — it's a shallow data-bag.

Proposed solution

Give KnowledgeInteractionContext a dispatch(binding_set) -> BindingSet method (for incoming ANSWER/REACT calls) and prepare_outgoing / parse_result helpers (for ASK/POST calls). call(), ask(), and post() on KnowledgeBase become single-line delegations.

Benefits

  • All binding-model handling concentrates in one place (locality).
  • Tests can target the dispatch logic directly, independent of the KB lifecycle.
  • KnowledgeBase sheds ~40 lines of repeated conversion logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions