diff --git a/.changeset/35280-about-version.md b/.changeset/35280-about-version.md new file mode 100644 index 00000000000..d4fc06b41c0 --- /dev/null +++ b/.changeset/35280-about-version.md @@ -0,0 +1,13 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/i18n': patch +--- + +fix(console): the About dialog names the ObjectStack version first, then the console build + +Clause-②: no +Metadata-protocol: none + +Help → About showed one row, the console build (a git short sha), and nowhere the ObjectStack version. The dialog now opens on an **ObjectStack version** row filled with exactly the `version` the server's discovery document answers (an operator's `OS_RUNTIME_VERSION` stamp where one is set), read through the shell's adapter from the discovery document the console already holds, so opening it sends no new request. **Console build** stays as the second row, so a deployment can still be traced to a commit. While the read is in flight the version row says it is loading; when discovery cannot be read or names no version, it says so in words ("Unknown version (the server did not report one)"), never an empty field. + +New locale keys `help.aboutVersion` and `help.aboutVersionUnknown` in all eleven packs, and `help.aboutDescription` now names both rows. No props or exports change. diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 136d151b9a3..e12ba8d0ac3 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -17,7 +17,7 @@ body: id: version attributes: label: Version - description: The output of `os --version`, or the build shown under About in the Console's help menu. + description: The output of `os --version`, or the ObjectStack version shown under About in the Console's help menu. - type: textarea id: what-happened attributes: diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index d332ec90f3f..192ddec6b1b 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -17,7 +17,7 @@ body: id: version attributes: label: Version - description: The output of `os --version`, or the build shown under About in the Console's help menu. + description: The output of `os --version`, or the ObjectStack version shown under About in the Console's help menu. - type: textarea id: what-happened attributes: diff --git a/ui/packages/app-shell/src/layout/AboutDialog.tsx b/ui/packages/app-shell/src/layout/AboutDialog.tsx index 00555021775..0aabb5984a6 100644 --- a/ui/packages/app-shell/src/layout/AboutDialog.tsx +++ b/ui/packages/app-shell/src/layout/AboutDialog.tsx @@ -1,18 +1,29 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * AboutDialog — the help menu's About entry (objectui#12970). + * AboutDialog — the help menu's About entry (objectui#12970, objectstack#35280). * - * Names the build this console was compiled from, so a reviewer can tell which - * objectui build a deployment serves. The value is the shared build identity - * (`buildIdentity.ts`), the same read Sentry's release falls back to. A console - * built without one says so in words; the field is never left empty. + * Two rows, the version first: * - * The runtime's own build identity is deliberately not shown here: the shell - * has no request that reads it today, and adding one is outside this dialog. + * 1. **ObjectStack version** — the `version` the runtime's discovery document + * answers (`DiscoverySchema`'s System Identity field, resolved server-side + * by `resolveDiscoveryVersion()`; an operator's `OS_RUNTIME_VERSION` stamp + * where one is set). It is read through the shell's adapter + * (`getDiscovery()`), which hands back the document its `connect()` already + * holds from the console's one shared discovery read — no second request. + * The value is shown exactly as discovery answers it, never trimmed. + * 2. **Console build** — the build this console was compiled from: the shared + * build identity (`buildIdentity.ts`), the same read Sentry's release falls + * back to, so a deployment can still be traced to a commit. + * + * Neither field is ever left empty: while the read is in flight the version + * row says it is loading, a discovery that cannot be read or answers no + * version says so in words, and a console built without an identity says so + * too. * @module */ +import { useEffect, useState } from 'react'; import { Dialog, DialogContent, @@ -21,6 +32,7 @@ import { DialogDescription, } from '@object-ui/components'; import { useObjectTranslation } from '@object-ui/i18n'; +import { useAdapter } from '../providers/AdapterProvider.js'; export interface AboutDialogProps { open: boolean; @@ -29,18 +41,71 @@ export interface AboutDialogProps { build: string | null; } +/** The discovery document's `version`, or `null` when it names none. */ +function discoveryVersion(discovery: unknown): string | null { + const version = (discovery as { version?: unknown } | null)?.version; + return typeof version === 'string' && version !== '' ? version : null; +} + +/** + * The runtime's version as discovery answers it, read each time the dialog + * opens: `undefined` before the first answer, `null` when discovery could not + * be read or named no version. A later open keeps the last answer on screen + * while it reads again. + */ +function useRuntimeVersion(open: boolean): string | null | undefined { + const adapter = useAdapter(); + const [version, setVersion] = useState(undefined); + useEffect(() => { + if (!open) return; + if (!adapter) { + setVersion(null); + return; + } + let cancelled = false; + // `getDiscovery()` answers `null` when the adapter cannot connect; it does + // not reject. + void adapter.getDiscovery().then((discovery) => { + if (!cancelled) setVersion(discoveryVersion(discovery)); + }); + return () => { + cancelled = true; + }; + }, [open, adapter]); + return version; +} + export function AboutDialog({ open, onOpenChange, build }: AboutDialogProps) { const { t } = useObjectTranslation(); + const version = useRuntimeVersion(open); return ( {t('help.aboutTitle', { defaultValue: 'About this console' })} - {t('help.aboutDescription', { defaultValue: 'The build this console was compiled from.' })} + {t('help.aboutDescription', { + defaultValue: 'The ObjectStack version this console runs on, and the build it was compiled from.', + })}
+
+ {t('help.aboutVersion', { defaultValue: 'ObjectStack version' })} +
+
+ {version ? ( + {version} + ) : ( + + {version === undefined + ? t('common.loading', { defaultValue: 'Loading…' }) + : t('help.aboutVersionUnknown', { + defaultValue: 'Unknown version (the server did not report one)', + })} + + )} +
{t('help.aboutBuild', { defaultValue: 'Console build' })}
diff --git a/ui/packages/app-shell/src/layout/HelpMenu.tsx b/ui/packages/app-shell/src/layout/HelpMenu.tsx index 26caa8d8b31..d707fd82c31 100644 --- a/ui/packages/app-shell/src/layout/HelpMenu.tsx +++ b/ui/packages/app-shell/src/layout/HelpMenu.tsx @@ -14,7 +14,8 @@ * 3. 「Keyboard shortcuts」 — inside an app, the dialog the `?` key opens * (C2/C3: the `?shortcuts=1` URL param); * 4. 「Online documentation」 — the public docs site; - * 5. 「About」 — the console's own build (objectui#12970). + * 5. 「About」 — the ObjectStack version and the console's own build + * (objectui#12970, objectstack#35280). */ import { useCallback, useState } from 'react'; @@ -149,8 +150,8 @@ export function HelpMenu({ inApp, appPackageId, triggerClassName, triggerTestId {t('help.onlineDocs', { defaultValue: 'Online documentation' })} - {/* About — names the console's own build, on every variant - (objectui#12970). */} + {/* About — names the ObjectStack version and the console's own + build, on every variant (objectui#12970). */} ({ }), })); +/** + * What the adapter's `getDiscovery()` answers; each case sets it. The adapter + * answers `null` when it cannot connect, and never rejects. + */ +let discoveryAnswer: Promise = Promise.resolve(null); + /** Stable identity: the header's readers key their effects on the adapter. */ -const fakeAdapter = { find: () => Promise.resolve({ data: [] }), getClient: () => undefined }; +const fakeAdapter = { + find: () => Promise.resolve({ data: [] }), + getClient: () => undefined, + getDiscovery: () => discoveryAnswer, +}; vi.mock('../../providers/AdapterProvider', () => ({ useAdapter: () => fakeAdapter, @@ -209,6 +222,7 @@ function openAbout() { beforeEach(() => { consoleBuild = null; + discoveryAnswer = Promise.resolve({ version: '18.5.0' }); vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, status: 200, json: async () => ({ data: [] }) }))); }); @@ -257,3 +271,47 @@ describe('AppHeader help menu: About names the console build (objectui#12970)', }, ); }); + +describe('About names the ObjectStack version first, read from discovery (objectstack#35280)', () => { + it.each(['18.5.0', '18.6.0-rc.2+deploy.41'])( + 'discovery answering `%s` fills the first row with exactly that value; the build row follows', + async (version) => { + consoleBuild = '0707b4ae'; + discoveryAnswer = Promise.resolve({ name: 'objectstack', version, services: {} }); + renderHeader('app'); + + const dialog = openAbout(); + const value = within(dialog).getByTestId('about:runtime-version'); + expect(await within(value).findByText(version)).toBeInTheDocument(); + expect(value.textContent).toBe(version); + + const terms = Array.from(dialog.querySelectorAll('dt')).map((dt) => dt.textContent); + expect(terms).toEqual(['«help.aboutVersion»', '«help.aboutBuild»']); + const values = Array.from(dialog.querySelectorAll('dd')).map((dd) => dd.getAttribute('data-testid')); + expect(values).toEqual(['about:runtime-version', 'about:console-build']); + expect(within(dialog).getByTestId('about:console-build')).toHaveTextContent('0707b4ae'); + }, + ); + + it.each<[string, unknown]>([ + ['discovery cannot be read (the adapter answers null)', null], + ['discovery answers no version', { name: 'objectstack', services: {} }], + ['discovery answers an empty version', { version: '' }], + ])('%s: the row says so in words, never an empty field', async (_case, answer) => { + discoveryAnswer = Promise.resolve(answer); + renderHeader('home'); + + const value = within(openAbout()).getByTestId('about:runtime-version'); + expect(await within(value).findByText('«help.aboutVersionUnknown»')).toBeInTheDocument(); + expect(value.textContent?.trim()).not.toBe(''); + }); + + it('while the read is in flight the row says it is loading, never an empty field', () => { + discoveryAnswer = new Promise(() => {}); + renderHeader('app'); + + const value = within(openAbout()).getByTestId('about:runtime-version'); + expect(value).toHaveTextContent('«common.loading»'); + expect(within(value).queryByText('«help.aboutVersionUnknown»')).not.toBeInTheDocument(); + }); +}); diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts index 266d2ced82a..1bf1f780522 100644 --- a/ui/packages/i18n/src/locales/ar.ts +++ b/ui/packages/i18n/src/locales/ar.ts @@ -3716,7 +3716,9 @@ const ar = { diagram: 'مخطط', about: 'حول', aboutTitle: 'حول وحدة التحكم هذه', - aboutDescription: 'الإصدار الذي بُنيت منه وحدة التحكم هذه.', + aboutDescription: 'إصدار ObjectStack الذي تعمل عليه وحدة التحكم هذه، والإصدار الذي بُنيت منه.', + aboutVersion: 'إصدار ObjectStack', + aboutVersionUnknown: 'إصدار غير معروف (لم يُبلغ الخادم عن أي إصدار)', aboutBuild: 'إصدار وحدة التحكم', aboutBuildUnknown: 'إصدار غير معروف (لم يُحدَّد أي إصدار عند بناء وحدة التحكم هذه)', }, diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts index 403ca6ae1bb..8ae41a2be0a 100644 --- a/ui/packages/i18n/src/locales/de.ts +++ b/ui/packages/i18n/src/locales/de.ts @@ -3401,7 +3401,9 @@ const de = { diagram: 'Diagramm', about: 'Über', aboutTitle: 'Über diese Konsole', - aboutDescription: 'Der Build, aus dem diese Konsole kompiliert wurde.', + aboutDescription: 'Die ObjectStack-Version, auf der diese Konsole läuft, und der Build, aus dem sie kompiliert wurde.', + aboutVersion: 'ObjectStack-Version', + aboutVersionUnknown: 'Unbekannte Version (der Server hat keine gemeldet)', aboutBuild: 'Konsolen-Build', aboutBuildUnknown: 'Unbekannter Build (beim Erstellen dieser Konsole wurde keine Version gesetzt)', }, diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts index 9ff4af973f9..c35db893df1 100644 --- a/ui/packages/i18n/src/locales/en.ts +++ b/ui/packages/i18n/src/locales/en.ts @@ -4075,7 +4075,9 @@ const en = { diagram: 'Diagram', about: 'About', aboutTitle: 'About this console', - aboutDescription: 'The build this console was compiled from.', + aboutDescription: 'The ObjectStack version this console runs on, and the build it was compiled from.', + aboutVersion: 'ObjectStack version', + aboutVersionUnknown: 'Unknown version (the server did not report one)', aboutBuild: 'Console build', aboutBuildUnknown: 'Unknown build (no version was set when this console was built)', }, diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts index 96159fc8ce3..9bf0ac0f8b8 100644 --- a/ui/packages/i18n/src/locales/es.ts +++ b/ui/packages/i18n/src/locales/es.ts @@ -3481,7 +3481,9 @@ const es = { diagram: 'Diagrama', about: 'Acerca de', aboutTitle: 'Acerca de esta consola', - aboutDescription: 'La compilación a partir de la cual se generó esta consola.', + aboutDescription: 'La versión de ObjectStack sobre la que se ejecuta esta consola y la compilación a partir de la cual se generó.', + aboutVersion: 'Versión de ObjectStack', + aboutVersionUnknown: 'Versión desconocida (el servidor no informó ninguna)', aboutBuild: 'Compilación de la consola', aboutBuildUnknown: 'Compilación desconocida (no se definió ninguna versión al compilar esta consola)', }, diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts index 2134308f32e..c0ff7e832ac 100644 --- a/ui/packages/i18n/src/locales/fr.ts +++ b/ui/packages/i18n/src/locales/fr.ts @@ -3477,7 +3477,9 @@ const fr = { diagram: 'Diagramme', about: 'À propos', aboutTitle: 'À propos de cette console', - aboutDescription: 'Le build à partir duquel cette console a été compilée.', + aboutDescription: 'La version d’ObjectStack sur laquelle cette console s’exécute, et le build à partir duquel elle a été compilée.', + aboutVersion: 'Version d’ObjectStack', + aboutVersionUnknown: 'Version inconnue (le serveur n’en a signalé aucune)', aboutBuild: 'Build de la console', aboutBuildUnknown: 'Build inconnu (aucune version n’a été définie lors de la compilation de cette console)', }, diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts index 63cd1c97184..0e513abcb8f 100644 --- a/ui/packages/i18n/src/locales/ja.ts +++ b/ui/packages/i18n/src/locales/ja.ts @@ -3403,7 +3403,9 @@ const ja = { diagram: '図', about: 'バージョン情報', aboutTitle: 'このコンソールについて', - aboutDescription: 'このコンソールのコンパイル元となったビルドです。', + aboutDescription: 'このコンソールが動作している ObjectStack のバージョンと、コンパイル元となったビルドです。', + aboutVersion: 'ObjectStack のバージョン', + aboutVersionUnknown: '不明なバージョン(サーバーがバージョンを報告しませんでした)', aboutBuild: 'コンソールのビルド', aboutBuildUnknown: '不明なビルド(このコンソールのビルド時にバージョンが設定されていません)', }, diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts index ff3406710af..a8b801b541b 100644 --- a/ui/packages/i18n/src/locales/ko.ts +++ b/ui/packages/i18n/src/locales/ko.ts @@ -3401,7 +3401,9 @@ const ko = { diagram: '다이어그램', about: '정보', aboutTitle: '이 콘솔 정보', - aboutDescription: '이 콘솔이 컴파일된 빌드입니다.', + aboutDescription: '이 콘솔이 실행 중인 ObjectStack 버전과 이 콘솔이 컴파일된 빌드입니다.', + aboutVersion: 'ObjectStack 버전', + aboutVersionUnknown: '알 수 없는 버전(서버가 버전을 보고하지 않음)', aboutBuild: '콘솔 빌드', aboutBuildUnknown: '알 수 없는 빌드(이 콘솔을 빌드할 때 버전이 설정되지 않음)', }, diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts index 5ac02b304b5..eb10c42e124 100644 --- a/ui/packages/i18n/src/locales/pt-BR.ts +++ b/ui/packages/i18n/src/locales/pt-BR.ts @@ -3476,7 +3476,9 @@ const pt = { diagram: 'Diagrama', about: 'Sobre', aboutTitle: 'Sobre este console', - aboutDescription: 'A build a partir da qual este console foi compilado.', + aboutDescription: 'A versão do ObjectStack em que este console é executado e a build a partir da qual ele foi compilado.', + aboutVersion: 'Versão do ObjectStack', + aboutVersionUnknown: 'Versão desconhecida (o servidor não informou nenhuma)', aboutBuild: 'Build do console', aboutBuildUnknown: 'Build desconhecida (nenhuma versão foi definida ao compilar este console)', }, diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts index d3ea838ac67..c840f1e219e 100644 --- a/ui/packages/i18n/src/locales/ru.ts +++ b/ui/packages/i18n/src/locales/ru.ts @@ -3566,7 +3566,9 @@ const ru = { diagram: 'Схема', about: 'О программе', aboutTitle: 'Об этой консоли', - aboutDescription: 'Сборка, из которой скомпилирована эта консоль.', + aboutDescription: 'Версия ObjectStack, на которой работает эта консоль, и сборка, из которой она скомпилирована.', + aboutVersion: 'Версия ObjectStack', + aboutVersionUnknown: 'Неизвестная версия (сервер её не сообщил)', aboutBuild: 'Сборка консоли', aboutBuildUnknown: 'Неизвестная сборка (при сборке этой консоли версия не была задана)', }, diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts index 9b480b27879..26c0b159474 100644 --- a/ui/packages/i18n/src/locales/zh-Hans.ts +++ b/ui/packages/i18n/src/locales/zh-Hans.ts @@ -3482,7 +3482,9 @@ const zh = { diagram: '图示', about: '关于', aboutTitle: '关于此控制台', - aboutDescription: '此控制台编译所用的构建。', + aboutDescription: '此控制台运行的 ObjectStack 版本,以及它编译所用的构建。', + aboutVersion: 'ObjectStack 版本', + aboutVersionUnknown: '未知版本(服务器未报告版本)', aboutBuild: '控制台构建', aboutBuildUnknown: '未知构建(构建此控制台时未设置版本)', }, diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts index 459582fd35b..eddb30f1ec3 100644 --- a/ui/packages/i18n/src/locales/zh-Hant.ts +++ b/ui/packages/i18n/src/locales/zh-Hant.ts @@ -3482,7 +3482,9 @@ const zhHant = { diagram: '圖示', about: '關於', aboutTitle: '關於此控制台', - aboutDescription: '此控制台編譯所用的構建。', + aboutDescription: '此控制台執行的 ObjectStack 版本,以及它編譯所用的構建。', + aboutVersion: 'ObjectStack 版本', + aboutVersionUnknown: '未知版本(伺服器未報告版本)', aboutBuild: '控制台構建', aboutBuildUnknown: '未知構建(構建此控制台時未設定版本)', },