Repository navigation
test(preprocessing): mark the inf-mask timing guards as slow - #1337
Merged
adrian-prior merged 3 commits intoOct 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9ab9f63. Configure here.
Both inf-mask performance guards in this file assert a wall-clock ratio against the other path, but neither carried a `slow` marker, so `pytest -m "not slow"` in the PR matrix did not deselect them and two wall-clock assertions ran in every pull request job. On the macos-15 / 3.14 / highest runner the fragmented-frame guard measured 8.79ms against a 6.94ms pandas baseline and failed its 1.25x budget, turning a PR that does not touch `clean.py` or the inf-mask paths red. The failure is a property of the runner, not of the code, so it makes unrelated PRs fail and trains reviewers to discount the signal. The docstring of the first guard already states it is "marked `slow` to run at merge time", so this adds the marker that was intended, and applies it to the sibling single-block guard which has the same shape. Both now run only in the merge-time matrix. The deterministic checks are untouched and still run in every PR: each guard first asserts the two paths agree element-for-element before timing them, and that assertion is the one that actually catches a regression in this code.
aniruddhaadak80
force-pushed
the
fix/inf-mask-timing-test-slow
branch
from
October 1, 2026 09:40
9ab9f63 to
58ec47f
Compare
adrian-prior
reviewed
Oct 1, 2026
adrian-prior
left a comment
Contributor
There was a problem hiding this comment.
Thanks for setting this up! Can you remove the changelog, then I am happy to approve the PR!
… `slow` marker their docstring already described, so their wall-clock assertions run in the merge-time matrix rather than in every pull request job. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… the failure The scientific-python/action-towncrier-changelog check exits 1 when a skip label is present AND a changelog file exists in the PR. So the fragment added in 58ec47f is what keeps the "Changelog entry" check red, not the absence of one. The repo README lists test refactoring as a case where the label is the right answer, and a maintainer has since applied it to this PR. Leaving the fragment in place guarantees a permanently red check; removing it lets the label do its job.
adrian-prior
approved these changes
Oct 1, 2026
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.

Issue
Fixes #1336
Motivation and Context
tests/test_preprocessing/test_inf_handling.pyhas two performance guards that assert a wall-clock ratio against the other code path:and its sibling
test__inf_mask__pandas_path_not_slower_than_per_block_on_single_block, which asserts the same kind of ratio in the other direction.Two problems:
The
slowmarker the docstring claims is not there. The first guard's docstring says it is "markedslowto run at merge time", but the only decorator on it is@pytest.mark.skipif(PANDAS_BELOW_3, ...). There is no@pytest.mark.slow, sopytest -m "not slow"in the PR matrix (.github/workflows/ci.yml) does not deselect it. The sibling has no marker and no such claim. The net effect is that two wall-clock assertions run in every pull request job.The 1.25x budget does not survive shared-runner noise. The comparison is a ratio of two
statistics.medianvalues over 11 wall-clock runs of ~7-9ms of work. A busy shared runner is enough to invert it.Observed failure
From the
Test Package Compatibility (macos-15, 3.14, highest)job on a PR that does not touchclean.pyor the inf-mask paths at all:8.79 / 6.94 = 1.27x, just over the 1.25x budget. The same commit passes the other matrix legs, so the failure is a property of the runner rather than of the code. That makes unrelated PRs red and trains reviewers to discount the signal.
What this changes
This adds the marker the docstring already describes, and applies it to the sibling guard which has the same shape. Both now run only in the merge-time matrix, which is what the docstring intends and what a timing assertion is good for.
The deterministic checks are deliberately untouched and still run in every PR. Each guard asserts the two paths agree element-for-element before timing them:
That assertion is the one that actually catches a regression in this code, and it is not wall-clock dependent, so it keeps its place in the PR gate.
Public API Changes
How Has This Been Tested?
Both directions of the marker were verified with
pytest --collect-only, so the evidence is about test selection rather than about wall-clock numbers, which are not reproducible on an arbitrary machine.Before the change, the guard is collected when the PR matrix does not filter it, confirming it is a PR-gate test today:
With the first marker added, it is deselected as intended:
With both markers added, the two timing guards are deselected and every other test in the file still runs:
Lint and format, both clean:
No changelog fragment is included: a maintainer applied the "no changelog needed" label, which the repo README lists as the right call for test refactoring that is not a bug fix. That label only takes effect once the fragment is gone, because
action-towncrier-changelogfails when both are present.Checklist
changelog/README.md), or "no changelog needed" label requested.