Skip to main content

Module progress

Module progress 

Source
Expand description

Progress feedback infrastructure for debtmap analysis.

This module provides two complementary progress reporting systems:

  1. Effects-based progress (new): ProgressSink trait with HasProgress environment extension for composable, testable progress reporting.

  2. Legacy progress (existing): ProgressManager using indicatif for direct progress bar management.

The effects-based system follows the “Pure Core, Imperative Shell” principle:

use debtmap::effects::progress::{with_stage, traverse_with_progress};
use debtmap::progress::implementations::RecordingProgressSink;

// Pure analysis function wrapped with progress reporting
fn analyze_files(files: Vec<PathBuf>) -> AnalysisEffect<Vec<FileMetrics>> {
    traverse_with_progress(files, "File Analysis", |path| {
        analyze_file_effect(path)
    })
}

// In tests, use RecordingProgressSink to verify behavior
let recorder = Arc::new(RecordingProgressSink::new());
let env = RealEnv::with_progress(config, recorder.clone());
let result = analyze_files(files).run(&env).await?;
assert!(recorder.stages().contains(&"File Analysis".to_string()));

§Progress Sink Implementations

ImplementationUse Case
SilentProgressSinkTesting, CI, benchmarks
CliProgressSinkCommand-line tools
RecordingProgressSinkTest assertions

§Legacy Progress System

The ProgressManager provides direct control over indicatif progress bars. This is still used for TUI integration and will be gradually migrated to the effects-based system.

use debtmap::progress::{ProgressConfig, ProgressManager, TEMPLATE_CALL_GRAPH};

let config = ProgressConfig::from_env(false, 0);
let manager = ProgressManager::new(config);

let progress = manager.create_bar(100, TEMPLATE_CALL_GRAPH);
progress.set_message("Building call graph");

for _i in 0..100 {
    progress.inc(1);
}

progress.finish_with_message("Call graph complete");

§Progress Behavior

  • Quiet Mode: No progress output (respects DEBTMAP_QUIET env var and --quiet flag)
  • Non-TTY: Gracefully disables progress bars in CI and piped output
  • Verbosity Levels:
    • Level 0 (default): Main progress bars only
    • Level 1 (-v): Sub-phase progress and timing
    • Level 2 (-vv): Detailed per-phase metrics

Re-exports§

pub use implementations::CliProgressSink;
pub use implementations::ProgressEvent;
pub use implementations::RecordingProgressSink;
pub use implementations::SilentProgressSink;
pub use traits::HasProgress;
pub use traits::ProgressSink;

Modules§

implementations
Progress sink implementations for different output modes.
traits
Progress sink trait definitions for effects-based progress reporting.

Structs§

ProgressConfig
Configuration for progress display behavior
ProgressManager
Centralized progress manager for coordinating multiple progress bars

Constants§

TEMPLATE_CALL_GRAPH
TEMPLATE_COVERAGE
TEMPLATE_FILE_ANALYSIS
TEMPLATE_FUNCTION_ANALYSIS
TEMPLATE_SPINNER
TEMPLATE_TRAIT_RESOLUTION