Skip to content

feat(console): registering from an invitation link joins its organization and enters the app in one step - #30556

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-lp3y66
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-lp3y66

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Part of #30125 (item 2 here; item 4 landed in PR #30490; items 1 and 3 moved to #30206; item 5 is the devx lane's and stays on the card).

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:被邀请人从邀请链接注册后,注册页直接接受这份邀请、切到该组织并进入应用;不再先停在「接受邀请」页、再停在「邀请已接受 … 继续」页。控制台自己的注册页和 app-shell 的 DefaultRegisterPage 行为一致。
  • 为什么改:卡片 First-run flow: small frictions a new deployment's first people meet #30125 第 2 项,通过邀请加入要走三屏;在 main c045c341 真栈上实测属实(注册 → 接受邀请 → 邀请已接受·继续 → 应用)。
  • 风险与回滚:接受仍由服务端判定,只针对该链接里的那一份邀请,且只在本页刚注册出的会话上发生;打开页面时已登录的人什么都不接受;邮箱不符时服务端照常 403,页面转到原来的接受页显示拒绝。无数据迁移,回滚即还原本 PR。
  • 先看:ui/packages/app-shell/src/console/auth/invitationSignUpJoin.ts(何时算同意)、ui/apps/console/src/pages/auth/RegisterPage.tsx 注册后编排里的 invitationJoin 分支、ui/packages/app-shell/src/console/auth/RegisterPage.tsx 的 if (user …) 三行。
  • 两分钟验证:pnpm --dir ui exec vitest run apps/console/src/pages/auth/__tests__/invitationSignUpJoin-30125.test.tsx packages/app-shell/src/console/auth/__tests__/invitationSignUpJoin-30125.test.tsx,预期 6 个用例全绿。
  • 需要你做的:无,席位落地。

What changes

