Skip to content

fix(console): a link refused as already linked to another user, or as unable to link, says why where the signed-in person lands - #33585

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-0fraah
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-0fraah

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

domain:ui#1 · os-project-manager · session_01FEkQ5oG4qX4LXsVnuxP2PZ

Fixes #33498

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

维护者速读

What changes

Measured live, through the real plugin-auth pipeline (origin/main a9da547). Both codes are produced on the signed-in link path and land on the Console login page. A throwaway probe on the implicit-account-linking.test.ts rig (a real AuthManager over the in-memory engine, a stubbed generic-OAuth provider, a real POST /api/v1/auth/link-social → GET /api/v1/auth/callback/acme-idp round trip with the signed-in cookie; not committed) read the callback's Location:

probe: four signed-in links, the 302 each answered
A links ext-shared (A's email):                         /after-sign-in   (linked)
the account row handed to user_b, A links it again:     /_console/login?error=account_already_linked_to_different_user   (A has 0 rows, user_b keeps 1)
provider asserts email_verified: false (untrusted):     /_console/login?error=unable_to_link_account   (0 rows)
operator config accountLinking.enabled: false:          /_console/login?error=unable_to_link_account
CONTROL provider email differs:                         /_console/login?error=email_does_not_match
Test Files 1 passed · Tests 4 passed · VERDICT command-exit 0

Read on the vendor code (better-auth 1.7.12 oauth2/link-account.mjs, linkOAuthAccount): the email check runs first, so account_already_linked_to_different_user is reached only when the provider account's email equals the signed-in account's (or allowDifferentEmails is on) and findAccountByKey answers a row owned by another user; unable_to_link_account is the untrusted-provider-and-unverified-email clause, accountLinking.enabled === false, or a failed createAccount. The callback (api/routes/callback.mjs) redirects both to onAPIError.errorURL, which plugin-auth sets to the Console login page, with no error_description (the failure carries no message).

  • ui/apps/console/src/pages/auth/ssoCallbackRefusal.ts: two copies, LINK_ALREADY_LINKED_TO_OTHER_USER (auth.login.errors.linkAlreadyLinkedToOtherUser) and LINK_UNABLE_TO_LINK (auth.login.errors.linkUnableToLink), and two entries in SIGNED_IN_LINK_REFUSALS. The doc comment names each code's producer. Nothing else changes: fix(console): a refused account link says why on the page the signed-in person lands on #33496's holdLinkRefusalForLanding, LinkRefusalNotice, LoginPage and App carry them as they are.
  • @object-ui/i18n: the two keys in all eleven locales (zh-Hant regenerated with gen:zh-hant). Each sentence says what happened and what to do, and names no other user or email.
  • Changeset .changeset/33498-link-refusal-other-codes-notice.md: @object-ui/console and @object-ui/i18n patch, both declaration lines.

Not changed: the server, plugin-auth, better-auth.

Tests

ui/apps/console/src/__tests__/App.linkRefusalLanding-33063.test.tsx gains a #33498 block through the same two-leg real App (real LoginPage at the error URL, then App reopened where it sent the person, only sessionStorage surviving):

  • account_already_linked_to_different_user and unable_to_link_account, each under en and zh-Hans: the toast reads that code's locale row exactly. The URL also carries error_description=bob@example.com already owns it, and the page text never contains bob@example.com.
  • CONTROL: email_does_not_match under en and zh-Hans still reads its own sentence, through the same table.
  • CONTROL: ?error=email_not_found (a vendor callback code that is not a link refusal) shows no notice and holds nothing. The existing <img> control is unchanged.
  • The three sentences are distinct from one another in each language.

Ablation (scripts/ablation-replace.mjs --delete, anchor the two new map lines 1 → 0, blob 071313cfbfc3 → 21dc9edf96a5; the console suite imports src/, no dist in the path):

Ablated: 4 failed | 8 passed (12); restored: blob == HEAD
× account_already_linked_to_different_user under en
× account_already_linked_to_different_user under zh-Hans
× unable_to_link_account under en
× unable_to_link_account under zh-Hans
Tests  4 failed | 8 passed (12) · VERDICT command-exit 1
ablation-replace: ok restored: blob == HEAD (071313cfbfc3) and `git diff HEAD` is empty

Both email_does_not_match controls and the unknown-code control stay green with the entries gone.

Acceptance notes

  • Live, not only read. The order allowed the vendor read; the plugin-auth rig was cheap, so both codes were driven through the real link-social → callback path. account_already_linked_to_different_user was staged by moving an existing account row to a second user in the store (the rig's posture refuses a second sign-up), which is the state the vendor branch reads.
  • The sentences' "what to do". For the already-linked case the way on is the Account app's Linked Accounts list (sys_account unlink_account, view mine), so the sentence says to sign in as the user it is linked to and unlink it there, or link a different account. For unable_to_link_account the common cause a person can act on is an unverified email at the sign-in service; the rest (linking turned off, a failed write) is the administrator's, which the sentence names last.

Verification

Head 06dc109b. Local subset from node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, reconciled with --ran:

38 derived, 38 run, all exit 0; --ran: 0 NOT-MEASURED, 0 UNRUN
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:merge-driver :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0

Also run locally on 06dc109b:

  • pnpm --dir ui exec vitest run apps/console/src/pages/auth/ apps/console/src/__tests__/App.linkRefusalLanding-33063.test.tsx → 35 files passed, 339 tests passed (VERDICT command-exit 0).
  • pnpm --dir ui exec vitest run packages/i18n/ → 102 files passed, 1894 passed | 13 skipped (the i18n census pins included).
  • pnpm --filter @object-ui/console --filter @object-ui/i18n run type-check after building the @object-ui/console^... closure → both Done (the console tsconfig includes src, so the new test is type-checked).
  • eslint on ssoCallbackRefusal.ts, the App test and en.ts → exit 0; pnpm --dir ui check:new-line-citations → 0 new.

The full @object-ui/console project and every other family are CI's.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (not touched)
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes. (touched files linted; the repo-wide run is CI's)
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English. (the 维护者速读 section is the seat format)
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5oG4qX4LXsVnuxP2PZ

…igned-in person lands

Co-Authored-By: Claude <noreply@anthropic.com>
@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 15, 2026
@objectstack-fleet objectstack-fleet Bot added the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 06dc109bb3fa9a000ef700ca981f3bf6e53e33ee
Local-runs: none

Inputs: card #33498 (body, claim 6887111102, os-dev-report 6887609141), PR #33585 body and its 14-file list, the net diff a9da5474..06dc109b (merge base with main; main is now 4bba8b8f, two commits on, none touching these files, git merge-tree clean), and the 41 check-runs on the head.

① Derived judgments

  • Accept set of SIGNED_IN_LINK_REFUSALS (ui/apps/console/src/pages/auth/ssoCallbackRefusal.ts): widens from {email_does_not_match} to {email_does_not_match, account_already_linked_to_different_user, unable_to_link_account}. RIGHT. Both new keys are the exact vendor codes linkOAuthAccount (better-auth 1.7.12 oauth2/link-account.mjs) redirects with. The PR measured them live through plugin-auth (/_console/login?error=CODE, no error_description), which goes beyond the card's "live, or on the vendor code" bar. The table is the only gate: isSignedInLinkRefusal uses hasOwnProperty on a frozen-typed record, so prototype keys (__proto__, constructor) stay out. holdLinkRefusalForLanding (LoginPage, signed-in exit only) and takeHeldLinkRefusal both re-check membership before they store or show anything. No other code joins.
  • What reaches the screen: only t(copy.key, {defaultValue}) for a code in the table. sessionStorage holds the code, never a sentence. error_description is never read on this path. RIGHT: the pin sends error_description=bob@example.com already owns it with each code under en and zh-Hans, and asserts document.body.textContent never contains it. Nothing from the URL is shown as it came.
  • Signed-out path unchanged: SSO_CALLBACK_REFUSALS is untouched, so a signed-out arrival with either code keeps the generic sentence as on main. RIGHT, because that path is out of the card's scope.
  • New public i18n surface (@object-ui/i18n, published): two keys, auth.login.errors.linkAlreadyLinkedToOtherUser and auth.login.errors.linkUnableToLink. Both are present in all 11 locale packs (ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans, zh-Hant; counted on the head tree, and index.ts/registry.ts/rtl.ts hold no strings). zh-Hant carries the gen-zh-hant.mjs @generated header and its two lines are the s2twp form of zh-Hans. Nothing is renamed or removed. RIGHT. Each defaultValue in the console module is byte-equal to the en row.
  • Copy against the card's "says what happened and what to do; names no other user": every row in every language says what happened and gives a way on: "link a different account, or sign in as the user it is linked to and unlink it there", and "check the email is verified with that sign-in service, then ask your administrator". No row interpolates anything, and none names a user or an email. RIGHT.
  • Pins against the card's acceptance: the pins run through the real App in two legs, for each new code under en and zh-Hans. CONTROL email_does_not_match keeps its own sentence, and CONTROL unknown code email_not_found shows nothing and holds nothing. The three sentences are distinct in each language. The PR's ablation of the two map lines fails exactly the 4 new-code cases, and the controls stay green. RIGHT.
  • nit (no effect on contract): unable_to_link_account is also a sign-in-path code (handleOAuthUserInfo implicit linking; see packages/plugins/plugin-auth/src/sso-oidc-refusal-cause.ts:67). A person who is already signed in and arrives with it from a sign-in round trip, not a link, now gets the "could not be linked" toast. The sentence is still true for that case (an implicit link failed), so this is not a defect. A later reader of the doc comment may want that producer named too.

② Semver level

  • Changeset .changeset/33498-link-refusal-other-codes-notice.md: @object-ui/console patch and @object-ui/i18n patch. Both packages are released (not private, not in .changeset/config.json ignore), and both are moved by the diff. No other package is moved. MATCHES.
  • Clause-②: yes (widening) is in the PR body, the changeset body and the claim. It is RIGHT: the published locale packs gain two keys and the console accepts two more codes, and nothing is narrowed. Metadata-protocol: none is RIGHT: no spec, metadata key or protocol is touched. Under AGENTS.md (Post-Task, item 3) the kind none takes patch, and a non-protocol widening ships patch. The level is correct, so no minor is owed. No major, no BREAKING banner, and no ADR-0087 disposition is owed. skip-changeset is correctly absent.

③ Boundary flags

  • Gates (check-runs on 06dc109b, 41 total). 12 success: Check Changeset (run 43665316274), PR-body guards (claim · duplicate · Part-of · single-writer path), Governed Surface Queue Guard, Check PR Size, Auto Label, filter, Type Check · workspace, Type Check · debt ledger, Test Core, Dogfood Regression Gate, Live E2E UI, Plan Test UI shards. 17 skipped (path-filtered or opt-in). 0 failed. PENDING (in_progress), 12: Build UI Deps, Check Changeset (re-run 43665463227), Type Check · consumer gates, Type Check · source gates, Lint · ESLint, Lint · repo & tooling gates, Lint · docs & code guards, Lint · CI, release & engine gates, Lint · PM dispatch-gates, Lint · scoped · tooling self-tests, Lint · scoped · query-options erasure, Lint · scoped · slot lookup & corpus. The UI test shards have not registered yet; they follow Build UI Deps. This PASS is the contract verdict only. Landing still waits on every pending gate turning green, as the queue requires.
  • Deviation (1): the pins sit in the existing App.linkRefusalLanding-33063.test.tsx as a console: linking a social/OIDC account that is already linked to another user, or that cannot be linked, still brings the signed-in person back with no word #33498 block, not in a new file. ACCEPTED. The claim's file surface names that file, and reusing the two-leg harness is the right call.
  • Deviation (2): the live probe was an uncommitted copy of the plugin-auth rig. The already-linked state was staged by reassigning a sys_account row. ACCEPTED. It is not in the diff, and it is the exact state the vendor branch reads.
  • Deviation (3): a standing conflict between os-dev.md rule 2 (pr_create carries assignees) and the order plus the AGENTS.md claim paragraph (none). ESCALATED to the seat as a process item: one of the two instruction sources needs to be reconciled. It has no bearing on this diff.
  • Deviation (4): no labels were sent. ACCEPTED. The auto-labeller added documentation, tooling, size/m and needs:contract-review. The first two are odd for a UI diff but harmless.
  • open_questions: [] and out_of_scope_findings: [], so there is nothing to answer. security_findings: none. I agree: no URL text is rendered, and no other user is disclosed.
  • File surface against the claim: every touched file is inside the claimed surface. No server, plugin-auth or packages/spec edit. LinkRefusalNotice.tsx was claimed but is untouched, which is fine. The card's serial constraint ("lands after PR fix(console): a refused account link says why on the page the signed-in person lands on #33496") is met: the merge base a9da5474 contains fix(console): a refused account link says why on the page the signed-in person lands on #33496.

Implemented-by: claude/project-thread-0fraah
Reviewed-by: session_01FEkQ5nWoa1Ze1QzjRTSYXD

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot removed the needs:contract-review Marker only — PR awaits its at-tier Contract review PASS; no check reads it, the record decides label Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

席位核对

Verdict: ACCEPT · head 06dc109b · 2026-11-15T02:18Z

  1. Shape. Draft → main, Fixes #33498. 14 files, +116/−0:

    All of it is on the claimed surface (6887111102).

  2. Premise. Both codes measured live through the real plugin-auth link-social → callback round trip (a throwaway rig probe, not committed). Each code returns 302 to /_console/login?error=CODE, and on main the person landed with no word.

    • The fix: each code joins SIGNED_IN_LINK_REFUSALS with its own sentence and travels through fix(console): a refused account link says why on the page the signed-in person lands on #33496's path unchanged: held before the console exit, shown once as the persistent toast. The sentences say what happened and what to do, and name no user or email.
    • Safety: nothing from the URL is shown. The pin sends an error_description naming an email with each code and asserts it never reaches the page. The signed-out map is untouched.
    • Pins: through the real App, each code under en and zh-Hans. CONTROL: email_does_not_match keeps its own sentence. CONTROL: an unknown code shows and holds nothing. Ablation of the two map lines: 4 red, 8 green, restored.
  3. Contract record. PASS 6887646324 on this head: two additive i18n keys, Clause-②: yes (widening), Metadata-protocol: none, patch right.

  4. Gates on head 06dc109b.

    • All 66 check runs are success or skipped, including Test UI shards + aggregate, Type Check UI, Lint UI, Build & E2E UI, Live E2E UI, Lint & Repo Gates, TypeScript Type Check, Check Changeset and PR-body guards.
    • The dev's local --ran is 38/38, 0 NOT-MEASURED.
  5. Accepted deviation. The PR carries no assignees, as the order says. os-dev.md rule 2 reads otherwise; the order wins here, as on fix(plugin-grid): fold a row's inline primary action into its menu while the table overflows with it #33441.

  6. Nit (no change asked). unable_to_link_account is also produced on the sign-in path (implicit linking). A person already signed in who arrives with it from a sign-in round trip now sees the toast. The sentence stays true for that case.

  7. K. 2 first-parent commits since base a9da5474 < 15, so no base sync.

  8. Out of scope. None.

  9. Authority. Landing under the maintainer's standing authorisation 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Landing · head 06dc109b (the ACCEPTed head; K = 2, no sync) · 2026-11-15T02:19Z

reading value
check runs on 06dc109b 66, all success or skipped
contract record PASS 6887646324

State: ready + auto-merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 02:19
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 6446935 Nov 15, 2026
67 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-0fraah branch November 15, 2026 04:21
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ectstack-ai#33679)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1XSxY8jRG8MhDJB39LgakrUc)_

domain:ui#1 · os-project-manager · session_01FEkQ5nwxuShQ1A7T6jAiLn

Fixes objectstack-ai#33650

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

## 维护者速读

- 改了什么:组织邀请链路上的两个报错改成控制台自己的语言。打开失效的邀请链接时不再显示 better-auth 的英文 "Invitation
not
found!",而是「该邀请已被使用、已过期或已撤销。如果您已接受过该邀请,可在组织列表中找到该组织。」;邀请一个已经是成员的人时显示「该用户已是本组织成员。」。共
11 种语言。
- 为什么改:better-auth 的 `get-invitation` 对「找不到」只回 400
加一句英文,不带错误码,控制台按错误码翻译所以漏掉了;「已是成员」这个错误码也没有映射。已接受过的邀请再打开,服务端的回答和「找不到」完全一样,控制台无法区分,所以改为在同一句话里说明「可能已被使用」并指向组织列表(页面原有的「前往组织」按钮)。
- 风险与回滚:只认「`get-invitation` + 400 + 无错误码」这一种回答,不读英文原文;其他 400(带错误码的)和 401
等仍照旧显示服务端原句。`@object-ui/auth` 抛出的错误多带一个 `status` 字段,原有字段与文字不变。服务端不改。回滚即
revert 本 PR。
-
先看:`ui/packages/app-shell/src/console/organizations/orgErrorMessage.ts`
的
`resolveInvitationLookupMessage`;`ui/packages/auth/src/createAuthClient.ts`
的 `toAuthError` 一行;`ui/packages/i18n/src/locales/zh-Hans.ts` 的两句中文。
- 两分钟验证:`pnpm --dir ui exec vitest run
packages/app-shell/src/console/organizations/__tests__/invitationVendorRefusals-33650.test.tsx`,预期
9 个用例全绿。
- 需要你做的:无,席位落地。

## What changes

- **The invitation lookup's code-less not-found reads as the console's
sentence.** better-auth 1.7.12 `GET /organization/get-invitation`
(`dist/plugins/organization/routes/crud-invites.mjs`, `getInvitation`)
throws `APIError.fromStatus("BAD_REQUEST", { message: "Invitation not
found!" })` with no `code` for an unknown id and for an invitation that
is accepted, rejected, canceled or expired. Every other 400 the route
answers names its code (`ORGANIZATION_NOT_FOUND`,
`INVITER_IS_NO_LONGER_A_MEMBER_OF_THE_ORGANIZATION`, better-call's
`VALIDATION_ERROR`). The new `resolveInvitationLookupMessage`
(orgErrorMessage.ts) reads exactly that answer, keyed on the route (only
`AcceptInvitationPage`'s `getInvitation` catch calls it), status 400 and
the missing code, and never on the English text (the module's rule,
objectui#4474). Anything else goes through `resolveOrgErrorMessage` as
before.
- **`@object-ui/auth` carries the HTTP status.** `toAuthError` dropped
`status`, so the page could not see the 400. It now copies a numeric
`status` onto the thrown error, like the two-factor and
invitation-preview errors in the same file already do. `message`, `code`
and the rest are unchanged. `AuthClientError` is a module-internal type;
no exported type changes.
- **`USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION` joins
`ORG_ERROR_MESSAGE_KEYS`** as `organization.errors.alreadyMember`, with
a sentence in all 11 packs (10 hand-written, `zh-Hant` generated by
`gen:zh-hant`).
- **The not-found sentence names every state the server folds into it**
("already been used, has expired, or was revoked") and tells an invitee
who accepted where the organization is. The error card already carries
the "Go to organizations" button, which is the way in.

## Tests

-
`ui/packages/app-shell/src/console/organizations/__tests__/invitationVendorRefusals-33650.test.tsx`
(new, 9 cases): the REAL `AcceptInvitationPage` and `InviteMemberDialog`
under the real `I18nProvider`, with `useAuth` forwarding to the REAL
`createAuthClient` over a stubbed `fetch` that answers better-auth
1.7.12's own bodies. Faces 1 (zh and en), 2 and 3, the pack census for
the new key, and four CONTROLs: a coded 400 from get-invitation keeps
its own message; a code-less 401 keeps its own message;
`accept-invitation`'s coded `INVITATION_NOT_FOUND` still maps as before;
an unmapped coded invite refusal keeps the server's sentence.
- `ui/packages/auth/src/__tests__/authErrorStatus-33650.test.ts` (new, 2
cases): the real client carries `status` on a code-less and on a coded
refusal, message unchanged.
- `orgErrorMessage-4474.test.ts`: the mapping-table census names the new
code.

## Acceptance notes

- **Face 3 is worded, not detected.** The id alone cannot tell an
accepted invitation from an unknown one: get-invitation refuses any
status but `pending` with the same code-less 400,
`list-user-invitations` filters to `pending`, and objectstack's
signed-out `invitation-preview` answers one uniform 404 by design
(ADR-0138 D2). The console could only find the invitation by listing
invitations of every organization the user belongs to
(`list-invitations` returns all statuses to a member), which is new
fan-out fetching, not data the page already has, so the order's fallback
applies: the sentence covers used / expired / revoked and points to the
organization list. A server answer that tells a signed-in recipient "you
already accepted this, organization X" is reported for a server card.
- **Clause-② is `yes (widening)`** (seat reading, as for PR objectstack-ai#33485 and
PR objectstack-ai#33585): `@object-ui/i18n` gains `organization.errors.alreadyMember`
in all eleven locale packs (and rewords
`organization.errors.invitationNotFound`), and errors thrown by
`@object-ui/auth` gain a numeric `status` property beside `message` and
`code`. Nothing is removed or narrowed; no exported type changes
(`AuthClientError` is module-internal).
- `resolveInvitationLookupMessage` is a separate entry point rather than
a status rule inside `resolveOrgErrorMessage`: only the caller knows
which route it called, and a code-less 400 from another organization
route is not a not-found.

## Verification

All local readings at head `2c555217` (the later head only changes the
changeset's declaration line and prose; the changeset gates were rerun
on it: check-changeset-no-major, check-empty-changeset,
check-adr-0087-registration and its self-test,
changeset-gate-self-tests, nul-bytes, all exit 0) (base `3c0033f9`;
`origin/main` has moved 20 commits since, none touching these files).

<details><summary>Measurement on base: all three faces
reproduce</summary>

Production sources put back to `3c0033f9` (tests kept), the new pins
run, then `git checkout HEAD --` restored (`git diff HEAD` empty):

```
× getInvitation: the code-less not-found carries status 400 and no code   (expected undefined to be 400)
× inviteMember: a coded refusal carries its status beside the code
× zh: draws the localized not-found sentence, not the vendor's English    (Received: Invitation not found!)
× en: draws the console's own English sentence, not the vendor's          (Received: Invitation not found!)
× reads as used / expired / revoked and points to the organization list   (Received: "Invitation not found!")
× zh: the invite dialog draws the localized sentence                      (Received: User is already a member of this organization)
× organization.errors.alreadyMember is a translated string in each pack   (en: undefined)
Tests  7 failed | 4 passed (11)    the 4 passing are the CONTROLs
```

Deciding lines on base: face 1 and 3, `orgErrorMessage.ts:191`
(`resolveOrgErrorMessage` returns the non-empty message verbatim because
the error has no code) behind `createAuthClient.ts:195` (`toAuthError`
keeps `code`, drops `status`), called from
`AcceptInvitationPage.tsx:84`; face 2, `ORG_ERROR_MESSAGE_KEYS` has no
`USER_IS_ALREADY_A_MEMBER_OF_THIS_ORGANIZATION` row (invite section,
`orgErrorMessage.ts:89-100`). Face 3 is the same wire answer as face 1:
better-auth refuses any status but `pending` with the code-less 400.
</details>

<details><summary>Head: new pins and affected suites</summary>

```
pnpm exec vitest run invitationVendorRefusals-33650.test.tsx authErrorStatus-33650.test.ts
  Test Files  2 passed (2) · Tests  11 passed (11)
pnpm exec vitest run packages/auth/ packages/i18n/ packages/app-shell/src/console/organizations/ packages/app-shell/src/console/auth/ apps/console/src/pages/auth/
  first run: 1 failed | 2972 passed | 13 skipped (orgErrorMessage-4474 mapping-table census, which lists every mapped code); census updated in 2c55521
  rerun of that file: Tests 21 passed (21)
pnpm --filter @object-ui/auth run type-check       :: exit 0
pnpm --filter @object-ui/app-shell run type-check  :: exit 0   (tsc --noEmit and tsc -p tsconfig.test.json)
pnpm --filter @object-ui/i18n run type-check       :: exit 0
```
</details>

<details><summary>Ablations: each new branch, its pins red, restored to
the HEAD blob</summary>

`node scripts/ablation-replace.mjs` per leg (ui vitest reads these
packages from source, so no dist leg):

```
A1 lookup branch off (guard forced false, marker ABL1) 3 failed: face 1 zh, face 1 en, face 3
A2 status narrowing off (any code-less answer reads not-found)  1 failed: CONTROL code-less 401 keeps its own message
A3 toAuthError drops status (copy line forced off, marker ABL3) 5 failed: both auth pins, face 1 zh, face 1 en, face 3
A4 already-member row unkeyed (ABL4_USER_IS_ALREADY_A_MEMBER)   1 failed: face 2 zh
each leg: "ok restored: blob == HEAD and `git diff HEAD` is empty"
```

The first A3 attempt was refused before running (anchor ambiguous, 2
hits, exit 3, nothing mutated); rerun with a three-line anchor.
</details>

<details><summary>Derived gates (39), dispatch-gates --ran: 39 derived,
39 run, 0 NOT-MEASURED</summary>

```
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:merge-driver :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:role-word :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
```
</details>


## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(no spec change)
- [x] 2. Every name I added uses the casing for its kind.
- [ ] 3. No formatter ran; `pnpm lint` passes. (no formatter ran; `pnpm
lint` was not run locally, the repo-wide lint run is CI's)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
(`.changeset/33650-invitation-refusal-copy.md`)
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (not touched)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (the 维护者速读 block is
the fleet's Chinese channel)

---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5nwxuShQ1A7T6jAiLn)_

<!-- signed: domain:ui#1 · os-project-manager ·
session_01FEkQ5nWoa1Ze1QzjRTSYXD -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
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

1 participant