Expand description
Cascade engine for propagating mutations through dependent code.
This module provides a generalized system for tracking mutation impacts and automatically generating necessary follow-up changes.
§Overview
When a mutation is applied (e.g., renaming a symbol, adding a field), it can have cascading effects throughout the codebase. The cascade engine:
- Analyzes the impact of a mutation
- Plans the necessary cascade changes
- Executes the changes in the correct order
§Example
ⓘ
use ryo_analysis::cascade::{CascadeEngine, CascadeStrategy};
// Create an engine
let engine = CascadeEngine::new(&graph, ®istry)
.with_strategy(CascadeStrategy::safe());
// Create a mutation spec
let rename = RenameSpec::new(path, "NewName");
// Analyze impacts
let analysis = engine.analyze(&rename);
println!("Affected files: {}", analysis.affected_file_count());
// Generate a plan
let plan = engine.plan(&rename);
// Dry run first
let dry_result = engine.execute(plan.clone(), true);
// Then execute for real
let result = engine.execute(plan, false);§Impact Levels
Mutations are classified by their impact level:
- Local: Changes only affect the same file
- Reference: Changes affect references from other files
- Structural: Changes affect type structure (fields, variants)
- Semantic: Changes affect type behavior (derives, visibility)
§Strategies
The cascade engine supports different strategies for handling various situations:
CascadeStrategy::default()- Balanced approachCascadeStrategy::safe()- Prioritize data protectionCascadeStrategy::aggressive()- Prioritize automationCascadeStrategy::interactive()- Prompt for decisions
Structs§
- Cascade
Analyzer - Cascade分析エンジン
- Cascade
Strategy - Unified cascade strategy combining all individual strategies.
- Impact
Set - Set of impacted symbols for cascade child generation.
Enums§
- Cascade
Spec - Cascade分析結果として生成される変更仕様
- Impact
Level - Impact level classification.
- Visibility
- Visibility レベル