Repository navigation
fix(console, i18n): the default app's Set-default star on Setup → Apps says why it is disabled - #33485
Conversation
The star on the current default app was disabled with no reason on hover, on focus or in its accessible description. It now goes through the console's disabled-reason pattern (useDisabledReason + DisabledReasonTrigger) with a new appManagement.alreadyDefault key in all eleven locale packs. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDjspYidQzuFnRj4r
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDjspYidQzuFnRj4r
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDjspYidQzuFnRj4r
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mDjspYidQzuFnRj4r
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Contract reviewServed-tier: Read: card #33103 (body, triage ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
…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>
Requested by Leehom · project thread
domain:ui#1 · os-project-manager · session_01FEkQ5mDjspYidQzuFnRj4r
Fixes #33103
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
useDisabledReason+DisabledReasonTrigger),不新造模式,不碰服务端。回滚即 revert 本 PR。ui/apps/console/src/pages/system/AppManagementPage.tsx的新组件SetDefaultStar;新测试AppManagementPage.defaultStarReason-33103.test.tsx;ui/packages/i18n/src/locales/*.ts里的appManagement.alreadyDefault。pnpm --dir ui exec vitest run apps/console/src/pages/system/__tests__/AppManagementPage.defaultStarReason-33103.test.tsx,预期 6 条全绿。What changes
ui/apps/console/src/pages/system/AppManagementPage.tsx:SetDefaultStarcomponent (the reason is a hook and the rows are drawn in a loop). It reuses the console's existing disabled-reason pattern from@object-ui/components, the same one plugin-grid's inline row-action button uses:useDisabledReason(isDefault, t('appManagement.alreadyDefault'))gives the reason, the button pointsaria-describedbyat it, andDisabledReasonTriggerwraps the button in the focusable span that opens the reason as a tooltip on hover and on focus and carries the same description. No second pattern was introduced.processing(a write in flight) still disables every star, and gives no reason: it is the page's own transient state, not a fact about the app, which is howdisabled-reason.tsxitself treats an execution in flight.processing || isDefault) are unchanged.ui/packages/i18n/src/locales/*.ts: one new key,appManagement.alreadyDefault, in all eleven shipped locales (en "Already the default app"), next tosetDefaultNamedand using each pack's existing word for "app" and "default"..changeset/33103-default-app-star-reason.md:patchfor@object-ui/consoleand@object-ui/i18n, both published (files[]shipsdist), with the two declaration lines.Tests
New
ui/apps/console/src/pages/system/__tests__/AppManagementPage.defaultStarReason-33103.test.tsx, through the rendered page, the real Radix tooltip and a realI18nProvider(the expected sentence is read from the shipped pack, not from the call site'sdefaultValue):zh, the description is the zh-Hans pack's sentence;aria-describedbyand no reason wrapper;Ablation through
scripts/ablation-replace.mjs: the hook's argumentisDefault,replaced byisDefault && false,(mutation landed, blob1d889086to467c2a73; restored, blob equals HEAD,git diff HEADempty). The four reason pins went red and both controls stayed green: 4 failed, 2 passed.Acceptance notes
origin/main9499dcc5: the star still readdisabled={processing || isDefault}with no reason wrapper, so the card reproduced and this is a change, not a pin.Clause-②: yes (widening)measured on the diff: the only published-surface change is the added i18n key; no export, prop or key is removed or narrowed.Verification
All local readings at head
8a3b16e6.Derived gates: 38 of 38 exit 0
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 38 families on this diff; each ran on8a3b16e6and exited 0.--ranreconciliation: "38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN". The run record is the gates-ran file the report names.Suites, type-check, lint
pnpm --dir ui exec vitest run apps/console/src/pages/system/__tests__/: 11 files, 97 tests pass (the new file 6/6) on8a3b16e6.pnpm --dir ui exec vitest run packages/i18n/: 102 files, 1894 pass, 13 skipped (includesall-locales-key-parity), on34cf492f; the later commit touches only the new test file's types.pnpm --dir ui exec vitest run apps/console/: 313 files, 3224 tests pass, on34cf492f.pnpm --filter @object-ui/console run type-check: exit 0 on8a3b16e6(the first run on34cf492fwas red on the new test's helper typing, fixed in8a3b16e6).pnpm --filter @object-ui/i18n run type-check: exit 0.pnpm exec eslinton the page and the new test: exit 0.pnpm --dir ui run check:new-line-citations: "0 new citation(s)".CI runs the full farm; the seat reads its check-runs.
Generated by Claude Code