fix(linear-release-sync): pick previous tag by semver, not creation date#142
Merged
Merged
Conversation
LatestStableSemverRange iterates GitHub releases in CREATED_AT DESC order and returned the first one matching the semver constraint. For loft-sh/loft — which maintains 4.5.x, 4.6.x, 4.7.x, 4.8.x stable lines in parallel — a patch on an older minor cut shortly before a patch on a newer minor wins the lookup. v4.6.3 was tagged two minutes before v4.8.2 on 2026-04-28, so LastStableReleaseBeforeTag(v4.8.2) returned v4.6.3. compare(v4.6.3..v4.8.2) then spanned the wrong git ancestry and dragged 4.8.0/4.8.1 PRs into the 4.8.2 sync run, posting spurious "Now available in stable release v4.8.2" comments on issues that already shipped one or more patches ago (ENGUI-494 was the trigger). Collect every match across pagination and return the highest semver. The per-tag dedup guard in MoveIssueToState stays as-is — once the compare range is correct, no historical PRs reach it. Closes DEVOPS-874
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.
Summary
Fixes DEVOPS-874 — the action posts spurious "Now available in stable release vX.Y.Z" comments on Linear issues that already shipped on an earlier patch of the same release line.
Root cause:
LatestStableSemverRangepaginated GitHub releases inCREATED_AT DESCorder and returned the first release matching the semver constraint. For repos that maintain multiple stable lines in parallel (loft-sh/loft: 4.5.x / 4.6.x / 4.7.x / 4.8.x), a patch on an older minor cut shortly before a patch on a newer minor would win the lookup.Concrete trigger from the loft release timeline:
LastStableReleaseBeforeTag(v4.8.2)returned v4.6.3 instead of v4.8.1.FetchAllPRsBetween(v4.6.3, v4.8.2)then included every commit unique to the 4.8 line — pulling in 4.8.0/4.8.1 PRs. ENGUI-494 (shipped in v4.8.0) was in that set, was already inReleasedstate, had no"Now available in stable release v4.8.2"comment yet (dedup is per-tag), so the action posted one.Strict-filtering does not mitigate this — the 4.8.0 PR was merged long before v4.8.2's
PublishedAt, so it passes the time filter.Key Changes
LatestStableSemverRangenow collects every release matching the constraint across all pages and returns the highest by semver comparison, instead of returning the first creation-date match.TestLastStableReleaseBeforeTag_PrefersSemverOverCreationDatethat pins the loft-sh/loft scenario (v4.6.3 ahead of v4.8.1 in CREATED_AT order, but v4.8.1 is the correct predecessor of v4.8.2).TestLatestStableSemverRange_HighestSemverAcrossPagescovering the case where the semver winner is on a later page than a non-winning match.Dependencies
None. Existing tests continue to pass (
TestLatestStableSemverRange_Pagination,TestLatestStableSemverRange_NoMatch, etc.).TODO
linear-release-sync/v1binary (workflow_dispatch onrelease-linear-release-sync.yaml) so the loft release workflow picks up the fix on the next stable releaseCloses DEVOPS-874