Skip to content

Refuse to make an empty patch release when tweak is 1 - #109489

Merged
alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
leshikus:refuse-empty-patch-release
Jul 7, 2026
Merged

alexey-milovidov merged 3 commits into
ClickHouse:masterfrom
leshikus:refuse-empty-patch-release

Conversation

@leshikus

@leshikus leshikus commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator

When creating a patch release, the version's tweak component equals the number of commits since the previous release tag (see Git.tweak). Right after a release, the pipeline pushes an automated "Update autogenerated version to ... and contributors" commit to the release branch. If a patch release is then started on that HEAD without any real changes on top, the computed tweak is 1 — the only commit since the previous release is that version bump. Tagging it produces a spurious, empty patch release such as v25.8.28.1-lts.

This adds a guard in ReleaseInfo.prepare: for a patch release, if the computed tweak is 1, the release is refused with a clear error. Recovery runs (only-repo/only-docker) rebuild an already-tagged release and do not tag, so the check is skipped there, mirroring the existing out-of-order check.

Related: #109440

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Version info

  • Merged into: 26.7.1.639 (included in 26.7 and later)

For a patch release the version tweak equals the number of commits since
the previous release tag. A tweak of 1 means the only commit on top of the
previous release is the automated post-release version bump, so there is
nothing to release. Tagging it produces a spurious empty release such as
`v25.8.28.1-lts` (whose follow-up version-bump PR ClickHouse#109440 was closed).

Break the release in `ReleaseInfo.prepare` in that case. Recovery runs
(`only-repo`/`only-docker`) rebuild an already-tagged release and do not
tag, so the check is skipped there, mirroring the out-of-order check.

Related: ClickHouse#109440
@leshikus leshikus added the can be tested Allows running workflows for external contributors label Jul 6, 2026
@leshikus
leshikus marked this pull request as ready for review July 6, 2026 12:16
@leshikus
leshikus requested a review from maxknv July 6, 2026 12:16
@clickhouse-gh

clickhouse-gh Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c2e6e34]

Summary: ✅


AI Review

Summary

This PR refines the empty patch-release guard in ReleaseInfo.prepare so the first user-facing stable/lts release after a branch cut (patch == 1, previous tag ...-new) is still allowed, while later reruns with only the automated version-bump commit are still refused. The current code matches the workflow ordering and the added unit tests cover the new decision helper; I found no remaining review findings.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 6, 2026
Comment thread tests/ci/create_release.py Resolved
leshikus added 2 commits July 6, 2026 15:03
Move the tweak==1 guard ahead of the out-of-order check in
`ReleaseInfo.prepare`. An empty patch release (only the automated version
bump since the previous tag) is the more fundamental "nothing to release"
condition, and checking it first gives a clearer error. It also makes the
guard reachable when replaying an old empty-release commit whose branch has
since advanced (which otherwise trips the out-of-order check first).
The tweak==1 empty-release guard also fired on the first user-facing
stable/lts release of a freshly cut branch: that release goes through the
patch path with version.patch == 1, its previous tag is the non-user-facing
vX.Y.1.1-new, and the single automated testing->stable version-update commit
also yields tweak == 1. Blocking it was wrong — no stable/lts release exists
on the branch yet.

Extract the decision into ReleaseInfo._is_empty_patch_release and exempt the
patch == 1 case. The post-release bump always increments patch, so an
already-published branch is always at patch >= 2 on an empty rerun. Add unit
tests covering the reject (patch>=2, tweak==1) and allow (patch==1 first
release; tweak>1) paths.

Reported by the AI reviewer on ClickHouse#109489
@alexey-milovidov alexey-milovidov self-assigned this Jul 7, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Jul 7, 2026
Merged via the queue into ClickHouse:master with commit 9c09274 Jul 7, 2026
175 of 176 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 7, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leshikus, the tests that run in CI are located in ./ci/tests/, right? lets move ./tests/ci/test_* there.

pull Bot pushed a commit to mikeyhodl/ClickHouse that referenced this pull request Jul 10, 2026
The CI unit-test job runs `pytest ci/tests/` (see `ci/jobs/ci_tests_job.py`),
so unit tests placed under `tests/ci/` were never executed in CI. Move the
three recently added unit-test files there:

- `test_create_release.py`
- `test_cherry_pick_branches.py`
- `test_pr_version_info.py`

Each module under test still lives in `tests/ci/` and imports its siblings by
bare name, so the import puts that directory on `sys.path` only for the
duration of the import and removes it afterwards, mirroring the existing
`ci/tests/test_download_release_packages.py`.

Follow-up to ClickHouse#109489
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The tweak==1 empty-release guard also fired on the first user-facing
stable/lts release of a freshly cut branch: that release goes through the
patch path with version.patch == 1, its previous tag is the non-user-facing
vX.Y.1.1-new, and the single automated testing->stable version-update commit
also yields tweak == 1. Blocking it was wrong — no stable/lts release exists
on the branch yet.

Extract the decision into ReleaseInfo._is_empty_patch_release and exempt the
patch == 1 case. The post-release bump always increments patch, so an
already-published branch is always at patch >= 2 on an empty rerun. Add unit
tests covering the reject (patch>=2, tweak==1) and allow (patch==1 first
release; tweak>1) paths.

Reported by the AI reviewer on ClickHouse#109489
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…-release

Refuse to make an empty patch release when tweak is 1
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
The CI unit-test job runs `pytest ci/tests/` (see `ci/jobs/ci_tests_job.py`),
so unit tests placed under `tests/ci/` were never executed in CI. Move the
three recently added unit-test files there:

- `test_create_release.py`
- `test_cherry_pick_branches.py`
- `test_pr_version_info.py`

Each module under test still lives in `tests/ci/` and imports its siblings by
bare name, so the import puts that directory on `sys.path` only for the
duration of the import and removes it afterwards, mirroring the existing
`ci/tests/test_download_release_packages.py`.

Follow-up to ClickHouse#109489
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants