Simulation Command
Simulate the impact of code changes
Simulation Command
The arc sim
command allows you to simulate the potential impact of code changes before merging them. It analyzes your changes, runs tests in a sandbox environment, and provides insights into how they might affect your system.
Usage
Subcommands
run
Run a simulation on the current changes.
history
Show the history of previous simulations.
show
Show details of a specific simulation.
Options for run
Option | Description |
---|---|
--scenario <scenario> | Simulation scenario to run (default: all) |
--diff <diff_path> | Path to a diff file to simulate (default: current changes) |
--branch <branch> | Branch to compare against (default: main) |
--sandbox <type> | Sandbox type: local, docker, e2b (default: local) |
--memory | Use memory from previous simulations to improve results |
--output <format> | Output format: text, json, markdown (default: text) |
--save <path> | Save simulation results to a file |
--debug | Enable debug mode |
Options for history
Option | Description |
---|---|
--limit <n> | Limit the number of results (default: 10) |
--format <format> | Output format: text, json, table (default: table) |
--service <service> | Filter by affected service |
--scenario <scenario> | Filter by scenario |
--risk <min>..<max> | Filter by risk score range |
Simulation Scenarios
Arc Memory supports the following simulation scenarios:
Scenario | Description |
---|---|
network_latency | Simulates the impact on network latency |
memory_usage | Simulates the impact on memory usage |
cpu_usage | Simulates the impact on CPU usage |
disk_io | Simulates the impact on disk I/O |
error_rates | Simulates the impact on error rates |
security | Analyzes potential security implications |
dependencies | Analyzes impact on dependencies |
all | Runs all available scenarios |
Examples
Basic Simulation
This will run a simulation on your current changes against the main branch.
Specific Scenario
This will run only the network latency simulation.
Using a Different Branch
This will compare your changes against the develop branch.
Using Memory
This will use insights from previous simulations to improve the results.
Viewing Simulation History
This will show a table of your recent simulations.
Filtering History
This will show only simulations that affected the auth-service and ran the network_latency scenario.
Viewing Specific Simulation
This will show detailed results for the simulation with ID sim_abc123.
Output Format
The simulation results include:
- Summary: An overview of the simulation, including risk score and affected services
- Detailed Analysis: In-depth analysis of potential impacts
- Metrics: Quantitative metrics showing predicted changes
- Recommendations: Suggestions for mitigating potential issues
Example output:
Sandbox Environments
Arc Memory supports different sandbox environments for running simulations:
Environment | Description |
---|---|
local | Runs in a local sandbox with limited isolation |
docker | Runs in a Docker container for better isolation |
e2b | Runs in an E2B cloud sandbox for maximum isolation and reproducibility |
Troubleshooting
Simulation Fails to Start
If the simulation fails to start:
- Check if you have the necessary permissions
- Verify that the sandbox environment is properly configured
- Check if there are any syntax errors in your changes
- Run with
--debug
for more detailed error information
Inaccurate Results
If you believe the simulation results are inaccurate:
- Try running with a different sandbox environment
- Ensure your local environment has all dependencies installed
- Run with
--memory
to leverage insights from previous simulations - Check if the test coverage is sufficient for your changes
See Also
- Simulation Examples - For more examples of using the simulation feature
- Memory Integration - For information on how memory is used in simulations
- Simulation Improvements - For details on recent improvements to the simulation feature