huskies: merge 964
This commit is contained in:
@@ -176,8 +176,8 @@ pub fn apply_remote_op(op: SignedOp) -> bool {
|
||||
};
|
||||
let from_stage = old_stage_str.and_then(|s| crate::pipeline_state::Stage::from_dir(&s));
|
||||
let name = match state.crdt.doc.items[idx].name.view() {
|
||||
JsonValue::String(s) if !s.is_empty() => Some(s),
|
||||
_ => None,
|
||||
JsonValue::String(s) => s.clone(),
|
||||
_ => String::new(),
|
||||
};
|
||||
emit_event(CrdtEvent {
|
||||
story_id: sid.clone(),
|
||||
|
||||
@@ -15,8 +15,8 @@ pub struct CrdtEvent {
|
||||
pub from_stage: Option<crate::pipeline_state::Stage>,
|
||||
/// The stage the item is now in.
|
||||
pub to_stage: crate::pipeline_state::Stage,
|
||||
/// Human-readable story name from the CRDT document.
|
||||
pub name: Option<String>,
|
||||
/// Human-readable story name from the CRDT document (empty string when unset).
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
// ── CRDT document types ──────────────────────────────────────────────
|
||||
@@ -538,7 +538,7 @@ mod tests {
|
||||
story_id: "42_story_foo".to_string(),
|
||||
from_stage: Some(crate::pipeline_state::Stage::Backlog),
|
||||
to_stage: crate::pipeline_state::Stage::Coding,
|
||||
name: Some("Foo Feature".to_string()),
|
||||
name: "Foo Feature".to_string(),
|
||||
};
|
||||
assert_eq!(evt.story_id, "42_story_foo");
|
||||
assert!(matches!(
|
||||
@@ -546,7 +546,7 @@ mod tests {
|
||||
Some(crate::pipeline_state::Stage::Backlog)
|
||||
));
|
||||
assert!(matches!(evt.to_stage, crate::pipeline_state::Stage::Coding));
|
||||
assert_eq!(evt.name.as_deref(), Some("Foo Feature"));
|
||||
assert_eq!(evt.name, "Foo Feature");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -555,12 +555,12 @@ mod tests {
|
||||
story_id: "10_story_bar".to_string(),
|
||||
from_stage: None,
|
||||
to_stage: crate::pipeline_state::Stage::Backlog,
|
||||
name: None,
|
||||
name: String::new(),
|
||||
};
|
||||
let cloned = evt.clone();
|
||||
assert_eq!(cloned.story_id, "10_story_bar");
|
||||
assert!(cloned.from_stage.is_none());
|
||||
assert!(cloned.name.is_none());
|
||||
assert!(cloned.name.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -573,7 +573,7 @@ mod tests {
|
||||
story_id: "99_story_noop".to_string(),
|
||||
from_stage: None,
|
||||
to_stage: crate::pipeline_state::Stage::Backlog,
|
||||
name: None,
|
||||
name: String::new(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -695,7 +695,7 @@ mod tests {
|
||||
story_id: "70_story_broadcast".to_string(),
|
||||
from_stage: Some(Stage::Backlog),
|
||||
to_stage: Stage::Coding,
|
||||
name: Some("Broadcast Test".to_string()),
|
||||
name: "Broadcast Test".to_string(),
|
||||
};
|
||||
tx.send(evt).unwrap();
|
||||
|
||||
@@ -703,6 +703,6 @@ mod tests {
|
||||
assert_eq!(received.story_id, "70_story_broadcast");
|
||||
assert!(matches!(received.from_stage, Some(Stage::Backlog)));
|
||||
assert!(matches!(received.to_stage, Stage::Coding));
|
||||
assert_eq!(received.name.as_deref(), Some("Broadcast Test"));
|
||||
assert_eq!(received.name, "Broadcast Test");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -273,8 +273,8 @@ pub fn write_item(
|
||||
if stage_changed {
|
||||
// Read the current name from the CRDT document for the event.
|
||||
let current_name = match state.crdt.doc.items[idx].name.view() {
|
||||
JsonValue::String(s) if !s.is_empty() => Some(s),
|
||||
_ => None,
|
||||
JsonValue::String(s) if !s.is_empty() => s,
|
||||
_ => String::new(),
|
||||
};
|
||||
// Storage seam: convert the old raw CRDT stage string to a typed Stage.
|
||||
let from_stage = old_stage.and_then(|s| Stage::from_dir(&s));
|
||||
@@ -336,7 +336,7 @@ pub fn write_item(
|
||||
story_id: story_id.to_string(),
|
||||
from_stage: None,
|
||||
to_stage: stage.clone(),
|
||||
name: name.map(String::from),
|
||||
name: name.unwrap_or("").to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user