From cbb375c527949d4474fc0143d328963f477bf0c6 Mon Sep 17 00:00:00 2001 From: Sergio Alexander Florez Galeano Date: Sun, 3 May 2026 15:31:07 +0000 Subject: [PATCH] fix(ci): use PSR 10's PATCH level for default_bump_level MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The auto-release run on the merge commit of #12 failed with: Cannot increment a non-prerelease version with a prerelease level bump `default_bump_level = 1` was set when this repo ran python-semantic-release v9, where the LevelBump enum mapped `1 = PATCH`. We pinned to PSR 10 in auto-release.yml, but the v9-era integer was left behind. PSR 10's enum is: 0 = NO_RELEASE 1 = PRERELEASE_REVISION ← what `1` means now (the failure mode) 2 = PATCH ← what we actually want 3 = MINOR 4 = MAJOR The bug stayed latent until #12, because feat:/fix:/perf: commits resolve through `minor_tags`/`patch_tags` and never consult `default_bump_level`. PR #12 was the first `ci:` (chore-like) commit since the v9→v10 PSR upgrade, so it was the first to fall through to the broken default. ## Change Log - pyproject.toml: `default_bump_level = 1` → `2`. Added a comment block explaining the PSR 10 LevelBump mapping so this can't silently rot again on a future PSR upgrade. - AGENTS.md (rule 15) and docs/RELEASE_AND_DISTRIBUTION.md: corrected the documented value, and fixed an unrelated stale claim that `major_on_zero = false` (it's been `true` since the production-grade flip). ## Risks - The next merge to main will cut `v1.4.1` (or higher if a `feat:` commit also rides along) — that is the desired behavior; it unblocks the action-bump from #12 from being released. - Config-only change to PSR. No runtime code touched, no tests needed. Co-Authored-By: Claude Opus 4.7 (1M context) --- AGENTS.md | 2 +- docs/RELEASE_AND_DISTRIBUTION.md | 4 ++-- pyproject.toml | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 6194da0..5026274 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -246,7 +246,7 @@ The implementation lives in `dailybot_cli/commands/agent.py::_resolve_agent_cont - `feat:` → MINOR (e.g. `1.0.1 → 1.1.0`) - `fix:` / `perf:` → PATCH (e.g. `1.0.1 → 1.0.2`) - `feat!:` or `BREAKING CHANGE:` in the body → MAJOR (e.g. `1.0.1 → 2.0.0`) - - any other prefix or no prefix at all → PATCH (because `default_bump_level = 1` in `pyproject.toml`) + - any other prefix or no prefix at all → PATCH (because `default_bump_level = 2` in `pyproject.toml` — PSR 10's LevelBump value for PATCH) PSR then updates `pyproject.toml::version` + `CHANGELOG.md`, commits as `DailyBot Automations`, tags `vX.Y.Z`, and pushes. The tag push triggers `release.yml`, which fans out to PyPI, the Linux binary, the GitHub Release, and the Homebrew tap. - Do **NOT** hand-edit `pyproject.toml::version` or `CHANGELOG.md` for normal work — let the automation own them. The two fallback flows (manual `git tag`, local `twine`) are documented for emergencies. See [docs/RELEASE_AND_DISTRIBUTION.md](docs/RELEASE_AND_DISTRIBUTION.md). diff --git a/docs/RELEASE_AND_DISTRIBUTION.md b/docs/RELEASE_AND_DISTRIBUTION.md index 92c8d2b..42b57af 100644 --- a/docs/RELEASE_AND_DISTRIBUTION.md +++ b/docs/RELEASE_AND_DISTRIBUTION.md @@ -114,8 +114,8 @@ All version-bump behavior is configured in `pyproject.toml::[tool.semantic_relea - `version_toml = ["pyproject.toml:project.version"]` — single source of truth stays here - `tag_format = "v{version}"` — matches the existing `release.yml` trigger pattern - `commit_message = "chore(release): {version}\n\n[skip ci]"` — keeps the bump commit out of any future push-triggered jobs -- `allow_zero_version = true` + `major_on_zero = false` — `feat:` on `0.x` stays in `0.x.y`; we don't auto-jump to `1.0.0` until we explicitly land a `BREAKING CHANGE` -- `default_bump_level = 0` — if no `feat:` / `fix:` / `perf:` commits land in a PR, no release is cut (chore-only PRs are silent) +- `allow_zero_version = true` + `major_on_zero = true` — once the CLI went production-grade, breaking changes on a 0.x version DO promote to 1.0.0 (uniform semver) +- `default_bump_level = 2` — `chore:`/`docs:`/`refactor:` commits and unprefixed merges still cut a PATCH release (PSR 10 LevelBump: 0=NO_RELEASE, 1=PRERELEASE_REVISION, **2=PATCH**, 3=MINOR, 4=MAJOR). Setting this to `1` silently breaks releases — PSR will try to bump a non-prerelease tag with a prerelease level and fail with `Cannot increment a non-prerelease version with a prerelease level bump` ### Conventional commit cheat sheet diff --git a/pyproject.toml b/pyproject.toml index 8ea3ddf..2255e64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -203,8 +203,15 @@ patch_tags = ["fix", "perf"] # feat: → MINOR (1.0.1 → 1.1.0) # fix: / perf: → PATCH (1.0.1 → 1.0.2) # feat!: or BREAKING CHANGE: → MAJOR (1.0.1 → 2.0.0) -# anything else (chore/docs/...) → PATCH (default_bump_level = 1) -default_bump_level = 1 +# anything else (chore/docs/...) → PATCH (default_bump_level = 2) +# +# `default_bump_level` is a python-semantic-release LevelBump enum value. +# Under PSR 10.x: 0 = NO_RELEASE, 1 = PRERELEASE_REVISION, 2 = PATCH, +# 3 = MINOR, 4 = MAJOR. Setting this to 1 (as it was previously, a v9-era +# value where 1 meant PATCH) makes PSR try to cut a prerelease from a +# non-prerelease tag and fail with "Cannot increment a non-prerelease +# version with a prerelease level bump". +default_bump_level = 2 [tool.semantic_release.changelog] exclude_commit_patterns = [