Skip to content

fix: three defensive bug fixes (trace logs per_page, silent catches in set-commits & resolve-target)#1228

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-6ba3
Draft

fix: three defensive bug fixes (trace logs per_page, silent catches in set-commits & resolve-target)#1228
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/sentry-cli-bug-fixes-6ba3

Conversation

@cursor

@cursor cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Three independent defensive bug fixes discovered through codebase audit:

1. trace logs per_page exceeds API max and hasMore is wrong

Root cause: listTraceLogs() sent the raw --limit value (up to 1000) as per_page to the Sentry API, which silently caps at 100. The hasMore logic compared logs.length >= flags.limit (e.g., 100 >= 200 = false), hiding available data.

Reproduction: sentry trace logs --limit 200 <trace-id> returns 100 items but says no more are available.

Fix: Cap per_page at Math.min(limit, API_MAX_PER_PAGE) in listTraceLogs, and compute hasMore against the effective per-page value.

Files: src/lib/api/logs.ts, src/commands/trace/logs.ts


2. Silent catch blocks in release/set-commits.ts

Root cause: Three catch blocks in the repo integration cache helpers silently swallowed errors with only inline comments. When DB operations fail (SQLITE_BUSY, disk full), errors vanish without a trace, making debugging impossible.

Reproduction: Any DB failure in hasNoRepoIntegration, cacheNoRepoIntegration, or clearRepoIntegrationCache — the error is invisible.

Fix: Add log.debug() calls so errors appear in verbose output while remaining non-blocking.

Files: src/commands/release/set-commits.ts


3. Silent catch blocks in resolve-target.ts

Root cause: Three catch blocks in the target resolution module silently swallowed errors: numeric org resolution failures, similar-project search failures, and DSN auto-detection failures. Users hitting network or auth issues got empty results with no diagnostic trail.

Reproduction: Any network/auth failure in normalizeNumericOrg, findSimilarProjectsAcrossOrgs, or the DSN auto-detection fallback path — the error is invisible.

Fix: Add log.debug() calls so errors appear in verbose output (SENTRY_LOG_LEVEL=debug) while preserving graceful degradation.

Files: src/lib/resolve-target.ts

Open in Web View Automation 

cursoragent and others added 3 commits July 13, 2026 12:13
… hasMore logic

listTraceLogs passed options.limit (up to 1000) directly as per_page
to the API, which silently caps at 100. The hasMore logic in trace/logs.ts
compared logs.length >= flags.limit, which would evaluate incorrectly
(e.g., 100 >= 200 → false) hiding available data from the user.

Fix: cap per_page at Math.min(limit, API_MAX_PER_PAGE) in the API
function, and compute hasMore against the effective per-page value.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
…mmits

Three catch blocks in the repo integration cache helpers silently
swallowed errors with only inline comments. When DB operations fail
(e.g., SQLITE_BUSY, disk full), the error vanished without a trace,
making debugging impossible.

Fix: add log.debug() calls so errors appear in verbose output while
remaining non-blocking for normal operation.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
Three catch blocks in resolve-target.ts silently swallowed errors,
making it impossible to debug org resolution, project search, and
DSN auto-detection failures. Users hitting network or auth issues
in these paths got empty results with no diagnostic trail.

Fix: add log.debug() calls so errors appear in verbose output
(SENTRY_LOG_LEVEL=debug) while preserving the graceful degradation.

Co-authored-by: Miguel Betegón <miguelbetegongarcia@gmail.com>
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/_preview/pr-1228/

Built to branch gh-pages at 2026-07-13 12:17 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions

Copy link
Copy Markdown
Contributor

Codecov Results 📊

❌ Patch coverage is 37.50%. Project has 5342 uncovered lines.
❌ Project coverage is 81.8%. Comparing base (base) to head (head).

Files with missing lines (2)
File Patch % Lines
src/commands/release/set-commits.ts 0.00% ⚠️ 3 Missing
src/lib/resolve-target.ts 33.33% ⚠️ 2 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
- Coverage    81.82%    81.80%    -0.02%
==========================================
  Files          423       423         —
  Lines        29343     29350        +7
  Branches     19118     19118         —
==========================================
+ Hits         24008     24008         —
- Misses        5335      5342        +7
- Partials      1989      1987        -2

Generated by Codecov Action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant