Repository navigation
Conversation
Store the numeric project ID alongside the slug in the cache so downstream API calls can use the `project` query param instead of `project:<slug>` search syntax. Bump schema version to 7 with migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`sentry issue list sentry/sentry` failed because `project:slug` in the search query only works for "actively selected" projects. When we have the numeric project ID, use the `project` query param (Array<number>) instead, which selects the project directly. - Add `projectId` to `ResolvedTarget` and populate it from all resolution paths (explicit, DSN, cache, directory inference) - `listIssuesPaginated` uses `project: [id]` query param when available, falls back to `project:slug` search syntax otherwise - Thread `projectId` through `listIssuesAllPages` and `fetchIssuesForTarget` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify that when projectId is provided, the `project` query param is used and `project:slug` is omitted from the search query. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…warnings - Replace nested ternary with if-statement in listIssuesPaginated - Extract fetchProjectId helper to reduce resolveAllTargets complexity - Use numeric separators (12_345) in test literals Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…projects fetchProjectId previously swallowed all errors silently, causing confusing downstream API errors when users typed a wrong project slug or lacked permissions. Now throws ResolutionError on 404 and re-throws AuthError, while still returning undefined for transient failures. Partial-failure messages now name the specific projects that failed (e.g. "Failed to fetch issues from org/proj-a") instead of just showing a count, both in human-readable stderr and JSON error output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The pattern `Number(x.id) || undefined` appeared 7 times and `cached.projectId ? Number(cached.projectId) : undefined` appeared 3 times across resolve-target.ts and list.ts. Extract a shared `toNumericId` helper to replace all 10 occurrences. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix 10 lint errors (trailing commas, line length, import ordering, Response.json) and 2 test failures caused by fetchProjectId requiring auth/region mocks when CLI flags are passed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…re project field Improve patch coverage for PR #312 by adding tests for new functions and enhancing existing assertions on error output format. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- toNumericId: accept null, use Number.isInteger + n > 0 (was falsy-check) - Remove fetchProjectId from resolveAllTargets/resolveOrgAndProject shared paths (dead code that added network calls to non-issue-list commands) - Enrich env-var/config-default auto-detect targets in issue list using getProject directly with silent fallback to slug-based querying - Fix test: spy on getProject in cursor-accepted test to avoid hitting the preload fetch mock (removed 3 [TEST] Unexpected fetch call warnings)
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Api
Formatters
Other
Internal Changes 🔧
Other
🤖 This preview updates automatically when you update the PR. |
Codecov Results 📊✅ 2289 passed | Total: 2289 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 83.51%. Project has 3240 uncovered lines. Files with missing lines (4)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 80.08% 80.14% +0.06%
==========================================
Files 120 120 —
Lines 16232 16316 +84
Branches 0 0 —
==========================================
+ Hits 12999 13076 +77
- Misses 3233 3240 +7
- Partials 0 0 —Generated by Codecov Action |
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.
|
|
||
| expect(fetchProjectId("test-org", "test-project")).rejects.toThrow( | ||
| ResolutionError | ||
| ); |
There was a problem hiding this comment.
Missing await on rejects.toThrow makes assertions no-ops
Medium Severity
Both expect(fetchProjectId(...)).rejects.toThrow(...) calls are missing await. Without it, the returned promise is never awaited, so the assertion never actually runs — the test passes regardless of whether fetchProjectId throws or not. Every other rejects.toThrow usage in the test suite correctly uses await expect(...).


Summary
Follow-up improvements identified during review of #312 (
fix/issue-list-project-id):toNumericIdcorrectness: Changed fromNumber(id) || undefined(falsy check) to explicitNumber.isInteger(n) && n > 0—toNumericId(0)was silently returningundefinedeven though0is technically a number. Sentry IDs are always positive integers so this is the correct semantic. Acceptsnullexplicitly now (no moreas unknowncast needed in tests).Remove dead code from shared resolve functions:
fetchProjectIdwas added toresolveAllTargetsandresolveOrgAndProjectbut is only used byissue list. Removed it from those shared paths — it was adding unnecessary network calls to every command that uses these helpers (project list, org list, etc.) with no benefit.Enrich auto-detect targets in issue list: The env-var/config-default path through
resolveAllTargetsnow gets project IDs enriched in the issue list command itself viagetProject, with a silent fallback to slug-based querying on any failure. This keeps enrichment scoped to where it's needed.Fix unmocked fetch warning in test: The
--cursor is accepted in multi-target modetest was hitting the preload fetch mock 3 times (3 retries) because it passed an explicittest-org/test-projecttarget which triggeredfetchProjectId → getProjectwithout a network mock. Fixed by spying onapiClient.getProject.