huskies: merge 504_story_update_story_front_matter_mcp_schema_should_accept_non_string_values_lists_bools_numbers

Squash merge of story 504: add MCP regression tests for non-string
front_matter values (arrays, bools, integers). The schema change itself
was already on master. Fixed the array assertion to match YAML's
space-after-comma inline sequence format.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Timmy
2026-04-10 11:08:21 +01:00
parent 9633ab35a6
commit 92b212e7fd
+79
View File
@@ -1521,6 +1521,85 @@ mod tests {
);
}
// ── tool_update_story non-string front matter tests ───────────────────────
fn setup_story_for_update(dir: &std::path::Path, story_id: &str, content: &str) {
let current = dir.join(".huskies/work/2_current");
fs::create_dir_all(&current).unwrap();
fs::write(current.join(format!("{story_id}.md")), content).unwrap();
crate::db::ensure_content_store();
crate::db::write_content(story_id, content);
}
#[test]
fn tool_update_story_front_matter_json_bool_written_unquoted() {
let tmp = tempfile::tempdir().unwrap();
setup_story_for_update(
tmp.path(),
"504_bool_test",
"---\nname: Bool Test\n---\n\nNo sections.\n",
);
let ctx = test_ctx(tmp.path());
let result = tool_update_story(
&json!({"story_id": "504_bool_test", "front_matter": {"blocked": false}}),
&ctx,
);
assert!(result.is_ok(), "Expected ok: {result:?}");
let content = crate::db::read_content("504_bool_test").unwrap();
assert!(content.contains("blocked: false"), "bool should be unquoted: {content}");
assert!(!content.contains("blocked: \"false\""), "bool must not be quoted: {content}");
}
#[test]
fn tool_update_story_front_matter_json_number_written_unquoted() {
let tmp = tempfile::tempdir().unwrap();
setup_story_for_update(
tmp.path(),
"504_num_test",
"---\nname: Num Test\n---\n\nNo sections.\n",
);
let ctx = test_ctx(tmp.path());
let result = tool_update_story(
&json!({"story_id": "504_num_test", "front_matter": {"retry_count": 3}}),
&ctx,
);
assert!(result.is_ok(), "Expected ok: {result:?}");
let content = crate::db::read_content("504_num_test").unwrap();
assert!(content.contains("retry_count: 3"), "number should be unquoted: {content}");
assert!(!content.contains("retry_count: \"3\""), "number must not be quoted: {content}");
}
#[test]
fn tool_update_story_front_matter_json_array_written_as_yaml_sequence() {
let tmp = tempfile::tempdir().unwrap();
setup_story_for_update(
tmp.path(),
"504_arr_test",
"---\nname: Array Test\n---\n\nNo sections.\n",
);
let ctx = test_ctx(tmp.path());
let result = tool_update_story(
&json!({"story_id": "504_arr_test", "front_matter": {"depends_on": [490, 491]}}),
&ctx,
);
assert!(result.is_ok(), "Expected ok: {result:?}");
let content = crate::db::read_content("504_arr_test").unwrap();
// YAML inline sequences use spaces after commas
assert!(content.contains("depends_on: [490, 491]"), "array should be unquoted YAML: {content}");
assert!(!content.contains("depends_on: \""), "array must not be quoted: {content}");
// The YAML must be parseable as a vec
let meta = crate::io::story_metadata::parse_front_matter(&content)
.expect("front matter should parse");
assert_eq!(meta.depends_on, Some(vec![490, 491]));
}
#[test]
fn tool_check_criterion_missing_story_id() {
let tmp = tempfile::tempdir().unwrap();