Skip to content

Improve test coverage to 70% and restore deployment threshold #115

@mottych

Description

@mottych

Overview

Current test coverage is at 64.55%, which is below our target of 70%. The deployment workflow threshold was temporarily lowered to 60% to unblock deployments. This issue tracks the work needed to improve coverage and restore the proper quality gate.

Background

  • Commits: 91b31d3, e9fe543
  • Previous Coverage: 44% (only 376/878 tests were running due to marker filter)
  • Current Coverage: 64.55% (all 878 tests now running)
  • Target Coverage: 70%
  • Gap: 5.45% additional coverage needed

Low Coverage Areas

Based on the latest coverage report, these modules need additional tests:

Critical (0-20% coverage)

  • coaching/src/scripts/seed_coaching_topics.py - 0%
  • coaching/src/scripts/seed_topics.py - 0%
  • coaching/src/scripts/verify_coaching_topics.py - 0%
  • coaching/src/services/model_config_service.py - 15%
  • coaching/src/services/llm_service_adapter.py - 20%
  • coaching/src/workflows/orchestrator.py - 23%

Medium Priority (30-60% coverage)

  • coaching/src/services/cache_service.py - 33%
  • coaching/src/repositories/conversation_repository.py - 43%
  • coaching/src/services/prompt_service.py - 66%
  • coaching/src/workflows/analysis_workflow.py - 69%

Tasks

  • Add unit tests for script modules (seed_coaching_topics, seed_topics, verify_coaching_topics)
  • Add tests for model_config_service (currently 15%)
  • Add tests for llm_service_adapter (currently 20%)
  • Add tests for workflows/orchestrator (currently 23%)
  • Add tests for cache_service (currently 33%)
  • Add tests for conversation_repository (currently 43%)
  • Improve prompt_service tests to reach 70%+
  • Improve analysis_workflow tests to reach 70%+
  • Restore deployment workflow threshold from 60% to 70%
  • Update CI workflow to match if needed

Acceptance Criteria

  • Overall test coverage reaches 70% or higher
  • All critical modules (0-20%) reach at least 60% coverage
  • Deployment workflow threshold restored to --cov-fail-under=70
  • All tests passing in CI
  • Coverage report shows improvement across targeted modules

Implementation Notes

Scripts Coverage

Scripts in coaching/src/scripts/ are currently untested but contain important logic. Consider:

  • Creating fixtures for database/S3 mocking
  • Testing seed data generation
  • Testing validation logic

Service Layer Coverage

Focus on:

  • Happy path scenarios
  • Error handling
  • Edge cases (empty inputs, missing data)
  • Integration points (mocking external dependencies)

Workflow Coverage

  • Test state transitions
  • Test error handling in nodes
  • Mock LLM responses appropriately

Related Files

  • .github/workflows/deploy-dev.yml - Deployment workflow with coverage threshold
  • .github/workflows/ci.yml - CI workflow
  • coaching/tests/unit/ - Unit test directory

Priority

High - This blocks us from enforcing proper quality gates on deployments. While deployments are working, we need to restore the 70% threshold to maintain code quality standards.

Labels

enhancement, testing, technical-debt, quality


Note: The temporary 60% threshold was set in commit 91b31d3 to unblock deployment after fixing MyPy errors. This should be considered a temporary measure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions