huskies: merge 741
This commit is contained in:
@@ -202,6 +202,29 @@ pub(super) async fn tool_status(args: &Value, ctx: &AppContext) -> Result<String
|
|||||||
{
|
{
|
||||||
front_matter.insert("review_hold".to_string(), json!(rh));
|
front_matter.insert("review_hold".to_string(), json!(rh));
|
||||||
}
|
}
|
||||||
|
if let Some(deps) = &meta.depends_on
|
||||||
|
&& !deps.is_empty()
|
||||||
|
{
|
||||||
|
front_matter.insert("depends_on".to_string(), json!(deps));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- CRDT view fields (claimed_by, claimed_at, is_deleted) ---
|
||||||
|
// read_item uses the visible index, so is_deleted is always false here;
|
||||||
|
// we include it only when true (which cannot happen for stories that
|
||||||
|
// 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
|
||||||
|
&& !cb.is_empty()
|
||||||
|
{
|
||||||
|
front_matter.insert("claimed_by".to_string(), json!(cb));
|
||||||
|
}
|
||||||
|
if let Some(ca) = view.claimed_at
|
||||||
|
&& ca > 0.0
|
||||||
|
{
|
||||||
|
front_matter.insert("claimed_at".to_string(), json!(ca));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- AC checklist ---
|
// --- AC checklist ---
|
||||||
@@ -336,6 +359,29 @@ mod tests {
|
|||||||
assert!(result.unwrap_err().contains("not found in work/2_current/"));
|
assert!(result.unwrap_err().contains("not found in work/2_current/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn tool_status_returns_blocked_retry_count_and_depends_on() {
|
||||||
|
let tmp = tempdir().unwrap();
|
||||||
|
|
||||||
|
crate::crdt_state::init_for_test();
|
||||||
|
crate::db::ensure_content_store();
|
||||||
|
let story_content = "---\nname: Blocked Story\nblocked: true\nretry_count: 3\ndepends_on: [100, 200]\n---\n\n## Acceptance Criteria\n\n- [ ] Do the thing\n";
|
||||||
|
crate::db::write_item_with_content("9887_story_blocked_test", "2_current", story_content);
|
||||||
|
|
||||||
|
let ctx = crate::http::context::AppContext::new_test(tmp.path().to_path_buf());
|
||||||
|
let result = tool_status(&json!({"story_id": "9887_story_blocked_test"}), &ctx)
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(parsed["front_matter"]["blocked"], true);
|
||||||
|
assert_eq!(parsed["front_matter"]["retry_count"], 3);
|
||||||
|
let depends_on = parsed["front_matter"]["depends_on"].as_array().unwrap();
|
||||||
|
assert_eq!(depends_on.len(), 2);
|
||||||
|
assert_eq!(depends_on[0], 100);
|
||||||
|
assert_eq!(depends_on[1], 200);
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn tool_status_returns_story_data() {
|
async fn tool_status_returns_story_data() {
|
||||||
let tmp = tempdir().unwrap();
|
let tmp = tempdir().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user