huskies: merge 1010
This commit is contained in:
@@ -211,6 +211,30 @@ pub fn set_qa_mode(story_id: &str, mode: Option<QaMode>) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Set the `plan_state` CRDT register for a pipeline item (story 1010).
|
||||
///
|
||||
/// Encodes the PLAN.md lifecycle as a wire string (`"missing"`, `"drafted"`,
|
||||
/// `"confirmed"`). Called by the filesystem watcher when PLAN.md is created,
|
||||
/// modified, or removed inside a coding worktree.
|
||||
///
|
||||
/// Returns `true` if the item was found and the op was applied, `false` otherwise.
|
||||
pub fn set_plan_state(story_id: &str, state: crate::pipeline_state::PlanState) -> bool {
|
||||
let Some(state_mutex) = get_crdt() else {
|
||||
return false;
|
||||
};
|
||||
let Ok(mut crdt_state) = state_mutex.lock() else {
|
||||
return false;
|
||||
};
|
||||
let Some(&idx) = crdt_state.index.get(story_id) else {
|
||||
return false;
|
||||
};
|
||||
let value = state.as_str().to_string();
|
||||
apply_and_persist(&mut crdt_state, |s| {
|
||||
s.crdt.doc.items[idx].plan_state.set(value)
|
||||
});
|
||||
true
|
||||
}
|
||||
|
||||
/// Write a pipeline item state through CRDT operations.
|
||||
///
|
||||
/// If the item exists, updates its registers. If not, inserts a new item
|
||||
@@ -232,7 +256,7 @@ pub fn write_item(
|
||||
) {
|
||||
let stage_str = stage_dir_name(stage);
|
||||
let claim: Option<&AgentClaim> = match stage {
|
||||
Stage::Coding { claim } => claim.as_ref(),
|
||||
Stage::Coding { claim, .. } => claim.as_ref(),
|
||||
Stage::Merge { claim, .. } => claim.as_ref(),
|
||||
_ => None,
|
||||
};
|
||||
@@ -350,6 +374,7 @@ pub fn write_item(
|
||||
"item_type": "",
|
||||
"epic": "",
|
||||
"resume_to": "",
|
||||
"plan_state": "",
|
||||
})
|
||||
.into();
|
||||
|
||||
@@ -378,6 +403,7 @@ pub fn write_item(
|
||||
item.item_type.advance_seq(floor);
|
||||
item.epic.advance_seq(floor);
|
||||
item.resume_to.advance_seq(floor);
|
||||
item.plan_state.advance_seq(floor);
|
||||
}
|
||||
|
||||
// Broadcast a CrdtEvent for the new item.
|
||||
|
||||
Reference in New Issue
Block a user