huskies: merge 1177 bug project.toml scaffold puts top-level keys after [[component]] so uncommenting them silently no-ops

This commit is contained in:
Huskies Agent
2026-07-16 16:13:17 +00:00
parent 0eacffa08d
commit a4e2d4bc25
4 changed files with 64 additions and 1 deletions
+32
View File
@@ -140,6 +140,38 @@ fn scaffold_project_toml_round_trips_through_project_config_load() {
);
}
#[test]
fn scaffold_project_toml_uncommenting_base_branch_takes_effect() {
use crate::config::ProjectConfig;
// Regression for story 1177: the scaffold template used to emit
// `[[component]]` headers before the commented top-level settings, so
// uncommenting a setting like `base_branch` attached it to the last
// `[[component]]` table instead of the top level, silently no-opping.
let dir = tempdir().unwrap();
fs::write(
dir.path().join("Cargo.toml"),
"[package]\nname = \"myapp\"\n",
)
.unwrap();
scaffold_story_kit(dir.path(), 3001).unwrap();
let content = fs::read_to_string(dir.path().join(".huskies/project.toml")).unwrap();
assert!(
content.contains("# base_branch = \"main\""),
"scaffold should emit a commented-out base_branch line to uncomment"
);
let uncommented = content.replace("# base_branch = \"main\"", "base_branch = \"main\"");
let config =
ProjectConfig::parse(&uncommented).expect("uncommented project.toml should still parse");
assert_eq!(
config.base_branch,
Some("main".to_string()),
"uncommenting base_branch in the scaffolded project.toml must take effect"
);
}
#[test]
fn scaffold_context_is_blank_template_not_story_kit_content() {
let dir = tempdir().unwrap();