Skip to content

fix(cli): Ship delta patches with stable releases - #2941

Merged
BYK merged 2 commits into
mainfrom
fix/cli-release-delta-patches
Dec 6, 2026
Merged

BYK merged 2 commits into
mainfrom
fix/cli-release-delta-patches

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

No stable cli@ release since the move to Toolkit (0.46.0 through 4.5.0) has .patch assets, so sentry cli upgrade on stable always downloads the full ~25–40 MB binary. The cause: generate-patches in cli-build.yml only ran on main. getsentry/cli also ran it on release branches with binpatch's generate-release mode, and #1393 ported only the nightly half.

This PR runs generate-patches on release/cli/** pushes too, with the binpatch Action in generate-release mode and release-tag-prefix: "cli@". It diffs the new binaries against the newest stable cli@ release, which before the next CLI release is cli@4.5.0, and writes the patches to the existing sentry-patches artifact. Releases of other packages in this repo (http@, logger@, wizard@, spotlight@) are skipped. That input comes from BYK/binpatch#51, so all three binpatch Action pins move to its merge commit. The only change in action/ since 0.4.2 is that input.

The artifact name sentry-patches already matches Craft's /^sentry-.*$/ artifact rule, and the github target has no includeNames, so Craft attaches the patches to the release. No .craft.yml change is needed. No other target's includeNames matches .patch.

The next release gets one patch per binary next to the existing assets, which is the name githubReleaseSource looks for (<binaryName>.patch):

sentry-linux-x64.patch        sentry-linux-x64-musl.patch
sentry-linux-arm64.patch      sentry-linux-arm64-musl.patch
sentry-darwin-arm64.patch     sentry-darwin-x64.patch
sentry-windows-x64.exe.patch  sentry-windows-arm64.exe.patch

The job keeps continue-on-error: true, so a patch failure never blocks a release. That release just ships without patches.

via @BYK.

--

View Session [Sentry]

The generate-patches job only ran on main, so stable cli@ releases had no
.patch assets and `sentry cli upgrade` always downloaded the full binary.
Run it on release/cli/** too, with binpatch's generate-release mode, as
getsentry/cli did before the move to Toolkit. The patches go into the
existing sentry-patches artifact, which Craft's github target attaches to
the release.

Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
@sentry-junior
sentry-junior Bot requested a review from BYK December 6, 2026 01:03
@vercel

vercel Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Dec 6, 2026 1:58am UTC
sentry-local Ready Ready Preview Dec 6, 2026 1:58am UTC

Request Review

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Known gap: binpatch's generate-release takes the newest stable release in the repo and does not filter by tag prefix. If an http@, logger@, wizard@, or spotlight@ release comes out between two CLI releases, the CLI release finds no base binaries and ships without patches, though never with wrong ones. Fixing that needs a tag-prefix input in BYK/binpatch.

Lets get this fixed first

@sentry-junior

sentry-junior Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

Agreed. The fix belongs in binpatch's generate-release lookup, but I can't push to BYK/binpatch (no access), so here's the patch for you to apply. It adds a release-tag-prefix input (empty by default, so current behavior stays) and widens the lookup from 5 releases to 100 so a run of other-package releases can't push the previous cli@ one out of the window:

--- a/action/action.yml
+++ b/action/action.yml
@@ inputs:
       default: ${{ github.repository }}
+  release-tag-prefix:
+    description: >-
+      generate-release: only consider GitHub Releases whose tag starts with
+      this prefix, e.g. 'cli@' in a repository that releases several packages.
+      Empty (default) considers every stable release.
+    required: false
+    default: ""
   new-binaries-dir:
@@ Download previous release binaries
         NEW_GZ_DIR: ${{ inputs.new-gz-dir }}
+        RELEASE_TAG_PREFIX: ${{ inputs.release-tag-prefix }}
       run: |
         set -euo pipefail
-        PREV_TAG=$(gh api "repos/${GH_REPO}/releases?per_page=5" \
-          --jq '[.[] | select(.prerelease == false and .draft == false)] | .[0].tag_name // empty')
+        # Newest stable release whose tag starts with RELEASE_TAG_PREFIX. A
+        # full page, so releases of other packages in the same repository
+        # don't push the previous one out of the window.
+        PREV_TAG=$(gh api "repos/${GH_REPO}/releases?per_page=100" \
+          --jq '[.[] | select(.prerelease == false and .draft == false and (.tag_name | startswith(env.RELEASE_TAG_PREFIX)))] | .[0].tag_name // empty')

It also needs a matching row in the input tables in action/README.md and website/src/content/docs/github-action.md.

Tested against getsentry/toolkit's real release list:

  • Live: release-tag-prefix: cli@ resolves cli@4.5.0, http@ resolves http@1.0.0, and empty resolves cli@4.5.0, same as today.
  • Interleaved: with the list cut so http@1.0.0 is the newest stable release, the current action picks http@1.0.0 (which would mean no patches), while cli@ picks cli@0.51.0.
  • Full step: running the patched step's script with cli@ downloaded and gunzipped sentry-linux-x64 from cli@4.5.0. zizmor reports no findings on action/action.yml.

Once it's on binpatch main, I'll pin this PR to the new SHA and add release-tag-prefix: "cli@" to the release step. Note that cli@4.5.0 shipped at 01:17 UTC without patches because this PR wasn't merged yet, so the first patched release will diff against cli@4.5.0.

via @BYK.

@sentry-junior
sentry-junior Bot requested a review from BYK December 6, 2026 01:37
@BYK

BYK commented Dec 6, 2026

Copy link
Copy Markdown
Member

Created a fork under getsentry/binpatch. Let's fix it there and create a PR upstream

@sentry-junior

sentry-junior Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor Author

Pushed the fix to the fork: getsentry/binpatch@feat/release-tag-prefix (action/action.yml plus the two docs tables). I can't open PRs on BYK/binpatch myself, so here's the one-click link: https://github.com/BYK/binpatch/compare/main...getsentry:binpatch:feat/release-tag-prefix?expand=1

Suggested title: feat(action): add release-tag-prefix input to generate-release. Once it's merged, I'll pin this PR to the new SHA and add release-tag-prefix: "cli@".

via @BYK.

@sentry-junior
sentry-junior Bot requested review from BYK and removed request for BYK December 6, 2026 01:47
@BYK

BYK commented Dec 6, 2026

Copy link
Copy Markdown
Member

merged

Pin binpatch to BYK/binpatch#51 and set release-tag-prefix to cli@, so a
release of another package between two CLI releases no longer leaves the
CLI release without patches.
@BYK
BYK enabled auto-merge December 6, 2026 02:05
@BYK
BYK added this pull request to the merge queue Dec 6, 2026
Merged via the queue into main with commit 46111a1 Dec 6, 2026
43 checks passed
@BYK
BYK deleted the fix/cli-release-delta-patches branch December 6, 2026 02:17

This branch was successfully deployed

2 active deployments
Preview – sentry-local — 0b500cca Deployed Dec 6, 2026 by vercel[bot]
Preview – cli — 0b500cca Deployed Dec 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant