Additional agent DAG tests (#750)

- test_agent_provenance.py: test_session_parent_uri,
  test_session_no_parent_uri, and 6 synthesis tests (types,
  single/multiple parents, document, label)
- test_on_action_callback.py: 3 tests — fires before tool, skipped
  for Final, works when None
- test_callback_message_id.py: 7 tests — message_id on think/observe/
  answer callbacks (streaming + non-streaming) and
  send_final_response
- test_parse_chunk_message_id.py (5 tests) - _parse_chunk propagates
  message_id for thought, observation, answer; handles missing
  gracefully
- test_explainability_parsing.py (+1) -
  test_dispatches_analysis_with_tooluse - Analysis+ToolUse mixin still
  dispatches to Analysis
- test_explainability.py (+1) -
  test_observation_found_via_subtrace_synthesis
- chain walker follows from sub-trace Synthesis to find Observation
  and
  Conclusion in correct order
- test_agent_provenance.py (+8) - session parent_uri (2), synthesis
  single/multiple parents, types, document, label (6)
This commit is contained in:
cybermaggedon 2026-04-01 13:59:34 +01:00 committed by Cyber MacGeddon
parent 3ba6a3238f
commit dbf8daa74a
7 changed files with 733 additions and 1 deletions

View file

@ -22,6 +22,7 @@ from trustgraph.api.explainability import (
TG_SYNTHESIS,
TG_ANSWER_TYPE,
TG_OBSERVATION_TYPE,
TG_TOOL_USE,
TG_ANALYSIS,
TG_CONCLUSION,
TG_DOCUMENT,
@ -76,6 +77,13 @@ class TestFromTriplesDispatch:
entity = ExplainEntity.from_triples("urn:a", triples)
assert isinstance(entity, Analysis)
def test_dispatches_analysis_with_tooluse(self):
"""Analysis+ToolUse mixin still dispatches to Analysis."""
triples = _make_triples("urn:a",
[PROV_ENTITY, TG_ANALYSIS, TG_TOOL_USE])
entity = ExplainEntity.from_triples("urn:a", triples)
assert isinstance(entity, Analysis)
def test_dispatches_observation(self):
triples = _make_triples("urn:o", [PROV_ENTITY, TG_OBSERVATION_TYPE])
entity = ExplainEntity.from_triples("urn:o", triples)