issue-4: added validation func, test case, updated README - #87
issue-4: added validation func, test case, updated README#87AnimeshRajwar wants to merge 2 commits into
Conversation
|
Thanks for this — the intent is right, and #4 is a real gap. But as written this PR removes two guarantees that are currently in 1. It deletes the runtime safety net. - self._check_mapping(source, router, mapping)
- self._graph.add_conditional_edges(
- source, self._checked_router(source, router, mapping), mapping
- )
+ self._validate_conditional_edge(source, router, mapping)
+ self._graph.add_conditional_edges(source, router, mapping)
2. The
from __future__ import annotations
import inspect
from typing import Literal, get_origin, get_type_hints
def router(state) -> Literal["a", "b"]: ...
inspect.signature(router).return_annotation # "Literal['a', 'b']" -> get_origin(...) is Literal: False
get_type_hints(router).get("return") # typing.Literal['a', 'b'] -> get_origin(...) is Literal: TrueSo the Literal/Enum arm falls through to 3. The declaration-time checks already exist. The PR is also What would land happily: the test file. 🤖 Generated with Claude Code |
Closes #4
added:
the error raised on unknown node, mentions source and bad node.