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' ;
1627import {
1728 Dialog ,
1829 DialogContent ,
@@ -21,6 +32,7 @@ import {
2132 DialogDescription ,
2233} from '@object-ui/components' ;
2334import { useObjectTranslation } from '@object-ui/i18n' ;
35+ import { useAdapter } from '../providers/AdapterProvider.js' ;
2436
2537export 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+
3278export 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 >
0 commit comments