Skip to content

test: fix weak and incorrect assertions in pr_filters tests#1151

Draft
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/pr-filters-cycle5-bfb6e2e38cef0394
Draft

test: fix weak and incorrect assertions in pr_filters tests#1151
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/pr-filters-cycle5-bfb6e2e38cef0394

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/compile/pr_filters.rs

What was wrong

  • test_gate_step_commit_message: assert!(pattern.contains("skip-agent")) is too weak — it passes for any pattern containing that substring, including one with the wildcards stripped. The pattern "*[skip-agent]*" must survive round-trip unchanged.

  • test_gate_step_change_count_includes_changed_files_fact: Test name claims to verify that ChangedFileCount transitively depends on ChangedFiles, but the body also set an explicit changed_files filter — so changed_files appeared in spec.facts regardless of the dependency. A regression removing the dependency declaration would have gone undetected.

  • test_gate_step_build_reason_include: Match arm used .. to silently skip the fact field inside ValueInSet. A regression wiring the wrong fact (e.g. "pr_title" instead of "build_reason") would not have been caught.

  • test_gate_step_build_reason_exclude: Same issue in the ValueNotInSet arm.

  • test_gate_step_labels_none_of: Missing check.name and fact assertions. The symmetric test_gate_step_labels_any_of already checked both; this variant was inconsistently weaker.

Changes

Test Action Reason
test_gate_step_commit_message Rewritten Weak check: containsassert_eq! on full pattern
test_gate_step_change_count_includes_changed_files_fact Corrected Removed changed_files filter so test exercises the declared dependency
test_gate_step_build_reason_include Strengthened Added assert_eq!(fact, "build_reason")
test_gate_step_build_reason_exclude Strengthened Added assert_eq!(fact, "build_reason")
test_gate_step_labels_none_of Strengthened Added check.name and fact assertions for consistency

Verification

  • cargo test: 2123 tests pass, 0 failed ✅
  • cargo clippy --all-targets --all-features: no 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 · 678.1 AIC · ⌖ 36.6 AIC · ⊞ 36.7K ·

Five fixes in src/compile/pr_filters.rs:

- test_gate_step_commit_message: pattern.contains("skip-agent") was too
  weak and would pass for many wrong patterns; replace with

- test_gate_step_change_count_includes_changed_files_fact: test name claims
  to verify that ChangedFileCount transitively depends on ChangedFiles, but
  the body also added an explicit changed_files filter — masking the
  dependency entirely. Remove that filter so only min_changes is set and
  changed_files can only appear via the declared dependency.

- test_gate_step_build_reason_include: match arm used .. to skip the fact
  field, so a regression that wired the wrong fact would go undetected.

- test_gate_step_build_reason_exclude: same issue as above for

- test_gate_step_labels_none_of: was missing both check.name and fact
  assertions that the symmetric test_gate_step_labels_any_of already

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