Repository navigation
fix(organizations): restrict organization names to letters A–Z, digits and name punctuation - #2041
Conversation
…igits and name punctuation The new-organization form now validates the name against the same allowlist central-manager enforces: an English letter or digit first, then letters, digits, spaces and ' ’ - . , & ( ). When the name is left blank, the default built from the user's name drops accents (José → Jose) and falls back to "My Organization" when it still is not a valid name, so the default never fails central-manager's validation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers A–Z The blank-name default no longer contains a double space when a user has only one name, or "undefined" when the name is missing; with no name at all it falls back to "My Organization". The error and hint now say letters A–Z, since accented letters are refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ization name Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces stricter validation for organization names using a new regex and Zod schema, while also implementing a helper to generate normalized, accent-free default organization names from user profiles. Comprehensive unit tests have been added to verify these validation rules and fallback behaviors. The review feedback suggests improving the user experience and data cleanliness by trimming leading and trailing whitespace from the organization name input in both the schema validation and the form's live preview logic.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…racter class Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DavidCockerill
left a comment
There was a problem hiding this comment.
Moving the hyphen is fine; the class accepts exactly the same characters as CM's. My my-organization note is non-blocking, so I'm fine with this going in as long as it deploys before central-manager#1063.
Findings drafted by claude-opus-5-5 via daivid-review, reviewed and posted by @DavidCockerill.
…he default name falls back Users whose names have no unaccented form (Łukasz, Øystein) all got the `My Organization` default and so all suggested `my-organization`, which CM refuses with 409 once one org holds it. Dispatch-Task: fix-Devin-Holland_studio_2041-9db89d90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… no letter A–Z or digit A name like 太郎 kebab-cases to just `org`, which every such user would share. Dispatch-Task: fix-Devin-Holland_studio_2041-9db89d90 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
⊙ Problem
Central Manager now rejects organization names outside an allowlist (central-manager#1063). The new-organization form had no character rule, so a bad name failed only after submit. Its blank-name default,
${firstname} ${lastname} Org, would also fail for users with accented names likeJosé García.🤔 Does the form need its own copy of the rule?
Central Manager is authoritative, but without a copy here a bad name fails only after submit, and the blank-name default would get a 400. The copy can drift from Central Manager's; that is tracked in studio#2040.
💡 Solution
' ’ - . , & ( ). The form shows the error inline and the hint lists the allowed characters.José García Org→Jose Garcia Org).Łukasz,Øystein,Weißhave no unaccented form), the default isMy Organization. The suggested subdomain still comes from the user's own name (ukasz-nowak-org), so they don't all collide onmy-organization.✅ Verification
pnpm exec vitest run: 614 files pass. Two unrelated editor tests failed once under full-suite load and pass alone, twice.@mallory@evil.comrefused,José García→Jose Garcia Org,Łukasz Nowak→My Organizationatukasz-nowak-org. Also new: default-name tests and regex tests.tsc -b,oxlintanddprint checkare clean.🤖 Generated by Anthropic Claude (Opus); posted via @Devin-Holland.
Related PRs: none found
Complexity: easy
Deferred findings
686bcc1086557b14nit maintainability —src/lib/string/regex/organizationNameRegex.ts— CM regex parity is by copy only; drift undetected by CI — NOT FILEDLate Grok findings
2 surviving (highest nit) — Grok reviewed f6c24b4, ruled against 8d9b883
src/features/organizations/mutations/newOrganizationSchema.ts:38— a profile first name with a leading space (for example' José') passesfilter(Boolean). That produces' Jose Garcia Org', which fails the allowlist, so a blank-name submit falls back toMy Organization. Trimming each part first would keep the name.src/features/organizations/components/NewOrgForm.tsx:113— the form description doesn't list the curly apostrophe’, although the regex accepts it. The copy understates what's allowed and doesn't reject any valid name.Not standing: 1 dropped-factually-wrong, 1 accepted-known. Grok ran 17m (17m from launch to report); the fold adjudication (
cursor-grok@f6c24b41e4ad-d1902f50, claude) took 1m.Late Grok findings
2 surviving (highest minor) — Grok reviewed 7bc6c3d, ruled against da2e2f2
src/features/organizations/mutations/newOrganizationSchema.ts:50— If a user's name has no ASCII letter or digit (李明 王芳, Иван Петров), the suggested subdomain is still the sharedmy-organization, the same one nameless users get. All of these users collide (409) on a blank-subdomain submit, and resubmitting sends the same value. A name with exactly one ASCII charasrc/features/organizations/mutations/newOrganizationSchema.ts:36— The comment's "so accents are dropped (José → Jose)" clause repeats whatunaccentedUserNameand line 39 already say. Only "names are English-only" is a real why [8: read at HEAD]Not standing: 1 dropped-factually-wrong, 1 merged. Grok ran 11m (11m from launch to report); the fold adjudication (
cursor-grok@7bc6c3d61851-69f40e33, claude) took 1m.Review-Coverage: authored=claude; ran=cursor-composer,gemini,codex,cursor-grok; late=cursor-grok:adjudicated; adjudicated=domain; declined=muse; rounds=4; full=1 @ da2e2f2
Review-Attention: study ~15m (critical: newOrganizationSchema.ts; decisions: ascii-gate-threshold, subdomain-source-diverges-from-display-name, fallback-for-untransliterable, transliterate-default-but-reject-typed, ascii-only-allowlist, deploy-order, do-less-alternative) @ da2e2f2