huskies: merge 1177 bug project.toml scaffold puts top-level keys after [[component]] so uncommenting them silently no-ops
This commit is contained in:
@@ -246,7 +246,13 @@ fn default_max_mesh_peers() -> usize {
|
||||
}
|
||||
|
||||
/// Configuration for a project component (name, path, setup/teardown commands).
|
||||
///
|
||||
/// `deny_unknown_fields` turns a top-level setting that lands inside a
|
||||
/// `[[component]]` table (e.g. because it was placed below the last
|
||||
/// `[[component]]` header) into a hard parse error instead of a silently
|
||||
/// dropped key.
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
#[allow(dead_code)]
|
||||
pub struct ComponentConfig {
|
||||
pub name: String,
|
||||
|
||||
@@ -521,6 +521,26 @@ runtime = "openai"
|
||||
assert!(err.contains("unknown runtime 'openai'"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unrecognized_key_in_component_table_errors_instead_of_silently_dropping() {
|
||||
// Regression for story 1177: a top-level setting that ends up attached to
|
||||
// a `[[component]]` table (e.g. because it was placed below the last
|
||||
// `[[component]]` header) must be a hard error, not a silently swallowed
|
||||
// key.
|
||||
let toml_str = r#"
|
||||
[[component]]
|
||||
name = "server"
|
||||
path = "."
|
||||
base_branch = "main"
|
||||
"#;
|
||||
|
||||
let err = ProjectConfig::parse(toml_str).unwrap_err();
|
||||
assert!(
|
||||
err.contains("base_branch"),
|
||||
"expected error to mention the unrecognized key, got: {err}"
|
||||
);
|
||||
}
|
||||
|
||||
// ── base_branch config ──────────────────────────────────────────────────
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user