Skip to content

Refuse to publish incomplete PHEP 3 schedules - #34

Merged
sapols merged 2 commits into
mainfrom
fix-schedule-integrity
Nov 4, 2026
Merged

sapols merged 2 commits into
mainfrom
fix-schedule-integrity

Conversation

@sapols

@sapols sapols commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Problem

phep3-check checks dependencies against a generated schedule.json. When a PyPI request failed during generation, fetch_package_releases() printed a warning and returned {}, fetch_all_core_packages() kept that empty entry, and update_schedule_file() saved it. release.yml publishes that file as the release asset the Action downloads by default, and the monthly update-schedule.yml commits it straight to main. The checker then returned silently for any core package with no schedule data.

So one transient PyPI failure during release.yml or the monthly update-schedule.yml silently disabled that core package's PHEP 3 checks for every Action user and every local run. For example, with packages.numpy = {}, a project with requires-python = ">=3.13" and numpy>=2.3 reported PASSED (exit 0), even with --fail-on-warning, instead of [ERROR] numpy>=2.3 drops support for numpy 2.2 too early.

This came out of a Codex review of #32, which makes local runs download the release schedule.json to match the Action. The weakness predates #32, and fixing it at the generator protects the Action and every local path at once, so it's a separate PR rather than extra validation inside #32.

Fix

  • Generation refuses incomplete data (src/pyhc_actions/phep3/pypi_fetcher.py): fetch_all_core_packages() raises a RuntimeError naming every core package with no release data, whether its request failed or it returned no usable X.Y.0 versions. update_schedule_file() therefore writes nothing, and the uncaught error exits the workflows' python -c step with status 1, so release.yml never uploads and update-schedule.yml never commits an incomplete schedule. The previous complete schedule stays in place, and the workflows themselves need no changes.
  • The checker warns instead of passing silently (src/pyhc_actions/phep3/checker.py): a core dependency whose schedule entry is missing or empty now gets [WARN] numpy>=2.3 was not checked: schedule has no numpy release data, in base dependencies and extras alike, so --fail-on-warning fails. Dependencies whose python_version markers exclude every supported Python still produce nothing, as before.

Retry

Each PyPI request now gets 3 attempts, 5s and then 10s apart. Since one failed request now fails the whole run, this keeps a brief PyPI hiccup from failing a tag-push release or the unattended monthly job. It costs nothing when PyPI responds and adds about 15s per package only to runs that fail anyway.

Tests

pytest tests/ -v → 224 passed (211 on main).

  • tests/test_pypi_fetcher.py (new): a failed request is retried and then succeeds; a package that never responds yields no releases after all attempts; when the last core package fails, either by a request error after all retries or by a response with no usable X.Y.0 versions, an existing schedule.json stays byte-for-byte unchanged; and the exact python -c "...update_schedule_file('schedule.json')" command from both workflows exits 1 without touching schedule.json.
  • TestMissingScheduleData in tests/test_phep3_checker.py: the empty-numpy case through the CLI (warning with exit 0, exit 1 with --fail-on-warning, also with --no-adoption-check, and with numpy in an extra), a core package missing from the schedule entirely, and a control showing the complete schedule still reports the error.
  • 11 of the 13 new tests fail against main; the 2 controls pass on both.
  • By hand: generation against live PyPI still writes all 10 core packages, and with PyPI unreachable it exits 1 and leaves the old file untouched.

Release

Today's published release asset (v1.1.3, generated 2026-09-29) and the committed schedule.json (generated 2026-11-01) both have data for all 10 core packages, so nothing needs regenerating. This should ship in the same release as #32.

🤖 Generated with Claude Code

sapols and others added 2 commits November 3, 2026 18:15
A failed PyPI fetch left that core package's entry empty in the generated schedule.json, which release.yml publishes and update-schedule.yml commits. The checker then skipped the package's checks silently, so a project with `numpy>=2.3` passed (even with --fail-on-warning) when numpy 2.2 must still be supported.

- Schedule generation now raises when any core package has no release data, so both workflows fail and the previous schedule stays in place. Each PyPI request gets 3 attempts (5s, then 10s apart) so a brief outage doesn't fail a release.
- The checker warns when a core dependency has no schedule data (missing or empty entry) instead of returning silently.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A later core package failing, by a request error or by yielding no usable X.Y.0 versions, leaves an existing schedule.json byte-for-byte unchanged.
- The workflows' `python -c` generation command exits 1 and keeps schedule.json.
- The "was not checked" warning also appears for a core dependency in an extra and with --no-adoption-check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sapols
sapols marked this pull request as ready for review November 4, 2026 01:34
@sapols
sapols merged commit ef91a87 into main Nov 4, 2026
7 checks passed
@sapols
sapols deleted the fix-schedule-integrity branch November 4, 2026 01:42
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.

1 participant