Repository navigation
feat(api): Match a method and concrete path to a catalog operation - #131235
Merged
Merged
Conversation
Add matchOperation to @sentry/api/operations. It finds the catalog operation for a method and a concrete path, such as GET /api/0/organizations/acme/issues/, with its decoded path parameters, so a raw request or proxy can look up its operationId and routing. A literal segment wins over a parameter at the first segment where templates differ. createOperationMatcher builds the same matcher from a filtered catalog or other templates, and throws on first use when two templates for one method differ only in parameter names. The operations module is now printed from compiler nodes, so its generator comes off the string-writer exemption list. Co-Authored-By: BYK <[email protected]>
BYK
approved these changes
Nov 16, 2026
BYK
enabled auto-merge (squash)
November 16, 2026 13:43
Contributor
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.
Reviewed by Cursor Bugbot for commit f195824. Configure here.
This was referenced Nov 16, 2026
BYK
added a commit
that referenced
this pull request
Nov 17, 2026
…1275) Part of #131203. Follow-up to #131235. Sentry isn't supported when served under a path prefix, so `matchOperation` and `createOperationMatcher` in `@sentry/api/operations` strip `API_BASE_PATH` only at the start of the path, unlike `parseApiPathScope`. This adds a comment at that check saying `/sentry/api/0/...` is deliberately not an API path, so the difference isn't mistaken for a bug, and pins that prefixed paths match no operation. Matching behavior doesn't change. <!-- junior-request-attribution:start --> via @BYK. <!-- junior-request-attribution:end --> <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A9cddb8264df48e793bc61c15cd431e51 --> -- [View Session](https://junior-prod.sentry.dev/conversations/agent%3A9cddb8264df48e793bc61c15cd431e51) [[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3A9cddb8264df48e793bc61c15cd431e51/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <[email protected]>
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.

Part of #131203.
Adds
matchOperation(method, path)to@sentry/api/operations. Given a concrete request, such asGET /api/0/organizations/acme/issues/, it returns the catalog operation (operationId, template, androutingfrom #131222) and the decoded path parameters. A raw-request layer, proxy or cache can then tell which operation it is handling without writing its own path rules.API_BASE_PATH, an origin or a query string. A missing trailing slash still matches./preprodartifacts/snapshots/latest-base/wins over/preprodartifacts/snapshots/{snapshot_id}/. If the literal branch has no match for the method, the matcher falls back to the parameter.createOperationMatcherbuilds the same matcher from any{ method, path }list, such as a filtered catalog or a consumer's own templates. The shipped catalog only covers public operations.The operations module is now printed from
ts.factorynodes, like the docs module, sogenerate-operations.mjscomes off the string-writer exemption list. The emitted catalog is the same array literal.via @BYK.
--
View Session [Sentry]