Skip to content

test: add unit tests for FrameTracer and DivergenceDetector (zero coverage) #208

@acailic

Description

@acailic

Problem

agent_debugger_sdk/core/frame_tracer.py (603 lines) and agent_debugger_sdk/core/divergence_detector.py (730 lines) have zero test coverage.

These are substantial modules implementing:

  • FrameTracer: function-level tracing, frame lifetime capture, call tree building, cost analysis (ADI / FSE 2026)
  • DivergenceDetector: structural, temporal, behavioral, state, and performance divergence detection between sessions

Every other research module (ConformalScorer, CausalTracer, ErrorAttribution, SafetyMonitor, RedundancyScorer) has tests in tests/test_research_features.py. These two do not.

Scope

Add a new test file tests/test_frame_tracer_divergence.py (or extend test_research_features.py) covering:

FrameTracer

  • TokenUsage arithmetic and serialization
  • FrameEvent dataclass and to_dict()
  • FrameLifetimeTrace construction
  • FrameTracer.trace() decorator/context manager
  • Call tree building and cost breakdown

DivergenceDetector

  • DivergenceType / DivergenceSeverity enum values
  • DivergencePoint dataclass and to_dict()
  • detect_divergences() with matching and diverging event lists
  • compare_session_structures()
  • analyze_temporal_divergence()
  • analyze_behavioral_divergence()

Validation

.venv-ci/bin/python3 -m pytest -q tests/test_frame_tracer_divergence.py
.venv-ci/bin/ruff check .

Labels

  • enhancement, test

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions