huskies: merge 509_bug_create_story_silently_drops_description_and_any_other_unknown_parameters_with_no_error
This commit is contained in:
@@ -20,6 +20,7 @@ pub(super) fn tool_create_story(args: &Value, ctx: &AppContext) -> Result<String
|
||||
.and_then(|v| v.as_str())
|
||||
.ok_or("Missing required argument: name")?;
|
||||
let user_story = args.get("user_story").and_then(|v| v.as_str());
|
||||
let description = args.get("description").and_then(|v| v.as_str());
|
||||
let acceptance_criteria: Option<Vec<String>> = args
|
||||
.get("acceptance_criteria")
|
||||
.and_then(|v| serde_json::from_value(v.clone()).ok());
|
||||
@@ -35,6 +36,7 @@ pub(super) fn tool_create_story(args: &Value, ctx: &AppContext) -> Result<String
|
||||
&root,
|
||||
name,
|
||||
user_story,
|
||||
description,
|
||||
acceptance_criteria.as_deref(),
|
||||
depends_on.as_deref(),
|
||||
commit,
|
||||
@@ -798,6 +800,34 @@ mod tests {
|
||||
assert!(result.unwrap_err().contains("Missing required argument"));
|
||||
}
|
||||
|
||||
// Regression test for bug 509: description was silently dropped.
|
||||
#[test]
|
||||
fn tool_create_story_description_is_written_to_file() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let ctx = test_ctx(tmp.path());
|
||||
|
||||
let result = tool_create_story(
|
||||
&json!({
|
||||
"name": "Story With Description",
|
||||
"description": "This is the background context."
|
||||
}),
|
||||
&ctx,
|
||||
)
|
||||
.unwrap();
|
||||
assert!(result.contains("Created story:"));
|
||||
|
||||
let story_id = result.trim_start_matches("Created story: ").trim().to_string();
|
||||
let content = crate::db::read_content(&story_id).expect("story content should exist");
|
||||
assert!(
|
||||
content.contains("## Description"),
|
||||
"Description section missing from story: {content}"
|
||||
);
|
||||
assert!(
|
||||
content.contains("This is the background context."),
|
||||
"Description text missing from story: {content}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tool_get_pipeline_status_returns_structured_response() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user