Skip to content

refactor(mosaic): centralize shared constants - #10560

Open
alexcarpenter wants to merge 1 commit into
mainfrom
carp/mosaic-constants
Open

alexcarpenter wants to merge 1 commit into
mainfrom
carp/mosaic-constants

Conversation

@alexcarpenter

Copy link
Copy Markdown
Member

Description

Mosaic repeated values that have to stay in sync across features, including permission strings, avatar upload rules and verification timings. This moves them into small domain files in src/utils/, so each has one place to change. It deliberately adds no catch-all constants.ts; values with a single owner stay with that owner.

  • permissions.ts: ORGANIZATION_PERMISSIONS, replacing local and inline org:sys_* strings in model files.
  • avatar-upload.ts: the file picker rules and rejection errors shared by the logo and profile picture rows.
  • verification.ts: CODE_LENGTH and CODE_RESEND_SECONDS.
  • providerId replaces three copies of the provider prefix strip. The profile section now also trims whitespace, which it did not before; this is the only behaviour difference.
  • The switcher now uses the OrganizationProfilePageId type from organization-profile.types instead of its own copy.

Checklist

  • pnpm test runs as expected. (@clerk/mosaic only)
  • pnpm build runs as expected. (@clerk/mosaic only)
  • (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:

@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Oct 30, 2026 11:04pm UTC
swingset Ready Ready Preview Oct 30, 2026 11:04pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8cd39ea

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 2079648 and 8cd39ea.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ccea971 and 2079648.

Files selected for processing: 27
  • .changeset/mosaic-shared-constants.md
  • packages/mosaic/AGENTS.md
  • packages/mosaic/src/components/otp/otp.tsx
  • packages/mosaic/src/features/api-keys/api-keys-table.model.ts
  • packages/mosaic/src/features/organization-profile/organization-profile-danger-section/organization-profile-danger-section.model.ts
  • packages/mosaic/src/features/organization-profile/organization-profile-members-panel/invitations-table-tab.model.ts
  • packages/mosaic/src/features/organization-profile/organization-profile-members-panel/members-table-tab.model.ts
  • packages/mosaic/src/features/organization-profile/organization-profile-members-panel/organization-profile-members-panel.model.ts
  • packages/mosaic/src/features/organization-profile/organization-profile-profile-section/organization-profile-logo-row.view.tsx
  • packages/mosaic/src/features/organization-profile/organization-profile-profile-section/organization-profile-profile-section.model.ts
  • packages/mosaic/src/features/reverification/reverification.controller.ts
  • packages/mosaic/src/features/reverification/steps/reverification-otp.tsx
  • packages/mosaic/src/features/switcher/switcher.model.tsx
  • packages/mosaic/src/features/switcher/switcher.pages.tsx
  • packages/mosaic/src/features/switcher/switcher.tsx
  • packages/mosaic/src/features/user-profile/user-profile-email-section/user-profile-add-email.controller.ts
  • packages/mosaic/src/features/user-profile/user-profile-enterprise-accounts-section/user-profile-enterprise-accounts-section.model.ts
  • packages/mosaic/src/features/user-profile/user-profile-mfa-section/user-profile-mfa-section.controller.ts
  • packages/mosaic/src/features/user-profile/user-profile-phone-section/user-profile-add-phone.controller.ts
  • packages/mosaic/src/features/user-profile/user-profile-phone.steps.tsx
  • packages/mosaic/src/features/user-profile/user-profile-profile-section/user-profile-picture-row.view.tsx
  • packages/mosaic/src/features/user-profile/user-profile-profile-section/user-profile-picture.controller.ts
  • packages/mosaic/src/features/user-profile/user-profile-profile-section/user-profile-profile-section.model.ts
  • packages/mosaic/src/features/user-profile/user-profile-provider.utils.ts
  • packages/mosaic/src/utils/avatar-upload.ts
  • packages/mosaic/src/utils/permissions.ts
  • packages/mosaic/src/utils/verification.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Walkthrough

The PR adds shared organization-permission, verification, avatar-upload, and provider utilities. Mosaic authorization checks, OTP and resend logic, avatar uploads, and enterprise-account provider handling now use these utilities. The switcher imports OrganizationProfilePageId from the organization-profile types module.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: austincalvelage, ephem

Merge Risk: Minimal · previous review 20796

The refactor preserves existing behavior and introduces no identified merge-blocking risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title "refactor(mosaic): centralize shared constants" matches the main change. The PR moves repeated values (organization permission strings, avatar upload rules and rejection errors, verification…
Description check Passed The description states that repeated values across Mosaic features (permission strings, avatar upload rules, verification timings) move into domain files under src/utils/. It lists the new permissions…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "refactor(mosaic): centralize shared constants" matches the main change. The PR moves repeated values (organization permission strings, avatar upload rules and rejection errors, verification code length and resend timing) into shared domain files under src/utils/, and the raw summary confirms this. The title is short, specific, and follows a conventional commit style.

Full details: Description check

Explanation

The description states that repeated values across Mosaic features (permission strings, avatar upload rules, verification timings) move into domain files under src/utils/. It lists the new permissions.ts, avatar-upload.ts, verification.ts files and the providerId helper, and it notes the switcher type change. This is directly related to the changeset.

Full details: Docstring Coverage

Explanation

Docstring coverage is 7.14% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 25 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10560

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10560

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10560

@clerk/expo

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

@clerk/expo-biometrics

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

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10560

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10560

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10560

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10560

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@10560

@clerk/upgrade

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

@clerk/vue

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

commit: 8cd39ea

This branch was successfully deployed

2 active deployments
Preview – swingset — 8cd39ea4 Deployed Oct 30, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 8cd39ea4 Deployed Oct 30, 2026 by vercel[bot]
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.

1 participant