Skip to main content

ralph_workflow/reducer/state/pipeline/
phase_fields.rs

1// Phase-specific validated outcome types.
2//
3// These structures capture the validated results from each pipeline phase
4// after XML parsing and schema validation. They represent the contract
5// between agent output and reducer state.
6
7#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
8pub struct ReviewValidatedOutcome {
9    pub pass: u32,
10    pub issues_found: bool,
11    pub clean_no_issues: bool,
12    #[serde(default)]
13    pub issues: Vec<String>,
14    #[serde(default)]
15    pub no_issues_found: Option<String>,
16}
17
18#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
19pub struct PlanningValidatedOutcome {
20    pub iteration: u32,
21    pub valid: bool,
22    #[serde(default)]
23    pub markdown: Option<String>,
24}
25
26#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
27pub struct DevelopmentValidatedOutcome {
28    pub iteration: u32,
29    pub status: DevelopmentStatus,
30    pub summary: String,
31    pub files_changed: Option<Vec<String>>,
32    pub next_steps: Option<String>,
33}
34
35#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
36pub struct FixValidatedOutcome {
37    pub pass: u32,
38    pub status: FixStatus,
39    pub summary: Option<String>,
40}
41
42#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
43pub struct CommitValidatedOutcome {
44    pub attempt: u32,
45    pub message: Option<String>,
46    pub reason: Option<String>,
47}
48
49#[derive(Clone, Serialize, Deserialize, Debug, Default)]
50pub struct PromptInputsState {
51    #[serde(default)]
52    pub planning: Option<MaterializedPlanningInputs>,
53    #[serde(default)]
54    pub development: Option<MaterializedDevelopmentInputs>,
55    #[serde(default)]
56    pub review: Option<MaterializedReviewInputs>,
57    #[serde(default)]
58    pub commit: Option<MaterializedCommitInputs>,
59    /// Materialized last invalid XML output for XSD retry prompts.
60    ///
61    /// This is used to dedupe retries and keep oversize handling reducer-visible.
62    #[serde(default)]
63    pub xsd_retry_last_output: Option<MaterializedXsdRetryLastOutput>,
64}
65
66#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
67pub struct MaterializedPlanningInputs {
68    pub iteration: u32,
69    pub prompt: MaterializedPromptInput,
70}
71
72#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
73pub struct MaterializedDevelopmentInputs {
74    pub iteration: u32,
75    pub prompt: MaterializedPromptInput,
76    pub plan: MaterializedPromptInput,
77}
78
79#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
80pub struct MaterializedReviewInputs {
81    pub pass: u32,
82    pub plan: MaterializedPromptInput,
83    pub diff: MaterializedPromptInput,
84}
85
86#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
87pub struct MaterializedCommitInputs {
88    pub attempt: u32,
89    pub diff: MaterializedPromptInput,
90}
91
92#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq)]
93pub struct MaterializedXsdRetryLastOutput {
94    pub phase: PipelinePhase,
95    pub scope_id: u32,
96    pub last_output: MaterializedPromptInput,
97}