Skip to main content

Module analyzer

Module analyzer 

Source
Expand description

Core incremental analysis coordinator (Phase 4.1).

This module implements the IncrementalAnalyzer, the main entry point for incremental code analysis. It coordinates:

  • Change detection via content-addressed fingerprinting (Blake3)
  • Dependency invalidation using BFS graph traversal
  • Reanalysis orchestration with topological sorting
  • Storage persistence for session continuity

§Performance Target

<10ms incremental update overhead (Constitutional Principle VI) achieved through content-addressed caching with >90% hit rate.

§Usage Example

use thread_flow::incremental::analyzer::IncrementalAnalyzer;
use thread_flow::incremental::storage::InMemoryStorage;

#[tokio::main]
async fn main() {
    let storage = Box::new(InMemoryStorage::new());
    let mut analyzer = IncrementalAnalyzer::new(storage);

    // Analyze changes
    let result = analyzer.analyze_changes(&[
        PathBuf::from("src/main.rs"),
        PathBuf::from("src/utils.rs"),
    ]).await.unwrap();

    // Invalidate affected files
    let affected = analyzer.invalidate_dependents(&result.changed_files).await.unwrap();

    // Reanalyze invalidated files
    analyzer.reanalyze_invalidated(&affected).await.unwrap();
}

Structs§

AnalysisResult
Result of an incremental analysis operation.
IncrementalAnalyzer
Core incremental analysis coordinator.

Enums§

AnalyzerError
Errors that can occur during incremental analysis.