Skip to content

Commit 58d00db

Browse files
fix(console): About names the ObjectStack version first, then the console build (#36288)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"} --> _Requested by **Leehom** · [project thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X6okWxYPWAsooBsJoAhnT1u)_ Fixes #35280 Clause-②: no Metadata-protocol: none ## 维护者速读 - 控制台用户打开「帮助 → 关于」时,先看到 ObjectStack 版本号(如 18.5.0),再看到原有的控制台构建号;以前只有构建号。 - 属于控制台体验修缮:管理员和支持人员查版本、做升级核对时不必再去调接口。 - 若读取失败,版本一行会用文字说明「未知版本」,不会留空;改动只在对话框内,可直接撤回。 - 无。 ## What changes Help → About now opens on an **ObjectStack version** row, then the existing **Console build** row. - The version is the `version` the discovery document answers, shown verbatim (an operator's `OS_RUNTIME_VERSION` stamp included, per ruling A on #34774). It is read through the shell's adapter (`useAdapter().getDiscovery()`), which returns the document the adapter's `connect()` already holds from the console's one shared discovery read (`getSharedDiscovery`). Opening the dialog sends no new request, and no second version source is added. - While the read is in flight the row shows `common.loading`. When discovery cannot be read (the adapter answers `null`) or names no version, the row says so in words: "Unknown version (the server did not report one)". The field is never empty. - New keys `help.aboutVersion` and `help.aboutVersionUnknown` in all eleven packs (zh-Hant regenerated with `gen:zh-hant`). `help.aboutDescription` now names both rows. - `AboutDialog.tsx`'s module doc no longer says the shell has no request that reads the runtime version. - The bug-report and feature-request templates' Version hint now points at "the ObjectStack version shown under About". - No server, `packages/spec` or discovery-shape change. No props or exports change. Files to read first, by risk: 1. `ui/packages/app-shell/src/layout/AboutDialog.tsx`: the `useRuntimeVersion` hook (the read, the `undefined`/`null`/string states) and the two `dl` rows. 2. `ui/packages/app-shell/src/layout/__tests__/AppHeader.aboutBuild-12970.test.tsx`: the new top-level describe. 3. `ui/packages/i18n/src/locales/en.ts`: the three `help.about*` lines (the other ten packs mirror them). Two-minute check: run `pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/AppHeader.aboutBuild-12970.test.tsx`. You should see 15 tests pass. Or open Help → About in a running console: the first row is "ObjectStack version" with the same value as `GET /api/v1/discovery`, and "Console build" is the second row. ## Tests The new pins are a top-level describe in the existing About harness, `AppHeader.aboutBuild-12970.test.tsx`. They are not in a sibling file because AGENTS.md puts a new pin into a component's existing shared harness (ruling record 6583487846). The new cases check: - Discovery answering `18.5.0`, and a stamped `18.6.0-rc.2+deploy.41`, fills the first row with exactly that text. The `dt` order is version then build, and the build row still shows its sha. - Discovery that cannot be read (`null`), that names no version, or that names an empty version shows `help.aboutVersionUnknown`, never an empty field. - While the read is pending the row shows `common.loading`. <details><summary>Local runs at head 3298438, under the shared verify lock</summary> - The pin file: Test Files 1 passed (1), Tests 15 passed (15). - `pnpm --dir ui exec vitest run packages/i18n/`: Test Files 105 passed (105), Tests 1962 passed, 13 skipped. This covers the key-parity suites. - `pnpm --filter @object-ui/i18n type-check` exit 0. `pnpm --filter @object-ui/app-shell type-check` exit 0 (both `tsc` programs, including `tsconfig.test.json`). </details> <details><summary>Ablation, one mutation per leg, each landed and restored on disk by scripts/ablation-replace.mjs</summary> Each mutation was restored and checked: blob equals HEAD 0aabb59 and `git diff HEAD` is empty. | Mutation | Pin file result | |---|---| | read: `setVersion(discoveryVersion(discovery))` becomes `setVersion(null)` | 2 failed, 13 passed | | fallback: `help.aboutVersionUnknown` becomes `common.loading` | 3 failed, 12 passed | | loading: loading text becomes `null` | 1 failed, 14 passed | | order: build row moved above the version row | 2 failed, 13 passed | </details> ## Acceptance notes - The discovery read reuses the adapter the help menu already holds. Nothing in the shell kept the parsed discovery document in React state: `useDiscovery` in `@object-ui/react` reads `SchemaRendererContext`, which the console header does not sit under. `adapter.getDiscovery()` is the existing holder. - `.github/ISSUE_TEMPLATE/**` is not a governed surface: it has no row in `GOVERNED_SURFACES`, which holds only `.github/workflows/**`. The wording change is in this PR. - No `content/docs/frontend` page or package README names the About dialog, so no docs page changes. - Not measured locally: - `pnpm check:type-check-debt`: exit 3, PREREQUISITE NOT MET. Its closure build never got the verify lock (queue-timeout). - `pnpm --dir ui exec vitest run scripts/`: lock queue-timeout, exit 99. This diff touches no `ui/scripts/` file. - CI's Test UI and the type-check lanes run both of these. ## Verification <details><summary>Local gate subset (derived by dispatch-gates --commands from this diff)</summary> - 46 of the 48 derived commands, plus `pnpm check:changeset-fixed`, exited 0. This includes `check:adr-0087-registration --base origin/main`, `check-empty-changeset`, `check-changeset-no-major`, `check:nul-bytes`, `check:cross-package-test-inputs`, `check:published-files`, `check:type-check-coverage` and `check:undeclared-dep-imports`. - Two commands were not measured, both listed above. - `ui` `check:new-line-citations`: 0 new citations. - `overlap-check`: VERDICT clean (main and #36234 / #36223, which share the locale files, merge cleanly). </details> Session: session_01FEkQ5oK4fFfnLADcipbEeT · dispatched by repo:objectstack#4 area a4-H. --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 99fbaa6 commit 58d00db

17 files changed

Lines changed: 184 additions & 25 deletions

File tree

‎.changeset/35280-about-version.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): the About dialog names the ObjectStack version first, then the console build
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
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.
12+
13+
New locale keys `help.aboutVersion` and `help.aboutVersionUnknown` in all eleven packs, and `help.aboutDescription` now names both rows. No props or exports change.

