Skip to content

Implement Unit Tests and LangFuse Integration #173

@Haydart

Description

@Haydart

Task 010: Implement Unit Tests and LangFuse Integration

Description

Create comprehensive unit tests for all components and integrate LangFuse observability for LLM monitoring.

Acceptance Criteria

  • Create tests/unit/domain/model/test_trend_models.py for all Pydantic models
  • Create tests/unit/services/test_simple_firebase_service_trends.py for Firebase methods
  • Create tests/unit/services/test_trend_cache.py for cache service
  • Create tests/unit/domain/processor/stages/test_trend_classification_stage.py
  • Create tests/unit/domain/processor/stages/test_new_trend_creation_stage.py
  • Create tests/unit/domain/processor/stages/test_trend_action_stage.py
  • Create tests/unit/domain/processor/test_trend_detection_processor.py
  • Create tests/unit/domain/executor/test_trend_firebase_executor.py
  • Integrate LangFuse in TrendClassificationStage (follow existing pattern)
  • Integrate LangFuse in NewTrendCreationStage (follow existing pattern)
  • Mock LLM responses at HTTP layer (not service layer)
  • All tests pass with pytest
  • LangFuse tracks classification latency, token usage, costs

Technical Details

  • Test location: tests/unit/
  • Use existing test patterns from codebase
  • Mock Firebase at client level, not service level
  • Mock LLM at HTTP layer (litellm library level)
  • No mock services - test real service logic
  • Verbose tests for debugging capability
  • LangFuse integration: copy pattern from existing LLM usage
  • Track: model name, latency, input/output tokens, cost per call

Effort Estimate

  • Size: L
  • Hours: 12-16
  • Parallel: false (depends on all implementation tasks)

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:trendsTrend Detection System EpictaskImplementation task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions