Skip to content

Conversation

tmilewski
Copy link
Member

@tmilewski tmilewski commented Oct 7, 2025

Description

Adds support for CRUD operations on the User locale field.

FIXES USER-3626

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Added support for a user locale (BCP‑47). You can set a locale when creating or updating a user, and read it from user data. If not provided, it may be null.
    • Enables localized experiences by storing a user’s preferred language/region.
  • Chores

    • Added changeset and prepared a minor release for the backend package.

@tmilewski tmilewski requested a review from wobsoriano October 7, 2025 18:29
@tmilewski tmilewski self-assigned this Oct 7, 2025
Copy link

changeset-bot bot commented Oct 7, 2025

🦋 Changeset detected

Latest commit: 1c91373

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/backend Minor
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Oct 7, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 7, 2025 6:36pm

@tmilewski tmilewski changed the title feat(i18n): Add support for User locale feat(backend): Add support for User locale Oct 7, 2025
Copy link
Contributor

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds optional BCP‑47 locale support across backend user types: creation/update params, public User model, and JSON shape. Populates User.locale from JSON and includes a changeset entry for a minor release of @clerk/backend.

Changes

Cohort / File(s) Summary
User API params
packages/backend/src/api/endpoints/UserApi.ts
Added optional locale?: string to CreateUserParams and UpdateUserParams with BCP‑47 description.
User resource + JSON shape
packages/backend/src/api/resources/JSON.ts, packages/backend/src/api/resources/User.ts
Introduced `locale: string
Release metadata
.changeset/calm-brooms-grab.md
Added changeset entry for a minor release documenting User locale support.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Client Code
  participant API as UserApi (Create/Update)
  participant Model as User (fromJSON)
  participant Store as Backend Service

  Dev->>API: createUser({ ..., locale? })
  API->>Store: POST /users { ..., locale? }
  Store-->>API: 200 OK { ..., locale }
  API->>Model: User.fromJSON({ ..., locale })
  Model-->>Dev: User { ..., locale }

  Dev->>API: updateUser({ ..., locale? })
  API->>Store: PATCH /users/:id { ..., locale? }
  Store-->>API: 200 OK { ..., locale }
  API->>Model: User.fromJSON({ ..., locale })
  Model-->>Dev: User { ..., locale }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A nibble of code, a hop through fields,
I taught our Users how locale yields—
BCP‑47 tucked in a neat little fold,
Whispered in JSON, carried in gold.
Minor release, a carrot for cheer—tail up, I steer. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly highlights that this PR adds support for the User locale in the backend, matching the code changes. It uses the conventional feat(backend) prefix and avoids extraneous detail, making it clear and specific. This aligns with best practices for PR titles.
Linked Issues Check ✅ Passed The implemented code adds locale support across CreateUserParams, UpdateUserParams, the UserJSON interface, and the User resource, fully addressing the requirements of USER-3626 to support locale in CRUD operations. It covers both request parameter definitions and response mappings without leaving gaps. This satisfies the primary coding objective of the linked issue.
Out of Scope Changes Check ✅ Passed All modifications in this PR are directly related to introducing the locale field, including parameter definitions, JSON interfaces, and resource mappings. No unrelated files or features have been touched, and only changes relevant to USER-3626 are present. This confirms that there are no out-of-scope alterations.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tom/user-3626-update-js-backend-sdk-to-support-locale

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1596486 and 1c91373.

📒 Files selected for processing (2)
  • packages/backend/src/api/resources/JSON.ts (1 hunks)
  • packages/backend/src/api/resources/User.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/backend/src/api/resources/JSON.ts
  • packages/backend/src/api/resources/User.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member

@wobsoriano wobsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅✅✅

coderabbitai[bot]

This comment was marked as resolved.

Copy link

pkg-pr-new bot commented Oct 7, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6938

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6938

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6938

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6938

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6938

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6938

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6938

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6938

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6938

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6938

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6938

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6938

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6938

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6938

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6938

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6938

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6938

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6938

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6938

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6938

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6938

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6938

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6938

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6938

commit: 1c91373

@tmilewski tmilewski enabled auto-merge (squash) October 7, 2025 18:35
@tmilewski tmilewski merged commit 20c2e29 into main Oct 7, 2025
43 checks passed
@tmilewski tmilewski deleted the tom/user-3626-update-js-backend-sdk-to-support-locale branch October 7, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants