Simulation Examples
This page provides examples of how to use Arc Memory’s simulation feature to predict the impact of code changes before merging them. The simulation feature helps you understand potential risks and make more informed decisions.Basic Simulation
The simplest way to run a simulation is to use thearc sim run
command with no options:
- Analyze your current uncommitted changes
- Compare them against the main branch
- Run all available simulation scenarios
- Provide a risk assessment and detailed analysis
Simulation Scenarios
Arc Memory supports various simulation scenarios to analyze different aspects of your changes:Network Latency Simulation
- API response times
- Service-to-service communication
- Database query performance
Memory Usage Simulation
- Memory allocation patterns
- Potential memory leaks
- Garbage collection impact
CPU Usage Simulation
- Computational complexity
- Concurrency patterns
- Resource contention
Error Rates Simulation
- Exception handling
- Error propagation
- Failure modes
Security Simulation
- Input validation
- Authentication/authorization
- Data exposure risks
Advanced Simulation Options
Using a Specific Diff
You can run a simulation on a specific diff file instead of your current changes:- Analyzing changes from a colleague
- Evaluating historical changes
- Testing hypothetical changes
Comparing Against a Different Branch
By default, simulations compare against the main branch. You can specify a different branch:- Feature branch development
- Release branch validation
- Experimental changes
Using Different Sandbox Environments
Arc Memory supports different sandbox environments for running simulations:local
: Fastest but least isolateddocker
: Good balance of speed and isolatione2b
: Most isolated and reproducible, but requires internet connection
Using Memory to Improve Results
Arc Memory can use insights from previous simulations to improve results:- More accurate risk assessments based on historical patterns
- Contextual recommendations based on similar past changes
- Improved explanation quality with relevant historical context
Working with Simulation History
Viewing Simulation History
To view your recent simulations:Filtering Simulation History
You can filter the history by various criteria:Viewing Detailed Simulation Results
To view detailed results for a specific simulation:- Summary information
- Detailed impact analysis
- Metrics and predictions
- Recommendations
Programmatic Simulation
You can also run simulations programmatically using the SDK:CI/CD Integration
You can integrate simulations into your CI/CD pipeline:Best Practices
- Run simulations early and often during development to catch issues early
- Use the appropriate sandbox for your needs (local for speed, e2b for isolation)
- Enable memory to improve simulation accuracy over time
- Integrate with CI/CD to automate simulation on pull requests
- Review simulation history to identify patterns and trends
- Use multiple scenarios to get a comprehensive view of potential impacts
Troubleshooting
Simulation Fails to Start
If the simulation fails to start:Inaccurate Results
If you believe the simulation results are inaccurate:See Also
- Simulation Command - For detailed command documentation
- Memory Integration - For information on how memory is used in simulations
- Simulation Improvements - For details on recent improvements to the simulation feature