Problem
Two classes in agent_debugger_sdk/core/exporters/ have zero test coverage:
InsightBuilder (agent_debugger_sdk/core/exporters/insights.py) — builds TraceInsight from session data, analysis, and entity extraction
MemoryExporterHook (agent_debugger_sdk/core/exporters/pipeline.py) — async hook that drives InsightBuilder and calls exporter.export() on session end
Neither class is referenced anywhere in tests/. The existing test_memory_exporters.py covers the exporter schemas and file exporter but not the insight building or pipeline hook logic.
Scope
Add unit tests covering:
InsightBuilder
build_insight() returns a valid TraceInsight with correct session_digest, failure_patterns, entity_summaries, and metadata
_build_session_digest() maps session fields correctly
_build_failure_patterns() sorts by count descending, caps at 20, extracts error types from fingerprints
_build_entity_summaries() returns empty list on None, maps entity types, caps top_entities at 5
MemoryExporterHook
on_session_end() does nothing when exporter is None
on_session_end() skips export when export_on_completion=True and session is not completed
on_session_end() calls exporter.export() when session is completed
on_session_end() always exports when export_on_update=True regardless of status
on_session_end() swallows exceptions from exporter (logs error, does not raise)
create_memory_exporter_hook() returns a MemoryExporterHook with correct config
Files to create
tests/test_insight_builder.py
Labels
auto-work
Problem
Two classes in
agent_debugger_sdk/core/exporters/have zero test coverage:InsightBuilder(agent_debugger_sdk/core/exporters/insights.py) — buildsTraceInsightfrom session data, analysis, and entity extractionMemoryExporterHook(agent_debugger_sdk/core/exporters/pipeline.py) — async hook that drivesInsightBuilderand callsexporter.export()on session endNeither class is referenced anywhere in
tests/. The existingtest_memory_exporters.pycovers the exporter schemas and file exporter but not the insight building or pipeline hook logic.Scope
Add unit tests covering:
InsightBuilder
build_insight()returns a validTraceInsightwith correctsession_digest,failure_patterns,entity_summaries, andmetadata_build_session_digest()maps session fields correctly_build_failure_patterns()sorts by count descending, caps at 20, extracts error types from fingerprints_build_entity_summaries()returns empty list onNone, maps entity types, caps top_entities at 5MemoryExporterHook
on_session_end()does nothing whenexporter is Noneon_session_end()skips export whenexport_on_completion=Trueand session is not completedon_session_end()callsexporter.export()when session is completedon_session_end()always exports whenexport_on_update=Trueregardless of statuson_session_end()swallows exceptions from exporter (logs error, does not raise)create_memory_exporter_hook()returns aMemoryExporterHookwith correct configFiles to create
tests/test_insight_builder.pyLabels
auto-work