#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct RunMetrics {
#[serde(default)]
pub dev_iterations_started: u32,
#[serde(default)]
pub dev_iterations_completed: u32,
#[serde(default)]
pub dev_attempts_total: u32,
#[serde(default)]
pub dev_continuation_attempt: u32,
#[serde(default)]
pub analysis_attempts_total: u32,
#[serde(default)]
pub analysis_attempts_in_current_iteration: u32,
#[serde(default)]
pub review_passes_started: u32,
#[serde(default)]
pub review_passes_completed: u32,
#[serde(default)]
pub review_runs_total: u32,
#[serde(default)]
pub fix_runs_total: u32,
#[serde(default)]
pub fix_analysis_runs_total: u32,
#[serde(default)]
pub fix_continuations_total: u32,
#[serde(default)]
pub fix_continuation_attempt: u32,
#[serde(default)]
pub current_review_pass: u32,
#[serde(default)]
pub xsd_retry_attempts_total: u32,
#[serde(default)]
pub xsd_retry_planning: u32,
#[serde(default)]
pub xsd_retry_development: u32,
#[serde(default)]
pub xsd_retry_review: u32,
#[serde(default)]
pub xsd_retry_fix: u32,
#[serde(default)]
pub xsd_retry_commit: u32,
#[serde(default)]
pub same_agent_retry_attempts_total: u32,
#[serde(default)]
pub timeout_no_output_agent_switches_total: u32,
#[serde(default)]
pub agent_fallbacks_total: u32,
#[serde(default)]
pub model_fallbacks_total: u32,
#[serde(default)]
pub retry_cycles_started_total: u32,
#[serde(default)]
pub commits_created_total: u32,
#[serde(default)]
pub connectivity_interruptions_total: u32,
#[serde(default)]
pub max_dev_iterations: u32,
#[serde(default)]
pub max_review_passes: u32,
#[serde(default)]
pub max_xsd_retry_count: u32,
#[serde(default)]
pub max_dev_continuation_count: u32,
#[serde(default)]
pub max_fix_continuation_count: u32,
#[serde(default)]
pub max_same_agent_retry_count: u32,
}
impl RunMetrics {
#[must_use]
pub fn new(
max_dev_iterations: u32,
max_review_passes: u32,
continuation: &ContinuationState,
) -> Self {
Self {
max_dev_iterations,
max_review_passes,
max_xsd_retry_count: continuation.max_xsd_retry_count,
max_dev_continuation_count: continuation.max_continue_count,
max_fix_continuation_count: continuation.max_fix_continue_count,
max_same_agent_retry_count: continuation.max_same_agent_retry_count,
..Self::default()
}
}
#[must_use]
pub const fn increment_dev_iterations_started(self) -> Self {
Self { dev_iterations_started: self.dev_iterations_started.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_dev_iterations_completed(self) -> Self {
Self { dev_iterations_completed: self.dev_iterations_completed.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_dev_attempts_total(self) -> Self {
Self { dev_attempts_total: self.dev_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_dev_continuation_attempt(self) -> Self {
Self { dev_continuation_attempt: self.dev_continuation_attempt.saturating_add(1), ..self }
}
#[must_use]
pub const fn reset_dev_continuation_attempt(self) -> Self {
Self { dev_continuation_attempt: 0, ..self }
}
#[must_use]
pub const fn increment_analysis_attempts_total(self) -> Self {
Self { analysis_attempts_total: self.analysis_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_analysis_attempts_in_current_iteration(self) -> Self {
Self { analysis_attempts_in_current_iteration: self.analysis_attempts_in_current_iteration.saturating_add(1), ..self }
}
#[must_use]
pub const fn reset_analysis_attempts_in_current_iteration(self) -> Self {
Self { analysis_attempts_in_current_iteration: 0, ..self }
}
#[must_use]
pub const fn increment_review_passes_started(self) -> Self {
Self { review_passes_started: self.review_passes_started.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_review_passes_completed(self) -> Self {
Self { review_passes_completed: self.review_passes_completed.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_review_runs_total(self) -> Self {
Self { review_runs_total: self.review_runs_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_fix_runs_total(self) -> Self {
Self { fix_runs_total: self.fix_runs_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_fix_analysis_runs_total(self) -> Self {
Self { fix_analysis_runs_total: self.fix_analysis_runs_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_fix_continuations_total(self) -> Self {
Self { fix_continuations_total: self.fix_continuations_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_fix_continuation_attempt(self) -> Self {
Self { fix_continuation_attempt: self.fix_continuation_attempt.saturating_add(1), ..self }
}
#[must_use]
pub const fn reset_fix_continuation_attempt(self) -> Self {
Self { fix_continuation_attempt: 0, ..self }
}
#[must_use]
pub const fn set_current_review_pass(self, pass: u32) -> Self {
Self { current_review_pass: pass, ..self }
}
#[must_use]
pub const fn increment_xsd_retry_attempts_total(self) -> Self {
Self { xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_xsd_retry_planning(self) -> Self {
Self { xsd_retry_planning: self.xsd_retry_planning.saturating_add(1), xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_xsd_retry_development(self) -> Self {
Self { xsd_retry_development: self.xsd_retry_development.saturating_add(1), xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_xsd_retry_review(self) -> Self {
Self { xsd_retry_review: self.xsd_retry_review.saturating_add(1), xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_xsd_retry_fix(self) -> Self {
Self { xsd_retry_fix: self.xsd_retry_fix.saturating_add(1), xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_xsd_retry_commit(self) -> Self {
Self { xsd_retry_commit: self.xsd_retry_commit.saturating_add(1), xsd_retry_attempts_total: self.xsd_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_same_agent_retry_attempts_total(self) -> Self {
Self { same_agent_retry_attempts_total: self.same_agent_retry_attempts_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_timeout_no_output_agent_switches_total(self) -> Self {
Self { timeout_no_output_agent_switches_total: self.timeout_no_output_agent_switches_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_agent_fallbacks_total(self) -> Self {
Self { agent_fallbacks_total: self.agent_fallbacks_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_model_fallbacks_total(self) -> Self {
Self { model_fallbacks_total: self.model_fallbacks_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_retry_cycles_started_total(self) -> Self {
Self { retry_cycles_started_total: self.retry_cycles_started_total.saturating_add(1), ..self }
}
#[must_use]
pub const fn increment_commits_created_total(self) -> Self {
Self { commits_created_total: self.commits_created_total.saturating_add(1), ..self }
}
}