Skip to content

Phase 8 — Advanced Simulation Layer (Latency, Jitter & Failure Injection)

Latest

Choose a tag to compare

@Maatify Maatify released this 23 Nov 08:49
· 3 commits to main since this release

📝 Release Notes — Phase 8: Advanced Simulation Layer

This release introduces the full Advanced Simulation Layer, enabling deterministic latency, jitter, and controlled failure injection across all fake adapters.
It is designed for CI pipelines, stress testing, resilience verification, and edge-case simulation inside the Maatify ecosystem.


🚀 New in This Release

⚡ Simulation Core

ErrorSimulator

A fully deterministic failure-injection engine.

  • Register per-operation failure scenarios
  • Probability-based triggering
  • Custom exception class, message, and code
  • Perfect for testing retry logic and error-handling flows

LatencySimulator

Provides reproducible latency simulation.

  • Default latency for all operations
  • Operation-specific latencies (e.g., mysql.select)
  • Optional jitter for more realistic delays
  • Returns final applied latency for assertions

FailureScenario

Immutable failure configuration.

  • Name
  • Probability (0–1)
  • Exception class
  • Message
  • Error code

🧩 Adapter Integration

🔹 Simulation Hooks (SimulationAwareTrait)

A new trait used internally by all fake adapters:

  • setLatencySimulator()
  • setErrorSimulator()
  • guardOperation() (applies latency + failure)

🔹 Updated Fake Adapters

All adapters now support optional latency & error simulation:

  • FakeMySQLAdapter
  • FakeMongoAdapter
  • FakeRedisAdapter

🔹 Storage Enhancements

FakeStorageLayer now accepts latency simulation for storage-level operation delays.


🧪 Tests

  • Added ErrorSimulatorTest verifying deterministic failure triggering
  • Added latency behavior tests in MySQL/Mongo/Redis adapter suites
  • Full coverage for scenario registration, jitter handling, and timing correctness

📚 Documentation

  • Added README.phase8.md
  • Updated README.full.md
  • Updated main README.md with new Simulation Layer section
  • Updated Phase documentation references

🧱 Summary

Phase 8 delivers a complete CI-friendly simulation engine that makes it possible to test:

  • Timeouts
  • Slow queries
  • Random outages
  • Exception paths
  • Retry behavior
  • Multi-adapter latency variance

—all without real infrastructure or non-deterministic chaos.