feat: automatically bump version on release - #102
carlos-granados merged 6 commits into
Conversation
|
@claude review this |
|
Claude finished @carlos-granados's task in 2m 7s —— View job Claude Code Review
Nice direction — automating the version bump removes a manual step that's easy to forget. That said, the current design has a few significant issues around what commit the tag actually points to vs. what commit produces the release binaries, plus a few smaller robustness concerns. Details below. Major issues1. Tag ↔ release-binary divergence (correctness)
Anyone building from source at Options, roughly in order of cleanliness:
2.
|
|
@claude I modified the workflow to do a pre-release step. Can you do a new review? |
|
Claude finished @carlos-granados's task in 1m 46s —— View job Claude Code Review — v2 (post-rework)
Big improvement — splitting this out into a manually-dispatched pre-release workflow that bumps + tags in one commit resolves the core correctness problem from the last review: the tag now points at the same commit the release binaries are built from. Nice. What the rework fixed
Issues remaining1. sed can silently no-op (medium)L40: sed -i -E "s/^#define XDEBUG_VERSION[[:space:]]+\"[^\"]*\"/#define XDEBUG_VERSION \"${VERSION}\"/" php_xdebug.hIf the pattern doesn't match (rename, whitespace change, someone reformats the header), The "already at version" branch should positively verify the file contains the target version, not just infer it from a no-op diff: if ! grep -qE "^#define XDEBUG_VERSION[[:space:]]+\"${VERSION}\"" php_xdebug.h; then
echo "::error::sed did not update XDEBUG_VERSION to ${VERSION} — pattern likely no longer matches"
exit 1
fiPut this right after the sed (before the 2. Hardcoded whitespace in replacement (minor)Same L40 — the replacement uses four literal spaces ( sed -i -E "s/^(#define XDEBUG_VERSION[[:space:]]+)\"[^\"]*\"/\1\"${VERSION}\"/" php_xdebug.h3. Push to
|
|
@claude all fixed, let's do a new review |
|
Claude finished @carlos-granados's task in 1m 24s —— View job Claude Code Review — v3 (post-rework)
All five issues from the v2 review are addressed cleanly. This is in good shape to merge. v2 fixes — verified
Bonus: Small remaining observations (none blocking)
Nit
VerdictLGTM. The correctness-critical concerns (sed silent no-op, tag/binary mismatch, tag-existence race with remote) are all handled. Remaining items are edge-cases that are either self-recovering or extremely unlikely in practice. |
|
@claude new fixes, please another review |
|
Claude finished @carlos-granados's task in 1m 4s —— View job Claude Code Review — v4 (post-rework)
All non-blocking items from the v3 review are now either fixed or explicitly documented as intentional. Nothing new introduced. LGTM to merge. v3 observations — status
Small observations (none blocking)
VerdictShip it. The correctness-critical paths (sed silent no-op, tag/binary mismatch, tag-existence race, mid-rebase conflict wedge, self-healing tag-push recovery) are all handled. Remaining items are either documented tradeoffs or purely stylistic. |
There was a problem hiding this comment.
Pull request overview
Adds a new GitHub Actions workflow to prepare releases by validating an operator-supplied version, bumping XDEBUG_VERSION in php_xdebug.h, committing directly to main, and pushing a matching Git tag so the existing tag-driven release pipeline can run.
Changes:
- Introduces a manually-triggered
Prepare Releaseworkflow with a requiredversioninput. - Validates version format and prevents reusing an existing remote tag.
- Updates
php_xdebug.h’sXDEBUG_VERSION, commits the change tomain, and pushes the tag.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| permissions: | ||
| contents: write | ||
|
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (3)
.github/workflows/prepare-release.yml:84
- The script always tags the current checkout HEAD. On reruns where
php_xdebug.his already at the target version, this can tag a newermaincommit (if additional commits landed after the version bump), producing a release tag that doesn’t actually correspond to the version-bump commit. Tag the commit in history that contains the version change instead of blindly tagging HEAD.
# If the commit push above succeeds but this tag push fails, main ends up
# bumped but untagged. Self-healing: rerunning with the same VERSION is a
# no-op for the sed/commit (already at that version) and just creates+pushes
# the missing tag.
git tag "${VERSION}"
.github/workflows/prepare-release.yml:32
fetch-depth: 1makes the checkout shallow, which is likely to break the “self-healing” behavior described later (reruns may need git history to locate and tag the original version-bump commit). Using a full fetch avoids tagging the wrong commit ifmainadvances between runs.
This issue also appears on line 80 of the same file.
with:
ref: main
fetch-depth: 1
fetch-tags: false
token: ${{ secrets.GITHUB_TOKEN }}
.github/workflows/prepare-release.yml:76
- If
git rebase origin/mainfails due to a merge conflict, the current loop aborts and silently retries the same push, eventually erroring with a misleading “main kept moving” message. It’s better to fail fast with a clear error so the release preparer can resolve the conflict manually.
echo "Push rejected, rebasing onto latest main and retrying..."
git fetch origin main
git rebase origin/main || { git rebase --abort; continue; }
|
@claude I did some changes after Copilot review, can you take a new look? |
|
Claude finished @carlos-granados's task in 1m 54s —— View job Claude Code Review — v5 (post-Copilot review)
All four Copilot findings are addressed cleanly, and the fix for the "always tag HEAD" issue is more careful than Copilot suggested — it uses Copilot's review — status
Verifying the new blame logic holds upThe new tag-resolution is the most substantive change; walking the paths:
Additional invariants verified:
Very minor observations (none blocking)
VerdictShip it. Every correctness-critical concern raised across the four review rounds is now handled — including the subtle "tag the bump commit, not HEAD" fix. Nice iteration. |
No description provided.