Skip to content

test: reduce and improve tests in safeoutputs noop/link_work_items/result#874

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/fix-safeoutputs-noop-link-result-65ffd19b119a91d8
Draft

test: reduce and improve tests in safeoutputs noop/link_work_items/result#874
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/fix-safeoutputs-noop-link-result-65ffd19b119a91d8

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 6, 2026

Test Suite Reduction: src/safeoutputs/

What was wrong

  • noop.rstest_result_serializes_correctly: duplicate of test_result_serializes_to_valid_json. Both tests create a NoopResult and assert on the name and context JSON fields. The removed test used fragile contains() string checks; the retained test uses proper serde_json::Value access and is strictly more rigorous.
  • result.rstest_from_env_lookup_build_id_parses_numeric: strict subset of test_from_env_lookup_populates_build_fields. The larger test already sets BUILD_BUILDID and asserts ctx.build_id == Some(12345) through the identical code path. The removed test added nothing beyond the existing assertion.
  • link_work_items.rstest_config_deserializes_from_yaml: used four separate assertions (len() == 3 + three contains() calls) instead of a single assert_eq!. The old form did not verify Vec ordering (YAML arrays are ordered) and was unnecessarily verbose.
  • result.rstest_anyhow_to_mcp_error_preserves_message: used assert!(mcp_err.message.contains("test error message")). Because the anyhow message passes through verbatim (err.to_string().into()), assert_eq! is both correct and more precise — it would catch unintended wrapping or prefixing that contains() would silently allow.

Changes

File Test Action Category
src/safeoutputs/noop.rs test_result_serializes_correctly Removed Duplicate (weaker)
src/safeoutputs/result.rs test_from_env_lookup_build_id_parses_numeric Removed Duplicate (subset)
src/safeoutputs/link_work_items.rs test_config_deserializes_from_yaml Rewritten Incorrect (contains → assert_eq)
src/safeoutputs/result.rs test_anyhow_to_mcp_error_preserves_message Rewritten Incorrect (contains → assert_eq)

Verification

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

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 · sonnet46 4.4M ·

…sult

- noop.rs: remove test_result_serializes_correctly (weaker duplicate of
  test_result_serializes_to_valid_json; both test the same two JSON fields
  but the removed test used contains() string checks instead of proper
  serde_json::Value access)
- result.rs: remove test_from_env_lookup_build_id_parses_numeric (strict
  subset of test_from_env_lookup_populates_build_fields which already
  asserts ctx.build_id == Some(12345) via the identical code path)
- link_work_items.rs: rewrite test_config_deserializes_from_yaml from
  four separate len()+contains() assertions to a single assert_eq! that
  also verifies Vec ordering
- result.rs: rewrite test_anyhow_to_mcp_error_preserves_message to use
  assert_eq! instead of contains() — the message passes through verbatim
  so an exact equality check is both correct and more precise

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