Skip to content

test: reduce and improve tests in src/compile/types.rs#1173

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/types-cycle5-8d1bd6f614e4924b
Draft

test: reduce and improve tests in src/compile/types.rs#1173
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/types-cycle5-8d1bd6f614e4924b

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/compile/types.rs

What was wrong

Test Category Problem
test_frontmatter_inlined_imports_false_explicit Duplicate Identical assertion (assert!(!fm.inlined_imports)) to test_frontmatter_inlined_imports_defaults_to_false. With #[serde(default)] on a bool, an absent key and an explicit false are indistinguishable — both paths produce false and both tests make the same assertion.
test_supply_chain_feed_only_validates Vacuous validate() only errors when registry is Some without a connection. With registry = None (feed-only), validate() always returns Ok(()) unconditionally — the assertion could never fail regardless of what the validate logic did.
test_permissions_default Low-value Called PermissionsConfig::default(), which is never invoked in any production code path. This tested the #[derive(Default)] macro's guaranteed behaviour (Option fields become None), not the actual deserialization contract.
test_cache_memory_bool_false Vacuous assertion CacheMemoryToolConfig::Enabled(_) always returns &[] from allowed_extensions(). The assert!(cm.allowed_extensions().is_empty()) assertion was trivially true for the Enabled variant regardless of the bool value.
test_lean_bool_false Vacuous assertion LeanRuntimeConfig::Enabled(_) always returns None from toolchain(). The assert!(lean.toolchain().is_none()) assertion was trivially true — only the WithOptions variant can return Some, and that is already covered by test_lean_with_toolchain.

Changes

Test Action Reason
test_frontmatter_inlined_imports_false_explicit Removed Duplicate of test_frontmatter_inlined_imports_defaults_to_false
test_supply_chain_feed_only_validates Strengthened Now also asserts that a combined feed + registry-with-connection config validates OK, exercising more of the validation logic
test_permissions_default Rewritten Now deserialises permissions: {} from YAML instead of calling Default::default() — tests the actual serde contract and guards against accidentally adding required fields
test_cache_memory_bool_false Trimmed Dropped the vacuous allowed_extensions().is_empty() assertion; kept the meaningful !cm.is_enabled() check
test_lean_bool_false Trimmed Dropped the vacuous toolchain().is_none() assertion; kept the meaningful !lean.is_enabled() check

Verification

  • cargo test: all tests pass ✅
  • cargo clippy --all-targets --all-features: no warnings or errors ✅

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · 1K AIC · ⌖ 19.3 AIC · ⊞ 36.7K ·

- 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants