test: fix vacuous is_err() assertions in create_git_tag and comment_on_work_item#1578
Merged
jamesadevine merged 1 commit intoJul 21, 2026
Conversation
…n_work_item Replace bare assert!(result.is_err()) with unwrap_err() + message content assertions so regressions that produce the wrong error cannot silently pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jamesadevine
marked this pull request as ready for review
July 21, 2026 13:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test Suite Reduction:
src/safe_outputs/create_git_tag.rs+src/safe_outputs/comment_on_work_item.rsWhat was wrong
test_validation_rejects_short_message(create_git_tag): bareassert!(result.is_err())— passes even if the wrong validator fires (e.g. tag_name check running instead of message check).test_validation_rejects_repository_pipeline_command(create_git_tag): bareassert!(result.is_err())— passes even if any unrelated validation rejects the input.test_validation_rejects_zero_work_item_id(comment_on_work_item): bareassert!(result.is_err())— would pass even if a completely different field caused the error.test_validation_rejects_negative_work_item_id(comment_on_work_item): same issue — assertion says nothing about which field was rejected or why.test_validation_rejects_short_body(comment_on_work_item): same issue — body-length guard could regress without the test catching it.Changes
test_validation_rejects_short_messagecreate_git_tag.rsis_err()→unwrap_err()+ assert contains"message must be at least 5 characters"test_validation_rejects_repository_pipeline_commandcreate_git_tag.rsis_err()→unwrap_err()+ assert contains"pipeline command"test_validation_rejects_zero_work_item_idcomment_on_work_item.rsis_err()→unwrap_err()+ assert contains"work_item_id must be positive"test_validation_rejects_negative_work_item_idcomment_on_work_item.rsis_err()→unwrap_err()+ assert contains"work_item_id must be positive"test_validation_rejects_short_bodycomment_on_work_item.rsis_err()→unwrap_err()+ assert contains"body must be at least 10 characters"Verification
cargo test: 2569+ tests pass, 0 failed ✅cargo clippy: no new warnings ✅Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
spsprodeus21.vssps.visualstudio.comSee Network Configuration for more information.