Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Expose chaos engineering mode via CLI flags #17

@noahgift

Description

@noahgift

Feature Request

The chaos module exists in the library but is not exposed via CLI flags. Add CLI support for chaos testing.

Current State

// src/chaos.rs exists with:
pub struct ChaosConfig {
    pub memory_limit: usize,
    pub cpu_limit: f64,
    pub timeout: Duration,
    pub signal_injection: bool,
    // ... network and byzantine features behind feature flags
}

But renacer --help shows no chaos-related flags.

Proposed CLI Flags

# Basic chaos
renacer --chaos-memory-limit 64M -- ./target/debug/my-app
renacer --chaos-cpu-limit 0.5 -- ./target/debug/my-app
renacer --chaos-timeout 10s -- ./target/debug/my-app
renacer --chaos-signals -- ./target/debug/my-app

# Presets
renacer --chaos gentle -- ./target/debug/my-app
renacer --chaos aggressive -- ./target/debug/my-app

# Combined with tracing
renacer -c --chaos aggressive -- aprender-shell suggest "git "

Use Cases

  1. Robustness testing - Find crashes under resource pressure
  2. Timeout validation - Ensure graceful handling of slow operations
  3. Memory leak detection - Limit memory and observe behavior
  4. CI integration - Run tests with chaos to find edge cases

Example Session

$ renacer --chaos aggressive -c -- aprender-shell suggest "git "
⚠️  Chaos mode enabled: memory=64MB, cpu=25%, timeout=10s, signals=on

git status  1.000

% time     seconds  usecs/call     calls    errors syscall
...

🔴 Chaos events:
  - Memory limit reached at 58MB (92% of limit)
  - 2 SIGALRM signals injected and handled
  - Execution completed in 8.2s (under 10s timeout)

Implementation Notes

  • Use ChaosConfig::gentle() and ChaosConfig::aggressive() presets
  • Wire up to clap args in main.rs
  • Apply limits via setrlimit for memory/cpu
  • Signal injection via kill(pid, signal) at random intervals

Related

  • Useful for testing aprender-shell robustness (#89 in aprender)
  • Extends existing anomaly detection with fault injection

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions