From 258b26df0ca5f3873cd4713b32db401bbd1b2e0e Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 21:30:55 +0000 Subject: [PATCH 1/4] feat(platform-objects): System Overview dataset members carry synonyms and a description WIP: vocabulary and bundle rows; source hashes, pin and changeset follow. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz --- .../src/apps/dashboards/system.datasets.ts | 87 +++++++++++++++++-- .../src/apps/translations/ar.ts | 54 ++++++++++-- .../src/apps/translations/de.ts | 54 ++++++++++-- .../src/apps/translations/en.ts | 67 +++++++++++--- .../src/apps/translations/es-ES.ts | 54 ++++++++++-- .../src/apps/translations/fr.ts | 54 ++++++++++-- .../src/apps/translations/ja-JP.ts | 54 ++++++++++-- .../src/apps/translations/ko.ts | 54 ++++++++++-- .../src/apps/translations/pt-BR.ts | 54 ++++++++++-- .../src/apps/translations/ru.ts | 54 ++++++++++-- .../src/apps/translations/zh-CN.ts | 54 ++++++++++-- .../src/apps/translations/zh-Hant.ts | 54 ++++++++++-- 12 files changed, 617 insertions(+), 77 deletions(-) diff --git a/packages/platform-objects/src/apps/dashboards/system.datasets.ts b/packages/platform-objects/src/apps/dashboards/system.datasets.ts index 2dab5e500da..b95092f6de1 100644 --- a/packages/platform-objects/src/apps/dashboards/system.datasets.ts +++ b/packages/platform-objects/src/apps/dashboards/system.datasets.ts @@ -9,6 +9,23 @@ import { defineDataset } from '@objectstack/spec/ui'; * datasets reference objects BY NAME, so co-locating them with the dashboard * (registered by plugin-auth) is fine; the widgets that target absent objects * are runtime-gated via `requiresObject`. + * + * Each member carries its business vocabulary (ADR-0149 D1): `synonyms`, the + * words an administrator types for it in a question, Chinese and English in + * the one authored array (a synonym is match input, never translated, so no + * bundle carries it), and a one-sentence `description`, which is display copy + * and is translated at `datasets..{measures,dimensions}..description`. + * These datasets reach the dataset AI tools through plugin-auth's runtime + * manifest, where the vocabulary advisory never reads them, so nothing but + * this file gives them words. + * + * The dataset tools match a term by EQUALITY after `normalizeDatasetTerm`, so + * a phrase an administrator asks in ("how many users", 「有多少用户」) answers + * only where it is written as one synonym. Each word below names one member + * across all five datasets: a word on two measures makes the tools ask which + * one is meant. The other language's label is listed too (`users` beside + * 「用户」), because the label a caller is matched against is the one served in + * the caller's locale. */ export const SysUserDataset = defineDataset({ @@ -16,7 +33,16 @@ export const SysUserDataset = defineDataset({ label: 'User Metrics', object: 'sys_user', dimensions: [], - measures: [{ name: 'user_count', label: 'Users', aggregate: 'count' }], + measures: [{ + name: 'user_count', + label: 'Users', + aggregate: 'count', + description: 'The number of user accounts on record, active or not.', + synonyms: [ + '用户', '用户数', '用户数量', '用户总数', '有多少用户', + 'users', 'user count', 'number of users', 'total users', 'how many users', + ], + }], }); export const SysOrganizationDataset = defineDataset({ @@ -24,7 +50,16 @@ export const SysOrganizationDataset = defineDataset({ label: 'Organization Metrics', object: 'sys_organization', dimensions: [], - measures: [{ name: 'org_count', label: 'Organizations', aggregate: 'count' }], + measures: [{ + name: 'org_count', + label: 'Organizations', + aggregate: 'count', + description: 'The number of organizations on record; each one keeps its own members, data and settings.', + synonyms: [ + '组织', '组织数', '组织数量', '组织总数', '有多少组织', + 'organizations', 'orgs', 'organization count', 'number of organizations', 'how many organizations', + ], + }], }); export const SysSessionDataset = defineDataset({ @@ -32,7 +67,16 @@ export const SysSessionDataset = defineDataset({ label: 'Session Metrics', object: 'sys_session', dimensions: [], - measures: [{ name: 'session_count', label: 'Sessions', aggregate: 'count' }], + measures: [{ + name: 'session_count', + label: 'Sessions', + aggregate: 'count', + description: 'The number of sign-in sessions on record, one per sign-in from a browser or device.', + synonyms: [ + '会话', '会话数', '会话数量', '登录会话', '有多少会话', + 'sessions', 'session count', 'number of sessions', 'login sessions', 'how many sessions', + ], + }], }); export const SysPackageInstallationDataset = defineDataset({ @@ -40,7 +84,17 @@ export const SysPackageInstallationDataset = defineDataset({ label: 'Package Installation Metrics', object: 'sys_package_installation', dimensions: [], - measures: [{ name: 'package_count', label: 'Installations', aggregate: 'count' }], + measures: [{ + name: 'package_count', + label: 'Installations', + aggregate: 'count', + description: 'The number of package installations on record, one per package installed.', + synonyms: [ + '已安装的包', '安装的包数', '包安装数', '装了多少包', + 'installations', 'installed packages', 'package installations', 'package count', + 'number of installed packages', 'how many packages are installed', + ], + }], }); export const SysAuditLogDataset = defineDataset({ @@ -48,7 +102,15 @@ export const SysAuditLogDataset = defineDataset({ label: 'Audit Log Metrics', object: 'sys_audit_log', dimensions: [ - { name: 'action', label: 'Action', field: 'action', type: 'string' }, + { + name: 'action', + label: 'Action', + field: 'action', + type: 'string', + description: + 'The kind of action an audit log entry records, such as create, update, delete, login or a configuration change.', + synonyms: ['操作类型', '动作', '审计动作', 'action type', 'operation', 'audit action'], + }, // Rows the platform writes itself carry no `user_id`; their bucket reads // "System", not the renderer's default "(None)". An inline locale map: // the translation bundles have no slot for a dimension's null label. @@ -57,10 +119,23 @@ export const SysAuditLogDataset = defineDataset({ label: 'User', field: 'user_id', type: 'lookup', + description: + 'The user who performed the audited action; entries the platform writes itself are grouped under System.', + synonyms: ['操作人', '操作者', '执行人', '操作用户', 'actor', 'performed by', 'acting user'], nullLabel: { en: 'System', 'zh-CN': '系统', 'ja-JP': 'システム', 'es-ES': 'Sistema', 'zh-Hant': '系統', ar: 'النظام', fr: 'Système', 'pt-BR': 'Sistema', ru: 'Система', de: 'System', ko: '시스템' }, }, ], - measures: [{ name: 'event_count', label: 'Events', aggregate: 'count' }], + measures: [{ + name: 'event_count', + label: 'Events', + aggregate: 'count', + description: + 'The number of audit log entries; each records one action taken in the system, by a user or by the platform itself.', + synonyms: [ + '事件', '事件数', '审计事件', '审计事件数', '审计日志条数', '有多少审计事件', + 'events', 'event count', 'audit events', 'audit log entries', 'how many audit events', + ], + }], }); export const SystemOverviewDatasets = [ diff --git a/packages/platform-objects/src/apps/translations/ar.ts b/packages/platform-objects/src/apps/translations/ar.ts index afdf92accf8..f43ca9d5701 100644 --- a/packages/platform-objects/src/apps/translations/ar.ts +++ b/packages/platform-objects/src/apps/translations/ar.ts @@ -188,13 +188,55 @@ export const ar: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'المستخدمون' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'المؤسسات' } } }, - sys_session_metrics: { measures: { session_count: { label: 'الجلسات' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'عمليات التثبيت' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'المستخدمون', + description: 'عدد حسابات المستخدمين المسجلة، النشطة وغير النشطة.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'المؤسسات', + description: 'عدد المؤسسات المسجلة؛ لكل مؤسسة أعضاؤها وبياناتها وإعداداتها الخاصة.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'الجلسات', + description: 'عدد جلسات تسجيل الدخول المسجلة، جلسة واحدة لكل تسجيل دخول من متصفح أو جهاز.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'عمليات التثبيت', + description: 'عدد عمليات تثبيت الحزم المسجلة، عملية واحدة لكل حزمة مثبتة.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'الإجراء' }, user_id: { label: 'المستخدم' } }, - measures: { event_count: { label: 'الأحداث' } }, + dimensions: { + action: { + label: 'الإجراء', + description: 'نوع الإجراء الذي يسجله إدخال سجل التدقيق، مثل الإنشاء أو التحديث أو الحذف أو تسجيل الدخول أو تغيير الإعدادات.', + }, + user_id: { + label: 'المستخدم', + description: 'المستخدم الذي نفّذ الإجراء الخاضع للتدقيق؛ تُجمع الإدخالات التي تكتبها المنصة بنفسها تحت «النظام».', + }, + }, + measures: { + event_count: { + label: 'الأحداث', + description: 'عدد إدخالات سجل التدقيق؛ يسجل كل إدخال إجراءً واحدًا نُفّذ في النظام من قِبل مستخدم أو من قِبل المنصة نفسها.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/de.ts b/packages/platform-objects/src/apps/translations/de.ts index 29da9baf502..ee26e903a53 100644 --- a/packages/platform-objects/src/apps/translations/de.ts +++ b/packages/platform-objects/src/apps/translations/de.ts @@ -190,13 +190,55 @@ export const de: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Benutzer' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Organisationen' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Sitzungen' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Installationen' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Benutzer', + description: 'Anzahl der erfassten Benutzerkonten, ob aktiv oder nicht.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Organisationen', + description: 'Anzahl der erfassten Organisationen; jede hat ihre eigenen Mitglieder, Daten und Einstellungen.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Sitzungen', + description: 'Anzahl der erfassten Anmeldesitzungen, eine pro Anmeldung über einen Browser oder ein Gerät.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Installationen', + description: 'Anzahl der erfassten Paketinstallationen, eine pro installiertem Paket.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Aktion' }, user_id: { label: 'Benutzer' } }, - measures: { event_count: { label: 'Ereignisse' } }, + dimensions: { + action: { + label: 'Aktion', + description: 'Art der Aktion, die ein Audit-Log-Eintrag festhält, etwa Erstellen, Aktualisieren, Löschen, Anmelden oder eine Konfigurationsänderung.', + }, + user_id: { + label: 'Benutzer', + description: 'Benutzer, der die protokollierte Aktion ausgeführt hat; Einträge, die die Plattform selbst schreibt, werden unter „System“ zusammengefasst.', + }, + }, + measures: { + event_count: { + label: 'Ereignisse', + description: 'Anzahl der Audit-Log-Einträge; jeder hält eine Aktion im System fest, ausgeführt von einem Benutzer oder von der Plattform selbst.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/en.ts b/packages/platform-objects/src/apps/translations/en.ts index d3840004000..07ce6a09912 100644 --- a/packages/platform-objects/src/apps/translations/en.ts +++ b/packages/platform-objects/src/apps/translations/en.ts @@ -15,8 +15,8 @@ import { enObjects } from './en.objects.generated.js'; * - `apps.setup.label` / `description` * - `apps.setup.navigation..label` for every group AND leaf * - `dashboards.system_overview.*` - * - `datasets..{measures,dimensions}..label` for the System - * Overview's datasets + * - `datasets..{measures,dimensions}..{label,description}` for + * the System Overview's datasets * * Object-level labels (Users, Roles, Audit Logs, …) are owned by the * sys_* object schemas themselves and translated separately. @@ -271,17 +271,62 @@ export const en: TranslationData = { // The copy the System Overview draws from its DATASETS rather than from the // board: the caption under each metric tile is the selected measure's label, // and a table or chart over a dimension is headed by the dimension's label. - // Mirrors `dashboards/system.datasets.ts` verbatim; keyed - // `datasets..{measures,dimensions}..label`, and served on the - // analytics query, which localizes the saved definition before it runs. + // Each member's `description` (ADR-0149 D1) is the business definition the + // dataset AI tools list beside it. Mirrors `dashboards/system.datasets.ts` + // verbatim; keyed `datasets..{measures,dimensions}..{label,description}`, + // and served wherever the saved definition is localized before it is read. + // The members' `synonyms` have no key here: they are match input in every + // language at once, never translated (ADR-0149 D1). datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Users' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Organizations' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Sessions' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Installations' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Users', + description: 'The number of user accounts on record, active or not.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Organizations', + description: 'The number of organizations on record; each one keeps its own members, data and settings.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Sessions', + description: 'The number of sign-in sessions on record, one per sign-in from a browser or device.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Installations', + description: 'The number of package installations on record, one per package installed.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Action' }, user_id: { label: 'User' } }, - measures: { event_count: { label: 'Events' } }, + dimensions: { + action: { + label: 'Action', + description: 'The kind of action an audit log entry records, such as create, update, delete, login or a configuration change.', + }, + user_id: { + label: 'User', + description: 'The user who performed the audited action; entries the platform writes itself are grouped under System.', + }, + }, + measures: { + event_count: { + label: 'Events', + description: 'The number of audit log entries; each records one action taken in the system, by a user or by the platform itself.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/es-ES.ts b/packages/platform-objects/src/apps/translations/es-ES.ts index 341a49107d4..06ce9bb3fd2 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.ts @@ -176,13 +176,55 @@ export const esES: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Usuarios' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Organizaciones' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Sesiones' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Instalaciones' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Usuarios', + description: 'Número de cuentas de usuario registradas, activas o no.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Organizaciones', + description: 'Número de organizaciones registradas; cada una tiene sus propios miembros, datos y configuración.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Sesiones', + description: 'Número de sesiones registradas, una por cada inicio de sesión desde un navegador o dispositivo.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Instalaciones', + description: 'Número de instalaciones de paquetes registradas, una por cada paquete instalado.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Acción' }, user_id: { label: 'Usuario' } }, - measures: { event_count: { label: 'Eventos' } }, + dimensions: { + action: { + label: 'Acción', + description: 'Tipo de acción que registra una entrada del registro de auditoría, como crear, actualizar, eliminar, iniciar sesión o cambiar la configuración.', + }, + user_id: { + label: 'Usuario', + description: 'Usuario que realizó la acción auditada; las entradas que escribe la propia plataforma se agrupan en «Sistema».', + }, + }, + measures: { + event_count: { + label: 'Eventos', + description: 'Número de entradas del registro de auditoría; cada una registra una acción realizada en el sistema por un usuario o por la propia plataforma.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/fr.ts b/packages/platform-objects/src/apps/translations/fr.ts index 8281ac9297f..8c2e03ce40b 100644 --- a/packages/platform-objects/src/apps/translations/fr.ts +++ b/packages/platform-objects/src/apps/translations/fr.ts @@ -190,13 +190,55 @@ export const fr: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Nombre d’utilisateurs' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Nombre d’organisations' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Nombre de sessions' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Nombre d’installations' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Nombre d’utilisateurs', + description: 'Nombre de comptes utilisateur enregistrés, actifs ou non.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Nombre d’organisations', + description: 'Nombre d’organisations enregistrées ; chacune possède ses propres membres, données et paramètres.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Nombre de sessions', + description: 'Nombre de sessions de connexion enregistrées, une par connexion depuis un navigateur ou un appareil.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Nombre d’installations', + description: 'Nombre d’installations de paquets enregistrées, une par paquet installé.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Type d’action' }, user_id: { label: 'Utilisateur' } }, - measures: { event_count: { label: 'Nombre d’événements' } }, + dimensions: { + action: { + label: 'Type d’action', + description: 'Type d’action enregistré par une entrée du journal d’audit, par exemple une création, une modification, une suppression, une connexion ou un changement de configuration.', + }, + user_id: { + label: 'Utilisateur', + description: 'Utilisateur qui a effectué l’action auditée ; les entrées écrites par la plateforme elle-même sont regroupées sous « Système ».', + }, + }, + measures: { + event_count: { + label: 'Nombre d’événements', + description: 'Nombre d’entrées du journal d’audit ; chacune enregistre une action effectuée dans le système, par un utilisateur ou par la plateforme elle-même.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/ja-JP.ts b/packages/platform-objects/src/apps/translations/ja-JP.ts index 4989859a123..f7781cf22dc 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.ts @@ -176,13 +176,55 @@ export const jaJP: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'ユーザー' } } }, - sys_organization_metrics: { measures: { org_count: { label: '組織' } } }, - sys_session_metrics: { measures: { session_count: { label: 'セッション' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'インストール' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'ユーザー', + description: '登録されているユーザーアカウントの数(有効・無効を問いません)。', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: '組織', + description: '登録されている組織の数。各組織はそれぞれ独自のメンバー、データ、設定を持ちます。', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'セッション', + description: '記録されているサインインセッションの数。ブラウザーやデバイスからのサインインごとに 1 つ作成されます。', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'インストール', + description: '記録されているパッケージのインストール数。インストールされたパッケージごとに 1 件です。', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'アクション' }, user_id: { label: 'ユーザー' } }, - measures: { event_count: { label: 'イベント' } }, + dimensions: { + action: { + label: 'アクション', + description: '監査ログのエントリが記録する操作の種類(作成、更新、削除、ログイン、設定変更など)。', + }, + user_id: { + label: 'ユーザー', + description: '監査対象の操作を行ったユーザー。プラットフォーム自身が書き込んだエントリは「システム」にまとめられます。', + }, + }, + measures: { + event_count: { + label: 'イベント', + description: '監査ログのエントリ数。各エントリは、ユーザーまたはプラットフォーム自身がシステムで行った 1 回の操作を記録します。', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/ko.ts b/packages/platform-objects/src/apps/translations/ko.ts index 1c510c4db45..41034ec5b0b 100644 --- a/packages/platform-objects/src/apps/translations/ko.ts +++ b/packages/platform-objects/src/apps/translations/ko.ts @@ -189,13 +189,55 @@ export const ko: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: '사용자' } } }, - sys_organization_metrics: { measures: { org_count: { label: '조직' } } }, - sys_session_metrics: { measures: { session_count: { label: '세션' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: '설치' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: '사용자', + description: '등록된 사용자 계정 수(활성 여부와 관계없음).', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: '조직', + description: '등록된 조직 수. 각 조직은 고유한 구성원, 데이터, 설정을 가집니다.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: '세션', + description: '기록된 로그인 세션 수. 브라우저나 기기에서 로그인할 때마다 하나씩 생깁니다.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: '설치', + description: '기록된 패키지 설치 수. 설치된 패키지마다 1건입니다.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: '작업' }, user_id: { label: '사용자' } }, - measures: { event_count: { label: '이벤트' } }, + dimensions: { + action: { + label: '작업', + description: '감사 로그 항목이 기록하는 작업 유형(예: 생성, 업데이트, 삭제, 로그인, 구성 변경).', + }, + user_id: { + label: '사용자', + description: '감사 대상 작업을 수행한 사용자. 플랫폼이 직접 기록한 항목은 "시스템"으로 묶입니다.', + }, + }, + measures: { + event_count: { + label: '이벤트', + description: '감사 로그 항목 수. 각 항목은 사용자나 플랫폼 자체가 시스템에서 수행한 작업 하나를 기록합니다.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/pt-BR.ts b/packages/platform-objects/src/apps/translations/pt-BR.ts index f59a880f56c..2c4ac426a18 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.ts @@ -190,13 +190,55 @@ export const ptBR: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Número de usuários' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Número de organizações' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Número de sessões' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Número de instalações' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Número de usuários', + description: 'Número de contas de usuário registradas, ativas ou não.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Número de organizações', + description: 'Número de organizações registradas; cada uma tem seus próprios membros, dados e configurações.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Número de sessões', + description: 'Número de sessões de login registradas, uma por login feito em um navegador ou dispositivo.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Número de instalações', + description: 'Número de instalações de pacotes registradas, uma por pacote instalado.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Tipo de ação' }, user_id: { label: 'Usuário' } }, - measures: { event_count: { label: 'Número de eventos' } }, + dimensions: { + action: { + label: 'Tipo de ação', + description: 'Tipo de ação registrada por uma entrada do log de auditoria, como criar, atualizar, excluir, fazer login ou alterar a configuração.', + }, + user_id: { + label: 'Usuário', + description: 'Usuário que realizou a ação auditada; as entradas gravadas pela própria plataforma são agrupadas em "Sistema".', + }, + }, + measures: { + event_count: { + label: 'Número de eventos', + description: 'Número de entradas do log de auditoria; cada uma registra uma ação realizada no sistema por um usuário ou pela própria plataforma.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/ru.ts b/packages/platform-objects/src/apps/translations/ru.ts index b4f43977ada..f88692fca87 100644 --- a/packages/platform-objects/src/apps/translations/ru.ts +++ b/packages/platform-objects/src/apps/translations/ru.ts @@ -190,13 +190,55 @@ export const ru: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: 'Число пользователей' } } }, - sys_organization_metrics: { measures: { org_count: { label: 'Число организаций' } } }, - sys_session_metrics: { measures: { session_count: { label: 'Число сеансов' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: 'Число установок' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: 'Число пользователей', + description: 'Число учётных записей пользователей, как активных, так и неактивных.', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: 'Число организаций', + description: 'Число организаций; у каждой свои участники, данные и настройки.', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: 'Число сеансов', + description: 'Число сеансов входа: по одному на каждый вход из браузера или с устройства.', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: 'Число установок', + description: 'Число установок пакетов: по одной на каждый установленный пакет.', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: 'Тип действия' }, user_id: { label: 'Пользователь' } }, - measures: { event_count: { label: 'Число событий' } }, + dimensions: { + action: { + label: 'Тип действия', + description: 'Тип действия, которое фиксирует запись журнала аудита: создание, изменение, удаление, вход или изменение конфигурации.', + }, + user_id: { + label: 'Пользователь', + description: 'Пользователь, выполнивший действие; записи, которые платформа создаёт сама, объединены под «Система».', + }, + }, + measures: { + event_count: { + label: 'Число событий', + description: 'Число записей журнала аудита; каждая фиксирует одно действие в системе, выполненное пользователем или самой платформой.', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/zh-CN.ts b/packages/platform-objects/src/apps/translations/zh-CN.ts index bd94da4faa9..1b5d86e5fee 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.ts @@ -183,13 +183,55 @@ export const zhCN: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: '用户' } } }, - sys_organization_metrics: { measures: { org_count: { label: '组织' } } }, - sys_session_metrics: { measures: { session_count: { label: '会话' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: '安装' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: '用户', + description: '系统中记录的用户账号数,无论是否处于启用状态。', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: '组织', + description: '系统中记录的组织数;每个组织拥有各自的成员、数据和设置。', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: '会话', + description: '系统中记录的登录会话数,每次从浏览器或设备登录产生一个会话。', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: '安装', + description: '系统中记录的包安装数,每安装一个包记一次。', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: '操作' }, user_id: { label: '用户' } }, - measures: { event_count: { label: '事件' } }, + dimensions: { + action: { + label: '操作', + description: '审计日志条目所记录的操作类型,例如创建、更新、删除、登录或配置变更。', + }, + user_id: { + label: '用户', + description: '执行该审计操作的用户;平台自身写入的条目归入“系统”。', + }, + }, + measures: { + event_count: { + label: '事件', + description: '审计日志条目数;每个条目记录系统中的一次操作,由用户或平台自身执行。', + }, + }, }, }, diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.ts b/packages/platform-objects/src/apps/translations/zh-Hant.ts index 387e1ebc926..77120dda943 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.ts @@ -188,13 +188,55 @@ export const zhHant: TranslationData = { }, datasets: { - sys_user_metrics: { measures: { user_count: { label: '使用者' } } }, - sys_organization_metrics: { measures: { org_count: { label: '組織' } } }, - sys_session_metrics: { measures: { session_count: { label: '工作階段' } } }, - sys_package_installation_metrics: { measures: { package_count: { label: '安裝' } } }, + sys_user_metrics: { + measures: { + user_count: { + label: '使用者', + description: '系統中記錄的使用者帳號數,無論是否處於啟用狀態。', + }, + }, + }, + sys_organization_metrics: { + measures: { + org_count: { + label: '組織', + description: '系統中記錄的組織數;每個組織擁有各自的成員、資料和設定。', + }, + }, + }, + sys_session_metrics: { + measures: { + session_count: { + label: '工作階段', + description: '系統中記錄的登入工作階段數,每次從瀏覽器或裝置登入產生一個工作階段。', + }, + }, + }, + sys_package_installation_metrics: { + measures: { + package_count: { + label: '安裝', + description: '系統中記錄的套件安裝數,每安裝一個套件記一次。', + }, + }, + }, sys_audit_log_metrics: { - dimensions: { action: { label: '操作' }, user_id: { label: '使用者' } }, - measures: { event_count: { label: '事件' } }, + dimensions: { + action: { + label: '操作', + description: '稽核記錄項目所記錄的操作類型,例如建立、更新、刪除、登入或設定變更。', + }, + user_id: { + label: '使用者', + description: '執行該稽核操作的使用者;平台自身寫入的項目歸入「系統」。', + }, + }, + measures: { + event_count: { + label: '事件', + description: '稽核記錄項目數;每個項目記錄系統中的一次操作,由使用者或平台自身執行。', + }, + }, }, }, From 71ab45b8401107d3ac857a559e4f6a1ccde28bc6 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 21:35:19 +0000 Subject: [PATCH 2/4] test(platform-objects): System Overview members carry vocabulary; record description source digests Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz --- ...stem-overview-dataset-translations.test.ts | 82 ++++++++++++++++++- .../src/apps/dashboards/system.datasets.ts | 12 +-- .../src/apps/translations/ar.source-hashes.ts | 7 ++ .../src/apps/translations/de.source-hashes.ts | 7 ++ .../apps/translations/es-ES.source-hashes.ts | 7 ++ .../src/apps/translations/fr.source-hashes.ts | 7 ++ .../apps/translations/ja-JP.source-hashes.ts | 7 ++ .../src/apps/translations/ko.source-hashes.ts | 7 ++ .../apps/translations/pt-BR.source-hashes.ts | 7 ++ .../src/apps/translations/ru.source-hashes.ts | 7 ++ .../apps/translations/zh-CN.source-hashes.ts | 7 ++ .../translations/zh-Hant.source-hashes.ts | 7 ++ 12 files changed, 158 insertions(+), 6 deletions(-) diff --git a/packages/platform-objects/src/apps/dashboards/system-overview-dataset-translations.test.ts b/packages/platform-objects/src/apps/dashboards/system-overview-dataset-translations.test.ts index c680f7cda71..e17627608cd 100644 --- a/packages/platform-objects/src/apps/dashboards/system-overview-dataset-translations.test.ts +++ b/packages/platform-objects/src/apps/dashboards/system-overview-dataset-translations.test.ts @@ -16,12 +16,13 @@ import { describe, it, expect } from 'vitest'; import { translateDataset } from '@objectstack/spec/system'; +import { DatasetSchema, normalizeDatasetTerm } from '@objectstack/spec/ui'; import { SystemOverviewDashboard } from './system_overview.dashboard.js'; import { SystemOverviewDatasets } from './system.datasets.js'; import { SetupAppTranslations } from '../translations/index.js'; import { en } from '../translations/en.js'; -type Member = { name: string; label?: unknown }; +type Member = { name: string; label?: unknown; description?: unknown; synonyms?: readonly string[] }; type Group = 'measures' | 'dimensions'; const datasetsByName = new Map(SystemOverviewDatasets.map((d) => [d.name, d])); @@ -107,3 +108,82 @@ describe('System Overview: every dataset label the board draws is translated', ( }); } }); + +// ADR-0149 D1: each of the seven members carries the words an administrator +// asks for it in (`synonyms`, every language in one authored array, never +// bundled) and a one-sentence business definition (`description`, display +// copy, translated beside the label). What `list_datasets` then answers for +// those words is pinned where these datasets meet the dataset tools: +// `packages/rest/src/system-overview-dataset-vocabulary.test.ts`. +describe('System Overview: every dataset member carries its business vocabulary', () => { + const members = SystemOverviewDatasets.flatMap((d) => + (['dimensions', 'measures'] as const).flatMap((group) => + ((d[group] ?? []) as Member[]).map((m) => ({ dataset: d.name, group, member: m })))); + + it('the seven members each declare synonyms in Chinese and English, and a description', () => { + expect(members.map(({ dataset, group, member }) => `${dataset}.${group}.${member.name}`)).toHaveLength(7); + for (const { dataset, group, member } of members) { + const at = `${dataset}.${group}.${member.name}`; + expect(member.description, at).toBeTypeOf('string'); + const synonyms = member.synonyms ?? []; + expect(synonyms.some((s) => /\p{Script=Han}/u.test(s)), `${at}: a Chinese synonym`).toBe(true); + expect(synonyms.some((s) => /^[a-z ]+$/.test(s)), `${at}: an English synonym`).toBe(true); + } + }); + + it('each dataset survives a full parse, vocabulary rules included', () => { + for (const dataset of SystemOverviewDatasets) { + const parsed = DatasetSchema.safeParse(dataset); + expect(parsed.success, `${dataset.name}: ${parsed.success ? '' : parsed.error.message}`).toBe(true); + } + }); + + it('no synonym is a word of another measure in any of the five datasets, in any locale', () => { + // Two measures answering to one word make the tools ask which one is meant. + // The schema judges collisions within one dataset; this holds the five + // together, against the label each locale serves. + const collisions: string[] = []; + for (const locale of Object.keys(SetupAppTranslations)) { + const served = SystemOverviewDatasets.map((d) => translateDataset(d, SetupAppTranslations, { locale })); + const measureWords = served.flatMap((d) => ((d.measures ?? []) as Member[]).map((m) => ({ + owner: `${d.name}.measures.${m.name}`, + words: [m.name, ...(typeof m.label === 'string' ? [m.label] : []), ...(m.synonyms ?? [])].map(normalizeDatasetTerm), + }))); + for (const { dataset, group, member } of members) { + const owner = `${dataset}.${group}.${member.name}`; + for (const synonym of member.synonyms ?? []) { + for (const other of measureWords) { + if (other.owner !== owner && other.words.includes(normalizeDatasetTerm(synonym))) { + collisions.push(`${locale}: "${synonym}" of ${owner} is a word of ${other.owner}`); + } + } + } + } + } + expect(collisions).toEqual([]); + }); + + it('en: the bundle copies each member description from the declared source verbatim', () => { + const drift: string[] = []; + for (const { dataset, group, member } of members) { + const served = (en.datasets?.[dataset]?.[group] as Record | undefined)?.[member.name]?.description; + if (served !== member.description) { + drift.push(`datasets.${dataset}.${group}.${member.name}.description: ${JSON.stringify(served)} ≠ ${JSON.stringify(member.description)}`); + } + } + expect(drift).toEqual([]); + }); + + for (const locale of TRANSLATED_LOCALES) { + it(`${locale}: no member description resolves to the English source`, () => { + const english: string[] = []; + for (const { dataset, group, member } of members) { + const doc = datasetsByName.get(dataset)!; + const served = translateDataset(doc, SetupAppTranslations, { locale }); + const description = ((served[group] ?? []) as Member[]).find((m) => m.name === member.name)?.description; + if (description === member.description) english.push(`datasets.${dataset}.${group}.${member.name}.description`); + } + expect(english, `untranslated dataset member descriptions under ${locale}`).toEqual([]); + }); + } +}); diff --git a/packages/platform-objects/src/apps/dashboards/system.datasets.ts b/packages/platform-objects/src/apps/dashboards/system.datasets.ts index b95092f6de1..b3d478488ce 100644 --- a/packages/platform-objects/src/apps/dashboards/system.datasets.ts +++ b/packages/platform-objects/src/apps/dashboards/system.datasets.ts @@ -21,11 +21,13 @@ import { defineDataset } from '@objectstack/spec/ui'; * * The dataset tools match a term by EQUALITY after `normalizeDatasetTerm`, so * a phrase an administrator asks in ("how many users", 「有多少用户」) answers - * only where it is written as one synonym. Each word below names one member - * across all five datasets: a word on two measures makes the tools ask which - * one is meant. The other language's label is listed too (`users` beside - * 「用户」), because the label a caller is matched against is the one served in - * the caller's locale. + * only where it is written as one synonym. No synonym below is a word of + * another measure in any of the five datasets, in any locale: a word on two + * measures makes the tools ask which one is meant. The other language's label + * is listed too (`users` beside 「用户」), because the label a caller is matched + * against is the one served in the caller's locale. 「用户」 is also the zh-CN + * label of the audit log's `user_id` dimension; a dimension match alone picks + * no number, so the word still answers with `user_count`. */ export const SysUserDataset = defineDataset({ diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts index f73111efd90..82cd4568128 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts @@ -183,12 +183,19 @@ export const arSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.ts index 51e25aaf514..d97bf05b27c 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.ts @@ -184,12 +184,19 @@ export const deSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts index dcae7f03bb9..ddfb0ce59c0 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts @@ -175,12 +175,19 @@ export const esESSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.title': '5fb9db734193fe37', 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts index b28c5a1ea6e..403b1e18c7f 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts @@ -184,12 +184,19 @@ export const frSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts index 23142a1d9a8..870128eeb2f 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts @@ -175,12 +175,19 @@ export const jaJPSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.title': '5fb9db734193fe37', 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts index 44d60b1bebf..0335d260f55 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts @@ -184,12 +184,19 @@ export const koSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts index 1f0fc650704..af1dbce1326 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts @@ -184,12 +184,19 @@ export const ptBRSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts index bca0e15ba04..2de43b38e58 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts @@ -184,12 +184,19 @@ export const ruSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts index a559ec3016b..2b64981e942 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts @@ -175,12 +175,19 @@ export const zhCNSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.title': '5fb9db734193fe37', 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts index b878361777d..b04272fa2dc 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts @@ -183,12 +183,19 @@ export const zhHantSourceHashes: Readonly> = { 'dashboards.system_overview.widgets.widget_recent_events.description': '5b9ce7479f6c178c', 'dashboards.system_overview.globalFilters.created_at.label': 'dcba3619736cb533', 'datasets.sys_user_metrics.measures.user_count.label': 'eee81f7307a66c40', + 'datasets.sys_user_metrics.measures.user_count.description': '51488331523a478a', 'datasets.sys_organization_metrics.measures.org_count.label': '07488357631b973d', + 'datasets.sys_organization_metrics.measures.org_count.description': 'bccb13ceedcde9a6', 'datasets.sys_session_metrics.measures.session_count.label': '673bde6e0c8a3ef9', + 'datasets.sys_session_metrics.measures.session_count.description': '2f16ee1a53845763', 'datasets.sys_package_installation_metrics.measures.package_count.label': 'bd7a67c9d5b3ac44', + 'datasets.sys_package_installation_metrics.measures.package_count.description': 'a7df1b2983457515', 'datasets.sys_audit_log_metrics.dimensions.action.label': 'a36bba313a7aa9ab', + 'datasets.sys_audit_log_metrics.dimensions.action.description': '427e65dc65d1ec06', 'datasets.sys_audit_log_metrics.dimensions.user_id.label': '6c0d22a931e235bd', + 'datasets.sys_audit_log_metrics.dimensions.user_id.description': '6e107d34eb914730', 'datasets.sys_audit_log_metrics.measures.event_count.label': '41e7c95aaa871569', + 'datasets.sys_audit_log_metrics.measures.event_count.description': '9d8081ef53838a60', 'pages.cloud_connection_settings.label': '3a7caad0cb98e71d', 'pages.cloud_connection_settings.subtitle': 'f5cdd253e8ffef9f', 'pages.connect_agent.label': 'a4542422fb5e8a68', From c8aa1e009d71563e2d1f581ed9f2c93182f174c3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 21:36:22 +0000 Subject: [PATCH 3/4] test(rest): list_datasets resolves the System Overview words as declared Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz --- ...system-overview-dataset-vocabulary.test.ts | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 packages/rest/src/system-overview-dataset-vocabulary.test.ts diff --git a/packages/rest/src/system-overview-dataset-vocabulary.test.ts b/packages/rest/src/system-overview-dataset-vocabulary.test.ts new file mode 100644 index 00000000000..9c9d322e5f2 --- /dev/null +++ b/packages/rest/src/system-overview-dataset-vocabulary.test.ts @@ -0,0 +1,120 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [ADR-0149 D1/D3] The platform's own System Overview datasets answer an + * administrator's words through `list_datasets`. + * + * The five datasets (`@objectstack/platform-objects/apps`) reach the dataset + * AI tools only through plugin-auth's runtime manifest, where the vocabulary + * advisory never reads them. This file feeds the REAL datasets, localized by + * the REAL Setup bundle through `translateDataset` (the resolver the metadata + * boundary applies to a `dataset` list read), to the REAL `list_datasets` + * executor of a service booted by `AnalyticsServicePlugin`. The objects behind + * the datasets are declaration doubles carrying the columns each dataset reads, + * every one readable: admission is pinned in `@objectstack/service-analytics`, + * and this file asks only what the declared words resolve to. + * + * The matcher compares a term by EQUALITY after `normalizeDatasetTerm`, so a + * multi-word phrase ("how many users") resolves only because a member writes + * that phrase as one synonym; a term no member writes still misses. + */ + +import { describe, it, expect } from 'vitest'; +import { AnalyticsServicePlugin, type AnalyticsService } from '@objectstack/service-analytics'; +import { SetupAppTranslations, SystemOverviewDatasets } from '@objectstack/platform-objects/apps'; +import type { ListDatasetsOutput } from '@objectstack/spec/ai'; +import type { ExecutionContext } from '@objectstack/spec/kernel'; +import { translateDataset } from '@objectstack/spec/system'; + +/** The columns each System Overview dataset reads, on its base object. */ +const OBJECTS: Record }> = { + sys_user: { fields: { id: { type: 'text' } } }, + sys_organization: { fields: { id: { type: 'text' } } }, + sys_session: { fields: { id: { type: 'text' } } }, + sys_package_installation: { fields: { id: { type: 'text' } } }, + sys_audit_log: { fields: { id: { type: 'text' }, action: { type: 'text' }, user_id: { type: 'lookup' } } }, +}; + +const security = { + getReadFilter: async () => undefined, + canReadObject: async () => true, + getReadableFields: async (object: string) => Object.keys(OBJECTS[object]?.fields ?? {}), + getQueryableFields: async (object: string) => Object.keys(OBJECTS[object]?.fields ?? {}), +}; + +async function bootAnalytics(): Promise { + const registered: Record = {}; + const engine = { + execute: async () => ({ rows: [] }), + hasObjectMiddleware: () => false, + getObject: (name: string) => OBJECTS[name], + resolveEffectiveDatasource: () => undefined, + }; + const ctx = { + getService: (name: string) => { + if (name === 'security') return security; + if (name === 'data') return engine; + return registered[name]; + }, + registerService: (name: string, svc: unknown) => { registered[name] = svc; }, + replaceService: (name: string, svc: unknown) => { registered[name] = svc; }, + logger: { info() {}, warn() {}, error() {}, debug() {} }, + }; + await new AnalyticsServicePlugin().init(ctx as never); + return registered.analytics as AnalyticsService; +} + +async function listFor(locale: string, terms: string[]): Promise { + const service = await bootAnalytics(); + const tools = service.datasetTools({ + loadDatasets: async () => SystemOverviewDatasets.map((d) => translateDataset(d, SetupAppTranslations, { locale })), + }); + const caller = { userId: 'u_admin', tenantId: 'org_a', locale } as ExecutionContext; + return tools.listDatasets({ terms }, caller); +} + +/** Every match the answer reports, as `dataset.member` per term. */ +function hits(answer: ListDatasetsOutput): Array<{ term: string; at: string; matchedOn: string }> { + return answer.datasets.flatMap((d) => + (d.matches ?? []).map((m) => ({ term: m.term, at: `${d.name}.${m.member}`, matchedOn: m.matchedOn }))); +} + +describe('[ADR-0149 D1/D3] list_datasets over the System Overview datasets', () => { + it('lists all five datasets with every member', async () => { + const answer = await listFor('en', ['用户数']); + expect(answer.partial).toBeUndefined(); + expect(answer.datasets.map((d) => d.name).sort()).toEqual(SystemOverviewDatasets.map((d) => d.name).sort()); + }); + + for (const locale of ['en', 'zh-CN']) { + it(`${locale}: 「用户数」 resolves to user_count alone, by its declared synonym`, async () => { + const answer = await listFor(locale, ['用户数']); + expect(hits(answer)).toEqual([ + { term: '用户数', at: 'sys_user_metrics.measures.user_count', matchedOn: 'synonym' }, + ]); + expect(answer.candidates).toBeUndefined(); + }); + + it(`${locale}: "how many users" resolves to user_count alone, by its declared synonym`, async () => { + const answer = await listFor(locale, ['how many users']); + expect(hits(answer)).toEqual([ + { term: 'how many users', at: 'sys_user_metrics.measures.user_count', matchedOn: 'synonym' }, + ]); + expect(answer.candidates).toBeUndefined(); + }); + + it(`${locale}: a word no member declares still misses`, async () => { + const answer = await listFor(locale, ['营收', 'revenue']); + expect(hits(answer)).toEqual([]); + expect(answer.candidates).toBeUndefined(); + }); + } + + it('zh-CN: the catalogue lists each member\'s description at the caller\'s locale', async () => { + const answer = await listFor('zh-CN', []); + const users = answer.datasets.find((d) => d.name === 'sys_user_metrics')?.measures.find((m) => m.name === 'user_count'); + const bundled = SetupAppTranslations['zh-CN']?.datasets?.sys_user_metrics?.measures?.user_count?.description; + expect(bundled).toBeTypeOf('string'); + expect(users?.description).toBe(bundled); + }); +}); From 82b53be53cc3e0f2818cd8a42ca536509e33b54d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 21:41:10 +0000 Subject: [PATCH 4/4] chore(changeset): platform-objects patch for the System Overview dataset words Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01WGufzi3ezPzTysQPDEjmVz --- .../34921-system-overview-dataset-words.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .changeset/34921-system-overview-dataset-words.md diff --git a/.changeset/34921-system-overview-dataset-words.md b/.changeset/34921-system-overview-dataset-words.md new file mode 100644 index 00000000000..e62e39cb30a --- /dev/null +++ b/.changeset/34921-system-overview-dataset-words.md @@ -0,0 +1,17 @@ +--- +'@objectstack/platform-objects': patch +--- + +feat(platform-objects): the System Overview datasets give their seven members synonyms and a description + +Clause-②: no +Metadata-protocol: none + +The five System Overview datasets (`sys_user_metrics`, `sys_organization_metrics`, `sys_session_metrics`, `sys_package_installation_metrics`, `sys_audit_log_metrics`) had no business words on their seven members. A question asked in an administrator's own words therefore found only a member's name or its label in the caller's locale. Each member now declares ADR-0149 D1 `synonyms`, Chinese and English in one array, and a one-sentence `description`: + +- measures `user_count`, `org_count`, `session_count`, `package_count`, `event_count`; +- dimensions `action` and `user_id` on `sys_audit_log_metrics`. + +Synonyms are match input, so no bundle translates them. Each description has a bundle entry at `datasets..{measures,dimensions}..description` in all eleven Setup bundle locales, and a recorded source digest in each translated locale. + +`list_datasets` compares a term by equality after normalization. So `list_datasets({ terms: ['用户数'] })` and `list_datasets({ terms: ['how many users'] })` now each match `sys_user_metrics.measures.user_count` on a synonym, and nothing else. A word that no member declares still matches nothing. No synonym is a word of another measure in any of the five datasets, in any locale.