feat(release): add --from to scope set-commits to a local range#1197
Merged
Conversation
Contributor
|
betegon
added a commit
that referenced
this pull request
Jul 3, 2026
…t crash getCommitLog with --from drops --max-count, so `git log <ref>..HEAD` can emit more than execFileSync's 1 MB default maxBuffer and throw ERR_CHILD_PROCESS_STDIO_MAXBUFFER on large histories. Raise the git() helper's maxBuffer to 100 MB. Addresses sentry-warden review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
Codecov Results 📊✅ Patch coverage is 83.33%. Project has 5333 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.80% 81.80% —%
==========================================
Files 423 423 —
Lines 29282 29308 +26
Branches 19051 19082 +31
==========================================
+ Hits 23953 23975 +22
- Misses 5329 5333 +4
- Partials 1983 1982 -1Generated by Codecov Action |
betegon
added a commit
that referenced
this pull request
Jul 3, 2026
…tion A --from value starting with "-" (e.g. --format=%H) became the argv element `--format=%H..HEAD`, which git parses as a --format override, silently corrupting the NUL-delimited output. Reject option-like refs in parseLocalScope with a clear error, and add `--end-of-options` before the range in getCommitLog as defense-in-depth so any caller-supplied ref is treated as a revision. Addresses sentry-warden review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
betegon
added a commit
that referenced
this pull request
Jul 3, 2026
…compat) --end-of-options requires git >= 2.24 and would crash older git with `fatal: unknown option '--end-of-options'`, regressing all local git ops (--local, --path, --from). Replace it with a version-independent guard that rejects an option-like `from` (leading '-') in getCommitLog, matching getMergeBase. Git refs cannot start with '-', so this fully closes the argument-injection vector without the flag. Addresses Seer review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
betegon
added a commit
that referenced
this pull request
Jul 3, 2026
…-path The "No commits found" warning suggested "Check the ref and path(s)" whenever --from was set, even if no --path was given. Make the suggestion conditional on whether paths were actually provided. Addresses Seer review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
betegon
added a commit
that referenced
this pull request
Jul 3, 2026
Removing the default let getCommitLog(cwd) / getCommitLog(cwd, {}) walk the
entire history instead of the documented 20-commit cap — a footgun for any
caller that omits depth. Restore depth = 20 and use an explicit non-positive
depth (0) to opt into the uncapped whole-range read used by --from.
Addresses Seer review feedback on #1197.
Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 306f19b. Configure here.
betegon
added a commit
that referenced
this pull request
Jul 6, 2026
getCommitLog omitted --max-count for any non-positive depth, but uncapped history was only intended when --from sets a self-bounding range (depth 0). --local --initial-depth 0 without --from would walk all of HEAD. Only skip max-count when from is set and depth is non-positive. Addresses Cursor Bugbot review on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
Adds a --from <ref> flag to `release set-commits` that reads the local `<ref>..HEAD` range (e.g. the previous release tag through the current checkout) and associates those commits. It implies --local and combines with --path, so monorepo users can scope a release to the commits that touched specific subtrees since the last release: sentry release set-commits 1.0.0 --from v0.9.0 --path apps/mobile,apps/shared Path filtering can only happen client-side (the Sentry API expands `--commit`/`--auto` ranges server-side with no path awareness), so --from runs through local git via getCommitLog. Because a `from..HEAD` range is self-bounding, the --initial-depth cap is dropped when --from is set; getCommitLog now only applies --max-count for a positive depth. Reported in #1156. Co-authored-by: Cursor <cursoragent@cursor.com>
…t crash getCommitLog with --from drops --max-count, so `git log <ref>..HEAD` can emit more than execFileSync's 1 MB default maxBuffer and throw ERR_CHILD_PROCESS_STDIO_MAXBUFFER on large histories. Raise the git() helper's maxBuffer to 100 MB. Addresses sentry-warden review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
The --from tests exercised HEAD~1/HEAD~3 against the real repo, which fails in CI's shallow (depth-1) checkout where those ancestors don't exist. Stub getCommitLog so the tests verify command wiring (local mode, from/paths passed) without depending on real git history. Co-authored-by: Cursor <cursoragent@cursor.com>
…tion A --from value starting with "-" (e.g. --format=%H) became the argv element `--format=%H..HEAD`, which git parses as a --format override, silently corrupting the NUL-delimited output. Reject option-like refs in parseLocalScope with a clear error, and add `--end-of-options` before the range in getCommitLog as defense-in-depth so any caller-supplied ref is treated as a revision. Addresses sentry-warden review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
…compat) --end-of-options requires git >= 2.24 and would crash older git with `fatal: unknown option '--end-of-options'`, regressing all local git ops (--local, --path, --from). Replace it with a version-independent guard that rejects an option-like `from` (leading '-') in getCommitLog, matching getMergeBase. Git refs cannot start with '-', so this fully closes the argument-injection vector without the flag. Addresses Seer review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
…-path The "No commits found" warning suggested "Check the ref and path(s)" whenever --from was set, even if no --path was given. Make the suggestion conditional on whether paths were actually provided. Addresses Seer review feedback on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
Removing the default let getCommitLog(cwd) / getCommitLog(cwd, {}) walk the
entire history instead of the documented 20-commit cap — a footgun for any
caller that omits depth. Restore depth = 20 and use an explicit non-positive
depth (0) to opt into the uncapped whole-range read used by --from.
Addresses Seer review feedback on #1197.
Co-authored-by: Cursor <cursoragent@cursor.com>
getCommitLog omitted --max-count for any non-positive depth, but uncapped history was only intended when --from sets a self-bounding range (depth 0). --local --initial-depth 0 without --from would walk all of HEAD. Only skip max-count when from is set and depth is non-positive. Addresses Cursor Bugbot review on #1197. Co-authored-by: Cursor <cursoragent@cursor.com>
token-host: filter saasSubdomainArb to labels that compose a valid https://<label>.sentry.io URL (e.g. `xn--` is invalid in WHATWG URL). snapshots upload: uploads run in parallel, so putSpy call order is non-deterministic — locate the a.png objectstore key by content hash instead of assuming mock.calls[0]. Co-authored-by: Cursor <cursoragent@cursor.com>
0581d7c to
5258174
Compare
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
Adds a
--from <ref>flag tosentry release set-commitsso 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:This reads the local
v0.9.0..HEADrange, 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/--autosend a ref range that Sentry expands server-side, and the API has no concept of paths (confirmed inset_refs/set_commitson the backend) — so a path filter there would be silently ignored. That's why--pathalready implies local git, and why the range it needs must also be local.--fromreuses the existinggetCommitLog(from, paths)path (git log <ref>..HEAD -- <paths>).What changed
--from <ref>(implies--local): reads<ref>..HEADfrom local git. Combines with--path. Cannot be combined with--auto/--commit(same rule as--path), and rejects an empty ref.from..HEADrange is self-bounding, so--initial-depthis dropped when--fromis set.getCommitLognow only adds--max-countfor a positive depth (omitting it reads the whole range).parseCommitRefsandparseLocalScopehelpers to keepfuncunder the cognitive-complexity limit.Test plan
pnpm vitest run test/commands/release/set-commits.test.ts test/lib/git-commit-log.test.ts— 28 pass (new:--fromimplies local, combines with--path, rejects empty/--auto/--commit;getCommitLogomits--max-countfor a range and applies it for a positive depth).pnpm tsc --noEmit, biome, andpnpm run check:fragmentsall clean.Follow-up to #1156 (the
--clearfix landed in #1196).Made with Cursor