Skip to content

fix(api): Unescape literal characters in generated API URL types - #128751

Merged
vaind merged 1 commit into
masterfrom
ivan/api-url-codegen-unescape
Oct 27, 2026
Merged

vaind merged 1 commit into
masterfrom
ivan/api-url-codegen-unescape

Conversation

@vaind

@vaind vaind commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

CI turns every Django API route into a TypeScript string in knownSentryApiUrls.generated.ts, so frontend calls to getApiUrl() are checked against real routes. The generator stripped regex groups and character classes but copied escapes through, so a route that matches a literal dot, such as \.git in the git endpoint added in #128444, came out as '/internal/scm-git/repositories/$repositoryId\.git/$route'. oxlint rejects that string as a useless escape, which fails lint on any PR that adds such a route.

Escaped punctuation is now written as the character itself ($repositoryId.git). No route on master has an escape, so the generated file doesn't change here.

Refs CW-2222

The generator copied a route regex's escapes into the TypeScript union, so a route matching a
literal dot, like \.git, came out as '$repositoryId\.git'. oxlint rejects that string as a useless
escape. Escaped punctuation is now written as the character itself.

Refs CW-2222
@linear-code

linear-code Bot commented Oct 26, 2026

Copy link
Copy Markdown

CW-2222

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 26, 2026
@sentry

sentry Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Sentry Snapshot Testing

Name Added Removed Changed Renamed Unchanged Skipped Status
sentry-frontend
sentry-frontend
- - - - - - ✅ 760 uploaded

Base commit 097e147e2a2062d76275bbcf4322835e01cfbef5 did not produce snapshots to compare against. Did its snapshot job fail? Try rebasing this branch on a commit with a successful snapshot job.

⚙️ sentry-frontend Snapshot Settings

@vaind
vaind marked this pull request as ready for review October 26, 2026 11:58
@vaind
vaind requested a review from a team as a code owner October 26, 2026 11:58
@vaind
vaind requested a review from scttcper October 27, 2026 08:04
vaind added a commit that referenced this pull request Oct 27, 2026
The generator copied the route's `\.git` escape into the TypeScript type,
which oxlint rejects as a useless escape. With the generator from
#128751 merged in, the type spells it `.git`.
@vaind
vaind added this pull request to stack #128946 October 27, 2026 20:50
@vaind
vaind merged commit 0c110d0 into master Oct 27, 2026
73 of 74 checks passed
@vaind
vaind deleted the ivan/api-url-codegen-unescape branch October 27, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants