ci: keep beta release-please versions valid#848
Merged
Conversation
2 tasks
There was a problem hiding this comment.
LGTM. Follow-ups noted below. The post-step is the right shape: release-please owns the SemVer-on-the-wire string, the normalizer owns the PEP 440 disk shape, and the two stay decoupled.
Things I checked
release-please-config.json:9— flippingversioningfromdefaulttoprereleasewithbump-minor-pre-major: true/bump-patch-for-minor-pre-major: falseis internally consistent for the beta train:featadvances the prerelease ordinal off the current minor instead of going to7.0.0-beta.1. Right call for where the SDK actually is.scripts/normalize_pyproject_prerelease.py:10-18— both regexes anchor with^...$/fullmatch, the section gate at L49 prevents[tool.example]collateral damage, and the test attests/test_normalize_pyproject_prerelease.py:22-42proves it.- Idempotency —
normalize_pyprojectreturnsFalsewhen the file is unchanged, and the workflow short-circuits atrelease-please.yml:39-42(git diff --quiet) before attempting a commit. No empty commits, no push loop. Verified by thetests/test_normalize_pyproject_prerelease.py:45-51second-call assertion. - No infinite workflow loop — push targets
release-please--branches--main, notmain, and the workflow only triggers onpushtomain. - Public API surface — none touched.
src/adcp/**unchanged. - Conventional commit prefix — both commits are
ci:. Correct for release-please semver gating (non-bumping).
Follow-ups (non-blocking — file as issues)
prs_created == 'true'may skip updates.code-reviewerflagged that release-please-action'sprs_createdoutput is only documented as'true'when a new PR is opened. If subsequent merges tomaincause release-please to update the existing release PR without re-emittingprs_created, the normalize step is skipped andpyproject.tomlstays SemVer. Worth either pinning the docs read or gating onoutputs.pr(non-empty JSON) /outputs.prsinstead. Easy follow-up to file once we see one update cycle.- Force-push race with release-please. The action rebuilds and force-pushes the release branch on every run. The normalize commit will get overwritten and replayed by the next workflow run. Happy path is fine, but there's a small window where the PR branch holds an invalid PEP 440 version. Belt-and-suspenders fix: also run normalize as the very first step of the publish job before
python -m build, so the build never sees an un-normalized version even mid-race. - Loud failure on unrecognized prerelease shapes. If release-please ever emits something the regex doesn't cover (
-next.1,+build, etc.), the script silently no-ops andpython -m buildblows up downstream with a less obvious error. Validating withpackaging.version.Version(...)after normalization and failing loud would localize the diagnosis. - Tag vs. PyPI version drift. The git tag / GitHub release name stays SemVer (
v6.1.0-beta.2) while PyPI shows6.1.0b2. Not breaking, but the next time someone goes "which tag is on PyPI?" they'll have to map it. Either normalize the tag at release-please's manifest layer or note the mapping in the release-notes template.
Minor nits (non-blocking)
- Comment the workflow step. A 2-line comment above
release-please.yml:27pointing to PEP 440 and the rationale would save the next maintainer from "simplifying" this away. Right now the why lives only in this PR description. - Idempotency test on already-PEP-440 input.
tests/test_normalize_pyproject_prerelease.pycovers the SemVer-in / no-op-on-second-call path but no explicit test that a[project]block already holding7.0.0b1is left alone. Currently the regex handles it because it requires the SemVer shape, but a regression on the regex would silently corrupt valid PEP 440 strings.
Safe to merge.
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.
Summary
versionfields with focused testsRoot Cause
Release-please was using default SemVer versioning, so a beta-line breaking commit generated
7.0.0-beta.1from6.1.0-beta.1. During this beta train we want the prerelease ordinal to advance instead. Separately, release-please writes raw SemVer prereleases like6.1.0-beta.2intopyproject.toml; Python packaging expects PEP 440, so the package version needs to be6.1.0b2.Validation
PYTHONPATH=src pytest tests/test_normalize_pyproject_prerelease.py -qpython3 -m json.tool release-please-config.jsonCloses #830.