‎.github/ISSUE_TEMPLATE/bug-report.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body:
1717
id: version
1818
attributes:
1919
label: Version
20-
description: The output of `os --version`, or the build shown under About in the Console's help menu.
20+
description: The output of `os --version`, or the ObjectStack version shown under About in the Console's help menu.
2121
- type: textarea
2222
id: what-happened
2323
attributes:

‎.github/ISSUE_TEMPLATE/feature-request.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ body:
1717
id: version
1818
attributes:
1919
label: Version
20-
description: The output of `os --version`, or the build shown under About in the Console's help menu.
20+
description: The output of `os --version`, or the ObjectStack version shown under About in the Console's help menu.
2121
- type: textarea
2222
id: what-happened
2323
attributes:

‎ui/packages/app-shell/src/layout/AboutDialog.tsx‎

Lines changed: 73 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
22

33
/**
4-
* AboutDialog — the help menu's About entry (objectui#12970).
4+
* AboutDialog — the help menu's About entry (objectui#12970, objectstack#35280).
55
*
6-
* Names the build this console was compiled from, so a reviewer can tell which
7-
* objectui build a deployment serves. The value is the shared build identity
8-
* (`buildIdentity.ts`), the same read Sentry's release falls back to. A console
9-
* built without one says so in words; the field is never left empty.
6+
* Two rows, the version first:
107
*
11-
* The runtime's own build identity is deliberately not shown here: the shell
12-
* has no request that reads it today, and adding one is outside this dialog.
8+
* 1. **ObjectStack version** — the `version` the runtime's discovery document
9+
* answers (`DiscoverySchema`'s System Identity field, resolved server-side
10+
* by `resolveDiscoveryVersion()`; an operator's `OS_RUNTIME_VERSION` stamp
11+
* where one is set). It is read through the shell's adapter
12+
* (`getDiscovery()`), which hands back the document its `connect()` already
13+
* holds from the console's one shared discovery read — no second request.
14+
* The value is shown exactly as discovery answers it, never trimmed.
15+
* 2. **Console build** — the build this console was compiled from: the shared
16+
* build identity (`buildIdentity.ts`), the same read Sentry's release falls
17+
* back to, so a deployment can still be traced to a commit.
18+
*
19+
* Neither field is ever left empty: while the read is in flight the version
20+
* row says it is loading, a discovery that cannot be read or answers no
21+
* version says so in words, and a console built without an identity says so
22+
* too.
1323
* @module
1424
*/
1525

