huskies: merge 1046
This commit is contained in:
@@ -90,10 +90,17 @@ pub(crate) fn tool_get_pipeline_status(ctx: &AppContext) -> Result<String, Strin
|
||||
})
|
||||
.collect();
|
||||
|
||||
let archived: Vec<Value> = state
|
||||
.archived
|
||||
.iter()
|
||||
.map(|s| json!({ "story_id": s.story_id, "name": s.name, "stage": "archived" }))
|
||||
.collect();
|
||||
|
||||
serde_json::to_string_pretty(&json!({
|
||||
"active": active,
|
||||
"backlog": backlog,
|
||||
"backlog_count": backlog.len(),
|
||||
"archived": archived,
|
||||
"deterministic_merges_in_flight": running_merges,
|
||||
}))
|
||||
.map_err(|e| format!("Serialization error: {e}"))
|
||||
|
||||
@@ -64,6 +64,8 @@ pub struct PipelineState {
|
||||
pub done: Vec<UpcomingStory>,
|
||||
/// Abandoned, superseded, and rejected items (story 984).
|
||||
pub closed: Vec<UpcomingStory>,
|
||||
/// Items swept from Done into the archived terminal state.
|
||||
pub archived: Vec<UpcomingStory>,
|
||||
/// Story IDs that currently have a deterministic merge in progress.
|
||||
pub deterministic_merges_in_flight: Vec<String>,
|
||||
}
|
||||
@@ -104,6 +106,7 @@ pub fn load_pipeline_state(ctx: &AppContext) -> Result<PipelineState, String> {
|
||||
merge: Vec::new(),
|
||||
done: Vec::new(),
|
||||
closed: Vec::new(),
|
||||
archived: Vec::new(),
|
||||
deterministic_merges_in_flight,
|
||||
};
|
||||
|
||||
@@ -194,7 +197,7 @@ pub fn load_pipeline_state(ctx: &AppContext) -> Result<PipelineState, String> {
|
||||
Stage::Abandoned { .. } | Stage::Superseded { .. } | Stage::Rejected { .. } => {
|
||||
state.closed.push(story)
|
||||
}
|
||||
Stage::Archived { .. } => {} // Completed/MergeFailed/ReviewHeld stay hidden
|
||||
Stage::Archived { .. } => state.archived.push(story),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,6 +208,7 @@ pub fn load_pipeline_state(ctx: &AppContext) -> Result<PipelineState, String> {
|
||||
state.merge.sort_by(|a, b| a.story_id.cmp(&b.story_id));
|
||||
state.done.sort_by(|a, b| a.story_id.cmp(&b.story_id));
|
||||
state.closed.sort_by(|a, b| a.story_id.cmp(&b.story_id));
|
||||
state.archived.sort_by(|a, b| a.story_id.cmp(&b.story_id));
|
||||
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
@@ -234,11 +234,13 @@ pub async fn fetch_one_project_pipeline_items(url: &str, client: &Client) -> Val
|
||||
match serde_json::from_str::<Value>(text) {
|
||||
Ok(pipeline) => {
|
||||
let active = pipeline.get("active").cloned().unwrap_or(json!([]));
|
||||
let backlog = pipeline.get("backlog").cloned().unwrap_or(json!([]));
|
||||
let backlog_count = pipeline
|
||||
.get("backlog_count")
|
||||
.and_then(|n| n.as_u64())
|
||||
.unwrap_or(0);
|
||||
json!({ "active": active, "backlog_count": backlog_count })
|
||||
let archived = pipeline.get("archived").cloned().unwrap_or(json!([]));
|
||||
json!({ "active": active, "backlog": backlog, "backlog_count": backlog_count, "archived": archived })
|
||||
}
|
||||
Err(_) => json!({ "error": "invalid pipeline JSON" }),
|
||||
}
|
||||
|
||||
@@ -249,6 +249,7 @@ mod tests {
|
||||
epic_id: None,
|
||||
}],
|
||||
closed: vec![],
|
||||
archived: vec![],
|
||||
deterministic_merges_in_flight: vec![],
|
||||
};
|
||||
let resp = pipeline_state_to_response(state);
|
||||
@@ -273,6 +274,7 @@ mod tests {
|
||||
merge: vec![],
|
||||
done: vec![],
|
||||
closed: vec![],
|
||||
archived: vec![],
|
||||
deterministic_merges_in_flight: vec![],
|
||||
};
|
||||
let resp = pipeline_state_to_response(state);
|
||||
@@ -311,6 +313,7 @@ mod tests {
|
||||
merge: vec![],
|
||||
done: vec![],
|
||||
closed: vec![],
|
||||
archived: vec![],
|
||||
deterministic_merges_in_flight: vec![],
|
||||
};
|
||||
let resp: WsResponse = state.into();
|
||||
|
||||
Reference in New Issue
Block a user