pub struct FeatureState {
pub feature: FeatureInfo,
pub status: FeatureStatus,
pub current_phase: u32,
pub git: GitInfo,
pub phases: Vec<PhaseRecord>,
pub pr: Option<PrInfo>,
pub total: TotalStats,
}Expand description
Complete state of a feature’s execution, persisted to state.yml.
Tracks the progress of a feature through all execution phases, enabling crash recovery by resuming from the last completed phase.
§Examples
use coda_core::state::{FeatureState, FeatureStatus};
let yaml = r#"
feature:
slug: "add-auth"
created_at: "2026-02-10T10:30:00Z"
updated_at: "2026-02-10T10:30:00Z"
status: planned
current_phase: 0
git:
worktree_path: ".trees/add-auth"
branch: "feature/add-auth"
base_branch: "main"
phases: []
total:
turns: 0
cost_usd: 0.0
cost:
input_tokens: 0
output_tokens: 0
duration_secs: 0
"#;
let state: FeatureState = serde_yaml::from_str(yaml).unwrap();
assert_eq!(state.status, FeatureStatus::Planned);
assert_eq!(state.feature.slug, "add-auth");Fields§
§feature: FeatureInfoBasic feature metadata.
status: FeatureStatusOverall feature execution status.
current_phase: u32Index of the current phase being executed (0-based).
git: GitInfoGit branch and worktree information.
phases: Vec<PhaseRecord>Records for each execution phase.
pr: Option<PrInfo>Pull request information, populated after PR creation.
total: TotalStatsCumulative statistics across all phases.
Implementations§
Source§impl FeatureState
impl FeatureState
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Validates structural invariants after deserialization.
Checks that phases has at least [MIN_PHASE_COUNT] entries
(1+ dev phases + review + verify), current_phase is within bounds,
and worktree_path does not contain parent-directory references.
§Errors
Returns a human-readable error description when validation fails.
Trait Implementations§
Source§impl Clone for FeatureState
impl Clone for FeatureState
Source§fn clone(&self) -> FeatureState
fn clone(&self) -> FeatureState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more