fix: add --all to cargo fmt in script/test and autoformat codebase
cargo fmt without --all fails with "Failed to find targets" in workspace repos. This was blocking every story's gates. Also ran cargo fmt --all to fix all existing formatting issues. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -226,10 +226,7 @@ pub enum PipelineEvent {
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum TransitionError {
|
||||
/// The current stage doesn't accept this event.
|
||||
InvalidTransition {
|
||||
from_stage: String,
|
||||
event: String,
|
||||
},
|
||||
InvalidTransition { from_stage: String, event: String },
|
||||
}
|
||||
|
||||
// ── The transition function ──────────────────────────────────────────────────
|
||||
@@ -260,11 +257,23 @@ pub fn transition(state: Stage, event: PipelineEvent) -> Result<Stage, Transitio
|
||||
// ── Forward path: backlog → current → (qa →) merge → done ──────────
|
||||
(Backlog, DepsMet) => Ok(Coding),
|
||||
(Coding, GatesStarted) => Ok(Qa),
|
||||
(Coding, QaSkipped { feature_branch, commits_ahead }) => Ok(Merge {
|
||||
(
|
||||
Coding,
|
||||
QaSkipped {
|
||||
feature_branch,
|
||||
commits_ahead,
|
||||
},
|
||||
) => Ok(Merge {
|
||||
feature_branch,
|
||||
commits_ahead,
|
||||
}),
|
||||
(Qa, GatesPassed { feature_branch, commits_ahead }) => Ok(Merge {
|
||||
(
|
||||
Qa,
|
||||
GatesPassed {
|
||||
feature_branch,
|
||||
commits_ahead,
|
||||
},
|
||||
) => Ok(Merge {
|
||||
feature_branch,
|
||||
commits_ahead,
|
||||
}),
|
||||
@@ -414,7 +423,9 @@ pub fn execution_transition(
|
||||
}),
|
||||
|
||||
(Running { agent, .. }, HitRateLimit { resume_at })
|
||||
| (Pending { agent, .. }, HitRateLimit { resume_at }) => Ok(RateLimited { agent, resume_at }),
|
||||
| (Pending { agent, .. }, HitRateLimit { resume_at }) => {
|
||||
Ok(RateLimited { agent, resume_at })
|
||||
}
|
||||
|
||||
(RateLimited { agent, .. }, SpawnedSuccessfully) => Ok(Running {
|
||||
agent,
|
||||
@@ -747,10 +758,7 @@ mod tests {
|
||||
assert!(matches!(e, ExecutionState::Running { .. }));
|
||||
|
||||
let e = execution_transition(e, ExecutionEvent::Exited { exit_code: 0 }).unwrap();
|
||||
assert!(matches!(
|
||||
e,
|
||||
ExecutionState::Completed { exit_code: 0, .. }
|
||||
));
|
||||
assert!(matches!(e, ExecutionState::Completed { exit_code: 0, .. }));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -800,22 +808,20 @@ fn main() {
|
||||
|
||||
// Helper to apply a transition + fire the bus.
|
||||
let mut current_stage = Stage::Backlog;
|
||||
let step = |bus: &EventBus,
|
||||
stage: &mut Stage,
|
||||
event: PipelineEvent|
|
||||
-> Result<(), TransitionError> {
|
||||
let before = stage.clone();
|
||||
let after = transition(stage.clone(), event.clone())?;
|
||||
bus.fire(TransitionFired {
|
||||
story_id: story_id.clone(),
|
||||
before,
|
||||
after: after.clone(),
|
||||
event,
|
||||
at: Utc::now(),
|
||||
});
|
||||
*stage = after;
|
||||
Ok(())
|
||||
};
|
||||
let step =
|
||||
|bus: &EventBus, stage: &mut Stage, event: PipelineEvent| -> Result<(), TransitionError> {
|
||||
let before = stage.clone();
|
||||
let after = transition(stage.clone(), event.clone())?;
|
||||
bus.fire(TransitionFired {
|
||||
story_id: story_id.clone(),
|
||||
before,
|
||||
after: after.clone(),
|
||||
event,
|
||||
at: Utc::now(),
|
||||
});
|
||||
*stage = after;
|
||||
Ok(())
|
||||
};
|
||||
|
||||
println!("Initial: {current_stage:?}\n");
|
||||
|
||||
|
||||
@@ -167,10 +167,9 @@ impl PipelineMachine {
|
||||
// transitions forward and doesn't read them — but they're available
|
||||
// to inspect via the State::Merge variant generated by the macro.
|
||||
match event {
|
||||
PipelineEvent::MergeSucceeded { merge_commit } => Transition(State::done(
|
||||
Utc::now(),
|
||||
merge_commit.clone(),
|
||||
)),
|
||||
PipelineEvent::MergeSucceeded { merge_commit } => {
|
||||
Transition(State::done(Utc::now(), merge_commit.clone()))
|
||||
}
|
||||
PipelineEvent::MergeFailedFinal { reason } => Transition(State::archived(
|
||||
Utc::now(),
|
||||
ArchiveReason::MergeFailed {
|
||||
@@ -205,9 +204,7 @@ impl PipelineMachine {
|
||||
reason: reason.clone(),
|
||||
},
|
||||
)),
|
||||
PipelineEvent::Abandon => {
|
||||
Transition(State::archived(now, ArchiveReason::Abandoned))
|
||||
}
|
||||
PipelineEvent::Abandon => Transition(State::archived(now, ArchiveReason::Abandoned)),
|
||||
PipelineEvent::Supersede { by } => Transition(State::archived(
|
||||
now,
|
||||
ArchiveReason::Superseded { by: by.clone() },
|
||||
@@ -230,12 +227,8 @@ impl PipelineMachine {
|
||||
let _ = merged_at; // currently unused; available for queries
|
||||
let _ = merge_commit;
|
||||
match event {
|
||||
PipelineEvent::Accepted => {
|
||||
Transition(State::archived(now, ArchiveReason::Completed))
|
||||
}
|
||||
PipelineEvent::Abandon => {
|
||||
Transition(State::archived(now, ArchiveReason::Abandoned))
|
||||
}
|
||||
PipelineEvent::Accepted => Transition(State::archived(now, ArchiveReason::Completed)),
|
||||
PipelineEvent::Abandon => Transition(State::archived(now, ArchiveReason::Abandoned)),
|
||||
PipelineEvent::Supersede { by } => Transition(State::archived(
|
||||
now,
|
||||
ArchiveReason::Superseded { by: by.clone() },
|
||||
@@ -294,10 +287,7 @@ pub mod execution {
|
||||
#[derive(Default)]
|
||||
pub struct ExecutionMachine;
|
||||
|
||||
#[state_machine(
|
||||
initial = "State::idle()",
|
||||
state(derive(Debug, Clone, PartialEq, Eq))
|
||||
)]
|
||||
#[state_machine(initial = "State::idle()", state(derive(Debug, Clone, PartialEq, Eq)))]
|
||||
impl ExecutionMachine {
|
||||
// ── Idle: no agent on this node is working on this story ──────────
|
||||
|
||||
@@ -327,11 +317,9 @@ pub mod execution {
|
||||
ExecutionEvent::HitRateLimit { resume_at } => {
|
||||
Transition(State::rate_limited(agent.clone(), *resume_at))
|
||||
}
|
||||
ExecutionEvent::Exited { exit_code } => Transition(State::completed(
|
||||
agent.clone(),
|
||||
*exit_code,
|
||||
Utc::now(),
|
||||
)),
|
||||
ExecutionEvent::Exited { exit_code } => {
|
||||
Transition(State::completed(agent.clone(), *exit_code, Utc::now()))
|
||||
}
|
||||
_ => Super,
|
||||
}
|
||||
}
|
||||
@@ -358,11 +346,9 @@ pub mod execution {
|
||||
ExecutionEvent::HitRateLimit { resume_at } => {
|
||||
Transition(State::rate_limited(agent.clone(), *resume_at))
|
||||
}
|
||||
ExecutionEvent::Exited { exit_code } => Transition(State::completed(
|
||||
agent.clone(),
|
||||
*exit_code,
|
||||
Utc::now(),
|
||||
)),
|
||||
ExecutionEvent::Exited { exit_code } => {
|
||||
Transition(State::completed(agent.clone(), *exit_code, Utc::now()))
|
||||
}
|
||||
_ => Super,
|
||||
}
|
||||
}
|
||||
@@ -380,11 +366,9 @@ pub mod execution {
|
||||
let now = Utc::now();
|
||||
Transition(State::running(agent.clone(), now, now))
|
||||
}
|
||||
ExecutionEvent::Exited { exit_code } => Transition(State::completed(
|
||||
agent.clone(),
|
||||
*exit_code,
|
||||
Utc::now(),
|
||||
)),
|
||||
ExecutionEvent::Exited { exit_code } => {
|
||||
Transition(State::completed(agent.clone(), *exit_code, Utc::now()))
|
||||
}
|
||||
_ => Super,
|
||||
}
|
||||
}
|
||||
@@ -411,9 +395,7 @@ pub mod execution {
|
||||
#[superstate]
|
||||
fn any(event: &ExecutionEvent) -> Response<State> {
|
||||
match event {
|
||||
ExecutionEvent::Stopped | ExecutionEvent::Reset => {
|
||||
Transition(State::idle())
|
||||
}
|
||||
ExecutionEvent::Stopped | ExecutionEvent::Reset => Transition(State::idle()),
|
||||
_ => Handled,
|
||||
}
|
||||
}
|
||||
@@ -677,7 +659,10 @@ mod tests {
|
||||
assert!(matches!(em.state(), ExecState::Running { .. }));
|
||||
|
||||
em.handle(&ExecutionEvent::Exited { exit_code: 0 });
|
||||
assert!(matches!(em.state(), ExecState::Completed { exit_code: 0, .. }));
|
||||
assert!(matches!(
|
||||
em.state(),
|
||||
ExecState::Completed { exit_code: 0, .. }
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -781,5 +766,8 @@ fn main() {
|
||||
});
|
||||
println!(" before Unblock: {:?}", sm2.state());
|
||||
sm2.handle(&PipelineEvent::Unblock); // silently ignored — no transition
|
||||
println!(" after Unblock: {:?} (no change — Unblock is a no-op from Done)", sm2.state());
|
||||
println!(
|
||||
" after Unblock: {:?} (no change — Unblock is a no-op from Done)",
|
||||
sm2.state()
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user