Skip to content

PyPI shows the wrong pre-commit rev for 11 of the 24 releases since #546: the pin is set by hand, in a race with publishing #722

Open

Description

@invictustitan2

What happens

The README is the long description PyPI shows, and #546 made pinning it a standing check. AGENTS.md asks every change to keep rev: on the released version, because a README that is wrong when the release is published "ships the old pin to PyPI, where it cannot be corrected without another release."

I read the rev: in the description of every release on PyPI. Of the 24 releases since #546, 11 name a different version:

Release rev: on its PyPI page
2.18.1 v2.18.0
2.18.2 v2.18.1
2.18.3 v2.18.2
2.19.1 v2.19.0
2.19.2 v2.19.0
2.19.3 v2.19.2
2.19.5 v2.19.4
2.20.0 v2.19.5
2.20.1 v2.21.0
2.21.0 v2.20.5
2.22.0 v2.21.1

The other 13 are right. 2.20.1 names a version that did not exist yet.

$ curl -s https://pypi.org/pypi/commit-check/2.22.0/json | python -c "import json,sys,re; print(re.findall(r'rev: (v\S+)', json.load(sys.stdin)['info']['description']))"
['v2.21.1']

Why

The pin is a hand edit that has to land in a short window: after the version is known, before the release is published. The recent misses fall on both sides of it:

Release Pin PR When it merged
2.20.0 #667 17 min after the release was published
2.21.0 #702 14 h after
2.22.0 #711 14 s after
2.20.1 #674 27 s before, but it pinned v2.21.0 and the release went out as v2.20.1; #676 fixed main, not PyPI

Pinning ahead has a cost of its own, which #687 names: until the tag exists, pre-commit can't resolve the pin. main is in that state now: it pins v2.23.1, which has no tag or PyPI release yet.

Suggested fix

The publish job already builds from the tag, so it can write the tag into the README before it builds. setuptools-scm then has to be given the version, because the edited README makes the tree dirty and the wheel would otherwise build as 2.22.0.post1.dev0:

    - name: Pin the README to this release
      if: github.event_name == 'release'
      env:
        TAG: ${{ github.event.release.tag_name }}
      run: |
        python - <<'PY'
        import os, pathlib, re
        p = pathlib.Path("README.md")
        p.write_text(re.sub(r"(rev:\s*)v\d+\.\d+\.\d+", rf"\g<1>{os.environ['TAG']}", p.read_text()))
        PY
        echo "SETUPTOOLS_SCM_PRETEND_VERSION_FOR_COMMIT_CHECK=${TAG#v}" >> "$GITHUB_ENV"

It goes before Build wheel. Checked on v2.22.0 with the workflow's own pip wheel --no-deps -w dist .:

Build Version rev: in the description
v2.22.0 as tagged 2.22.0 v2.21.1, what PyPI has
README stamped 2.22.0.post1.dev0 v2.22.0
README stamped, version given 2.22.0 v2.22.0

The workflow_dispatch dry run to TestPyPI has no release tag, so the step is skipped there and nothing changes.

What it changes in AGENTS.md

The exception for pinning ahead of the tag can go, along with the check after publishing that #720 asks for: the job does both. The README on main would be bumped once the release exists, the same rule .pre-commit-config.yaml already follows, so it never names a tag that doesn't exist. A late bump then only leaves GitHub's README one release behind for a while. PyPI is right either way.

Happy to send the PR, with the AGENTS.md wording, if the direction seems right.

