Skip to content

fix: select the release tag by version instead of by tagged commit - #567

Merged
MishaKav merged 1 commit into
developfrom
fix/release-tag-selection
Aug 13, 2026
Merged

fix: select the release tag by version instead of by tagged commit#567
MishaKav merged 1 commit into
developfrom
fix/release-tag-selection

Conversation

@yeelali14

@yeelali14 yeelali14 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Problem

The release job on develop failed after #566 merged (run):

HTTP 422: Validation Failed
Release.tag_name already exists
tag_name was used by an immutable release      NEW_TAG: 2.0.257

2.0.257 was already released on 08-06. tag-version.sh recomputed it because three tags point at the same commit f6ecd22:

2.0.256 → f6ecd22
2.0.257 → f6ecd22
v2      → f6ecd22

It read the latest version with git describe --tags $(git rev-list --tags --max-count=1) — whichever tag git happens to name on the newest tagged commit. With several tags on one commit that pick is arbitrary; it returned 2.0.256, bumped to 2.0.257, and that release already existed. This is structural rather than a one-off: update-v2-tag force-moves v2 onto every release commit, so the newest release commit always carries a second tag.

A second bug hid the first: with no set -e, the rejected git tag / git push still exited 0 and exported NEW_TAG=2.0.257 anyway, so the step went green and the failure surfaced two steps later as a confusing 422.

Nothing to do with #566 — any push touching src/, dist/, scripts/, package*.json or action.yml would have failed the same way.

Change

  • Select the highest version tag by version order (git tag -l '[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -1) instead of by tagged commit. The glob also keeps the legacy v-prefixed tags (v2, v1.111, v2-lite) out of the running, which removes the v-stripping branch that would have turned v1.111 into 1.111.1.
  • set -eo pipefail so a rejected tag or push fails the step where it breaks.
  • Guard against an empty tag list, and quote the variables.

Verification

Reproduced the three-tags-on-one-commit state in a scratch repo:

result
old logic 0.1.0 — arbitrary pick, confirming the ambiguity
new logic 2.0.257 → next tag 2.0.258

bash -n clean.

Note

The failed run died before npm run update-v2-tag, so v2 still points at f6ecd22 — the payload change from #566 is on develop but not yet live for @v2 consumers. Merging this with auto-deploy cuts 2.0.258 and moves v2 forward, which ships it.

🤖 Generated with Claude Code

✨ PR Description

Purpose: Fix release tag selection to use semantic version ordering instead of commit recency, preventing incorrect version increments.

Main changes:

  • Replace git describe with git tag -l and sort -V for version-based tag selection instead of commit-based
  • Add error handling with set -eo pipefail and validation check for missing tags
  • Quote variables and restore GitHub Actions output statements with proper escaping

Changelog

✨ New Features

  • Support oversized payloads via server-side stashing
  • Handle gzip-compressed payloads to reduce transmission size

🔧 Improvements

  • Simplified payload parsing with centralized resolution logic
  • Replaced repetitive JSON double-decoding with cleaner step outputs

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

The release job computed an already-released tag and failed with
"tag_name was used by an immutable release".

tag-version.sh read the latest version with
`git describe --tags $(git rev-list --tags --max-count=1)`, which names
whichever tag git happens to find on the newest tagged commit. Several
tags share that commit - 2.0.256, 2.0.257 and v2 all point at f6ecd22,
and update-v2-tag force-moves v2 onto every release commit, so a
collision is structural rather than a one-off. describe returned
2.0.256, the bump produced 2.0.257, and that release already existed.

Select the highest version tag with `sort -V` instead. The glob also
keeps the legacy v-prefixed tags out of the running, which removes the
v-stripping branch that would have turned v1.111 into 1.111.1.

Add `set -eo pipefail` so this fails at the point it breaks: without it
the rejected `git tag`/`git push` still exited 0 and exported the unused
tag, surfacing two steps later as a confusing 422.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@yeelali14 yeelali14 added the auto-deploy when exists in PR, will auto make release and auto deploy to prod label Aug 13, 2026

@orca-security-us orca-security-us Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed OSS Licenses high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@linearb linearb Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✨ PR Review

LGTM

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how

@yeelali14
yeelali14 requested a review from MishaKav August 13, 2026 09:33

@MishaKav MishaKav left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@MishaKav
MishaKav merged commit 06e0b34 into develop Aug 13, 2026
15 of 16 checks passed
@MishaKav
MishaKav deleted the fix/release-tag-selection branch August 13, 2026 09:35
@MishaKav
MishaKav requested a lite review from Copilot August 13, 2026 09:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the release-tagging script to select the next release tag based on semantic version ordering (rather than “newest tagged commit”), and to fail fast when tag creation/push fails—preventing accidental re-use of an existing release tag.

Changes:

  • Switch latest-version detection from git describe on the newest tagged commit to version-based selection from the tag list.
  • Add set -eo pipefail and a guard for an empty tag list so failures surface at the correct step.
  • Quote tag/output variables and force-refresh tags from the remote.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/tag-version.sh
Comment on lines +3 to +5
# Fail the step if the tag cannot be created or pushed. Without this, a rejected
# `git push` still exits 0 and the release step goes on to use a tag that was
# never created.
Comment thread scripts/tag-version.sh
Comment on lines +12 to 17
latest_tag=$(git tag -l '[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -1)

if [[ -z $latest_tag ]]; then
echo "No version tag found; refusing to guess the next version" >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 min review auto-deploy when exists in PR, will auto make release and auto deploy to prod 🤖 Claude Code missing-jira

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants