Repository navigation
feat(app-shell): prefill the first organization name from the sign-up e-mail - #30305
Draft
objectstack-fleet[bot] wants to merge 4 commits into
Draft
objectstack-fleet[bot] wants to merge 4 commits into
objectstack-fleet[bot] wants to merge 4 commits into
Conversation
…up e-mail Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2
…omain rules move to a neutral util
A public-mailbox user's first organization is prefilled with the existing
workspace.default copy ("My Organization" / 我的组织) instead of a new
per-person key, so the frozen workspace namespace (ADR-0060) gains nothing;
the workspace.defaultPersonalName key is removed from all ten packs. A work
e-mail still names the company from the domain's registrable label.
The address parse, the closed public-mailbox list and the registrable-label
rule move out of the frozen console/organizations directory into
utils/emailDomain.ts, with their test; only the company-versus-default
choice stays in CreateWorkspaceDialog. The changeset now names
@object-ui/app-shell at patch with Clause-②: no.
Claude-Session: https://claude.ai/code/session_01Q4EjjRhUZjdy8VXs6Kkur2
Co-authored-by: Claude <noreply@anthropic.com>
This branch has not been 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.
Fixes #30136
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
jane@acme.com→Acme),公共邮箱(gmail、qq、163 等,代码里的闭合清单)用「张三的组织」。用户可以改,也可以直接点创建;不会自动建组织。ui/packages/app-shell/src/console/organizations/defaultOrganizationName.ts(域名规则与公共邮箱清单)、CreateWorkspaceDialog.tsx(只在打开那一刻取默认值的那段)、ui/packages/i18n/src/locales/zh.ts的defaultPersonalName。pnpm --dir ui exec vitest run packages/app-shell/src/console/organizations/__tests__/,预期全部通过,其中prefills a first organization from the e-mail一组覆盖 gmail 用户(中英两种语言)与 acme.com 用户。What changes
defaultOrganizationName({ email, name })(ui/packages/app-shell/src/console/organizations/defaultOrganizationName.ts), a pure function returning either{ kind: 'company', name }or{ kind: 'personal', person }, ornullwhen there is no usable e-mail.co,com,net,org,gov,edu,ac,or,ne,go,gob,ltd,plc), where it is the label before that pair. Soacme.com,mail.acme.com,acme.co.uk,acme.com.cn,eu.acme.co.jpall giveAcme. A suffix this misses gives a visible, editable guess, not an error.PUBLIC_MAILBOX_DOMAINS, which carries every domain the card names plus similar providers); a subdomain of a listed domain counts too (vip.qq.com), while a domain that merely ends in a listed name does not (notgmail.com). Unknown domains are work domains, as ruled.zhang.san@gmail.com→zhang.san).xn--…would show as gibberish, so it takes the personal form instead.CreateWorkspaceDialogtakesuser,organizationsandisOrganizationsLoadingfromuseAuth()(it already called it) and prefills the name when the dialog opens. The personal form is rendered through the newworkspace.defaultPersonalNamekey ({{name}}'s organization/{{name}}的组织), so all ten locales get it, not just en/zh. The default is read only at open time: creating the organization movesorganizationsoff zero mid-submit, and the name being submitted must not change.?create=1for a zero-org user. Creating a second organization still opens empty, because a second default from the same e-mail would just repeat the first organization's name. The check reads the auth context, so no new prop is added to the exported component and every caller behaves the same.@object-ui/i18n: the newworkspace.defaultPersonalNamekey is in all ten packs, and the organisation-noun vocabulary pin (organizations-picker-vocabulary-5215.test.ts) now lists it.@object-ui/i18npatch (@object-ui/app-shellis private and ships inside the Console build).Tests
__tests__/defaultOrganizationName.test.ts(new) covers the domain rule (including the multi-part suffixes and the generic-TLD control), every entry of the closed list, the named domains, the subdomain and look-alike cases, the name fallbacks, punycode, and thenullinputs (acceptance 4).__tests__/CreateWorkspaceDialog.test.tsxgets a new top-leveldescribe. The harnesstcan now answer from a real built-in pack, so the en and zh values themselves are what's tested:Zhang San's organization) and zh (张三的组织), and one submit creates it and provisions its environment (acceptance 1, 3);@acme.comuser seesAcmein both locales (acceptance 2, 3);Test run at head 8b0243f
(
app-shell'stsconfig.test.jsonincludessrc/**/*.test.ts(x), so the type-check covers both new test files.)Ablations (one-time, via scripts/ablation-replace.mjs, restored and verified blob == HEAD)
setName(defaultNameRef.current)tosetName(''): 4 failed, 15 passed. The en, zh and work-domain cases and the mid-submit case went red; the editable case and the empty-name controls stayed green, as they should.[open, defaultName]: 1 failed, 18 passed. Onlythe name does not change while open when the organization list moves off zerowent red.Acceptance notes
acme-labs.com→Acme-labs); only the first letter is capitalised, which is how the card states the rule. The user sees it and can edit it.Организация {{name}}, with the name left in the nominative. Declining arbitrary personal names is out of reach for a template.packages/service-cloud/src/cloud-stack.ts.Verification
Derived gate families (dispatch-gates --commands, 35 families), all run locally at head 8b0243f, every one exit 0
node scripts/pm/dispatch-gates.mjs --repo objectstack-ai/objectstack --ran FILEprinted:Run reconciliation — 35 derived, 35 run, 0 NOT-MEASURED, 0 UNRUN.All 35 recorded an exit code, and every one was 0. They includecheck:nul-bytes,check:published-files,check:type-check-coverage,check:type-check-debt,check:cross-package-test-inputs,check:test-source-alias,check-sdui-manifest, the changeset gates (check-adr-0087-registration,check-changeset-no-major,check-empty-changeset,check:changeset-gate-self-tests) andpnpm --dir ui exec vitest run scripts/(170 files passed, 2 skipped). Alsocheck:new-line-citations:VERDICT new-cross-file-line-citations: 0 new citation(s).The repo-wide scans (
pnpm lint, fullTest UI,Type Check UI) are left to CI.Generated by Claude Code