26+
import { useEffect, useState } from 'react';
1627
import {
1728
Dialog,
1829
DialogContent,
@@ -21,6 +32,7 @@ import {
2132
DialogDescription,
2233
} from '@object-ui/components';
2334
import { useObjectTranslation } from '@object-ui/i18n';
35+
import { useAdapter } from '../providers/AdapterProvider.js';
2436

2537
export interface AboutDialogProps {
2638
open: boolean;
@@ -29,18 +41,71 @@ export interface AboutDialogProps {
2941
build: string | null;
3042
}
3143

44+
/** The discovery document's `version`, or `null` when it names none. */
45+
function discoveryVersion(discovery: unknown): string | null {
46+
const version = (discovery as { version?: unknown } | null)?.version;
47+
return typeof version === 'string' && version !== '' ? version : null;
48+
}
49+
50+
/**
51+
* The runtime's version as discovery answers it, read each time the dialog
52+
* opens: `undefined` before the first answer, `null` when discovery could not
53+
* be read or named no version. A later open keeps the last answer on screen
54+
* while it reads again.
55+
*/
56+
function useRuntimeVersion(open: boolean): string | null | undefined {
57+
const adapter = useAdapter();
58+
const [version, setVersion] = useState<string | null | undefined>(undefined);
59+
useEffect(() => {
60+
if (!open) return;
61+
if (!adapter) {
62+
setVersion(null);
63+
return;
64+
}
65+
let cancelled = false;
66+
// `getDiscovery()` answers `null` when the adapter cannot connect; it does
67+
// not reject.
68+
void adapter.getDiscovery().then((discovery) => {
69+
if (!cancelled) setVersion(discoveryVersion(discovery));
70+
});
71+
return () => {
72+
cancelled = true;
73+
};
74+
}, [open, adapter]);
75+
return version;
76+
}
77+
3278
export function AboutDialog({ open, onOpenChange, build }: AboutDialogProps) {
3379
const { t } = useObjectTranslation();
80+
const version = useRuntimeVersion(open);
3481
return (
3582
<Dialog open={open} onOpenChange={onOpenChange}>
3683
<DialogContent className="sm:max-w-md" data-testid="overlay:about">
3784
<DialogHeader>
3885
<DialogTitle>{t('help.aboutTitle', { defaultValue: 'About this console' })}</DialogTitle>
3986
<DialogDescription>
40-
{t('help.aboutDescription', { defaultValue: 'The build this console was compiled from.' })}
87+
{t('help.aboutDescription', {
88+
defaultValue: 'The ObjectStack version this console runs on, and the build it was compiled from.',
89+
})}
4190
</DialogDescription>
4291
</DialogHeader>
4392
<dl className="grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 pt-2 text-sm">
93+
<dt className="text-muted-foreground">
94+
{t('help.aboutVersion', { defaultValue: 'ObjectStack version' })}
95+
</dt>
96+
<dd data-testid="about:runtime-version" className="min-w-0 break-all">
97+
{version ? (
98+
<code className="font-mono">{version}</code>
99+
) : (
100+
<span className="text-muted-foreground">
101+
{version === undefined
102+
? t('common.loading', { defaultValue: 'Loading…' })
103+
: t('help.aboutVersionUnknown', {
104+
defaultValue: 'Unknown version (the server did not report one)',
105+
})}
106+
</span>
107+
)}
108+
</dd>
44109
<dt className="text-muted-foreground">
45110
{t('help.aboutBuild', { defaultValue: 'Console build' })}
46111
</dt>

‎ui/packages/app-shell/src/layout/HelpMenu.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
* 3. 「Keyboard shortcuts」 — inside an app, the dialog the `?` key opens
1515
* (C2/C3: the `?shortcuts=1` URL param);
1616
* 4. 「Online documentation」 — the public docs site;
17-
* 5. 「About」 — the console's own build (objectui#12970).
17+
* 5. 「About」 — the ObjectStack version and the console's own build
18+
* (objectui#12970, objectstack#35280).
1819
*/
1920

2021
import { useCallback, useState } from 'react';
@@ -149,8 +150,8 @@ export function HelpMenu({ inApp, appPackageId, triggerClassName, triggerTestId
149150
{t('help.onlineDocs', { defaultValue: 'Online documentation' })}
150151
</a>
151152
</DropdownMenuItem>
152-
{/* About — names the console's own build, on every variant
153-
(objectui#12970). */}
153+
{/* About — names the ObjectStack version and the console's own
154+
build, on every variant (objectui#12970). */}
154155
<DropdownMenuItem
155156
className="cursor-pointer"
156157
data-testid="action:about:open"

‎ui/packages/app-shell/src/layout/__tests__/AppHeader.aboutBuild-12970.test.tsx‎

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* the tenant console's `app` bar and the control plane's `home` / `orgs` /
66
* `studio` bars are the one component — the help menu carries 「关于」 / About,
77
* and the dialog it opens names the build this console was compiled from.
8+
* Since objectstack#35280 it names the ObjectStack version first: the
9+
* `version` the discovery document answers, read through the adapter's
10+
* `getDiscovery()`, stubbed here through a mutable answer.
811
*
912
* The build identity is `buildIdentity.ts`'s one read, stubbed here through a
1013
* mutable reading: this repo's Vitest setup cannot put a `VITE_*` value on
@@ -151,8 +154,18 @@ vi.mock('../../providers/MetadataProvider', () => ({
151154
}),
152155
}));
153156

157+
/**
158+
* What the adapter's `getDiscovery()` answers; each case sets it. The adapter
159+
* answers `null` when it cannot connect, and never rejects.
160+
*/
161+
let discoveryAnswer: Promise<unknown> = Promise.resolve(null);
162+
154163
/** Stable identity: the header's readers key their effects on the adapter. */
155-
const fakeAdapter = { find: () => Promise.resolve({ data: [] }), getClient: () => undefined };
164+
const fakeAdapter = {
165+
find: () => Promise.resolve({ data: [] }),
166+
getClient: () => undefined,
167+
getDiscovery: () => discoveryAnswer,
168+
};
156169

157170
vi.mock('../../providers/AdapterProvider', () => ({
158171
useAdapter: () => fakeAdapter,
@@ -209,6 +222,7 @@ function openAbout() {
209222

210223
beforeEach(() => {
211224
consoleBuild = null;
225+
discoveryAnswer = Promise.resolve({ version: '18.5.0' });
212226
vi.stubGlobal('fetch', vi.fn(async () => ({ ok: true, status: 200, json: async () => ({ data: [] }) })));
213227
});
214228

@@ -257,3 +271,47 @@ describe('AppHeader help menu: About names the console build (objectui#12970)',
257271
},
258272
);
259273
});
274+
275+
describe('About names the ObjectStack version first, read from discovery (objectstack#35280)', () => {
276+
it.each(['18.5.0', '18.6.0-rc.2+deploy.41'])(
277+
'discovery answering `%s` fills the first row with exactly that value; the build row follows',
278+
async (version) => {
279+
consoleBuild = '0707b4ae';
280+
discoveryAnswer = Promise.resolve({ name: 'objectstack', version, services: {} });
281+
renderHeader('app');
282+
283+
const dialog = openAbout();
284+
const value = within(dialog).getByTestId('about:runtime-version');
285+
expect(await within(value).findByText(version)).toBeInTheDocument();
286+
expect(value.textContent).toBe(version);
287+
288+
const terms = Array.from(dialog.querySelectorAll('dt')).map((dt) => dt.textContent);
289+
expect(terms).toEqual(['«help.aboutVersion»', '«help.aboutBuild»']);
290+
const values = Array.from(dialog.querySelectorAll('dd')).map((dd) => dd.getAttribute('data-testid'));
291+
expect(values).toEqual(['about:runtime-version', 'about:console-build']);
292+
expect(within(dialog).getByTestId('about:console-build')).toHaveTextContent('0707b4ae');
293+
},
294+
);
295+
296+
it.each<[string, unknown]>([
297+
['discovery cannot be read (the adapter answers null)', null],
298+
['discovery answers no version', { name: 'objectstack', services: {} }],
299+
['discovery answers an empty version', { version: '' }],
300+
])('%s: the row says so in words, never an empty field', async (_case, answer) => {
301+
discoveryAnswer = Promise.resolve(answer);
302+
renderHeader('home');
303+
304+
const value = within(openAbout()).getByTestId('about:runtime-version');
305+
expect(await within(value).findByText('«help.aboutVersionUnknown»')).toBeInTheDocument();
306+
expect(value.textContent?.trim()).not.toBe('');
307+
});
308+
309+
it('while the read is in flight the row says it is loading, never an empty field', () => {
310+
discoveryAnswer = new Promise(() => {});
311+
renderHeader('app');
312+
313+
const value = within(openAbout()).getByTestId('about:runtime-version');
314+
expect(value).toHaveTextContent('«common.loading»');
315+
expect(within(value).queryByText('«help.aboutVersionUnknown»')).not.toBeInTheDocument();
316+
});
317+
});

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3723,7 +3723,9 @@ const ar = {
37233723
diagram: 'مخطط',
37243724
about: 'حول',
37253725
aboutTitle: 'حول وحدة التحكم هذه',
3726-
aboutDescription: 'الإصدار الذي بُنيت منه وحدة التحكم هذه.',
3726+
aboutDescription: 'إصدار ObjectStack الذي تعمل عليه وحدة التحكم هذه، والإصدار الذي بُنيت منه.',
3727+
aboutVersion: 'إصدار ObjectStack',
3728+
aboutVersionUnknown: 'إصدار غير معروف (لم يُبلغ الخادم عن أي إصدار)',
37273729
aboutBuild: 'إصدار وحدة التحكم',
37283730
aboutBuildUnknown: 'إصدار غير معروف (لم يُحدَّد أي إصدار عند بناء وحدة التحكم هذه)',
37293731
},

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3408,7 +3408,9 @@ const de = {
34083408
diagram: 'Diagramm',
34093409
about: 'Über',
34103410
aboutTitle: 'Über diese Konsole',
3411-
aboutDescription: 'Der Build, aus dem diese Konsole kompiliert wurde.',
3411+
aboutDescription: 'Die ObjectStack-Version, auf der diese Konsole läuft, und der Build, aus dem sie kompiliert wurde.',
3412+
aboutVersion: 'ObjectStack-Version',
3413+
aboutVersionUnknown: 'Unbekannte Version (der Server hat keine gemeldet)',
34123414
aboutBuild: 'Konsolen-Build',
34133415
aboutBuildUnknown: 'Unbekannter Build (beim Erstellen dieser Konsole wurde keine Version gesetzt)',
34143416
},

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4082,7 +4082,9 @@ const en = {
40824082
diagram: 'Diagram',
40834083
about: 'About',
40844084
aboutTitle: 'About this console',
4085-
aboutDescription: 'The build this console was compiled from.',
4085+
aboutDescription: 'The ObjectStack version this console runs on, and the build it was compiled from.',
4086+
aboutVersion: 'ObjectStack version',
4087+
aboutVersionUnknown: 'Unknown version (the server did not report one)',
40864088
aboutBuild: 'Console build',
40874089
aboutBuildUnknown: 'Unknown build (no version was set when this console was built)',
40884090
},

‎ui/packages/i18n/src/locales/es.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3488,7 +3488,9 @@ const es = {
34883488
diagram: 'Diagrama',
34893489
about: 'Acerca de',
34903490
aboutTitle: 'Acerca de esta consola',
3491-
aboutDescription: 'La compilación a partir de la cual se generó esta consola.',
3491+
aboutDescription: 'La versión de ObjectStack sobre la que se ejecuta esta consola y la compilación a partir de la cual se generó.',
3492+
aboutVersion: 'Versión de ObjectStack',
3493+
aboutVersionUnknown: 'Versión desconocida (el servidor no informó ninguna)',
34923494
aboutBuild: 'Compilación de la consola',
34933495
aboutBuildUnknown: 'Compilación desconocida (no se definió ninguna versión al compilar esta consola)',
34943496
},

0 commit comments

Comments
 (0)