test: add unit tests for FrameTracer and DivergenceDetector (#208)#221
Open
acailic wants to merge 5 commits into
Open
test: add unit tests for FrameTracer and DivergenceDetector (#208)#221acailic wants to merge 5 commits into
acailic wants to merge 5 commits into
Conversation
- Extract StrEnum 3.10 compat shim into agent_debugger_sdk.core._compat (removed 7 duplicate copies from core modules) - Fix duplicate CoordinationIssue in core/__init__.py __all__ - Add composite indexes: events(session_id,timestamp), events(tenant_id,event_type), events(tenant_id,timestamp), sessions(tenant_id,started_at), checkpoints(session_id,sequence) - Add session-scoped shared_app fixture in conftest.py replacing module-level _shared_app in 7 test files - Enable pyright type checking in CI (remove || true, add --ignoreexternal) - Create CHANGELOG.md 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
- api/schemas.py → re-export facade for backward compatibility - api/schemas_core.py: sessions, events, checkpoints, traces, API keys - api/schemas_alerts.py: anomaly alerts, alert policies, fix notes - api/schemas_analysis.py: workflow, safety, redundancy, causal, drift, baseline 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
- Move test_collector_*.py → tests/collector/ - Move test_research_*.py → tests/research/ - Move test_alert_*.py → tests/alerts/ - Move test_e2e_*.py, test_phase2_*.py → tests/integration/ - Add frontend/src/utils/logger.ts centralized logging utility - Replace 30+ raw console.log/warn/error with logger in 14 files - Add deprecation note to core/__init__.py barrel module 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
…ks, docs - Add /api/version endpoint for API contract versioning - Add frontend/src/api/httpClient.ts typed fetch wrapper - Add tests/contract/test_schema_alignment.py (Session + TraceEvent fields) - Add agent_debugger_sdk/telemetry/ OpenTelemetry integration (opt-in) - Add tests/test_performance_regression.py (app startup, serialization, queries) - Add TraceEventSchema documentation explaining flat-union pattern - Add redaction/ module documentation - Add frontend/src/utils/d3.ts typed D3 wrapper for visualization - Add core/__init__.py barrel deprecation note 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Closes #208 Adds 117 unit tests covering previously-uncovered modules: - tests/sdk/core/test_frame_tracer.py: TokenUsage, ExceptionInfo, FrameEvent, FrameCost, FrameLifetimeTrace, build_frame_tree, get_frame_by_id, get_frames_at_depth, filter_frames_by_name, get_cost_breakdown, FrameCaptureContext, capture_function_call decorator (including nested calls, exception capture, arg/return capture control), _serialize_value, to_dict/from_dict round-trips, global context helpers. - tests/sdk/core/test_divergence_detector.py: DivergencePoint, SessionComparison, detect_divergences (empty, same, count diff, checkpoint state), compare_session_structures, analyze_temporal_ divergence, analyze_behavioral_divergence, and all internal helpers (_build_event_tree, _max_tree_depth, _avg_branching_factor, _get_event_distribution, _calculate_structural_similarity, _calculate_session_duration, _compare_decision_patterns, _compare_tool_usage, _count_divergences_by_type, _pair_checkpoints_by_sequence, _compare_checkpoint_states, _severity_for_count_difference, _severity_for_timing_difference). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
frame_tracer.pyanddivergence_detector.pyFiles added
tests/sdk/core/test_frame_tracer.py— coversTokenUsage,ExceptionInfo,FrameEvent,FrameCost,FrameLifetimeTrace,build_frame_tree,get_frame_by_id,get_frames_at_depth,filter_frames_by_name,get_cost_breakdown,FrameCaptureContext,capture_function_calldecorator (nested calls, exception capture, arg/return control, no-context passthrough),_serialize_value,to_dict/from_dictround-trips, global context helperstests/sdk/core/test_divergence_detector.py— coversDivergencePoint,SessionComparison,detect_divergences(empty, same events, count diff, checkpoint state divergence),compare_session_structures,analyze_temporal_divergence,analyze_behavioral_divergence, and all internal helpers (_build_event_tree,_max_tree_depth,_avg_branching_factor,_get_event_distribution,_calculate_structural_similarity,_calculate_session_duration,_compare_decision_patterns,_compare_tool_usage,_count_divergences_by_type,_pair_checkpoints_by_sequence,_compare_checkpoint_states, severity helpers)Test plan
python3 -m pytest tests/sdk/core/test_frame_tracer.py tests/sdk/core/test_divergence_detector.py -v→ 117 passed in 0.65sruff check→ 0 errors🤖 Generated with Claude Code