huskies: merge 857

This commit is contained in:
dave
2026-04-29 17:38:38 +00:00
parent 8a42839b37
commit fc86774618
12 changed files with 566 additions and 159 deletions
+46 -3
View File
@@ -47,6 +47,15 @@ pub enum PipelineEvent {
Supersede { by: StoryId },
/// Story put on review hold.
ReviewHold { reason: String },
/// Story rejected by QA or reviewer.
Reject { reason: String },
/// Story triaged from upcoming to backlog.
Triage,
/// Direct completion — item closed without going through the full pipeline
/// (e.g. spike auto-merge, bug closure, manual acceptance).
Close,
/// Manual demotion back to backlog from an active stage.
Demote,
}
// ── Per-node execution events ───────────────────────────────────────────────
@@ -81,6 +90,10 @@ pub fn event_label(e: &PipelineEvent) -> &'static str {
PipelineEvent::Abandon => "Abandon",
PipelineEvent::Supersede { .. } => "Supersede",
PipelineEvent::ReviewHold { .. } => "ReviewHold",
PipelineEvent::Reject { .. } => "Reject",
PipelineEvent::Triage => "Triage",
PipelineEvent::Close => "Close",
PipelineEvent::Demote => "Demote",
}
}
@@ -103,6 +116,9 @@ pub fn transition(state: Stage, event: PipelineEvent) -> Result<Stage, Transitio
let now = Utc::now();
match (state, event) {
// ── Triage: upcoming → backlog ──────────────────────────────────
(Upcoming, Triage) => Ok(Backlog),
// ── Forward path ────────────────────────────────────────────────
(Backlog, DepsMet) => Ok(Coding),
(Coding, GatesStarted) => Ok(Qa),
@@ -161,7 +177,8 @@ pub fn transition(state: Stage, event: PipelineEvent) -> Result<Stage, Transitio
}),
// ── Abandon / supersede from any active or done stage ───────────
(Backlog, Abandon)
(Upcoming, Abandon)
| (Backlog, Abandon)
| (Coding, Abandon)
| (Qa, Abandon)
| (Merge { .. }, Abandon)
@@ -170,7 +187,8 @@ pub fn transition(state: Stage, event: PipelineEvent) -> Result<Stage, Transitio
reason: ArchiveReason::Abandoned,
}),
(Backlog, Supersede { by })
(Upcoming, Supersede { by })
| (Backlog, Supersede { by })
| (Coding, Supersede { by })
| (Qa, Supersede { by })
| (Merge { .. }, Supersede { by })
@@ -179,13 +197,38 @@ pub fn transition(state: Stage, event: PipelineEvent) -> Result<Stage, Transitio
reason: ArchiveReason::Superseded { by },
}),
// ── Unblock: only from Archived(Blocked) → Backlog ─────────────
// ── Reject from any active stage or QA ──────────────────────────
(Backlog, Reject { reason })
| (Coding, Reject { reason })
| (Qa, Reject { reason })
| (Merge { .. }, Reject { reason }) => Ok(Archived {
archived_at: now,
reason: ArchiveReason::Rejected { reason },
}),
// ── Demote: send an active item back to backlog ────────────────
(Coding, Demote) | (Qa, Demote) | (Merge { .. }, Demote) => Ok(Backlog),
// ── Close: direct completion from any active stage ─────────────
(Backlog, Close) | (Coding, Close) | (Qa, Close) | (Merge { .. }, Close) => Ok(Done {
merged_at: now,
merge_commit: GitSha("closed".to_string()),
}),
// ── Unblock: from Archived(Blocked) or Archived(MergeFailed) → Backlog
(
Archived {
reason: ArchiveReason::Blocked { .. },
..
},
Unblock,
)
| (
Archived {
reason: ArchiveReason::MergeFailed { .. },
..
},
Unblock,
) => Ok(Backlog),
// ── Everything else is invalid ──────────────────────────────────