Skip to content

fix: correct Windows tag-existence check in justfile - #279

Merged
iabaako merged 1 commit into
mainfrom
fix/windows-tag-existence-check
Aug 23, 2026
Merged

fix: correct Windows tag-existence check in justfile#279
iabaako merged 1 commit into
mainfrom
fix/windows-tag-existence-check

Conversation

@iabaako

@iabaako iabaako commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Pull Request Summary 🚀

What does this PR do? 📝

Fixes a broken tag-existence check in the [windows] variants of tag-version, push-tag, push-all, and bump-and-tag in justfile. These recipes incorrectly reported that a version tag already existed even when it did not, so just tag-version silently skipped tag creation and the release never got tagged/pushed.

Why is this change needed? 🤔

While cutting the v1.1.0rc1 pre-release, just tag-version printed "Tag v1.1.0rc1 already exists. Skipping tag creation." even though git tag showed no such tag locally or on the remote — the tag was never created, so the Release workflow never ran and nothing was published to Test PyPI.

Root cause: git rev-parse <ref> echoes the ref name back to stdout even when it fails to resolve (exiting 128). The Windows recipes checked if (git rev-parse "$TAG" 2>$null), which only silences stderr. PowerShell's if() evaluates the output of the expression, not the exit code — so that leftover stdout string from the failed rev-parse is always truthy, regardless of whether the tag exists. This means every one of these recipes has always reported "already exists" for any tag, on any Windows machine — it isn't specific to v1.1.0rc1.

How was this implemented? 🛠️

Changed each of the four affected [windows] recipes to suppress all output from git rev-parse (*>$null, all streams) and branch on $LASTEXITCODE -eq 0 instead of on the command's output truthiness. This matches the semantics of the [unix] recipes, which already use git rev-parse "$TAG" >/dev/null 2>&1 (exit-code-based) and were never affected by this bug.

How to test or reproduce ? 🧪

On Windows, reproduce the bug pre-fix:

$TAG = "v9.9.9-does-not-exist"
if (git rev-parse "$TAG" 2>$null) { "BUG: reports exists" } else { "correct: does not exist" }
# -> prints "BUG: reports exists" even though the tag was never created

With the fix:

git rev-parse $TAG *>$null
if ($LASTEXITCODE -eq 0) { "reports exists" } else { "correctly reports does not exist" }
# -> prints "correctly reports does not exist"

Verified just tag-version now correctly creates v1.1.0rc1 locally when the tag does not yet exist, and correctly reports "already exists" when run again afterward.

Screenshots (if applicable) 📷

N/A — build tooling change only.

Checklist ✅

  • I have run and tested my changes locally
  • I have limit this PR to less than 1000 lines of code change (if not, explain why)
  • I have updated/added tests to cover my changes (if applicable) — N/A, justfile recipes aren't covered by the pytest suite
  • I have updated/added requirements to cover my changes (if applicable) — N/A
  • I have run linting and formatting on any code changes (if applicable)
  • I have updated the documentation (README, etc.) accordingly — N/A, no documented behavior changed, only a bug fix
  • I have reviewed and resolved any merge conflict

🤖 Generated with Claude Code

git rev-parse echoes the ref name to stdout even when it fails to resolve
(exit 128). The [windows] recipes for tag-version, push-tag, push-all, and
bump-and-tag checked `if (git rev-parse "$TAG" 2>$null)`, which only
silences stderr — PowerShell's if() evaluates the leftover stdout string
as truthy regardless of exit code, so every one of these recipes reported
"tag already exists" for tags that were never created. Discovered when
`just tag-version` for v1.1.0rc1 claimed the tag existed while `git tag`
showed no such tag locally or on the remote.

Suppress all output with `*>$null` and branch on $LASTEXITCODE instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@iabaako
iabaako requested a review from a team as a code owner August 23, 2026 10:47
@sonarqubecloud

Copy link
Copy Markdown

@dmartinezIPA dmartinezIPA 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.

approve changes to justfile

@iabaako
iabaako merged commit e9466d9 into main Aug 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants