This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(release): make set-commits --clear actually clear commits - #1196
Merged
Merged
Conversation
--clear sent `{ commits: [] }`, but the Sentry release PUT endpoint only
runs `clear_commits()` when it receives an explicitly-empty `refs` array;
an empty `commits` list is falsy server-side and silently no-ops. Route
--clear through setCommitsWithRefs(org, version, []) so it sends
`{ refs: [] }` and the commits are removed.
Reported in #1156.
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
betegon
marked this pull request as ready for review
July 3, 2026 16:01
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 5302 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.77% 81.84% +0.07%
==========================================
Files 423 423 —
Lines 29194 29194 —
Branches 18980 18980 —
==========================================
+ Hits 23871 23892 +21
- Misses 5323 5302 -21
- Partials 1969 1974 +5Generated by Codecov Action |
This was referenced Jul 3, 2026
betegon
added a commit
that referenced
this pull request
Jul 6, 2026
## Summary Adds a `--from <ref>` flag to `sentry release set-commits` so monorepo users can associate only the commits that changed a given subtree since the last release — the use case raised in the last comment of #1156: ``` sentry release set-commits 1.0.0 --from v0.9.0 --path apps/mobile,apps/shared ``` This reads the local `v0.9.0..HEAD` range, keeps only commits touching those paths, and sends them. ## Why a new flag instead of `--commit PREV..SHA --path ...` Path filtering can only happen client-side. `--commit`/`--auto` send a ref range that Sentry expands **server-side**, and the API has no concept of paths (confirmed in `set_refs`/`set_commits` on the backend) — so a path filter there would be silently ignored. That's why `--path` already implies local git, and why the range it needs must also be local. `--from` reuses the existing `getCommitLog(from, paths)` path (`git log <ref>..HEAD -- <paths>`). ## What changed - **`--from <ref>`** (implies `--local`): reads `<ref>..HEAD` from local git. Combines with `--path`. Cannot be combined with `--auto`/`--commit` (same rule as `--path`), and rejects an empty ref. - **Depth handling**: a `from..HEAD` range is self-bounding, so `--initial-depth` is dropped when `--from` is set. `getCommitLog` now only adds `--max-count` for a positive depth (omitting it reads the whole range). - Extracted `parseCommitRefs` and `parseLocalScope` helpers to keep `func` under the cognitive-complexity limit. - Requires a full (non-shallow) checkout spanning the range — already surfaced via the existing shallow-clone warning. ## Test plan - `pnpm vitest run test/commands/release/set-commits.test.ts test/lib/git-commit-log.test.ts` — 28 pass (new: `--from` implies local, combines with `--path`, rejects empty/`--auto`/`--commit`; `getCommitLog` omits `--max-count` for a range and applies it for a positive depth). - `pnpm tsc --noEmit`, biome, and `pnpm run check:fragments` all clean. Follow-up to #1156 (the `--clear` fix landed in #1196). Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
5 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
sentry release set-commits <version> --clearreported success but left the commits attached in Sentry. This makes--clearactually remove them.Reported in the last comment of #1156 (against the nightly build): "
sentry release set-commits org/version --cleardoesn't seem to work."What changed
--clearused to send{ commits: [] }viaupdateRelease. But the Sentry release PUT endpoint (organization_release_details.py) only runsrelease.clear_commits()when it receives an explicitly-emptyrefsarray — an emptycommitslist is falsy server-side and hits no branch, so it silently no-ops:Now
--clearroutes through the existingsetCommitsWithRefs(org, version, []), which sends{ refs: [] }and triggersclear_commits(). This also drops the now-unusedupdateReleaseimport from the command.Test plan
pnpm vitest run test/commands/release/set-commits.test.ts— 15 pass (1 new: asserts--clearcallssetCommitsWithRefswith an empty refs array).Made with Cursor