From 4509bc7d207764451c0e9e2240a20ce3a4c73a91 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2026 13:47:57 +0000 Subject: [PATCH 1/2] test: reduce and improve tests in src/compile/types.rs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove test_frontmatter_inlined_imports_false_explicit: duplicate of test_frontmatter_inlined_imports_defaults_to_false — both assert key and explicit `false` are indistinguishable. - Strengthen test_supply_chain_feed_only_validates: the original assertion `validate().is_ok()` on a feed-only config was vacuous because `validate()` only errors when `registry` is Some without a connection. Now also tests combined feed + registry-with-connection, which exercises more of the validation logic. - Rewrite test_permissions_default: previously called `PermissionsConfig::default()` which is only ever called from this test (never in production). Replaced with deserialization of `permissions: {}`, which guards against accidentally adding a required field or a non-None serde default — a meaningful regression check. - Remove vacuous `allowed_extensions().is_empty()` assertion from test_cache_memory_bool_false: `CacheMemoryToolConfig::Enabled(_)` always returns `&[]` regardless of the bool, so this assertion can never fail. The coverage is already provided by test_cache_memory_with_options. - Remove vacuous `toolchain().is_none()` assertion from test_lean_bool_false: `LeanRuntimeConfig::Enabled(_)` always returns `None` from `toolchain()`; only the `WithOptions` variant can return `Some`. That case is covered by test_lean_with_toolchain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/compile/types.rs | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/compile/types.rs b/src/compile/types.rs index 119b66ca..535263aa 100644 --- a/src/compile/types.rs +++ b/src/compile/types.rs @@ -2063,8 +2063,14 @@ mod tests { #[test] fn test_supply_chain_feed_only_validates() { + // feed-only: registry is None, so validate() never errors regardless of feed. let sc = parse_supply_chain("supply-chain:\n feed: my-feed"); assert!(sc.validate().is_ok()); + // combined feed + registry-with-connection must also validate OK. + let sc2 = parse_supply_chain( + "supply-chain:\n feed: my-feed\n registry:\n name: myacr.azurecr.io\n service-connection: acr-conn", + ); + assert!(sc2.validate().is_ok()); } #[test] @@ -2254,7 +2260,12 @@ timeout-minutes: 60 #[test] fn test_permissions_default() { - let pc = PermissionsConfig::default(); + // Deserialising `permissions: {}` must produce None/None — guards against + // accidentally introducing a required field or a non-None serde default. + let yaml = "permissions: {}"; + let fm: serde_yaml::Value = serde_yaml::from_str(yaml).unwrap(); + let pc: PermissionsConfig = + serde_yaml::from_value(fm["permissions"].clone()).unwrap(); assert!(pc.read.is_none()); assert!(pc.write.is_none()); } @@ -2319,20 +2330,6 @@ Body assert!(fm.inlined_imports); } - #[test] - fn test_frontmatter_inlined_imports_false_explicit() { - let content = r#"--- -name: "Test Agent" -description: "Test" -inlined-imports: false ---- - -Body -"#; - let (fm, _) = super::super::common::parse_markdown(content).unwrap(); - assert!(!fm.inlined_imports); - } - // ─── CacheMemoryToolConfig deserialization ────────────────────────────── #[test] @@ -2366,7 +2363,6 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let cm = fm.tools.as_ref().unwrap().cache_memory.as_ref().unwrap(); assert!(!cm.is_enabled()); - assert!(cm.allowed_extensions().is_empty()); } #[test] @@ -2485,7 +2481,8 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let lean = fm.runtimes.as_ref().unwrap().lean.as_ref().unwrap(); assert!(!lean.is_enabled()); - assert!(lean.toolchain().is_none()); + // toolchain() always returns None for the Enabled variant; the WithOptions + // case is covered by test_lean_with_toolchain. } #[test] From 0acdb3ea8aeddebdebf58b3f2131561c5476799d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Jun 2026 15:33:36 +0000 Subject: [PATCH 2/2] test: restore three dropped coverage items per review feedback Co-authored-by: jamesadevine <4742697+jamesadevine@users.noreply.github.com> --- src/compile/types.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/compile/types.rs b/src/compile/types.rs index 535263aa..9a832b92 100644 --- a/src/compile/types.rs +++ b/src/compile/types.rs @@ -2330,6 +2330,20 @@ Body assert!(fm.inlined_imports); } + #[test] + fn test_frontmatter_inlined_imports_false_explicit() { + let content = r#"--- +name: "Test Agent" +description: "Test" +inlined-imports: false +--- + +Body +"#; + let (fm, _) = super::super::common::parse_markdown(content).unwrap(); + assert!(!fm.inlined_imports); + } + // ─── CacheMemoryToolConfig deserialization ────────────────────────────── #[test] @@ -2363,6 +2377,7 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let cm = fm.tools.as_ref().unwrap().cache_memory.as_ref().unwrap(); assert!(!cm.is_enabled()); + assert!(cm.allowed_extensions().is_empty()); } #[test] @@ -2481,8 +2496,7 @@ Body let (fm, _) = super::super::common::parse_markdown(content).unwrap(); let lean = fm.runtimes.as_ref().unwrap().lean.as_ref().unwrap(); assert!(!lean.is_enabled()); - // toolchain() always returns None for the Enabled variant; the WithOptions - // case is covered by test_lean_with_toolchain. + assert!(lean.toolchain().is_none()); } #[test]