Skip to content

Fix release-tag.sh changelog check failing under pipefail#976

Open
phinze wants to merge 1 commit into
mainfrom
phinze/fix-release-tag-pipefail
Open

Fix release-tag.sh changelog check failing under pipefail#976
phinze wants to merge 1 commit into
mainfrom
phinze/fix-release-tag-pipefail

Conversation

@phinze

@phinze phinze commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Tagging v0.12.1 tonight hit this: release-tag.sh insisted origin/main's changelog didn't contain ## v0.12.1 when it very much did, right there at line 16.

It's a SIGPIPE-under-pipefail bug. grep -q exits the moment it matches, git show gets a SIGPIPE and exits 141, and set -o pipefail faithfully reports the pipeline as failed. The check is inverted into an error precisely when it should pass, which means it fails harder the earlier the version heading appears in the file.

Fix is to read the changelog into a variable and grep that. A git show failure still leaves it empty and fails the check, so a genuinely missing changelog is caught the same as before.

This only affects the jj-workspace branch. The plain-git path greps the file on disk with no pipe involved. That branch landed in #950 on the 22nd, one day after v0.12.0 was tagged, so v0.12.1 was its first real outing and --force was the only way through.

Verified against the live repo: v0.12.1 and v0.12.0 both pass, v9.9.9 correctly fails, and a nonexistent path correctly fails. I didn't re-run the full script end to end for a passing case, because every version in the changelog now has a tag and the tag-exists guard short-circuits first.

The jj branch of release-tag.sh confirms the release PR landed by grepping
origin/main's changelog for the version heading. grep -q exits on its first
match, which hands git show a SIGPIPE and exit 141, and set -o pipefail turns
that into a failed pipeline. So the check reported "changelog does not contain
'## vX.Y.Z'" against a changelog that plainly contained it, and --force was the
only way past it.

Read the file into a variable and grep that instead. A git show failure
(missing path, bad rev) still leaves the variable empty and fails the check,
so a genuinely absent changelog is caught the way it was before.

Caught while tagging v0.12.1, which was the first real release to go through
the jj path. It landed in #950 a day after v0.12.0 was tagged, so nothing had
exercised it until now.
@phinze
phinze requested a review from a team as a code owner July 24, 2026 21:55
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85219c74-45b0-4ed1-bb24-f2f9a23878c0

📥 Commits

Reviewing files that changed from the base of the PR and between 7f611d5 and 4df5e3b.

📒 Files selected for processing (1)
  • hack/release-tag.sh

Comment @coderabbitai help to get the list of available commands.

@miren-code-agent miren-code-agent 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.

🍪 biscuit: ✅ ready to merge — auto-review, non-blocking

This is a correct, targeted fix for a real pipefail hazard.

The root cause is well understood: git show … | grep -q causes grep -q to exit as soon as it finds its first match, which sends a SIGPIPE (exit 141) to git show mid-stream. With set -euo pipefail in effect, bash sees a non-zero exit from a pipeline member and fails the whole command — even though the version was found. The script was reporting a missing changelog entry when the version was actually present.

The fix breaks the pipeline by capturing git show's output into REMOTE_CHANGELOG first (|| true absorbs any real git show failure gracefully, which is fine because the subsequent grep will then find nothing and the script will exit with a useful error), then feeds the variable into grep via a here-string. A here-string is entirely in-process, so grep -q exiting early has nothing to SIGPIPE. The logic is correct and the comment explaining why is clear and accurate.

One small observation: grep … <<< "$REMOTE_CHANGELOG" is a bashism, but the shebang is already #!/usr/bin/env bash and the rest of the script uses bash-specific constructs ([[ ]], $BASH_SOURCE, etc.), so there's no portability regression here.

The symmetrical path for a plain git checkout (line 144) uses grep -q … "$CHANGELOG" on a real file — no pipe involved — so it never had this problem and doesn't need changing.

Ready to merge.


🍪 full review note · comment /biscuit review to run biscuit again.

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