Skip to content

feat(cli): Lint against manual Sentry API requests - #2292

Merged
BYK merged 1 commit into
mainfrom
byk/feat/cli-no-manual-api-request
Nov 16, 2026
Merged

BYK merged 1 commit into
mainfrom
byk/feat/cli-no-manual-api-request

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Refs getsentry/sentry#130351.

The CLI's hand-written API calls are down to routes the spec leaves out on purpose and requests to hosts that aren't the Sentry API. Without a rule, a new feature can bring a raw apiRequestToRegion call back for a route that already has a generated @sentry/api operation. This adds sentry-cli/no-manual-api-request, so every remaining raw transport has to be a sanctioned exception with a stated reason.

Rule: reports any value use of apiRequest* or customFetch in packages/cli/src/. That covers calls, and passing it as a fetch option. Imports, re-exports and typeof type queries are allowed. Tests aren't covered. It's enabled in .oxlintrc.json next to the other CLI rules, and packages/cli/AGENTS.md points to the list.

Exceptions (MANUAL_API_REQUEST_EXCEPTIONS, one comment line each). A whole file, or named top-level functions:

Where Why it stays raw
lib/api/infrastructure.ts, lib/api-client.ts, lib/custom-ca.ts They define or re-export the helpers
users.ts getCurrentUser /auth/ fallback for servers older than the public /users/me/ read
projects.ts findProjectByDsnKeyOnOldServer projects/?query=dsn: fallback for older servers
replays.ts fetchReplayPage replay list --json prints info_ids/warning_ids (they're in the replay output schema), and the generated field enum leaves them out. Moving to listOrganizationReplays would drop them from the output.
trials.ts getCustomerTrialInfo, startProductTrial getsentry billing (/customers/{org}/, /product-trial/), which stays private
preprod-artifacts.ts fetchSnapshotsUploadOptions snapshots/upload-options/ is private upload transport config
preprod-artifacts.ts openSnapshotArchive The archive ?download stream is left out of the spec on purpose
preprod-artifacts.ts downloadBuildArtifact Signed storage URLs. The token only goes to the region origin.
issues.ts getSharedIssue Unauthenticated transport handed to the generated shared-issue call, for a share URL on another host
status-page.ts, binary.ts, delta-upgrade.ts, ghcr.ts, release-notes.ts, docs-service.ts, games/leaderboard-api.ts, objectstore.ts Not the Sentry API: the status page, release and registry hosts, GitHub, the docs service, the games Worker, and objectstore uploads

sentry-client.ts doesn't reference the helpers, so it has no entry.

CLI code and behavior stay the same. Nothing breaks.

New operations from getsentry/sentry#131199 (monitor, uptime and issue stats, Explore saved queries, starred dashboards, open periods, Seer runs) aren't used yet. Moving the CLI onto them waits for an @sentry/api release that includes them.

--

View Session [Sentry]

Add sentry-cli/no-manual-api-request, which rejects apiRequest* and
customFetch in packages/cli/src so new API calls go through the
generated @sentry/api operations. MANUAL_API_REQUEST_EXCEPTIONS lists
the sanctioned raw transports, each with a one-line reason: the helper
definitions, private routes the spec leaves out, fallbacks for older
servers, signed or non-API hosts, and the replay list fields the
generated enum omits.

Refs getsentry/sentry#130351
@vercel

vercel Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 16, 2026 2:11pm UTC

Request Review

@BYK
BYK enabled auto-merge (squash) November 16, 2026 14:20
@BYK
BYK merged commit d22b47e into main Nov 16, 2026
37 checks passed
@BYK
BYK deleted the byk/feat/cli-no-manual-api-request branch November 16, 2026 14:24

This branch was successfully deployed

1 active deployment
Preview — 639ec8b1 Deployed Nov 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: low PR risk score: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant