Skip to main content

ralph_workflow/checkpoint/
file_state.rs

1//! File system state capture and validation for checkpoints.
2//!
3//! This module provides functionality for capturing and validating state
4//! of key files in repository to enable idempotent recovery.
5
6use crate::checkpoint::execution_history::FileSnapshot;
7use crate::executor::{ProcessExecutor, RealProcessExecutor};
8use crate::workspace::Workspace;
9use serde::{Deserialize, Serialize};
10use std::collections::HashMap;
11use std::path::Path;
12
13/// File system state snapshot for key files.
14///
15/// Captures the state of important files that affect pipeline execution.
16/// This enables validation on resume to detect unexpected changes.
17#[derive(Debug, Clone, Serialize, Deserialize, Default)]
18pub struct FileSystemState {
19    /// Snapshots of tracked files
20    pub files: HashMap<String, FileSnapshot>,
21    /// Git HEAD commit OID (if available)
22    pub git_head_oid: Option<String>,
23    /// Git branch name (if available)
24    pub git_branch: Option<String>,
25    /// Git status output (porcelain format) for tracking staged/unstaged changes
26    pub git_status: Option<String>,
27    /// List of modified files from git diff
28    pub git_modified_files: Option<Vec<String>>,
29}
30
31include!("file_state/capture.rs");
32include!("file_state/validation.rs");
33include!("file_state/error.rs");
34include!("file_state/recovery.rs");
35
36#[cfg(test)]
37include!("file_state/tests.rs");