Skip to content

test: fix vacuous assertions in src/execute.rs#1673

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/execute-rs-malformed-assertions-5dd13a1bc526117a
Draft

test: fix vacuous assertions in src/execute.rs#1673
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/execute-rs-malformed-assertions-5dd13a1bc526117a

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/execute.rs (round 2)

What was wrong

Five malformed-input tests only asserted result.is_err() with no check on the error message. These are vacuous from a regression-detection standpoint: the assertion passes regardless of why the function failed. If the implementation changed to reject inputs with an unrelated error (e.g. a panic, a network timeout, or wrong dispatch), the test would still pass silently.

Changes

Test Action Reason
test_execute_safe_output_malformed_work_item_returns_err Rewritten Bare is_err() — upgraded to unwrap_err() + "Failed to parse create-work-item" + "missing field" checks
test_execute_malformed_update_wiki_page_returns_err Rewritten Bare is_err() — same pattern
test_execute_malformed_create_wiki_page_returns_err Rewritten Bare is_err() — same pattern
test_execute_malformed_upload_pipeline_artifact_returns_err Rewritten Bare is_err() — same pattern
test_execute_malformed_comment_on_work_item_returns_err Rewritten Bare is_err() — same pattern

Each rewrite checks:

  1. The error message contains "Failed to parse {tool-name}" — confirming the correct dispatch path is hit (not a random earlier failure).
  2. The error message contains "missing field" — confirming serde deserialization is the actual failure mechanism.

Verification

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

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.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"

See Network Configuration for more information.

Generated by Test Reducer · 243.2 AIC · ⌖ 12.1 AIC · ⊞ 8.7K ·

Five malformed-input tests asserted only `result.is_err()` with no
check on the error message. This means the test passes even if the
implementation returns the wrong error (e.g. a network timeout instead
of a parse error). Replace each bare assertion with an unwrap_err() +
message check that confirms the dispatcher correctly identifies the
failing tool and reports a missing-field deserialization error.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
2 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot mentioned this pull request Jul 26, 2026
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