huskies: merge 951
This commit is contained in:
@@ -343,10 +343,9 @@ mod stage_migration_tests {
|
||||
|
||||
for (id, _, expected_variant) in cases {
|
||||
let view = read_item(id).expect("item must still exist after migration");
|
||||
let projected: Stage = crate::pipeline_state::project_stage(&view)
|
||||
.expect("projection must succeed after migration");
|
||||
let projected: &Stage = view.stage();
|
||||
assert_eq!(
|
||||
std::mem::discriminant(&projected),
|
||||
std::mem::discriminant(projected),
|
||||
std::mem::discriminant(expected_variant),
|
||||
"stage for {id} should project to {expected_variant:?} after migration, got {projected:?}",
|
||||
);
|
||||
@@ -367,7 +366,7 @@ mod stage_migration_tests {
|
||||
|
||||
let after = read_item(story_id).expect("item must still exist after migration");
|
||||
assert!(
|
||||
matches!(after.stage(), crate::crdt_state::Stage::Backlog),
|
||||
matches!(after.stage(), crate::pipeline_state::Stage::Backlog),
|
||||
"7_frozen should collapse to Backlog: got {:?}",
|
||||
after.stage()
|
||||
);
|
||||
@@ -400,8 +399,14 @@ mod stage_migration_tests {
|
||||
// Clean item is unchanged; legacy item is now clean too.
|
||||
let clean = read_item("9520_already_clean").unwrap();
|
||||
let migrated = read_item("9521_needs_migration").unwrap();
|
||||
assert!(matches!(clean.stage(), crate::crdt_state::Stage::Coding));
|
||||
assert!(matches!(migrated.stage(), crate::crdt_state::Stage::Coding));
|
||||
assert!(matches!(
|
||||
clean.stage(),
|
||||
crate::pipeline_state::Stage::Coding
|
||||
));
|
||||
assert!(matches!(
|
||||
migrated.stage(),
|
||||
crate::pipeline_state::Stage::Coding
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -413,7 +418,7 @@ mod stage_migration_tests {
|
||||
let after_first = read_item("9530_idempotent").unwrap();
|
||||
assert!(matches!(
|
||||
after_first.stage(),
|
||||
crate::crdt_state::Stage::Merge
|
||||
crate::pipeline_state::Stage::Merge { .. }
|
||||
));
|
||||
|
||||
// Second call must be a no-op — the filter pass returns empty.
|
||||
@@ -421,7 +426,7 @@ mod stage_migration_tests {
|
||||
let after_second = read_item("9530_idempotent").unwrap();
|
||||
assert!(matches!(
|
||||
after_second.stage(),
|
||||
crate::crdt_state::Stage::Merge
|
||||
crate::pipeline_state::Stage::Merge { .. }
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ fn migrate_story_ids_to_numeric_preserves_stage_and_name() {
|
||||
migrate_story_ids_to_numeric();
|
||||
|
||||
let item = read_item("45").expect("item must be accessible by numeric ID");
|
||||
assert_eq!(item.stage, "coding");
|
||||
assert!(matches!(item.stage, crate::pipeline_state::Stage::Coding));
|
||||
assert_eq!(item.name.as_deref(), Some("Crash Bug"));
|
||||
assert_eq!(item.agent.as_deref(), Some("coder-1"));
|
||||
}
|
||||
@@ -620,7 +620,7 @@ async fn bug_511_rowid_replay_preserves_field_update_after_list_insert() {
|
||||
let sid = format!("{}_story_warmup", i);
|
||||
let item: JsonValue = json!({
|
||||
"story_id": sid,
|
||||
"stage": "1_backlog",
|
||||
"stage": "backlog",
|
||||
"name": "",
|
||||
"agent": "",
|
||||
"retry_count": 0.0,
|
||||
@@ -657,7 +657,7 @@ async fn bug_511_rowid_replay_preserves_field_update_after_list_insert() {
|
||||
let idx = rebuild_index(&crdt)["511_story_target"];
|
||||
let stage_op = crdt.doc.items[idx]
|
||||
.stage
|
||||
.set("2_current".to_string())
|
||||
.set("coding".to_string())
|
||||
.sign(&kp);
|
||||
crdt.apply(stage_op.clone());
|
||||
// stage_op.inner.seq == 1
|
||||
@@ -701,8 +701,8 @@ async fn bug_511_rowid_replay_preserves_field_update_after_list_insert() {
|
||||
);
|
||||
let idx2 = index2["511_story_target"];
|
||||
let view = extract_item_view(&crdt2.doc.items[idx2]).unwrap();
|
||||
assert_eq!(
|
||||
view.stage, "2_current",
|
||||
assert!(
|
||||
matches!(view.stage, crate::pipeline_state::Stage::Coding),
|
||||
"stage field update lost during replay (bug 511 regression)"
|
||||
);
|
||||
|
||||
@@ -726,9 +726,9 @@ async fn bug_511_rowid_replay_preserves_field_update_after_list_insert() {
|
||||
// but the stage update is lost (it ran before the item existed).
|
||||
if let Some(idx3) = index3.get("511_story_target") {
|
||||
let view3 = extract_item_view(&crdt3.doc.items[*idx3]).unwrap();
|
||||
// The bug: stage is still "1_backlog" because the update was dropped.
|
||||
assert_eq!(
|
||||
view3.stage, "1_backlog",
|
||||
// The bug: stage is still "backlog" because the update was dropped.
|
||||
assert!(
|
||||
matches!(view3.stage, crate::pipeline_state::Stage::Backlog),
|
||||
"expected seq-ASC replay to exhibit the bug (update lost)"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user