fix(release): stamp the tag being built into version.Version - #206
Open
mateeullahmalik wants to merge 1 commit into
Open
fix(release): stamp the tag being built into version.Version#206mateeullahmalik wants to merge 1 commit into
mateeullahmalik wants to merge 1 commit into
Conversation
The v1.20.2 release artifact reports `version: 1.20.2-rc1` while carrying the correct commit aafc4a2. Both v1.20.2 and v1.20.2-rc1 point at that same commit. VERSION_TAG picked the newest tag by `creatordate` among tags reachable from HEAD. For a LIGHTWEIGHT tag `creatordate` is the COMMIT date, not the tagging date. At build time v1.20.2 was still lightweight, so it reported the commit date (2026-08-07 19:55:24) while the annotated v1.20.2-rc1 reported its tagger date (2026-08-07 19:57:40) and sorted first. The release build therefore stamped the rc1 string onto the final binary. Resolution now prefers, in order: the tag actually being pushed (GITHUB_REF_NAME on a tag ref), then a non-prerelease tag pointing at HEAD, then the previous newest-reachable-tag fallback with a short SHA suffix. Binary-only labelling change: no state machine, consensus or upgrade-handler behavior is touched. Verified against all 43 existing tags -- each now stamps its own name, and prerelease tags still stamp their prerelease string.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Behavior change
Release binaries stamp the tag they were actually built from into
version.Version. Previously a final release tag sharing a commit with aprerelease tag could stamp the prerelease string.
v1.20.2shipped with this bug:Live testnet reports the same, post-upgrade:
Root cause
v1.20.2andv1.20.2-rc1both point at commitaafc4a28.VERSION_TAGpicked the newest tag by
creatordateamong tags reachable from HEAD:For a lightweight tag,
creatordateis the COMMIT date, not the taggingdate. At build time
v1.20.2was still lightweight, so it sorted by thecommit date while the annotated
v1.20.2-rc1sorted by its tagger date:The rc1 tag won by 2m16s and its string was stamped onto the final binary.
The existing
tag_commit = head_commitguard did not help: it only decideswhether to append a short SHA, and both tags point at the same commit, so it
passed while the wrong name had already been selected.
Reproduced from scratch (annotated rc + lightweight final on one commit):
Note the repo state has since changed (
v1.20.2is annotated today), which isitself the point: the old output depended on tag type and creation order, not
on which tag was being released.
Fix
Resolve
VERSION_TAGin priority order:GITHUB_REF_NAMEwhen the ref is a tag — the tag actually being released,authoritative in release CI and immune to any date heuristic.
-rc/-beta/-alpha/-pre/-hotfix, ties broken withsort -V.VERSION_TAG=... makeoverrides still win (the?=is retained).Verification
Every one of the 43 tags in the repo, old logic vs new, asserting each stamps
its own name:
Both historical collisions (
v1.20.2/v1.20.2-rc1,v1.6.2/v1.6.2-pre) arefixed; no tag regressed. Also checked:
RELEASE_VERSION_TAG->v1.20.2, so the artifact filename is unchangedBUILD_LDFLAGSrendersversion.Version=1.20.2, commit unchanged1.20.2-rc1VERSION_TAG=9.9.9 makestill yields9.9.9Risks
Low. Build-time labelling only — no Go source, no state machine, no consensus
path, no upgrade handler, no store key touched. The binary's behavior is
identical; only the string in
version --longandnode_infochanges.Worst case is a mislabelled build, which is the status quo being fixed. The
?=override is preserved, so any pinned invocation keeps working.Rollback
Revert this commit. No state implications, no coordination needed.
Migration
None.
Observability
This is the observability fix:
version --long,/node_info, and/abci_infobecome trustworthy for rollout audits. Until this lands, operatorsverifying a fleet must compare
git_commit, notversion—v1.20.2in thewild reports
1.20.2-rc1.Note this does not retroactively fix the published
v1.20.2artifact. Thatbinary is correct code (commit
aafc4a28) with a wrong label. Options are toleave it and communicate, or cut a
v1.20.3rebuild once this merges.