Card #30125, item 2: joining by invitation took three screens (register, "Accept invitation", "Invitation accepted … Continue").

  • @object-ui/app-shell: useInvitationSignUpJoin(redirect) (new export, with type InvitationSignUpJoin), in console/auth/invitationSignUpJoin.ts. It applies only when the page's ?redirect= names an invitation (invitationIdOf, the same reading as isInvitationRedirect) AND the session appeared on the page: the first answered session check found nobody signed in (latched during render, since isLoading is raised again by the sign-up in flight). It then reads the invitation (get-invitation), accepts it (accept-invitation), and switches the session to its organization, once per invitation id. Answers none, joining, joined, or refused (any throw before the acceptance lands).
  • @object-ui/console: /register: the post-sign-up effect holds while joining, and on joined makes one full-page navigation to the console root (withConsoleBase('/')), the way the accept page's Continue does; refused falls through to today's steps, which open the accept page, where the server's refusal is shown.
  • @object-ui/app-shell: DefaultRegisterPage: the same hook. It used to go to / after the sign-up and leave the invitation behind; now joining/joined hold an empty layout, joined enters resolveRootUrl(), and refused navigates to the accept page. A visitor signed in when the page opens still goes to / (objectui#11714 unchanged). onSuccess no longer navigates for an invitation sign-up, so it cannot race the join.
  • No new i18n keys: the wait is the pages' existing spinner or empty layout. No server change: get-invitation, accept-invitation and set-active are the routes the accept page already calls.
  • Changeset: .changeset/30125-invitation-sign-up-joins.md, @object-ui/app-shell patch, @object-ui/console patch (Metadata-protocol: none grades every entry patch).

Branch: the harness-assigned claude/project-thread-lp3y66, not claude/issue-30125-*; the card is #30125.

Tests

Two new files, one per register page, real AuthProvider over a mock client whose getSession answers the session the sign-up created:

  • ui/apps/console/src/pages/auth/__tests__/invitationSignUpJoin-30125.test.tsx (console mounted under a base href of /_console/, as the shipped build is): the sign-up accepts exactly the link's invitation, switches to its organization, and makes exactly one navigation, landing on /_console/; the server refusing get-invitation: nothing accepted, one navigation to /_console/accept-invitation/ID; CONTROL: already signed in on arrival, nothing read or accepted.
  • ui/packages/app-shell/src/console/auth/__tests__/invitationSignUpJoin-30125.test.tsx: the same three for DefaultRegisterPage (refusal renders the accept route; signed-in arrival renders /).

Acceptance notes

  • Consent boundary. Accepting stays the invited person's act: only the invitation the page's own link names, only for a session created on that page by registering. An address that is not the invited one gets the server's refusal (403 get-invitation, measured live below) and the invitation stays pending. Under invite_only a sign-up with an address that has no invitation at all is already refused at sign-up/email (SELF_REGISTRATION_CLOSED), unchanged.
  • Email verification on. A sign-up that waits for verification creates no session on the page, so nothing is accepted there; the verification mail returns to the accept page (objectui#10893), one click as before. Not changed here, on purpose: auto-accepting on that page would let any link with a crafted query accept on behalf of a signed-in person.
  • Signing in to an existing account from the invitation link still goes through the accept page ("Accept invitation", then "Continue"). Item 2 names registration; that path is unchanged.
  • On a single-organization deployment the new account is already bound to the default organization at sign-up (ADR-0093 D1/D2), and the acceptance adopts that membership (adopt-membership.ts); measured live: the invitation turns accepted, the account has one organization.
  • The console's post-sign-up effect on main assigned the accept page twice in the mocked flow (seen in ablation 1 below); with the join, every exit happens once.

Verification

Base c045c341. Source head b81f734a; the head adds an evidence commit and its removal, the tree is byte-identical to b81f734a (git diff b81f734a HEAD is empty).

Live rig and screenshots (os dev, zh-CN, 1440 wide)

examples/app-showcase: pnpm dev -- --fresh -p PORT (objectstack dev --seed-admin, invite_only, single tenancy), console vite from ui/apps/console with DEV_PROXY_TARGET at that port, Playwright Chromium. The administrator (admin@objectos.ai) invites a fresh address over organization/invite-member; a clean browser opens /accept-invitation/ID signed out, follows "注册并加入", registers that address, and the script records every screen it has to act on until an app route.

Before (main c045c341, the two register pages restored to the base): sign-up, then /accept-invitation/ID with 接受邀请, then 邀请已接受 with 继续, then /apps/com.example.showcase/.... Auth requests after the sign-up: get-invitation x4, accept-invitation, set-active.

before: register
before: accept page
before: invitation accepted, continue
before: app

After (b81f734a): sign-up, then /apps/com.example.showcase/... directly, 6.6 s after submit. Requests after the sign-up: get-invitation x1, accept-invitation x1, set-active x1. The invitation reads accepted in the administrator's list-invitations.

after: register
after: app, right after the sign-up

Mismatch (b81f734a): A and B are both invited; B registers from A's link. sign-up/email 200 (B has an invitation), get-invitation 403, no accept-invitation request; the page lands on A's accept page, which shows 邀请不可用 / 您不是该邀请的收件人。 Both invitations still pending.

mismatch: the server refusal on the accept page

Tests, ablation, typecheck, lint
  • The two new files: Test Files 2 passed (2), Tests 6 passed (6).
  • pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/console/auth/ packages/app-shell/src/console/organizations/ apps/console/src/pages/auth/ on b81f734a: Test Files 59 passed (59), Tests 456 passed (456), lock VERDICT command-exit 0.
  • Ablation 1 (scripts/ablation-replace.mjs, anchor x1 to x0): the hook never applies (const applies = false && …): 4 failed / 2 passed (both join cases and both refusal cases; the CONTROLs stay green). Restored, blob equals HEAD, git diff HEAD empty.
  • Ablation 2: the signed-out latch dropped from applies: 2 failed / 4 passed (both CONTROL cases: an already signed-in visitor would accept). Restored, blob equals HEAD, git diff HEAD empty.
  • pnpm --filter @object-ui/app-shell run type-check and pnpm --filter @object-ui/console run type-check: lock VERDICT command-exit 0.
  • eslint on the six changed source and test files: 0 errors; the 2 warnings are on console RegisterPage.tsx lines this PR does not change.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands derived 35 families on b81f734a (the final head's tree is identical). Every one ran and exited 0, each recorded as command :: exit N; --ran reconciliation: 35 derived, 35 run, 0 NOT-MEASURED (a derived zero). Also pnpm --dir ui run check:new-line-citations, check:control-bytes and check:spec-symbols: exit 0 each. CI runs the rest.


Generated by Claude Code

…tion

Both register pages accept the invitation their ?redirect= names for the
account the sign-up just created, switch to its organization and enter
the console root, instead of stopping on the accept page and on
'Invitation accepted'. A refused address goes on to the accept page.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUk9sDw68FAQ6MtiV8
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#4 · os-sales · session_01L6bhgVfPeFZkN1FP93imKU

维护者速读

  • 改了什么:从邀请链接注册(/register?redirect=/accept-invitation/ID)的人,注册成功后自动接受这一份邀请、切到它的组织并进入控制台,不再经过「接受邀请」和「邀请已接受 … 继续」两屏。控制台自己的注册页和 app-shell 的 DefaultRegisterPage 都改了(后者以前注册完去 /,邀请直接丢了)。
  • 为什么改:First-run flow: small frictions a new deployment's first people meet #30125 第 2 项,维护者同意的建议原文是「从邀请链接注册即接受,落在应用里」。
  • 风险与回滚:仍由服务器判定,地址不是被邀请的那个就拒,页面照旧去接受页显示拒绝(dev 实测 B 用 A 的链接注册:get-invitation 403,没有接受请求,两份邀请都还挂着)。打开页面时已登录的人在此处什么都不接受;要邮箱验证的注册没有会话,也不接受。@object-ui/app-shell 新增导出 useInvitationSignUpJoin 与类型 InvitationSignUpJoin(Clause-② yes,加宽),两包 changeset 都是 patch。回滚即撤本 PR。
  • 先看:ui/packages/app-shell/src/console/auth/invitationSignUpJoin.ts 整个钩子;然后两处 RegisterPage.tsx 各自如何等待 joining、在 joined 时整页进根路径。
  • 两分钟验证:管理员邀请一个新邮箱,退出登录,打开邀请链接选注册,用被邀请的邮箱注册,应直接进入控制台、当前组织就是邀请方;换一个邮箱注册则停在接受页并显示拒绝。
  • 需要你做的:无,席位落地。
  • 席位意见:可合。

席位核对 — ACCEPT · head 3fc0467

  • 形态:7 文件 +494/−1(新钩子 invitationSignUpJoin.ts +104;console RegisterPage.tsx +23;app-shell RegisterPage.tsx +27/−1;index.ts +3;两份测试 +166、+159;changeset @object-ui/app-shell 与 @object-ui/console 各 patch)。check-governed-merges --pr 30556:NOT governed(0/7),495 行 ≤ 3000。Part of #30125(只做第 2 项),draft,目标 main,标题无 !。证据截图提交 665dd1b6 已由 fb66a388 移除,与代码 head b81f734a 的树相同;3fc04671 只改 changeset 的一处级别。
  • 复核面:TIER_DEFAULT(声明面:Clause-②: yes (widening),@object-ui/app-shell 入口新增 useInvitationSignUpJoin 与类型 InvitationSignUpJoin;没有 packages/spec 路径、没有受管路径、没有收窄;Metadata-protocol: none),由本席在此写出。认领行已由修正 6662179699 改为 yes,并把 index.ts 补进文件面。
  • 席位逐行读:钩子只在三件事同时成立时生效:?redirect= 指向一份邀请;第一次会话检查答「没人登录」(在渲染时锁存,注册中 isLoading 再次拉起也不影响);之后出现了用户,所以会话是本页注册出来的。每个邀请 id 只跑一次(startedFor ref):先 getInvitation,再 acceptInvitation,任一抛错即 refused;switchOrganization 失败照接受页的做法吞掉,成员关系已在,根路径自己的组织步骤会选上。console 页在 post-sign-in effect 里 joining 时整体返回,joined 时只做一次 window.location.assign(withConsoleBase('/')),refused 落到原有步骤去接受页;invitationJoin 已进依赖数组。app-shell 页 joining/joined 时画空的 AuthPageLayout,joined 由 effect 整页去 resolveRootUrl(),refused 时 <Navigate to={redirect}>;onSuccess 只在不是邀请链接时 navigate('/')。我核对过没有会话的注册不会卡在表单上:createAuthClient.ts 里 requiresVerification 就是 token === null,所以 autoSignIn: false 与要验证的注册一样走 onVerificationRequired,不走 onSuccess。两页的早返回都在全部 hook 之后。LoginPage.tsx 与 AcceptInvitationPage.tsx 没动;没有服务器改动,没有新文案键。
  • 前提实测:dev 报告 6662113644。改前在 origin/main c045c341 真栈(os dev、showcase、invite_only)走过三屏;改后注册即进应用;不匹配的一轮服务器拒绝、零接受请求。新测试 2 文件 6 例绿,各含一例 CONTROL(打开页面时已登录)。消融两腿:钩子永不生效 4 红 2 绿;去掉「到达时未登录」锁存 2 红(正是两个 CONTROL),还原后 blob 与 HEAD 相同。packages/app-shell/src/console/auth/、organizations/ 与 console pages/auth/ 59 文件 456 例绿;派生门禁 35 条全部 exit 0,0 NOT-MEASURED;app-shell 与 console type-check exit 0。
  • 门禁 check-runs:head 上 55 个(按名取最新一次),42 success,13 skipped(ui-only diff 的预期跳过),0 红;Build & E2E UI、Live E2E UI、Test UI 16 片、Type Check UI 与各 Type Check 均绿,Check Changeset 在改成 patch 后与本席改正文后两次 success。fb66a388 上的 Lint & Repo Gates、TypeScript Type Check、Test UI 汇总红是被 3fc04671 推送取消的分片(日志里各 lane 都是 cancelled),不是真红。mergeable_state clean。
  • 接受的偏差:changeset 原把 app-shell 定为 minor,Check Changeset 在 fb66a388 上据裁定 A(changeset levels: minor only when the metadata protocol changes (added / narrowed / semantic), patch otherwise; release notes grouped by what the reader must do (maintainer ruling A, 2026-10-21) #25105:级别只看元数据协议,none 即 patch)拒绝;卡线程在 3fc04671 改为 patch,正文对应一行由本席经中继改正。index.ts 在认领文件面外,是导出所必需,已补记。分支是线程指定的 claude/project-thread-*。
  • 范围外去向:用已有账号从邀请链接登录仍要经过接受页与「继续」:第 2 项只说注册,自动接受已登录账号是另一个同意问题,dev 已写进 Acceptance notes,本席不立卡。要邮箱验证的注册仍停在接受页(一次点击),是故意的。RegisterPage.tsx 的语言选择同形缺口(fix(console): save a language picked on the sign-in page as the person's own when they have none #30539 的范围外)仍由开着的 A language picked on the sign-in page is dropped when someone else last used that browser, and the sign-in list differs from the signed-in one #30338 承载,本 PR 与 fix(console): save a language picked on the sign-in page as the person's own when they have none #30539 都落地后作为 A language picked on the sign-in page is dropped when someone else last used that browser, and the sign-in list differs from the signed-in one #30338 的余项派出。First-run flow: small frictions a new deployment's first people meet #30125 其余各项不受本 PR 影响:第 4 项已由 fix(console): after a sign-out, the next person to sign in lands on their own home, not the previous person's page #30490 落地,第 1、3 项随 First-run setup checklist for administrators, replacing the currency and time zone dialog #30206 关,第 5 项(脚手架示例 note 对象)仍在卡上,卡保持打开。
  • 落地条款:中继 pr_ready + automerge_enable。合并后 Part of 不关卡,席位同一笔在 First-run flow: small frictions a new deployment's first people meet #30125 留落地评论(第 2 项已交付,余项第 5 项),摘掉 pm:dispatched 换回 pm:queue 并清空指派。

Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant