Repository navigation
feat(cli): Lint against manual Sentry API requests - #2292
Merged
Merged
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 16, 2026
This branch was successfully deployed
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.
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
apiRequestToRegioncall back for a route that already has a generated@sentry/apioperation. This addssentry-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*orcustomFetchinpackages/cli/src/. That covers calls, and passing it as afetchoption. Imports, re-exports andtypeoftype queries are allowed. Tests aren't covered. It's enabled in.oxlintrc.jsonnext to the other CLI rules, andpackages/cli/AGENTS.mdpoints to the list.Exceptions (
MANUAL_API_REQUEST_EXCEPTIONS, one comment line each). A whole file, or named top-level functions:lib/api/infrastructure.ts,lib/api-client.ts,lib/custom-ca.tsusers.tsgetCurrentUser/auth/fallback for servers older than the public/users/me/readprojects.tsfindProjectByDsnKeyOnOldServerprojects/?query=dsn:fallback for older serversreplays.tsfetchReplayPagereplay list --jsonprintsinfo_ids/warning_ids(they're in the replay output schema), and the generated field enum leaves them out. Moving tolistOrganizationReplayswould drop them from the output.trials.tsgetCustomerTrialInfo,startProductTrial/customers/{org}/,/product-trial/), which stays privatepreprod-artifacts.tsfetchSnapshotsUploadOptionssnapshots/upload-options/is private upload transport configpreprod-artifacts.tsopenSnapshotArchive?downloadstream is left out of the spec on purposepreprod-artifacts.tsdownloadBuildArtifactissues.tsgetSharedIssuestatus-page.ts,binary.ts,delta-upgrade.ts,ghcr.ts,release-notes.ts,docs-service.ts,games/leaderboard-api.ts,objectstore.tssentry-client.tsdoesn'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/apirelease that includes them.--
View Session [Sentry]