Skip to content

Fix Windows xfail reason matching#115

Merged
leynos merged 2 commits intomainfrom
codex/replace-substring-match-with-exact-match
Sep 23, 2025
Merged

Fix Windows xfail reason matching#115
leynos merged 2 commits intomainfrom
codex/replace-substring-match-with-exact-match

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Sep 21, 2025

Summary

Testing

  • make test

https://chatgpt.com/codex/tasks/task_e_68d08c80d5bc8322afc155c5266499a8

Summary by Sourcery

Bug Fixes:

  • Ensure the xfail hook drops marks only when the reason exactly equals the Windows xfail reason

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Sep 21, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Refines the Windows smoke test xfail hook to drop marks only when the reason exactly matches the expected string, preventing unintended removals of other xfail markers.

File-Level Changes

Change Details Files
Use exact reason match for Windows xfail hook
  • Replaced substring inclusion check with equality comparison on stripped reason
.github/actions/rust-build-release/tests/conftest.py

Assessment against linked issues

Issue Objective Addressed Explanation
#114 Replace substring matching of xfail reason with exact string match (after trimming whitespace) in .github/actions/rust-build-release/tests/conftest.py.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 21, 2025

Summary by CodeRabbit

  • Tests
    • Refined handling of Windows-specific expected-fail marks to require an exact reason match, reducing accidental test exclusions.
    • Delivers more accurate test outcomes and clearer pass/fail reporting, especially on Windows.
    • Improves reliability and signal quality of CI runs and release validation across platforms.

Walkthrough

Tighten the pytest collection hook’s xfail filtering in .github/actions/rust-build-release/tests/conftest.py by replacing substring matching with exact, trimmed string equality for the Windows-specific xfail reason.

Changes

Cohort / File(s) Summary
Pytest xfail reason matching refinement
.github/actions/rust-build-release/tests/conftest.py
Replace substring check on mark.kwargs["reason"] with exact match after .strip(), narrowing which Windows xfail marks are removed during collection.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Pytest as Pytest Collector
  participant Hook as conftest.py hook
  participant Marks as Test Marks

  Pytest->>Hook: collect tests
  Hook->>Marks: iterate xfail marks
  alt reason exactly equals WINDOWS_XFAIL_REASON (trimmed)
    Hook-->>Marks: drop xfail mark
  else different or whitespace-variant only
    Hook-->>Marks: keep xfail mark
  end
  Hook-->>Pytest: return filtered tests/marks
  note over Hook: Exact equality replaces prior substring match
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

Trim the reason, match it true,
No more ghosts in xfail’s view.
Substrings banished, scope made tight,
Windows whispers judged just right.
Tests proceed in calmer flight—
Filters neat, and outcomes bright.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed Confirm that the title "Fix Windows xfail reason matching" succinctly and accurately summarises the primary change to the pytest xfail filtering logic; it is concise, specific and directly related to the changeset.
Linked Issues Check ✅ Passed Verify that the change implements exact trimmed equality matching for WINDOWS_XFAIL_REASON in .github/actions/rust-build-release/tests/conftest.py as requested by issue #114; the raw summary and PR objectives indicate the substring check was replaced with an equality check, satisfying the coding requirement.
Out of Scope Changes Check ✅ Passed Confirm that the diff only adjusts the pytest conftest hook to tighten Windows xfail reason matching and does not modify unrelated files or functionality; the raw summary lists only the single targeted file, so no out-of-scope changes are detected.
Description Check ✅ Passed Confirm that the PR description clearly states the intent to replace substring-based matching with exact trimmed equality for the Windows xfail reason, references issue #114, and includes testing instructions; the description is on-topic and aligns with the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/replace-substring-match-with-exact-match

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 484958d and 1977181.

📒 Files selected for processing (1)
  • .github/actions/rust-build-release/tests/conftest.py (1 hunks)
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review
🔇 Additional comments (1)
.github/actions/rust-build-release/tests/conftest.py (1)

344-347: Tighten xfail reason match with a safe type guard — LGTM

Implement exact, trimmed equality and restrict reason to strings; satisfies #114.

Run to confirm no remaining substring 'in' membership checks exist:

#!/bin/bash
set -euo pipefail
# Expect: no hits
rg -nP -C2 'WINDOWS_XFAIL_REASON\s+in\s+' || true

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Ruff (0.13.1)
.github/actions/rust-build-release/tests/conftest.py

�[1;31mruff failed�[0m
�[1mCause:�[0m Failed to load configuration /ruff.toml
�[1mCause:�[0m Failed to parse /ruff.toml
�[1mCause:�[0m TOML parse error at line 26, column 3
|
26 | "RSE100", # Use of assert detected
| ^^^^^^^^
Unknown rule selector: RSE100


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@leynos leynos force-pushed the codex/replace-substring-match-with-exact-match branch from 069681a to 484958d Compare September 23, 2025 14:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 097c717 and 484958d.

📒 Files selected for processing (1)
  • .github/actions/rust-build-release/tests/conftest.py (1 hunks)
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: python-tests (ubuntu-latest)
  • GitHub Check: python-tests (windows-latest)
  • GitHub Check: Sourcery review
  • GitHub Check: build-release (windows-latest, x86_64-pc-windows-gnu)
  • GitHub Check: build-release (windows-latest, aarch64-pc-windows-gnu)
🔇 Additional comments (1)
.github/actions/rust-build-release/tests/conftest.py (1)

344-345: Approve change; exact, trimmed match confirmed

Conftest uses str(mark.kwargs.get("reason", "")).strip() == WINDOWS_XFAIL_REASON; repository-wide search found no substring-based checks like WINDOWS_XFAIL_REASON in.

Comment thread .github/actions/rust-build-release/tests/conftest.py Outdated
@leynos leynos force-pushed the codex/replace-substring-match-with-exact-match branch from 9edcd1d to 1977181 Compare September 23, 2025 19:36
@leynos leynos merged commit 4bbd480 into main Sep 23, 2025
7 of 9 checks passed
@leynos leynos deleted the codex/replace-substring-match-with-exact-match branch September 23, 2025 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve xfail reason matching in pytest hook to prevent collateral removals

1 participant