huskies: merge 891
This commit is contained in:
@@ -17,7 +17,7 @@ pub(super) async fn tool_merge_agent_work(
|
||||
// Check CRDT stage before attempting merge — if already done or archived,
|
||||
// return success immediately to avoid spurious error notifications.
|
||||
if let Some(item) = crate::crdt_state::read_item(story_id)
|
||||
&& crate::pipeline_state::Stage::from_dir(&item.stage).is_some_and(|s| {
|
||||
&& crate::pipeline_state::Stage::from_dir(item.stage_str()).is_some_and(|s| {
|
||||
matches!(
|
||||
s,
|
||||
crate::pipeline_state::Stage::Done { .. }
|
||||
@@ -31,7 +31,7 @@ pub(super) async fn tool_merge_agent_work(
|
||||
"success": true,
|
||||
"message": format!(
|
||||
"Story '{}' is already in '{}' — no merge needed.",
|
||||
story_id, item.stage
|
||||
story_id, item.stage_str()
|
||||
),
|
||||
}))
|
||||
.map_err(|e| format!("Serialization error: {e}"));
|
||||
|
||||
@@ -215,12 +215,12 @@ pub(super) async fn tool_status(args: &Value, ctx: &AppContext) -> Result<String
|
||||
// pass the read_typed / 2_current check above, but the code is present
|
||||
// for completeness and future-proofing).
|
||||
if let Some(view) = crate::crdt_state::read_item(story_id) {
|
||||
if let Some(cb) = &view.claimed_by
|
||||
if let Some(cb) = view.claimed_by()
|
||||
&& !cb.is_empty()
|
||||
{
|
||||
front_matter.insert("claimed_by".to_string(), json!(cb));
|
||||
}
|
||||
if let Some(ca) = view.claimed_at
|
||||
if let Some(ca) = view.claimed_at()
|
||||
&& ca > 0.0
|
||||
{
|
||||
front_matter.insert("claimed_at".to_string(), json!(ca));
|
||||
|
||||
@@ -233,8 +233,8 @@ mod tests {
|
||||
assert!(r.is_ok(), "set [1,2,3] should succeed: {r:?}");
|
||||
let view = crate::crdt_state::read_item("888_deps_scr").expect("CRDT must have story");
|
||||
assert_eq!(
|
||||
view.depends_on,
|
||||
Some(vec![1, 2, 3]),
|
||||
view.depends_on(),
|
||||
&[1, 2, 3],
|
||||
"CRDT should hold [1,2,3] after set"
|
||||
);
|
||||
|
||||
@@ -245,9 +245,9 @@ mod tests {
|
||||
);
|
||||
assert!(r.is_ok(), "clear [] should succeed: {r:?}");
|
||||
let view = crate::crdt_state::read_item("888_deps_scr").expect("CRDT must have story");
|
||||
assert_eq!(
|
||||
view.depends_on, None,
|
||||
"CRDT should be None after clearing to []"
|
||||
assert!(
|
||||
view.depends_on().is_empty(),
|
||||
"CRDT should be empty after clearing to []"
|
||||
);
|
||||
|
||||
// Replace with [4, 5] — must not append to previous [1,2,3].
|
||||
@@ -258,8 +258,8 @@ mod tests {
|
||||
assert!(r.is_ok(), "replace [4,5] should succeed: {r:?}");
|
||||
let view = crate::crdt_state::read_item("888_deps_scr").expect("CRDT must have story");
|
||||
assert_eq!(
|
||||
view.depends_on,
|
||||
Some(vec![4, 5]),
|
||||
view.depends_on(),
|
||||
&[4, 5],
|
||||
"CRDT should hold exactly [4,5] after replace (not [1,2,3,4,5])"
|
||||
);
|
||||
}
|
||||
@@ -290,7 +290,10 @@ mod tests {
|
||||
);
|
||||
assert!(r.is_ok(), "clear should succeed: {r:?}");
|
||||
let view = crate::crdt_state::read_item("888_deps_persist").expect("CRDT must have story");
|
||||
assert_eq!(view.depends_on, None, "CRDT should be None after clear");
|
||||
assert!(
|
||||
view.depends_on().is_empty(),
|
||||
"CRDT should be empty after clear"
|
||||
);
|
||||
|
||||
// Now update a different field — this triggers write_story_content with
|
||||
// the stale YAML (which still has depends_on: [100, 200]).
|
||||
@@ -300,11 +303,11 @@ mod tests {
|
||||
);
|
||||
assert!(r.is_ok(), "subsequent name update should succeed: {r:?}");
|
||||
|
||||
// The CRDT must still be None — the YAML value must not have been restored.
|
||||
// The CRDT must still be empty — the YAML value must not have been restored.
|
||||
let view = crate::crdt_state::read_item("888_deps_persist").expect("CRDT must have story");
|
||||
assert_eq!(
|
||||
view.depends_on, None,
|
||||
"CRDT depends_on must remain None after unrelated update (write_story_content must not restore YAML value)"
|
||||
assert!(
|
||||
view.depends_on().is_empty(),
|
||||
"CRDT depends_on must remain empty after unrelated update (write_story_content must not restore YAML value)"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -327,8 +330,8 @@ mod tests {
|
||||
// CRDT register must hold the deps.
|
||||
let view = crate::crdt_state::read_item("504_arr_test").expect("CRDT must have the story");
|
||||
assert_eq!(
|
||||
view.depends_on,
|
||||
Some(vec![490, 491]),
|
||||
view.depends_on(),
|
||||
&[490, 491],
|
||||
"CRDT register should hold [490, 491]: {view:?}"
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user