Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

Commit 45d5853

Browse files
feat(app-shell,types,i18n,cli): cloud:workspace-timezone-notice names the seeded workspace timezone on the welcome page (objectui#11930) (#11960)
Fixes #11930 Clause-②: yes The objectui half of objectstack-ai/cloud#2676 step 3. A registered SDUI widget, `cloud:workspace-timezone-notice`, prints one line on the Cloud welcome page naming the timezone a workspace was seeded with at creation. It reads the additive `workspaceTimezoneSeed` from the org-scoped `GET /api/v1/cloud/environment-entitlements` summary, the one `cloud:plan-status` and the environment list already read. It renders nothing when that field is absent. **File surface.** The claim (`6057491447`) was amended by the seat in `6058827980` (option A), after the dev's stop report `6058785780`. The amendment adds `packages/app-shell/package.json` (`sideEffects` only), `packages/app-shell/src/environment/entitlements.ts`, the `@object-ui/types` arm files and their tests, and one row of the CLI ratchet. It also adds `@object-ui/types` (minor) to the `Clause-②` widening. Precedent: `24d3e656` (objectui#10990, `cloud:plan-status`) touched the same file set. ## Every widening, checkable from this body Spelling note: the platform sanitizer eats angle-bracket fragments, so generics are written in words below ("`Record` of `string` to `never`"). ### 1. Language-pack key — `@object-ui/i18n` (minor) One new key, `cloudWorkspaceTimezoneNotice.seeded`, in all ten packs (`ar de en es fr ja ko pt ru zh`). Each pack has one interpolation, the i18next placeholder named `zone`, which is written as ZONE below. No other key was added, changed or removed. | pack | value (ZONE = the placeholder `zone`) | | --- | --- | | en | The workspace timezone was set to ZONE from your browser when the workspace was created. You can change it in Settings → Localization. | | zh | 工作区时区在创建时已按你的浏览器设为 ZONE,可在「设置 → 本地化」中修改。 (the cloud seat's suggested copy, plus a full stop) | | ja | ワークスペースのタイムゾーンは、作成時にブラウザーに合わせて ZONE に設定されました。「設定 → ローカリゼーション」で変更できます。 | | ko | 워크스페이스 시간대는 생성 시 브라우저에 맞춰 ZONE(으)로 설정되었습니다. 설정 → 현지화에서 변경할 수 있습니다. | | de | Die Zeitzone des Workspace wurde beim Erstellen anhand Ihres Browsers auf ZONE festgelegt. Sie können sie unter Einstellungen → Lokalisierung ändern. | | es | La zona horaria del espacio de trabajo se configuró en ZONE a partir de su navegador al crearlo. Puede cambiarla en Configuración → Localización. | | fr | Le fuseau horaire de l’espace de travail a été défini sur ZONE d’après votre navigateur lors de sa création. Vous pouvez le modifier dans Paramètres → Localisation. | | pt | O fuso horário do workspace foi definido como ZONE com base no seu navegador quando ele foi criado. Você pode alterá-lo em Configurações → Localização. | | ru | Часовой пояс рабочего пространства был задан по вашему браузеру при его создании: ZONE. Его можно изменить в разделе «Настройки → Локализация». | | ar | تم تعيين المنطقة الزمنية لمساحة العمل إلى ZONE وفقًا لمتصفحك عند إنشائها. يمكنك تغييرها من الإعدادات → التوطين. | The zone is printed verbatim: it is an IANA id, and no `Intl` call formats it. Each pack reuses its own existing vocabulary for "workspace timezone", taken from its `workspaceTimezonePrompt` block, and its own word for "Settings". "Settings → Localization" is the Setup nav entry `nav_settings_localization` (objectstack `platform-objects`). ### 2. Newly accepted type — `@object-ui/cli` (minor) and the validator - `KNOWN_SCHEMA_TYPES` (`packages/cli/src/utils/known-schema-types.ts`, GENERATED) gains exactly one row, `'cloud:workspace-timezone-notice'`, so `objectui check` accepts it. It was regenerated with `node scripts/regenerate-known-schema-types.mjs`, and `--check` reports OK. There is no bare `workspace-timezone-notice` row and no `app-shell:`-prefixed twin, because the registration is `{ namespace: 'cloud', skipFallback: true }`, the same as `cloud:plan-status`. - `objectui validate` / `safeValidateSchema`: `AnyComponentSchema` now claims the literal (section 4). The CLI ratchet `registered-types-validate-ratchet-10859` keeps `NAMESPACED_REFUSED_AT_TYPE` at 360 and gains the row "counts `cloud:workspace-timezone-notice` armed — it registered WITH its arm (objectui#11930)". ### 3. New `@object-ui/types` exports (minor), with their shapes - **`@object-ui/types/zod`** (`zod/index.zod.ts` re-exports from `zod/cloud.zod.ts`): `CloudWorkspaceTimezoneNoticeSchema` ```ts BaseSchema.extend({ type: z.literal('cloud:workspace-timezone-notice'), properties: z.strictObject({}).optional(), // the widget reads no prop: the only bag accepted is {} body: retirementTombstone(CLOUD_WORKSPACE_TIMEZONE_NOTICE_NEITHER_CHANNEL), children: retirementTombstone(CLOUD_WORKSPACE_TIMEZONE_NOTICE_NEITHER_CHANNEL), }) ``` The members are the keys the widget reads, and no others. `@objectstack/spec` has no `ComponentPropsMap` row for a `cloud:` widget, so nothing is read by reference. The closed empty bag is the spelling `element:divider` uses for a node with no prop. Both content channels are refused by name, and the refusal text carries the family-D parser-tier clause that `content-channel-parser-tier-clause-10928` pins. - **`@object-ui/types`** (root, re-exported from `cloud.ts`): the TS twin, interface `CloudWorkspaceTimezoneNoticeSchema extends BaseSchema` with members `type: 'cloud:workspace-timezone-notice'`, `properties?` typed `Record` of `string` to `never`, `body?: never` and `children?: never`. Its parity pair `cloud.zod.ts#CloudWorkspaceTimezoneNoticeSchema` is registered in `zod-mirror-parity.test.ts`, where `EXPECTED_MIRROR_PAIRS` goes from 194 to 195. ### 4. Union members - `AnyComponentSchema` (zod) gains one member, `CloudWorkspaceTimezoneNoticeSchema`, after `CloudPlanStatusSchema`. Its accept set widens by exactly that literal. `StrictAnyComponentSchema` is derived from it, so it follows with no edit. `any-component-emit-headroom-11573.test.ts` lists the member as an inline arm, and the declaration-size headroom test stays green. - `AnySchema` (TS) gains one member, `CloudWorkspaceTimezoneNoticeSchema`, after `CloudPlanStatusSchema`. - Nothing that parsed before is refused now. ### 5. The changeset — `.changeset/11930-workspace-timezone-notice.md` Four `minor` entries and nothing else: `@object-ui/app-shell`, `@object-ui/types`, `@object-ui/i18n` and `@object-ui/cli`. There is no `major` (`check-changeset-no-major` OK). ### 6. `@object-ui/app-shell` (minor) - It registers the widget, `CloudWorkspaceTimezoneNotice`, from `console/home/CloudWorkspaceTimezoneNotice.tsx`. The entry `src/index.ts` gains one side-effect import beside the `CloudPlanStatus.js` import. - `sideEffects` (a published contract field) gains `./dist/console/home/CloudWorkspaceTimezoneNotice.js` and `./src/console/home/CloudWorkspaceTimezoneNotice.tsx`. Nothing else in `package.json` moved. `check:side-effects-array` reports that the array "names exactly the 16 module(s) that register at load time". - **Built-entry declarations, measured:** `dist/index.d.ts` keeps the new side-effect import, so the widget's `.d.ts` (`CloudWorkspaceTimezoneNoticeProps` with `className?: string`, and the component function) is in the declaration closure. `exports` has only `.`, so no new name is importable. A walk of the `.d.ts` import graph from `dist/index.d.ts` reaches 175 files and not `environment/entitlements.d.ts`. So the hook's widened result type is package-internal. - `EnvironmentEntitlementsSummary` and `EnvironmentEntitlementsState` (`environment/entitlements.ts`) each gain `workspaceTimezoneSeed?: string`. The hook reads it verbatim, as it reads `upgradeUrl`. The row-derived and unknown fallback states never carry it. ## Behaviour - Seed present: one `p` element, `text-sm text-muted-foreground`, with `data-workspace-timezone-notice="seeded"`. The node's `className` / `responsiveStyles` scope class reaches it. It is text only: no link (cloud#2676 Q2) and no dismissal state. - It renders nothing when the summary has no seed or an empty one, while loading, when the request fails (non-OK), when the request rejects, and when the body is not the `{ success, data }` envelope (cloud#1046). It never throws: the hook swallows the failure and falls back to the rows, which carry no seed. ## Verification All of these ran from the worktree root. Heavy runs went through the shared `os-verify-lock`. - **After merging `main` 70e3d77 (merge commit 113443d, no conflict; `zod-mirror-parity.test.ts` auto-merged):** - the widget pin, the arm pin, `zod-mirror-parity`, `any-component-emit-headroom-11573` and the CLI ratchet: 5 files, 94 tests passed; - `regenerate-known-schema-types --check`: OK; - `check:side-effects-array`: OK; - `type-check` for `@object-ui/types`, `@object-ui/app-shell`, `@object-ui/i18n` and `@object-ui/cli`: all exit 0, after building their dependency closures. - **On 4929b50, before the merge:** - `packages/types/`: 360 files, 9615 tests; - `packages/i18n/`: 82 files, 1316 passed and 13 skipped; - `packages/cli/`: 25 files, 370 tests; - `packages/app-shell/`, NARROWED: 27 files, 209 tests. The full package is 1166 files and belongs to CI. The 27 are `console/home/__tests__/`, `environment/__tests__/` and every test that reads the hook, the summary endpoint, `cloud:`, `sideEffects` or the barrel; - 13 root `scripts/__tests__` files that read the touched files: 811 tests. - **Gates on 4929b50:** these were all green: `check:control-bytes`, `check:test-path-roots`, `check:i18n-keys`, `check:i18n-drift`, `check:i18n-dead-keys`, `check:i18n-designer-parity`, `check:pending-changeset-literals`, `check:changeset-claims` (report-only), `check:readme-exports`, `check:eager-locale-catalogues`, `check:sdui-registration-pins` (`workspace-timezone-notice` is present in 1 chunk) and `check-changeset-presence`. eslint on the 24 touched `.ts/.tsx` files gave 0 errors. The config is not type-aware, and repo-wide lint is CI's. - **Reverse checks** used `ablation-replace` in wrap mode, with a trap and absolute paths. Every subject resolves to `src`, through relative imports and the vitest alias for `@object-ui/types/zod`, so no `dist` is involved. Each mutation was restored to the HEAD blob, and the tool proved the restore. - A, the widget ignores the seed: 5 of the widget file's 12 tests go red, exactly the seed-present pins (EN, ZH, endpoint, one line, SchemaRenderer). The absent, empty, loading, failed, rejected and bare-body controls stay green. - B, the hook drops the field: the same 5 go red. - C, the arm leaves the union: 12 go red, including the ratchet's "`objectui validate` refuses 361 registered namespaced key(s) at `type`; the pin is 360". - **First-load bytes:** this was measured locally before the merge, from console builds of both sides on one box. `eagerGzipBytes` is +195 B (+752 raw): `i18n-locale-en` +63 gz and `src` +153 gz, and every other chunk is raw-identical. That put 4929b50 at 3307.6 KB against the then-ceiling of 3307.0 KB, with base f3a0488 at 3307.4 KB. `main` now carries the rollback (3c888c6) and the 5,120 B allowance (1c51e97). The authoritative reading is this PR's `Bundle Analysis` run, and the report on the card quotes it. ## Acceptance notes - **Localization label.** objectstack `platform-objects` translates the Setup nav label `nav_settings_localization` only for en, zh-CN, es-ES and ja-JP. A de, fr, pt, ko, ru or ar user therefore sees the English "Localization" in the Setup nav, while this notice names the translated word (Lokalisierung, Localisation, Localização, 현지화, Локализация, التوطين). This is an observation, not filed: no public door gives a wrong answer, and nobody has picked it up. - The widget takes `className` only. The dispatch's suggested props were `{ properties, className }`, but the widget reads no prop, and the arm declares the bag empty. - Out of scope, as the card says: the cloud field (cloud#2676 step 2), the welcome-page node (step 4) and the creation half (objectui#11908). --- _Generated by [Claude Code](https://claude.ai/code/session_01CGZy1BGCjdN5cXqL9cnvB8)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent ccddd11 commit 45d5853

27 files changed

Lines changed: 595 additions & 13 deletions
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
'@object-ui/app-shell': minor
3+
'@object-ui/types': minor
4+
'@object-ui/i18n': minor
5+
'@object-ui/cli': minor
6+
---
7+
8+
New SDUI widget `cloud:workspace-timezone-notice`: one line on the Cloud welcome page naming the timezone a workspace was seeded with at creation (objectui#11930, the objectui half of objectstack-ai/cloud#2676).
9+
10+
**Clause-②: yes** — four published surfaces widen, and nothing that parsed or rendered before changes:
11+
12+
- the accept set of `AnyComponentSchema`, and so of `safeValidateSchema` and `objectui validate`, widens by one `type` literal, `cloud:workspace-timezone-notice`. `@object-ui/types/zod` exports one new schema, `CloudWorkspaceTimezoneNoticeSchema`, and `@object-ui/types` exports its TypeScript twin of the same name, a member of `AnySchema`;
13+
- `@object-ui/i18n` adds one key, `cloudWorkspaceTimezoneNotice.seeded`, to all ten locale packs;
14+
- `@object-ui/cli`: `objectui check` knows `cloud:workspace-timezone-notice` as a registered type;
15+
- `@object-ui/app-shell` registers the widget, and its `sideEffects` array names the new module in its source and published spellings.
16+
17+
**Why.** The welcome page is static metadata, and nothing in a page's expression scope carries a per-organization value, so the page could not say which timezone the workspace was created with. The seed is available only from the org-scoped `GET /cloud/environment-entitlements` summary, as the additive `workspaceTimezoneSeed` string.
18+
19+
**What changed, in observable terms.**
20+
21+
- A page places the node with no props: `{ "type": "cloud:workspace-timezone-notice" }`. The widget reads the summary through the hook the environment list and `cloud:plan-status` already use, and when the summary carries `workspaceTimezoneSeed` it renders one muted line naming that zone, verbatim. In English: "The workspace timezone was set to Asia/Shanghai from your browser when the workspace was created. You can change it in Settings → Localization."
22+
- It renders nothing when the summary carries no seed (workspaces created before the seed existed, and control planes that do not send it yet), while the summary loads, when the request fails or rejects, and when the body is not the `{ success, data }` envelope. A failed request does not throw.
23+
- The line is text only: no link and no dismissal state.
24+
- The node's `className` and `responsiveStyles` reach the line.
25+
- The widget is registered under one key, `cloud:workspace-timezone-notice`. There is no bare `workspace-timezone-notice` fallback and no `app-shell:`-prefixed twin.
26+
- `CloudWorkspaceTimezoneNoticeSchema` takes no prop: `properties` is optional and may only be `{}`, so any key in the bag, the zone included, is refused at `properties`. `body` and `children` are refused by name, because the widget reads neither.

‎packages/app-shell/package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"./dist/console/diagnostics/CloudAiModelStatus.js",
1111
"./dist/console/home/CloudOnboardingNext.js",
1212
"./dist/console/home/CloudPlanStatus.js",
13+
"./dist/console/home/CloudWorkspaceTimezoneNotice.js",
1314
"./dist/console/marketplace/InstalledListWidget.js",
1415
"./dist/services/builtinComponents.js",
1516
"./dist/views/global-notifications-renderer.js",
@@ -26,6 +27,7 @@
2627
"./src/console/diagnostics/CloudAiModelStatus.tsx",
2728
"./src/console/home/CloudOnboardingNext.tsx",
2829
"./src/console/home/CloudPlanStatus.tsx",
30+
"./src/console/home/CloudWorkspaceTimezoneNotice.tsx",
2931
"./src/console/marketplace/InstalledListWidget.tsx",
3032
"./src/services/builtinComponents.tsx",
3133
"./src/views/global-notifications-renderer.tsx",
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* CloudWorkspaceTimezoneNotice — one line on the Cloud control plane's welcome
5+
* page naming the timezone a workspace was seeded with at creation, registered
6+
* as the SDUI widget `cloud:workspace-timezone-notice` (objectui#11930, the
7+
* objectui half of objectstack-ai/cloud#2676).
8+
*
9+
* The welcome page is static metadata: nothing in its expression scope carries
10+
* a per-organization value, so a page node cannot print the seeded zone. The
11+
* seed is only available from the org-scoped `GET /cloud/environment-entitlements`
12+
* summary (`data.workspaceTimezoneSeed`, an additive string). This widget reads
13+
* that summary and says one thing about it:
14+
*
15+
* • the summary carries a seed → one muted, localized line naming it;
16+
* • the summary carries no seed → nothing. That covers every workspace
17+
* created before the seed existed and every control plane that does not
18+
* send the field yet;
19+
* • loading, failed, or no summary → nothing. The row-derived fallback of
20+
* `useEnvironmentEntitlements` carries no seed, so a failed summary request
21+
* degrades to the empty render, never to a guess and never to a throw.
22+
*
23+
* The zone is printed VERBATIM — it is an IANA id (`Asia/Shanghai`), not a
24+
* value to localize — and the line is text only: no link (a relative link from
25+
* the control plane would open the control plane's own settings, cloud#2676
26+
* Q2) and no dismissal state.
27+
*
28+
* ## The summary is read through `useEnvironmentEntitlements`
29+
*
30+
* The same hook `cloud:plan-status` and the environment list use: one reading of
31+
* the endpoint and its strict `{ success, data }` envelope, not another copy of
32+
* the fetch.
33+
*/
34+
35+
import { useState } from 'react';
36+
import { cn } from '@object-ui/components';
37+
import { createAuthenticatedFetch } from '@object-ui/auth';
38+
import { ComponentRegistry } from '@object-ui/core';
39+
import { useObjectTranslation } from '@object-ui/i18n';
40+
import { useAdapter } from '../../providers/AdapterProvider.js';
41+
import { useEnvironmentEntitlements } from '../../environment/useEnvironmentEntitlements.js';
42+
43+
export interface CloudWorkspaceTimezoneNoticeProps {
44+
/** Carries the scope class of the node's `responsiveStyles`. */
45+
className?: string;
46+
}
47+
48+
export function CloudWorkspaceTimezoneNotice({ className }: CloudWorkspaceTimezoneNoticeProps) {
49+
const { t } = useObjectTranslation();
50+
const dataSource = useAdapter();
51+
// `useState`, not `useMemo`: the hook keys its fetch effect on this function,
52+
// so its identity has to be one React guarantees to keep (AGENTS.md #10).
53+
const [authFetch] = useState(() => createAuthenticatedFetch());
54+
const entitlements = useEnvironmentEntitlements({
55+
enabled: true,
56+
dataSource,
57+
authFetch,
58+
apiBase: (import.meta.env.VITE_SERVER_URL as string | undefined) || '',
59+
});
60+
61+
const zone = entitlements?.workspaceTimezoneSeed;
62+
if (typeof zone !== 'string' || zone === '') return null;
63+
64+
return (
65+
<p className={cn('text-sm text-muted-foreground', className)} data-workspace-timezone-notice="seeded">
66+
{t('cloudWorkspaceTimezoneNotice.seeded', { zone })}
67+
</p>
68+
);
69+
}
70+
71+
// SDUI registration — the Cloud welcome page places one node. Registered under
72+
// the `cloud` namespace with no bare fallback, so the one key is
73+
// `cloud:workspace-timezone-notice`: the spelling the page authors, and the one
74+
// literal its `@object-ui/types` arm claims (`CloudWorkspaceTimezoneNoticeSchema`).
75+
ComponentRegistry.register('workspace-timezone-notice', (props: CloudWorkspaceTimezoneNoticeProps) => (
76+
<CloudWorkspaceTimezoneNotice {...props} />
77+
), {
78+
namespace: 'cloud',
79+
skipFallback: true,
80+
label: 'Cloud Workspace Timezone Notice',
81+
category: 'plugin',
82+
inputs: [],
83+
});
Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* CloudWorkspaceTimezoneNotice (`cloud:workspace-timezone-notice`,
5+
* objectui#11930) prints ONE line on the Cloud welcome page naming the
6+
* timezone the workspace was seeded with, read from the authoritative
7+
* entitlements summary's `workspaceTimezoneSeed` — and nothing in every other
8+
* state: no seed, a failed request, a body outside the envelope, or loading.
9+
*/
10+
11+
import { describe, it, expect, vi, afterEach } from 'vitest';
12+
import { render, screen, waitFor, cleanup } from '@testing-library/react';
13+
import React from 'react';
14+
15+
let fetchImpl: (url: string, init?: RequestInit) => Promise<unknown>;
16+
const fetchedUrls: string[] = [];
17+
18+
vi.mock('@object-ui/auth', async (importOriginal) => ({
19+
...(await importOriginal<Record<string, unknown>>()),
20+
useAuth: () => ({ activeOrganization: { id: 'org_1' } }),
21+
createAuthenticatedFetch: () => (url: string, init?: RequestInit) => {
22+
fetchedUrls.push(url);
23+
return fetchImpl(url, init);
24+
},
25+
}));
26+
27+
import { I18nProvider } from '@object-ui/i18n';
28+
import { ComponentRegistry } from '@object-ui/core';
29+
import { AdapterCtx, SchemaRenderer } from '@object-ui/react';
30+
import { CloudWorkspaceTimezoneNotice } from '../CloudWorkspaceTimezoneNotice';
31+
32+
const EN = { defaultLanguage: 'en', detectBrowserLanguage: false } as const;
33+
const ZH = { defaultLanguage: 'zh', detectBrowserLanguage: false } as const;
34+
35+
/** The two packs' sentences for the seed below — the copy a user reads. */
36+
const EN_LINE =
37+
'The workspace timezone was set to Asia/Shanghai from your browser when the workspace was created. '
38+
+ 'You can change it in Settings → Localization.';
39+
const ZH_LINE = '工作区时区在创建时已按你的浏览器设为 Asia/Shanghai,可在「设置 → 本地化」中修改。';
40+
41+
/**
42+
* The line resolves from the locale packs, so a real i18n context is needed —
43+
* without one `t()` returns the raw key and a text assertion would pass
44+
* against nothing. The adapter is the row-derived fallback's data source; its
45+
* rows resolve, so a failed summary falls through to a REAL `derived` state.
46+
*/
47+
const adapter = { find: vi.fn().mockResolvedValue([{ id: 'env_1', environment_type: 'production' }]) };
48+
49+
const renderInShell = (ui: React.ReactElement, config: typeof EN | typeof ZH = EN) =>
50+
render(
51+
<I18nProvider config={config} persistLanguage={false}>
52+
<AdapterCtx.Provider value={adapter as never}>{ui}</AdapterCtx.Provider>
53+
</I18nProvider>,
54+
);
55+
56+
/** The control plane's `{ success, data }` envelope around a summary. */
57+
function summary(data: Record<string, unknown>) {
58+
return { ok: true, status: 200, json: async () => ({ success: true, data }) };
59+
}
60+
61+
const SEEDED = { plan: 'free', hasProductionEnv: true, workspaceTimezoneSeed: 'Asia/Shanghai' };
62+
const UNSEEDED = { plan: 'free', hasProductionEnv: true };
63+
64+
const noticeOf = (container: HTMLElement) => container.querySelector('[data-workspace-timezone-notice]');
65+
66+
/** Waits until the summary was read and the hook settled, so an empty render is a verdict, not the loading state. */
67+
async function settledAfterSummary() {
68+
await waitFor(() => expect(fetchedUrls).toHaveLength(1));
69+
await new Promise((r) => setTimeout(r, 0));
70+
}
71+
72+
afterEach(() => {
73+
cleanup();
74+
fetchedUrls.length = 0;
75+
adapter.find.mockClear();
76+
});
77+
78+
describe('CloudWorkspaceTimezoneNotice — the seed is present (objectui#11930)', () => {
79+
it('names the seeded zone in English, verbatim', async () => {
80+
fetchImpl = async () => summary(SEEDED);
81+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
82+
83+
expect(await screen.findByText(EN_LINE)).toBeTruthy();
84+
expect(noticeOf(container)?.textContent).toBe(EN_LINE);
85+
});
86+
87+
it('names the seeded zone in Chinese, verbatim', async () => {
88+
fetchImpl = async () => summary(SEEDED);
89+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />, ZH);
90+
91+
expect(await screen.findByText(ZH_LINE)).toBeTruthy();
92+
expect(noticeOf(container)?.textContent).toBe(ZH_LINE);
93+
});
94+
95+
it('reads the org-scoped summary endpoint', async () => {
96+
fetchImpl = async () => summary(SEEDED);
97+
renderInShell(<CloudWorkspaceTimezoneNotice />);
98+
99+
await screen.findByText(EN_LINE);
100+
expect(fetchedUrls).toEqual(['/api/v1/cloud/environment-entitlements?organizationId=org_1']);
101+
});
102+
103+
it('is one line of text — no link, no button, no dismissal', async () => {
104+
fetchImpl = async () => summary(SEEDED);
105+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
106+
107+
await screen.findByText(EN_LINE);
108+
expect(container.querySelectorAll('a, button')).toHaveLength(0);
109+
expect(noticeOf(container)?.children).toHaveLength(0);
110+
});
111+
});
112+
113+
describe('CloudWorkspaceTimezoneNotice — nothing renders without a seed (objectui#11930)', () => {
114+
it('renders nothing when the summary carries no seed — the control', async () => {
115+
fetchImpl = async () => summary(UNSEEDED);
116+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
117+
118+
await settledAfterSummary();
119+
expect(container.innerHTML).toBe('');
120+
});
121+
122+
it('renders nothing for an empty seed', async () => {
123+
fetchImpl = async () => summary({ ...UNSEEDED, workspaceTimezoneSeed: '' });
124+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
125+
126+
await settledAfterSummary();
127+
expect(container.innerHTML).toBe('');
128+
});
129+
130+
it('renders nothing while the summary is loading', () => {
131+
fetchImpl = () => new Promise(() => {});
132+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
133+
134+
expect(container.innerHTML).toBe('');
135+
});
136+
137+
it('renders nothing, and does not throw, when the summary request fails', async () => {
138+
fetchImpl = async () => ({ ok: false, status: 500, json: async () => null });
139+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
140+
141+
// The hook fell through to the rows, which resolve (source `derived`) but
142+
// carry no seed — so the line is left out instead of guessed.
143+
await waitFor(() => expect(adapter.find).toHaveBeenCalledTimes(1));
144+
await new Promise((r) => setTimeout(r, 0));
145+
expect(container.innerHTML).toBe('');
146+
});
147+
148+
it('renders nothing, and does not throw, when the summary request rejects', async () => {
149+
fetchImpl = async () => {
150+
throw new TypeError('Failed to fetch');
151+
};
152+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
153+
154+
await waitFor(() => expect(adapter.find).toHaveBeenCalledTimes(1));
155+
await new Promise((r) => setTimeout(r, 0));
156+
expect(container.innerHTML).toBe('');
157+
});
158+
159+
it('renders nothing for a bare (un-enveloped) body that carries a seed', async () => {
160+
// A bare body is a producer contract violation (cloud#1046): it yields no
161+
// summary, so even a seed in it must not print.
162+
fetchImpl = async () => ({ ok: true, status: 200, json: async () => SEEDED });
163+
const { container } = renderInShell(<CloudWorkspaceTimezoneNotice />);
164+
165+
await waitFor(() => expect(adapter.find).toHaveBeenCalledTimes(1));
166+
await new Promise((r) => setTimeout(r, 0));
167+
expect(container.innerHTML).toBe('');
168+
});
169+
});
170+
171+
describe('`cloud:workspace-timezone-notice` registration (objectui#11930)', () => {
172+
it('is registered under the one key the page authors, with no second spelling', () => {
173+
expect(ComponentRegistry.has('cloud:workspace-timezone-notice')).toBe(true);
174+
// `skipFallback: true` — no bare `workspace-timezone-notice` fallback …
175+
expect(ComponentRegistry.has('workspace-timezone-notice')).toBe(false);
176+
// … and no `app-shell:`-prefixed twin.
177+
expect(ComponentRegistry.has('app-shell:cloud:workspace-timezone-notice')).toBe(false);
178+
});
179+
180+
it('renders from a page node through SchemaRenderer', async () => {
181+
fetchImpl = async () => summary(SEEDED);
182+
const { container } = renderInShell(
183+
<SchemaRenderer
184+
schema={{
185+
type: 'cloud:workspace-timezone-notice',
186+
id: 'welcome_timezone_notice',
187+
responsiveStyles: { large: { marginTop: '8px' } },
188+
} as never}
189+
/>,
190+
);
191+
192+
expect(await screen.findByText(EN_LINE)).toBeTruthy();
193+
// The node's `responsiveStyles` scope class reaches the line through
194+
// `className`, so the page can place it.
195+
const scope = container.querySelector('style[data-os-scope]')?.getAttribute('data-os-scope');
196+
expect(scope).toBeTruthy();
197+
expect(noticeOf(container)?.classList.contains(scope as string)).toBe(true);
198+
});
199+
});

‎packages/app-shell/src/environment/entitlements.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ export interface EnvironmentEntitlementsSummary {
189189
seatCount?: number;
190190
upgradeUrl?: string;
191191
contactSalesUrl?: string;
192+
/**
193+
* The IANA timezone the workspace was seeded with at creation, from the
194+
* creator's browser (objectstack-ai/cloud#2676). Additive: absent when no
195+
* seed was recorded, which includes every workspace created before the seed
196+
* existed and every control plane that does not send it yet.
197+
*/
198+
workspaceTimezoneSeed?: string;
192199
}
193200

194201
/** Combined client state (authoritative summary, or a row-derived fallback). */
@@ -206,6 +213,13 @@ export interface EnvironmentEntitlementsState {
206213
*/
207214
upgradeUrl?: string;
208215
contactSalesUrl?: string;
216+
/**
217+
* The summary's `workspaceTimezoneSeed`, verbatim. Absent when the control
218+
* plane sent none — including the row-derived and unknown states, which
219+
* never had one — and then the `cloud:workspace-timezone-notice` widget
220+
* renders nothing (objectui#11930).
221+
*/
222+
workspaceTimezoneSeed?: string;
209223
/** Where the signal came from — telemetry + degradation note + tests. */
210224
source: 'summary' | 'derived' | 'unknown';
211225
}

‎packages/app-shell/src/environment/useEnvironmentEntitlements.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export function useEnvironmentEntitlements(
9090
// upgrade prompt then renders no CTA (objectui#10437).
9191
upgradeUrl: data.upgradeUrl,
9292
contactSalesUrl: data.contactSalesUrl,
93+
// Verbatim, like `upgradeUrl`: absent stays absent, and the
94+
// workspace-timezone notice then renders nothing (objectui#11930).
95+
workspaceTimezoneSeed: data.workspaceTimezoneSeed,
9396
source: 'summary',
9497
};
9598
} catch {

‎packages/app-shell/src/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,8 @@ import './console/connect/ConnectAgentWidget.js';
336336
import './console/home/CloudOnboardingNext.js';
337337
// SDUI widget for the Cloud pricing page's "current plan" marker (objectui#10919).
338338
import './console/home/CloudPlanStatus.js';
339+
// SDUI widget for the Cloud welcome page's seeded workspace-timezone line (objectui#11930).
340+
import './console/home/CloudWorkspaceTimezoneNotice.js';
339341
// SDUI widget: read-only admin diagnostic for the env's effective AI model
340342
// (cloud#797) — fetches GET /api/v1/ai/effective-model.
341343
import './console/diagnostics/CloudAiModelStatus.js';

‎packages/cli/src/__tests__/registered-types-validate-ratchet-10859.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,14 @@ describe('registered NAMESPACED component types refused at `type` — a ratchet
571571
expect(BARE_KEYS).not.toContain('plan-status');
572572
expect(refusedAtType('cloud:plan-status')).toBe(false);
573573
});
574+
575+
it('counts `cloud:workspace-timezone-notice` armed — it registered WITH its arm (objectui#11930)', () => {
576+
// One registry key (`skipFallback: true`, so no bare `workspace-timezone-notice`),
577+
// armed in `@object-ui/types/zod` in the same change, so the pin above did not move.
578+
expect(NAMESPACED_KEYS).toContain('cloud:workspace-timezone-notice');
579+
expect(BARE_KEYS).not.toContain('workspace-timezone-notice');
580+
expect(refusedAtType('cloud:workspace-timezone-notice')).toBe(false);
581+
});
574582
});
575583

576584
/* ── End to end: the README document through `objectui validate` ─────────── */

‎packages/cli/src/utils/known-schema-types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const KNOWN_SCHEMA_TYPES: readonly string[] = [
8282
'cloud:ai-model-status',
8383
'cloud:onboarding-next',
8484
'cloud:plan-status',
85+
'cloud:workspace-timezone-notice',
8586
'code',
8687
'code-editor',
8788
'collapsible',

0 commit comments

Comments
 (0)