Floor the version check at the published release, not main - #109
Merged
Conversation
Ports the socket-python-cli fix. Three changes to the same job: Floor on PyPI, not main. The check required the PR version to exceed both main and PyPI. The main term forbids the legitimate case where several PRs ship under one unreleased version: the first bumps main and the rest ride it without bumping again, which is what keeps them under a single changelog header. Main is still a floor in the direction that matters -- a PR may leave the version alone or move it forwards, never back. Forgetting to bump, reusing a published version, and branching from a stale base all still fail. Stop checking out main to read its version. `git checkout origin/main` left the working tree detached on main, so the "Require uv.lock update when pyproject changes" step below it diffed main against itself and never fired. Reading the version out of the ref with `git show` removes the side effect and revives that guard. Only enforce a bump when the PR changes shipped content. This workflow is now in its own paths filter so an edit to the check is exercised by the PR making it, but a CI-only change ships nothing and must not be told to cut a release. The comparison still runs and reports either way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Douglas (dacoburn)
approved these changes
Sep 9, 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.
Ports the version-check fix from the Python CLI to the SDK for better enforcement and consistency.
Floor on PyPI, not main
The check required
pr_ver > max(main_version, pypi_latest). Themainterm forbids the legitimate case where several PRs ship under one unreleased version: the first bumpsmainto the new version and the rest ride it without bumping again, which is what keeps them under a single changelog header. Every such PR failed, and the only way to green it was a throwaway bump that would strand a changelog header on a version that never ships.PyPI is now the floor, since the real invariant is that a release cannot reuse a published version.
mainremains a floor in the direction that matters: a PR may leave the version alone or move it forwards, never back.Stop checking out main to read its version
git checkout origin/mainleft the working tree detached onmain, so theRequire uv.lock update when pyproject changesstep below it computedgit diff --name-only origin/main...HEADwithHEADatorigin/main— an empty diff. That guard has never fired. Reading the version out of the ref withgit showremoves the side effect and revives it.Only enforce a bump when the PR changes shipped content
This workflow is now in its own
paths:filter, so an edit to the check is exercised by the PR that makes it rather than landing untested. That alone would demand a version bump from CI-only PRs, so the bump is enforced only when the PR touchessocketdev/**,pyproject.tomloruv.lock. The comparison still runs and reports either way.Note the CLI carries a fourth change that deliberately does not port: it asserts
pyproject.tomland__init__.pyagree, because it keeps the version as two hand-maintained literals. This repo setsdynamic = ["version"]with[tool.hatch.version] path = "socketdev/version.py", and__init__.pyandcore/api.pyboth import__version__from it, so there is a single source and nothing to drift.Validation
Extracted the embedded script and executed it against fixtures with a stubbed PyPI response, across both enforcement modes:
Also verified the shell
PACKAGE_CHANGEDdetection against representative paths (including a mixed workflow+package PR, which correctly enforces), confirmed thegit checkoutside effect empties the diff on a branch that is genuinely ahead of main,actionlintreports the same two pre-existingSC2086infos asmainwith no new findings, and the YAML parses.Public Changelog
N/A
Note
Low Risk
Changes are limited to GitHub Actions CI logic with no runtime or security impact on the published package.
Overview
Reworks the PR version-check workflow so release rules match how this repo actually ships (multiple PRs on one unreleased version) and so related guards work again.
Version rules: Enforcement no longer requires
PR > max(main, PyPI). The hard floor is latest PyPI (no reusing a published version). Main only blocks moving the version backwards; matching main’s unreleased version is allowed (“riding” one changelog release). Failures apply only when the PR touches packaged paths (socketdev/**,pyproject.toml,uv.lock); CI-only PRs still run the check but exit successfully with an informational message.Bugfixes:
MAIN_VERSIONis read viagit show origin/main:…instead of checking outmain, which had leftHEADon main and made theuv.lockvspyproject.tomldiff step always empty.Workflow trigger: The workflow’s
pathsfilter now includes.github/workflows/version-check.ymlso changes to the check run on their own PR.Reviewed by Cursor Bugbot for commit f3f9853. Configure here.