Skip to content

Add comprehensive test implementations for core SDK features - #567

Open
uchechithelmaonye-cpu wants to merge 4 commits into
Stellar-split:mainfrom
uchechithelmaonye-cpu:feature/add-core-feature-tests
Open

Add comprehensive test implementations for core SDK features#567
uchechithelmaonye-cpu wants to merge 4 commits into
Stellar-split:mainfrom
uchechithelmaonye-cpu:feature/add-core-feature-tests

Conversation

@uchechithelmaonye-cpu

Copy link
Copy Markdown

Summary

This PR adds comprehensive test implementations for four critical SDK features that enable performance monitoring, dependency management, schema compatibility, and SLA tracking:

All tests follow the acceptance criteria from each issue and provide comprehensive coverage of happy paths, edge cases, and error scenarios.

Test Implementation Details

PerformanceProfiler (src/profiling/tests/PerformanceProfiler.test.ts)

  • Proxy-based method interception with per-call timing
  • Call count, total duration, average, and percentile latency tracking
  • Flamegraph-compatible JSON export with method aggregation
  • Ring buffer with configurable depth and overflow handling
  • Error path profiling and reattach support

DependencyCycleBreaker (src/graph/tests/DependencyCycleBreaker.test.ts)

  • Simple (A→B→A) and complex (A→B→C→A) cycle detection
  • Topological sort validation with Kahn's algorithm
  • Disconnected subgraph analysis
  • Self-referencing and missing dependency edge cases

SchemaMigrationLayer (src/migration/tests/SchemaMigrationLayer.test.ts)

  • Version matching and default version 1 handling
  • Single and multi-step migration chains
  • NoMigrationPathError for unreachable versions
  • Data preservation through migration pipelines
  • Alternative path exploration in migration DAGs

SlaBreachDetector (src/sla/tests/SlaBreachDetector.test.ts)

  • Event emission at configurable thresholds (warn, critical, breached)
  • Idempotent event emission (each fires exactly once per window)
  • Multi-invoice tracking with independent SLA windows
  • Status tracking with time-to-next-threshold calculation
  • Global and per-invoice configuration override

Testing Approach

All tests use Vitest with:

  • Fake timers for deterministic SLA testing
  • Mocked clients for profiler interception testing
  • Comprehensive edge case coverage (empty states, missing data, cycles, etc.)
  • No external dependencies or fixture files

Closes #463
Closes #462
Closes #461
Closes #460

Adds comprehensive test suite for SlaBreachDetector with:
- Event emission at configurable warn, critical, and breached thresholds
- Idempotent event emission (each event fires exactly once per threshold)
- Multi-invoice tracking with independent SLA windows
- Status tracking with time-until-next-threshold calculation
- Global and per-invoice config overrides
- Proper cleanup with untrack() stopping further events

Closes Stellar-split#460
Adds comprehensive test suite for SchemaMigrationLayer with:
- Version matching and no-op returns for current version
- Default version 1 when __schemaVersion is missing
- Single and multi-step migration chains (v1→v2→v3)
- Rejection with NoMigrationPathError for unreachable versions
- Complex migrations for Payment and Recipient types
- Direct version jumps and alternative migration paths
- Proper __schemaVersion removal from final results
- Migration order verification and data preservation

Closes Stellar-split#461
Adds comprehensive test suite for DependencyCycleBreaker with:
- Detection of simple (A→B→A) and longer (A→B→C→A) cycles
- Validation of acyclic linear chains and fan-out dependencies
- Topological sort correctness using Kahn's algorithm
- Disconnected subgraph analysis with independent cycle detection
- Cycle detection in partial graphs while processing others
- Self-referencing cycles and edge cases
- Proper handling of missing prerequisites
- Consistent results across multiple invocations

Closes Stellar-split#462
Adds comprehensive test suite for PerformanceProfiler with:
- Proxy-based method interception with high-resolution timing
- Call count, total duration, and average latency tracking
- Percentile latency computation (p50, p95, p99)
- Flamegraph-compatible JSON export with tree aggregation
- Ring buffer management with configurable depth
- Proper detach() behavior preserving buffered data
- Error handling in profiled methods
- Argument summarization for logging
- Reattach support after detach
- Concurrent method tracking across 100+ calls

Closes Stellar-split#463
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@uchechithelmaonye-cpu Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant