This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix: consolidate Cursor BugBot PRs (#908, #947, #973, #1023, #1044) #1051
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8a25d9e
fix(db): guard corrupt cache JSON and log silent catch blocks
BYK d48dfec
fix(events): use autoPaginate so overshoot never skips events
BYK 8ed120d
fix(formatters): clamp negative relative times to '0m ago'
BYK 66fb25f
fix(seer): normalize canceled status and fix root-cause/no-solution e…
BYK 6253ac0
fix(release): only fall back to local git on missing repo integration
BYK 48b80b6
test: complete env isolation in terminalLink withTTY helper
BYK e245a77
chore: enforce no-silent-catch (advisory) and document automated-PR r…
BYK 817389d
fix(db): validate cached DSN detection JSON shape
BYK 8865da1
fix(events): cap per_page and preserve cursor so pagination never stalls
BYK 5ca856b
fix: address review findings — restore multi-page events accumulation…
BYK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -199,7 +199,19 @@ export type ListIssueEventsOptions = { | |
| * | ||
| * Uses the SDK's `listAnIssue_sEvents` endpoint with region-aware routing. | ||
| * When `limit` exceeds {@link API_MAX_PER_PAGE} (100), auto-paginates through | ||
| * multiple API calls to fill the requested limit, bounded by {@link MAX_PAGINATION_PAGES}. | ||
| * multiple API calls to fill the requested limit, bounded by | ||
| * {@link MAX_PAGINATION_PAGES}. | ||
| * | ||
| * Page size is capped at `min(limit, API_MAX_PER_PAGE)` via `per_page`, which | ||
| * Sentry accepts on this route at runtime even though it is absent from the | ||
| * OpenAPI spec. Capping page size keeps the server-issued `nextCursor` aligned | ||
| * to a page boundary, preventing the skip bug where trim + keep-cursor would | ||
| * jump past items. | ||
| * | ||
| * When trimming to `limit`, `nextCursor` is PRESERVED: the events cursor is | ||
| * offset-based, so resuming from it re-includes any trimmed tail rather than | ||
| * skipping it. This prevents both the original skip bug and the stall | ||
| * (drop-cursor) regression. | ||
| * | ||
| * @param orgSlug - Organization slug for region routing | ||
| * @param issueId - Numeric issue ID | ||
|
|
@@ -214,12 +226,13 @@ export async function listIssueEvents( | |
| const { limit = 25, query, full, cursor, statsPeriod, start, end } = options; | ||
|
|
||
| const config = await getOrgSdkConfig(orgSlug); | ||
| const perPage = Math.min(limit, API_MAX_PER_PAGE); | ||
|
|
||
| const allEvents: IssueEvent[] = []; | ||
| let currentCursor = cursor; | ||
| let nextCursor: string | undefined; | ||
|
|
||
| for (let page = 0; page < MAX_PAGINATION_PAGES; page++) { | ||
| for (let page = 0; page < MAX_PAGINATION_PAGES; page += 1) { | ||
| const result = await listAnIssue_sEvents({ | ||
| ...config, | ||
| path: { | ||
|
Comment on lines
228
to
238
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: When Suggested FixWhen the number of fetched items exceeds the requested Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
@@ -233,7 +246,10 @@ export async function listIssueEvents( | |
| statsPeriod, | ||
| start, | ||
| end, | ||
| }, | ||
| // `per_page` is accepted at runtime but absent from the generated query | ||
| // type, so widen via cast. | ||
| per_page: perPage, | ||
| } as Parameters<typeof listAnIssue_sEvents>[0]["query"], | ||
| }); | ||
|
|
||
| const paginated = unwrapPaginatedResult( | ||
|
|
@@ -250,12 +266,10 @@ export async function listIssueEvents( | |
| currentCursor = nextCursor; | ||
| } | ||
|
|
||
| // Trim to exact limit. Unlike listIssuesAllPages (which controls per_page), | ||
| // the issue events endpoint has no per-page parameter, so the API may return | ||
| // more items than requested. We preserve nextCursor so the command-level | ||
| // cursor stack can navigate to subsequent pages. | ||
| const trimmed = | ||
|
cursor[bot] marked this conversation as resolved.
Resolved
|
||
| allEvents.length > limit ? allEvents.slice(0, limit) : allEvents; | ||
|
|
||
| return { data: trimmed, nextCursor }; | ||
| // Trim to limit but PRESERVE nextCursor. The events cursor is offset-based, | ||
| // so resuming from it re-includes any trimmed tail rather than skipping it. | ||
| // Preserving the cursor lets `-c next` advance; dropping it would strand all | ||
| // events past the first page. | ||
| const data = allEvents.length > limit ? allEvents.slice(0, limit) : allEvents; | ||
| return { data, nextCursor }; | ||
| } | ||
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CATCH_RE global regex
lastIndexnot reset between files, causing missed matchesBecause
CATCH_REis a module-level/gregex andlastIndexis never reset insidecheckSilentCatch, every call after the first will start scanning from where the previous file left off, silently skipping catch blocks in all subsequent files.Evidence
CATCH_REis declared at module scope with/gflag (line 277–278), makinglastIndexstateful across calls.checkSilentCatchis called once per file inside thefor (const filePath of files)loop (line 356).CATCH_RE.lastIndex = 0before beginning itsexecloop.lastIndexstays at or near the end of that file's content length; the next file's content is a fresh string, butexecstarts atlastIndexwhich is almost certainly past the end, returningnullimmediately.checkAdHocTryPatterns(line 253 area) only because that function usesString.prototype.matchAllor a freshly constructed regex — not a shared global one.Identified by Warden find-bugs · 3PA-UHS