Skip to content

Commit 0bf7aaf

Browse files
fix(platform-objects): the Users identity source reads "Local Account" instead of "Env-Native" (#28543)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X13YDEfngeSnxKczzPZGBXm)_ domain:server#1 · os-project-manager · session_01FEkQ5m3nbb6XEM5CRtHn7i Refs #27855 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:用户的「身份来源」字段中,本地注册用户(存储值 `env_native`)原来显示 "Env-Native",现在显示 "Local Account",与联合登录的 "IdP-Provisioned" 并列;中文显示「本地账号」,日文「ローカルアカウント」,西班牙文「Cuenta local」。 - 为什么改:管理员在 Setup → Users 看到的是设计文档里的术语,看不懂(#27855 第三条)。 - 风险与回滚:只改选项标签,存储值 `env_native`、默认值和所有读取它的代码都不变。回滚即 revert 本 PR。 - 先看:`packages/platform-objects/src/identity/sys-user.object.ts`(`source` 字段),`packages/platform-objects/src/identity/sys-user-identity-source-label.test.ts`。 - 两分钟验证:`pnpm --filter @objectstack/platform-objects exec vitest run src/identity/sys-user-identity-source-label.test.ts`,预期 6 passed(在 main 上 5 个红)。 - 需要你做的:通知主题(topic)可读化需要你拍板,平台没有不改字段类型、不改 ui 的纯显示途径,选项和分析见下方 Acceptance notes;#27855 保持打开。 ## What changes - `identity/sys-user.object.ts`: the `source` (Identity Source) option `env_native` is labelled **"Local Account"** (was "Env-Native"). Why this word: the field answers "where does this identity live", and its other option is "IdP-Provisioned" (held by an identity provider). An `env_native` user signed up with email and password in this environment, or is an app end-user, so the identity is a local account of this environment. The zh-CN object description already calls a user a 用户账号, so 本地账号 sits beside it. The stored value, the default and the description are unchanged. - Translations: `zh-CN` 本地账号 (was 环境本地), `ja-JP` ローカルアカウント (was 環境ネイティブ), `es-ES` Cuenta local (was Nativa del entorno), re-translated in place in the generated bundles as their header asks. `en.objects.generated.ts` was regenerated by `node scripts/check-i18n-bundles.mjs --write --filter=platform-objects`; that run moved no other line, and none of these leaves has a `source-hashes` entry to refresh. - Pin: `identity/sys-user-identity-source-label.test.ts`: the field stays a `select` over `idp_provisioned` / `env_native` with default `env_native`; the `env_native` label is "Local Account"; each of the four bundles carries its word. - Changeset: `@objectstack/platform-objects` patch. ## Why Every administrator on Setup → Users read "Env-Native" as a user's identity source, a term from the provenance design (ADR-0135 D4), not a business word. ## Acceptance notes **Not in this PR: the readable notification topic (the card's other remaining part). It needs a maintainer decision; #27855 stays open.** The dispatch ruled out a `select` that refuses unknown topics, any type, storage or value change, and `packages/spec/**` / `ui/**`. Measured at `origin/main` `35b178bd`, no display-only route reaches the face the card names (the Notifications list's Topic column): - `options` parse on any field type, and two readers already honour them on a text field: the analytics dimension resolver (`service-analytics/src/dimension-labels.ts`, "never the field's `type`") and the grid's group header (`ui/packages/plugin-grid/src/objectGridGrouping.ts`). The list cell does not: `TextCellRenderer` (`ui/packages/fields/src/index.tsx`) prints the stored text, and the record title is `titleFormat: '{topic}'`. - The read-face `widget` hints a text field can promote to are a closed set of four reference faces (`object-ref`, `recipient-picker`, `position-ref`, `permission-ref`); none names a topic, and adding one is `ui/**`. - A `select` would label known topics and, for an unknown one, the select cell falls back to `humanizeLabel` (`lead_routing` reads "Lead Routing"). It would not refuse anything if the field were `readonly`, as `sys_activity.type` is (the open-vocabulary ruling executed at commit 88b9d74). But it is a type change: a `text` field is a TEXT column and a `select` falls to the SQL driver's `table.string(name)` (varchar 255), which the drift differ reports as `narrow_varchar` on existing tables. The vocabulary, measured: 11 distinct topic literals in this repo (10 `approval.*` in plugin-approvals, plus `collab.mention`), plus the flow notify node's default `notify` (`io-node-config.zod.ts`, `topic: z.string()`); hotcrm `a598256` emits 19 more of its own (`lead_routing`, `deal_stalled`, …). The same key is what administrators type into `sys_notification_template.topic` and `sys_notification_preference.topic`, both free text matched against `sys_notification.topic`. Options, for the decision record: - **A.** Make `topic` a readonly `select` over the platform's built-in topics, following the `sys_activity.type` open-vocabulary pattern. Known topics read through translatable labels. Unknown topics are stored as written and drawn humanized. Costs: a type and column change (TEXT to varchar 255, a destructive drift finding on existing PostgreSQL and MySQL tables), and a census of the built-in topics that every new platform topic must extend in four locales. - **B.** Keep `Field.text` and declare display-only `options` for the built-in topics. Group headers and analytics would read labels, but the list cell, the detail and the title stay raw until a ui card teaches the text cell to read `options`. Until then the declaration is honoured in only some places. - **C.** Leave the topic as its key and close the rest of #27855. The key is what an administrator types into notification templates and preferences, so on this admin event log it is the value they need to see. Recommendation: **C**. Along the four axes: - Business need: the reach is real (every administrator on Notifications), but the raw key is the value the admin later types into templates and preferences. - Long-term soundness: A buys a p3 label with a storage type change. - Preventing AI mistakes: A's option list reads as closed to an AI author, which is exactly what the `sys_activity` ruling had to undo with a long description. B declares something the main face ignores. - Startup focus: C adds no catalog, no census and no ui card. If the maintainer wants the label anyway, A is the honest route, as its own card with the drift finding handled. ## Verification Red first on `main` (test commit `cf9f9991` before the fix): `sys-user-identity-source-label.test.ts` 5 failed, 1 passed. The stored-value case stayed green, and the red ones received "Env-Native", 环境本地, 環境ネイティブ, Nativa del entorno. Green on this head: 6 passed. Suites: `@objectstack/platform-objects` 105 files / 1480 tests pass; its typecheck (tsc, scripts, test-typecheck) passes; `eslint --no-inline-config packages/platform-objects` exit 0. Gates at head `7164bb2a`: `dispatch-gates --commands` derived 59 families; all 59 ran and exit 0, and `--ran` reconciles 59 derived / 59 run / 0 NOT-MEASURED. `check-plugin-teardown-shape --self-test` first answered exit 3 (the shallow clone lacked its fixture commit); after `git fetch --depth=1` of that commit it exits 0. These include `check:i18n`, `check:i18n-stale-fill`, `check:dual-build-cjs-loads` (after a full non-ui workspace build) and `check:type-check-debt`. `git merge-tree` against the one open PR touching these bundles or this object file (#28525, head `b0284131`) merges clean. Skills-docs: none — labels only; no published skill names the "Env-Native" label. ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes (scoped to `packages/platform-objects`; the repo-wide 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. - [x] 6. `packages/spec` touched: 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. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FEkQ5m3nbb6XEM5CRtHn7i --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 76b4ae4 commit 0bf7aaf

7 files changed

Lines changed: 71 additions & 5 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@objectstack/platform-objects': patch
3+
---
4+
5+
fix(platform-objects): the Users identity source reads "Local Account" instead of "Env-Native"
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
- **Identity Source.** A user who signed up with email and password, or an app end-user, showed the identity source "Env-Native", a word from the provenance design. The `env_native` option is now labelled "Local Account", beside the federated "IdP-Provisioned": the identity is held by this environment's own sign-in rather than by an identity provider. zh-CN reads 本地账号, ja-JP ローカルアカウント, es-ES Cuenta local.
11+
- The stored value is unchanged: rows, the sign-up hook and the cloud-managed gating keep reading `env_native`.

‎packages/platform-objects/src/apps/translations/en.objects.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const enObjects: NonNullable<TranslationData['objects']> = {
108108
help: "How this identity was created — idp_provisioned (federated SSO JIT) or env_native (local signup / app end-user). System-managed; do not edit.",
109109
options: {
110110
idp_provisioned: "IdP-Provisioned",
111-
env_native: "Env-Native"
111+
env_native: "Local Account"
112112
}
113113
},
114114
id: {

‎packages/platform-objects/src/apps/translations/es-ES.objects.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const esESObjects: NonNullable<TranslationData['objects']> = {
108108
help: "Cómo se creó esta identidad: idp_provisioned (JIT de SSO federado) o env_native (registro local / usuario final de la aplicación). Gestionado por el sistema; no editar.",
109109
options: {
110110
idp_provisioned: "Aprovisionada por IdP",
111-
env_native: "Nativa del entorno"
111+
env_native: "Cuenta local"
112112
}
113113
},
114114
id: {

‎packages/platform-objects/src/apps/translations/ja-JP.objects.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const jaJPObjects: NonNullable<TranslationData['objects']> = {
108108
help: "この ID の作成方法 — idp_provisioned(フェデレーション SSO の JIT)または env_native(ローカルサインアップ/アプリのエンドユーザー)。システム管理のため編集しないでください。",
109109
options: {
110110
idp_provisioned: "IdP プロビジョニング",
111-
env_native: "環境ネイティブ"
111+
env_native: "ローカルアカウント"
112112
}
113113
},
114114
id: {

‎packages/platform-objects/src/apps/translations/zh-CN.objects.generated.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export const zhCNObjects: NonNullable<TranslationData['objects']> = {
108108
help: "该身份的创建方式——idp_provisioned(联合 SSO 即时开通)或 env_native(本地注册 / 应用最终用户)。系统维护,请勿编辑。",
109109
options: {
110110
idp_provisioned: "IdP 开通",
111-
env_native: "环境本地"
111+
env_native: "本地账号"
112112
}
113113
},
114114
id: {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* #27855 — the Users "Identity Source" value reads in business terms.
5+
*
6+
* A user who signed up with email and password (or an app end-user) is stamped
7+
* `env_native`, and the option was labelled "Env-Native": a word from the
8+
* provenance design (ADR-0135 D4), not one an administrator uses. It is labelled
9+
* "Local Account" beside the federated "IdP-Provisioned": the identity is held
10+
* by this environment's own sign-in rather than by an identity provider.
11+
*
12+
* The stored value is pinned beside the label. A label is display text; the
13+
* value is what every row, the AuthManager hook and the cloud-managed gating
14+
* already read, so it does not move.
15+
*/
16+
17+
import { describe, it, expect } from 'vitest';
18+
import { SysUser } from './sys-user.object';
19+
import { zhCNObjects } from '../apps/translations/zh-CN.objects.generated';
20+
import { jaJPObjects } from '../apps/translations/ja-JP.objects.generated';
21+
import { esESObjects } from '../apps/translations/es-ES.objects.generated';
22+
import { enObjects } from '../apps/translations/en.objects.generated';
23+
24+
type Option = { value: string; label: string };
25+
26+
const sourceField = SysUser.fields.source as { type: string; defaultValue?: unknown; options: Option[] };
27+
28+
function bundleOptionLabel(bundle: Record<string, unknown>, value: string): unknown {
29+
const sysUser = bundle.sys_user as { fields?: Record<string, { options?: Record<string, string> }> } | undefined;
30+
return sysUser?.fields?.source?.options?.[value];
31+
}
32+
33+
describe('sys_user.source identity-source labels', () => {
34+
it('keeps the field a select over the same stored values and default', () => {
35+
expect(sourceField.type).toBe('select');
36+
expect(sourceField.options.map((o) => o.value)).toEqual(['idp_provisioned', 'env_native']);
37+
expect(sourceField.defaultValue).toBe('env_native');
38+
});
39+
40+
it('labels env_native "Local Account"', () => {
41+
expect(sourceField.options.find((o) => o.value === 'env_native')?.label).toBe('Local Account');
42+
});
43+
44+
it.each([
45+
['en', enObjects, 'Local Account'],
46+
['zh-CN', zhCNObjects, '本地账号'],
47+
['ja-JP', jaJPObjects, 'ローカルアカウント'],
48+
['es-ES', esESObjects, 'Cuenta local'],
49+
])('the %s bundle carries the matching words', (_locale, bundle, expected) => {
50+
expect(bundleOptionLabel(bundle as Record<string, unknown>, 'env_native')).toBe(expected);
51+
});
52+
});

‎packages/platform-objects/src/identity/sys-user.object.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,9 @@ export const SysUser = ObjectSchema.create({
11741174
// identity-edit actions hide for managed users, who hold no local
11751175
// credential) and is the marker SCIM lifecycle keys off. Owned by objectql
11761176
// (better-auth is oblivious to this column — like `ai_access`).
1177+
// The option labels are the administrator's words (#27855): `env_native`
1178+
// reads "Local Account", an identity held by this environment's own
1179+
// sign-in, beside the federated "IdP-Provisioned". The stored values stay.
11771180
source: Field.select({
11781181
label: 'Identity Source',
11791182
required: false,
@@ -1182,7 +1185,7 @@ export const SysUser = ObjectSchema.create({
11821185
defaultValue: 'env_native',
11831186
options: [
11841187
{ label: 'IdP-Provisioned', value: 'idp_provisioned' },
1185-
{ label: 'Env-Native', value: 'env_native' },
1188+
{ label: 'Local Account', value: 'env_native' },
11861189
],
11871190
description: 'How this identity was created — idp_provisioned (federated SSO JIT) or env_native (local signup / app end-user). System-managed; do not edit.',
11881191
}),

0 commit comments

Comments
 (0)