You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2958f17
Browse filesBrowse the repository at this point in the historyBrowse files
fix(auth): label the external organization role objectstack#25515 added, so the console type-checks against objectstack main (objectui#13427) (#13429)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuCB2j33nwkf8zRiRLVnonR8)_Closes#13427
Clause-②: yes (follows objectstack#25515's widening: a new
`ORG_ROLE_EXTERNAL` export and `ORG_ROLE_LABELS` row in
`@object-ui/auth`, a new `organization.roles.external` key in each
shipped pack; no acceptance set of objectui's own widens)
## What changed
objectstack#25515 (objectstack#25233 stage 1, ruling of record
6355206139, letter B) added `external` to `@objectstack/spec`'s
`BUILTIN_MEMBERSHIP_ROLES`. `ORG_ROLE_LABELS` is a `Record` over that
vocabulary, so the console stopped type-checking against objectstack
`main` (`TS2741` at `packages/auth/src/org-roles.ts:67`), and
objectstack's Console Pin Gate and Spec Shape Gate went red. This PR
makes the console know the role:
- `packages/auth/src/org-roles.ts`: a new `ORG_ROLE_EXTERNAL` export,
its label row (`organization.roles.external`, "External"), and the
any-issuer rule for invitations (below).
- Every pack in `packages/i18n/src/locales/` carries
`organization.roles.external`. zh is 外部成员, ja 外部メンバー and es Externo, the
words objectstack's own `sys_member.role` option uses; de, fr, ko, pt,
ru and ar follow each pack's word for `member`.
## The two choices the card asked for
1. **Where the role shows.** `ORG_ROLES` stays the spec list unfiltered,
so `external` appears in the invite dialog and in the members page's
role menu wherever the spec lists it. The invite offer for an issuer
below admin grade (a delegated admin, or a caller whose membership has
not loaded) becomes `member` and `external`. That mirrors the
framework's invitation cap: in the spec's grant table
(`INVITATION_ROLE_GRANTORS`) both rows read `'any'`, because `external`
confers less than a member (ruling E3). An owner or admin may also set
it from the members page, as better-auth's `update-member-role` allows.
Two server refusals are not pre-empted, because the screen cannot see
what they read: a role list mixing `external` with another role (E5; the
menu sets one role) and re-roling a member who is placed in a business
unit (E6).
2. **Where it sits on the grade ladder.** At `member` grade, as
objectstack's own cap ladder (`invitation-role-cap.ts`) grades it. The
console ladder answers only "is this an administrative grade", so
`external` never unlocks invite, remove, cancel or re-role. That it
reaches less than a member is enforced server-side; a rung below
`member` here would have no reader.
## Why the pin does not move, and the literal
Importing the spec's `MEMBERSHIP_ROLE_EXTERNAL` needs objectui's own
`.objectstack-sha` past objectstack#25515. Any such pin also carries
objectstack#25483, PR1 of objectstack#25251, whose PR2 (spec lane) has
not landed; this project keeps objectui's pin before #25483 until it
does. So the pin stays at `915e9404`, and the console compiles against
both vocabularies:
- `ORG_ROLE_EXTERNAL = 'external'` is spelled locally, with a docblock
pointing at objectstack#25515.
- `ORG_ROLE_LABELS` is typed `Record<OrgRole | typeof ORG_ROLE_EXTERNAL,
…>`. Against `main` the union is `OrgRole` itself, so the table stays
exhaustive there.
- A tripwire test (`spells external itself only while the pin predates
objectstack#25515`) goes red on the pin move that brings #25515. Its
message lists the follow-up: import the constant, drop the union, add
`external` to the role lists that `InviteMemberDialog.roleCap.test.tsx`
and `org-i18n-holdouts-4474.test.tsx` expect, and delete the tripwire.
## Tests
- `org-roles.test.ts`: the external label row; external grades as
`member` and below admin; an external actor may re-role nobody; an admin
may re-role an existing external; and the invite offer equals what the
spec's grant table admits, for owner, admin and every below-admin
issuer. That last pin holds at either spec, and against `main` it
asserts `['member', 'external']` for a delegate.
- `org-i18n-holdouts-4474.test.tsx`: every pack defines
`organization.roles.external`, and an external member's badge reads 外部成员
in zh and External in en.
## Verification
Measured in this container, in the worktree on this branch:
- **Against objectstack `main` `5ea211cc`** (the pin built at that
commit, nothing committed): `turbo run build --filter=@object-ui/auth
--filter=@object-ui/i18n`, then `turbo run type-check` for
`@object-ui/console`, `@object-ui/auth`, `@object-ui/app-shell`,
`@object-ui/i18n`: exit 0, 39/39 tasks (console runs `tsc --noEmit` and
`tsc -b tsconfig.node.json`, app-shell its test tsconfig too). `vitest
run` on `org-roles.test.ts` plus `console/organizations/__tests__/`: 159
passed, 6 failed, all six expected. The tripwire is one of them. The
other five are the existing literal role lists, whose received values
show the new behaviour: owner offered 5 roles, delegate and unloaded
offered `['member', 'external']`, and the zh and en dropdowns ending in
外部成员 and External. Ablation on the same build: restoring the old
below-admin offer (`[ORG_ROLE_MEMBER]`) turns `offers exactly what the
spec grant table admits` red.
- **At the pin `915e9404`** (after `pnpm run setup`; `objectstack-pin
status` reads the cache at the pin): the same build and type-check, exit
0, 39/39 tasks; `vitest run packages/auth/src/__tests__/
packages/app-shell/src/console/organizations/ packages/i18n/
apps/console/src/pages/system/`: 168 files, 2019 passed, 13 skipped, 0
failed. `eslint` on the changed files: 0 errors (17 warnings, all
pre-existing `any` lines in the holdouts test's mocks).
- Repo checks, each exit 0: `check:i18n-keys`, `check:i18n-drift`,
`check:i18n-dead-keys`, `check:changeset-claims`,
`check:pending-changeset-literals`, `check:spec-symbols`,
`check:new-line-citations`, `check:control-bytes`,
`check:installed-pin-claims`, `check:vi-mock-specifiers`,
`check:vi-mock-inherit`, `check:vi-mock-override-shape`,
`check:test-path-roots`. `check:readme-exports` answered exit 1 as a
prerequisite, not a verdict: 27 packages were unbuilt, so its population
collapsed below its floors. CI runs it after the build.
## Notes
- Branch `claude/issue-13427-external-role-label`, worktree
`objectui-issue-13427`, claim 6374956587 (Seat: `domain:ui#1`).
- After this merges, #25537 moves
objectstack's `.objectui-sha` past it, which greens Console Pin Gate and
Spec Shape Gate.
- Not changed, outside the surface: the profile page's access word is
two-way (admin or member, from `useWorkspaceAdminStatus`), so an
external user reads 成员 / Member there. `orgRoleLabel.ts`'s docblock
still says "the four" roles.
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
Session: `https://claude.ai/code/session_01JtDJkBUiZnD9NWnDqYuhq7`
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JtDJkBUiZnD9NWnDqYuhq7)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01JtDJkBUiZnD9NWnDqYuhq7
Co-authored-by: Claude <noreply@anthropic.com>
The console knows the `external` organization role that objectstack#25515 added to `@objectstack/spec`'s membership vocabulary (objectui#13427). Without it `ORG_ROLE_LABELS` no longer type-checked against an `@objectstack/spec` that lists the role.
7
+
8
+
`@object-ui/auth` exports `ORG_ROLE_EXTERNAL` and labels it (`organization.roles.external`, "External"). Every pack in `@object-ui/i18n` carries the key; zh reads 外部成员, as the server's own `sys_member.role` option does. Wherever the installed spec lists the role, the invite dialog offers it to every issuer who can invite, a delegated admin included, because objectstack's invitation cap admits it from any issuer: it confers less than a member. Owners and admins can also set it from the members page. On the grade ladder it sits with `member`, as it does in objectstack's cap, so it never unlocks an administrative affordance.
0 commit comments