huskies: merge 919

This commit is contained in:
dave
2026-05-13 06:22:22 +00:00
parent 9ce5a8df0c
commit 09a8edc0a1
7 changed files with 146 additions and 48 deletions
+18 -18
View File
@@ -282,10 +282,11 @@ pub fn transition_to_merge_failure(
Ok(fired)
}
/// Transition a story out of `Blocked` back to `Coding` via the state machine.
/// Transition a story out of a blocked state via the state machine.
///
/// Builds a `PipelineEvent::Unblock`, validates the transition, writes the
/// resulting `Stage::Coding` to the CRDT, and resets `retry_count` to 0.
/// result to the CRDT, and resets `retry_count` to 0. The destination stage
/// depends on the current stage: `Blocked` → `Coding`; `MergeFailure` → `Merge`.
/// Returns `Err` on `TransitionError` — callers must NOT fall back to direct
/// register writes.
pub fn transition_to_unblocked(story_id: &str) -> Result<(), String> {
@@ -333,8 +334,8 @@ fn map_stage_move_to_event(
}),
(Stage::Coding | Stage::Qa | Stage::Backlog, "done") => Ok(PipelineEvent::Close),
(Stage::Blocked { .. }, "current") => Ok(PipelineEvent::Unblock),
// Story 893: MergeFailure + Unblock now goes to Coding (retry), so
// manual demotion to backlog uses Demote instead.
// Story 919: MergeFailure + Unblock goes to Merge (re-attempt); manual
// demotion to backlog uses Demote to park it without a retry.
(Stage::MergeFailure { .. }, "backlog") => Ok(PipelineEvent::Demote),
(
Stage::Archived {
@@ -596,14 +597,14 @@ mod tests {
);
}
// ── Story 893: MergeFailure unblock → Coding regression ─────────────────
// ── Story 919: MergeFailure unblock → Merge regression ─────────────────
/// Regression test (story 893): unblocking a story in `MergeFailure` via
/// `transition_to_unblocked` transitions it to `Stage::Coding`, not `Backlog`.
/// After the unblock, the auto-assigner can pick it up normally (it looks for
/// stories in `Coding` / active stages).
/// Regression test (story 919): unblocking a story in `MergeFailure` via
/// `transition_to_unblocked` transitions it to `Stage::Merge`, not `Coding`
/// or `Backlog`. After the unblock, the merge pipeline re-attempts the
/// squash-merge immediately.
#[test]
fn unblock_merge_failure_story_lands_in_coding() {
fn unblock_merge_failure_story_lands_in_merge() {
crate::db::ensure_content_store();
crate::db::write_item_with_content(
"99893_story_merge_failure_unblock",
@@ -626,26 +627,25 @@ mod tests {
transition_to_unblocked("99893_story_merge_failure_unblock")
.expect("transition_to_unblocked should succeed for MergeFailure story");
// Story must land in Coding, not Backlog — the auto-assigner picks up
// Coding-stage stories without an extra DepsMet promotion step.
// Story must land in Merge — the mergemaster re-attempts the squash.
let item = crate::pipeline_state::read_typed("99893_story_merge_failure_unblock")
.expect("CRDT read should succeed")
.expect("item should exist after unblock");
assert_eq!(
item.stage.dir_name(),
"coding",
"MergeFailure story should land in Coding after unblock for immediate retry: {:?}",
"merge",
"MergeFailure story should land in Merge after unblock for immediate re-attempt: {:?}",
item.stage
);
assert!(
matches!(item.stage, Stage::Coding),
"stage should be Stage::Coding after unblock, got: {:?}",
matches!(item.stage, Stage::Merge { .. }),
"stage should be Stage::Merge after unblock, got: {:?}",
item.stage
);
// auto_assign checks is_active() — Coding satisfies it.
// auto_assign checks is_active() — Merge satisfies it.
assert!(
item.stage.is_active(),
"Coding satisfies is_active() so auto_assign can pick it up: {:?}",
"Merge satisfies is_active() so auto_assign can pick it up: {:?}",
item.stage
);
}