Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/conformance/harness/expectations.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,21 @@ def _discriminate_expected(
blocks themselves don't know that, so we discriminate on the keys
that ARE distinctive and fall back to graph-engine for plain
``final_state``-only fixtures.

Pydantic invokes this callable on both the validation and
serialization paths. On serialization the value is already one of the
concrete variants, so route by ``isinstance`` first; otherwise the
dump path falls through to ``graph_engine`` and warns that the
serialized variant doesn't match the union's first arm.
"""
if isinstance(value, GraphEngineExpected):
return "graph_engine"
if isinstance(value, LlmProviderExpected):
return "llm_provider"
if isinstance(value, PipelineUtilitiesExpected):
return "pipeline_utilities"
if isinstance(value, ObservabilityExpected):
return "observability"
if not isinstance(value, dict):
return "graph_engine"
keys: set[str] = {str(k) for k in cast("dict[str, Any]", value)}
Expand Down
10 changes: 10 additions & 0 deletions tests/conformance/harness/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,17 @@ def _discriminate_fixture(value: Any) -> Literal["llm_provider", "cases", "graph
llm-provider fixtures (e.g. 003-message-validation) have BOTH —
``mock_provider`` is the load-bearing discriminator, ``cases`` is just
the table style for sub-cases.

Also handle the serialization path (where the value is a concrete
variant) so a future ``model_dump`` through the top-level union
doesn't fall through to ``graph`` and warn.
"""
if isinstance(value, LlmProviderFixture):
return "llm_provider"
if isinstance(value, CasesFixture):
return "cases"
if isinstance(value, GraphFixture):
return "graph"
if isinstance(value, dict):
if "mock_provider" in value:
return "llm_provider"
Expand Down
Loading