Skip to main content

Module cascade

Module cascade 

Source
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:

  1. Analyzes the impact of a mutation
  2. Plans the necessary cascade changes
  3. Executes the changes in the correct order

§Example

use ryo_analysis::cascade::{CascadeEngine, CascadeStrategy};

// Create an engine
let engine = CascadeEngine::new(&graph, &registry)
    .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 approach
  • CascadeStrategy::safe() - Prioritize data protection
  • CascadeStrategy::aggressive() - Prioritize automation
  • CascadeStrategy::interactive() - Prompt for decisions

Structs§

CascadeAnalyzer
Cascade分析エンジン
CascadeStrategy
Unified cascade strategy combining all individual strategies.
ImpactSet
Set of impacted symbols for cascade child generation.

Enums§

CascadeSpec
Cascade分析結果として生成される変更仕様
ImpactLevel
Impact level classification.
Visibility
Visibility レベル