Skip to content

pip cross-check: stop once errors pass 5% of the plan; publish only after a successful scan - #90

Merged
patrickballard merged 2 commits into
wheelgap:mainfrom
sarankumar1325:fix/pip-check-early-stop
Nov 16, 2026
Merged

patrickballard merged 2 commits into
wheelgap:mainfrom
sarankumar1325:fix/pip-check-early-stop

Conversation

@sarankumar1325

Copy link
Copy Markdown
Contributor

Closes #51

scripts/check_pip.py

  • Before starting, agreement() counts the planned cells: every looked-up package × target that isn't unknown. pip runs through a small wrapper that counts errors as answers come in, under a lock. Once errors are over 5% of the planned total, it sets a stop flag. No new pip run starts after that, the remaining queued packages return at once, and TooManyErrors is raised: pip couldn't answer N of M checks, over 5% of the P planned, so it stopped early (examples). main() then exits 1 without writing, as today.
  • I used the planned total rather than a minimum sample (such as 40 attempts) because the early stop is then exact. With errors over 5% of everything planned, the final share (errors over the cells actually asked) is over 5% too, so it never stops a run that would have passed. For the nightly 800 checks it stops after 41 errors, about a minute with 8 workers at roughly 9 s per call, well inside the 15-minute step.
  • The end-of-run check stays for runs whose errors stay under 5% of the plan. The module docstring describes the early stop.

.github/workflows/scan.yml

  • publish now needs contains(fromJSON('["success","skipped"]'), needs.scan.result) in place of needs.scan.result != 'failure', so a scan that timed out or was displaced (cancelled) doesn't republish main. !cancelled() and the commit condition are unchanged. The YAML parses, and jobs.publish.if reads back as written.

Tests (tests/test_check_pip.py)

  • test_stops_starting_pip_once_errors_pass_five_percent_of_the_plan: every call fails, 60 planned, 2 workers. It raises the early-stop error after at most 5 pip calls, where main makes 60.
  • test_errors_that_stay_under_five_percent_of_the_plan_do_not_stop_it: 3 of 60 (exactly 5%) still runs all 60 calls and reports 3 errors.
  • test_too_many_errors_writes_nothing now expects the early-stop message.
  • With the script change reverted, 2 tests fail. 5 repeated runs passed, so the call-count bound isn't flaky. The full uvx --python 3.14 [email protected] run gives 341 passed, 1 skipped.

Written with an AI coding assistant; I reviewed the diff and ran the checks above.

…fter a successful scan

check_pip counts errors as answers come in and starts no more pip runs
once they pass 5% of every planned cell, when the result can only fail,
so an unreachable PyPI ends in about a minute instead of the step
timeout. publish now requires the scan to be success or skipped, so a
cancelled scan doesn't republish main.

Closes wheelgap#51

Signed-off-by: sarankumar1325 <[email protected]>
@patrickballard

Copy link
Copy Markdown
Contributor

Thanks @sarankumar1325, nice work on this one. Stopping against the planned total is a neat way to make the early stop exact (it can never stop a run that would have passed), and the success/skipped check on publish closes the cancelled-scan gap cleanly.

It looks good overall. Since it changes .github/workflows/scan.yml and scripts/, and the issue is help wanted, Patrick reviews and merges these himself, so he'll take it from here. One small thing he may tidy: import threading sits between collections.abc and concurrent.futures, out of the usual sorted order.

(Review assisted by Claude.)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@patrickballard
patrickballard merged commit ee2a851 into wheelgap:main Nov 16, 2026
1 check passed
@patrickballard

Copy link
Copy Markdown
Contributor

Merged, thanks @sarankumar1325! Stopping against the planned total is a neat touch: the early stop is exact, so it can never cut short a run that would have passed. And a cancelled scan can no longer publish a half-finished site.

That's four tracker PRs from you today. If you'd like another, #92 brings the whole-tree install results ("will pip install X work here?") into the home page's lookup card. Say the word and it's yours.

(Reply assisted by Claude.)

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.

pip cross-check: stop early once errors pass 5%, and don't publish when the scan was cancelled

2 participants