Activity

  1. shenxianpeng commented on Nov 20, 2026

    @shenxianpeng
    Member

    Hi @invictustitan2 Thanks for bringing this up. Feel free to submit a PR. Thank you so much!

  2. invictustitan2 commented on Nov 20, 2026

    @invictustitan2
    ContributorAuthor

    Following up from #723, as promised there. Reading further for this turned up more than a pin, so I'm putting it here as a plan to discuss rather than a PR. Nothing in it needs to land at once, and parts of it touch how results reach each integration, which is yours to weigh.

    One idea

    The same commit with the same config should give the same verdict, and when it can't, the run should say what it ran against. Two inputs decide that: which commit-check version runs, and which policy is actually in force. Both have places today where they change without the result showing it.

    The clearest example is already in the project's own tooling. On commit-check.com, docs-sync caught a stale pin twice and the site deployed anyway: on 16 October and 22 October, test_pinned_revisions_match_the_released_version failed while build and deploy succeeded, because deploy needs only build. The check was right; nothing downstream waited for it. Most of what follows has that shape.

    The version that runs

    11 of the 24 releases since #546 put the wrong rev: on PyPI. The same pin is written by hand in three repositories (heads of 20 November; hours measured from each pin's history on main against PyPI's upload times):

    Where Kept current by Checked by Behind the latest release since #546
    README rev:, and PyPI's copy of it hand, pinned ahead per AGENTS.md nothing 556 h (23%)
    commit-check.com guides, six rev: hand docs-sync, which nothing waits for 370 h (15%)
    .github profile README rev: hand nothing 2,246 h (94%)

    pip install commit-check, commit-check-action@v2 and uvx commit-check-mcp float on purpose. The Action already names the version it ran in its summary footer, which is what makes a floating form workable. One floating case gets an older release without saying so: commit-check-mcp still declares Python 3.10, where commit-check>=2.18.0 resolves to 2.19.5, the last release before #662 (on 3.12 it gets 2.23.0).

    Checks for the pins, each reading only rev: under repo: https://github.com/commit-check/commit-check, each failure naming the file, the pin found, the pin expected, and where the bump is made:

    1. On main: Release Drafter's action already outputs the draft's tag_name; with the org's reusable workflow passing it on, a follow-on job fails if the README names neither the latest release nor the draft's tag. That catches pinning v2.21.0 while preparing v2.20.1.
    2. Before publishing: a preflight that requires the README at the commit about to be tagged to name the draft's tag. Publishing is manual, so this is a signal for whoever publishes, not a gate.
    3. At publish: publish.yml compares the tag's README with the event's tag before Build wheel. The GitHub release is public by then; what this guarantees is that PyPI never gets the wrong rev:. Replayed against every release tag since docs: pin the README to v2.15.0, and make that a standing check #546, it fails the 11 and passes the other 13.
    4. commit-check.com: the pin check on a daily schedule in its own workflow (adding schedule to the current one would let a scheduled run deploy), and in every deploy run, with deploy waiting for it.
    5. .github: the same check for the profile README.

    Pinning ahead keeps the cost #687 names: main named a version not yet on PyPI for 18 h in total since #546, most of it the current v2.23.1.

    The policy that's in force

    Here the CLI already tells the truth: each case below prints a notice. What I measured is where that notice ends up on the other faces (local fixtures at the 20 November heads of this repo, the Action and the MCP server; the first two rows give the same CLI and hook results at v2.23.0, the release a pinned hook runs):

    The config says CLI pre-commit hook Action summary, PR comment, result MCP result
    inherit_from that can't load (missing file, 404, DNS, no network) ⊘ … could not be loaded Passed; notice hidden passed; notice only in the step log pass; notice only on server stderr
    a misspelt key (subject_max_lenght) ⚠ unknown setting Passed passed; step log only pass; no notice
    files = "x" ⊘ [files] must be a table Passed "Files: skipped — no rule is set in the [files] section" n/a
    [pull_request] ai_declaration_checkbox (singular) nothing; CC501 is off no hook runs it "skipped: ai_attribution is "ignore"", though with the key spelt right the same config fails CC501 n/a
    CCHK_SUBJECT_MAX_LENGTH=10 fails on length not measured not measured pass (the server doesn't read CCHK_*)

    The hook column is pre-commit hiding a passing hook's output, as it does by design; with verbose: true every notice shows. The network cases held 3 out of 3 runs on each face. Fail-open itself is documented and I'm not arguing against it; the point is that the user who depends on the org policy can't see from the result that it didn't load.

    The two cases that do reach the Action and the MCP result show the way: ignore_authors arrives in the Action's summary as a skip with its reason and in the MCP result as skip, and warn as "passed with warnings" and a warn check. Those travel in the result itself; the ones in the table are printed beside it. Carrying them in the result too (which parent loaded, at which ref, or that it didn't; which keys were ignored) would let each integration show them the way it already shows a skip. In the docs, "pin the branch" (@main) still moves; only a tag or a SHA pins what the policy says.

    A possible order

    1. The three pin checks here (1–3) and the AGENTS.md wording that goes with them.
    2. The commit-check.com and .github checks (4–5).
    3. A design note on carrying config notices in the result, for you to shape before any code.
    4. The MCP's Python 3.10 floor and its CCHK_* gap, raised in that repository.

    I have the measurements behind every number here and can share any of them. Happy to take whichever parts you want, in whatever order suits you.

  3. shenxianpeng commented on Nov 20, 2026

    @shenxianpeng
    Member

    Thanks, great write-up, and the numbers check out.

    I'd rather keep the README in step with the release draft. Would you take this?

    1. A workflow here, run after Release Drafter on main: if the draft's tag differs from the commit-check rev: in README.md, update that line on one fixed branch and open or update a single PR labeled skip-changelog. I'll merge it right before publishing, and I'll set up the token.
    2. A read-only check in publish.yml before Build wheel that fails if the pin doesn't match the release tag.

    Plus the matching AGENTS.md update. Pins in other repos I'll handle separately. The "policy in force" idea deserves its own issue; let's agree on the design there before any code.

  4. invictustitan2 commented on Nov 21, 2026

    @invictustitan2
    ContributorAuthor

    Thanks. It's in #726: the workflow, the publish.yml check and the AGENTS.md change. I'll open the policy-in-force issue separately.

    Two things bear on the token. The job rebuilds the fixed branch from main on each run, which is a force push to that one branch, because otherwise require_rebase_target fails the pull request as soon as main moves. And it reads README_PIN_TOKEN directly, so what fits as written is a fine-grained token limited to this repository, with contents and pull-requests write; a classic one would reach every repository you can write to. If you'd rather use a GitHub App, the job can mint its token with actions/create-github-app-token instead, and I'll switch it.

    I ran it on my fork against real drafts and releases first, including a publish with the pin still unmerged; the runs are linked in the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions