Skip to content

Commit 6e75797

Browse files
committed
feat(app-shell): Studio's publish review sheet says a customization lives in this environment's database and moves only by os package export
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Utp6Cay8ZjjPDJ1vkTcVDd
1 parent 6fa842a commit 6e75797

14 files changed

Lines changed: 94 additions & 2 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
feat(app-shell): Studio's publish review sheet says a customization lives in this environment's database and moves only by `os package export` (#30119)
7+
8+
Clause-②: yes (widening) — new `@object-ui/i18n` key `preview.changes.customizationEnvironment` in every pack; `preview/savedToCustomization` gains `customizationEnvironmentText` and `PACKAGE_EXPORT_COMMAND`
9+
Metadata-protocol: none
10+
11+
Reviewing a read-only package's customizations, the sheet adds one line under "Saved to BASE's customizations": the changes are kept in this environment's database as items of the `.custom` package it names (the id the server answered for the base), not in the project's source, and they reach another environment only through `os package export`.

‎ui/packages/app-shell/src/preview/DraftChangesPanel.tsx‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ import {
8787
// spec-named local declaration is what `scripts/check-spec-symbol-derivation.mjs`
8888
// refuses, and a faithful copy is exactly the fork that guard exists to prevent.
8989
import { fetchPendingDrafts } from './usePendingDrafts.js';
90-
import { savedToCustomizationText } from './savedToCustomization.js';
90+
import { customizationEnvironmentText, savedToCustomizationText } from './savedToCustomization.js';
9191
import { canonicalMetaUrlType } from '@objectstack/spec/shared';
9292
import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui';
9393
import { MetadataProtectionFields, OverrideDeclarationFields, stripReadDecorations } from '@objectstack/spec/kernel';
@@ -1401,7 +1401,9 @@ export interface DraftChangesPanelProps {
14011401
* objectstack ADR-0146 D3 — the label of the read-only base whose
14021402
* `<base>.custom` pair these drafts are saved to. When set, the sheet says
14031403
* so under its title ({@link savedToCustomizationText}); the host passes it
1404-
* only while it reviews a pair's drafts.
1404+
* only while it reviews a pair's drafts, so `packageId` is then the pair, and
1405+
* the sheet names it in the line that says where the changes live
1406+
* ({@link customizationEnvironmentText}, objectstack#30119).
14051407
*/
14061408
customizationOf?: string;
14071409
}
@@ -1697,6 +1699,14 @@ export function DraftChangesPanel({
16971699
{savedToCustomizationText(t, customizationOf)}
16981700
</p>
16991701
) : null}
1702+
{/* objectstack#30119 (ADR-0146 D2) — and where they live: this
1703+
* environment's database, as items of the pair (`packageId`, the
1704+
* pair the host reviews), moved only by `os package export`. */}
1705+
{customizationOf && packageId ? (
1706+
<p data-testid="draft-changes-environment" className="text-xs text-muted-foreground">
1707+
{customizationEnvironmentText(t, packageId)}
1708+
</p>
1709+
) : null}
17001710
</SheetHeader>
17011711
{posture === 'confirm' && entries && entries.length > 0 && !error ? (
17021712
// objectui#12517 — what the publish carries, counted off the same

‎ui/packages/app-shell/src/preview/__tests__/DraftChangesPanel.test.tsx‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ vi.mock('@object-ui/i18n', async (importOriginal) => {
2727

2828
import { createI18n, I18nProvider } from '@object-ui/i18n';
2929
import { DraftChangesPanel, computeChangeDetail } from '../DraftChangesPanel';
30+
import { PACKAGE_EXPORT_COMMAND, customizationEnvironmentText } from '../savedToCustomization';
3031

3132
afterEach(() => {
3233
vi.restoreAllMocks();
@@ -293,5 +294,40 @@ describe('DraftChangesPanel — names the base whose customizations it saves (ob
293294
renderIn('en');
294295
await waitFor(() => expect(screen.getByText('ticket')).toBeInTheDocument());
295296
expect(screen.queryByTestId('draft-changes-saved-to')).not.toBeInTheDocument();
297+
expect(screen.queryByTestId('draft-changes-environment')).not.toBeInTheDocument();
298+
});
299+
300+
/*
301+
* objectstack#30119 (ADR-0146 D2) — under it, where the changes live: this
302+
* environment's database, as items of the pair the host reviews (its
303+
* `packageId`, named as served), and the one command that moves them,
304+
* verbatim in every pack.
305+
*/
306+
it('names the pair and `os package export` in the line under it, in en', async () => {
307+
renderIn('en', { customizationOf: 'HotCRM', packageId: 'com.hotcrm.custom' });
308+
const line = await screen.findByTestId('draft-changes-environment');
309+
expect(line.textContent).toContain('this environment’s database');
310+
expect(line.textContent).toContain('com.hotcrm.custom');
311+
expect(line.textContent).toContain('os package export');
312+
});
313+
314+
it('keeps the pair id and the command untranslated in zh', async () => {
315+
renderIn('zh', { customizationOf: 'HotCRM', packageId: 'com.hotcrm.custom' });
316+
const line = await screen.findByTestId('draft-changes-environment');
317+
expect(line.textContent).toContain('当前环境的数据库');
318+
expect(line.textContent).toContain('com.hotcrm.custom');
319+
expect(line.textContent).toContain('os package export');
320+
});
321+
});
322+
323+
describe('the environment line keeps the command verbatim in every pack (objectstack#30119)', () => {
324+
const LOCALES = ['en', 'zh', 'ja', 'ko', 'de', 'fr', 'es', 'pt', 'ru', 'ar'] as const;
325+
it.each(LOCALES)('%s: names the pair and `os package export` once each', async (lang) => {
326+
const i18n = createI18n({ defaultLanguage: lang, detectBrowserLanguage: false });
327+
await i18n.changeLanguage(lang);
328+
const text = customizationEnvironmentText(i18n.t.bind(i18n) as never, 'com.hotcrm.custom');
329+
expect(text).not.toContain('{{');
330+
expect(text.split('com.hotcrm.custom')).toHaveLength(2);
331+
expect(text.split(PACKAGE_EXPORT_COMMAND)).toHaveLength(2);
296332
});
297333
});

‎ui/packages/app-shell/src/preview/savedToCustomization.tsx‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,29 @@ export function savedToCustomizationText(t: Translate, baseLabel: string): strin
2323
});
2424
}
2525

26+
/**
27+
* The command that moves a customization to another environment, spelled
28+
* verbatim in every language: it is typed, not read (objectstack#30119).
29+
*/
30+
export const PACKAGE_EXPORT_COMMAND = 'os package export';
31+
32+
/**
33+
* objectstack#30119 (ADR-0146 D2) — the sentence under "Saved to BASE's
34+
* customizations" in the pending-changes sheet: the changes live in this
35+
* environment's database as items of `pairId`, the `<base>.custom` package
36+
* the server answered for the base, not in the project's source, and only
37+
* {@link PACKAGE_EXPORT_COMMAND} takes them to another environment. True on
38+
* every deployment, so it is not switched by the served `environment`.
39+
*/
40+
export function customizationEnvironmentText(t: Translate, pairId: string): string {
41+
return t('preview.changes.customizationEnvironment', {
42+
pair: pairId,
43+
command: PACKAGE_EXPORT_COMMAND,
44+
defaultValue:
45+
'These changes are kept in this environment’s database as items of {{pair}}, not in your project’s source. They reach another environment only through {{command}}.',
46+
});
47+
}
48+
2649
/** {@link savedToCustomizationText} as an element, for the Studio item header's note line. */
2750
export function SavedToCustomizationNote({ baseLabel, testId }: { baseLabel: string; testId?: string }) {
2851
const { t } = useObjectTranslation();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4941,6 +4941,7 @@ const ar = {
49414941
title: 'التغييرات المعلّقة',
49424942
description: 'ما الذي سيغيّره النشر. تُضاف العناصر الجديدة؛ وتستبدل التحديثات النسخة المنشورة.',
49434943
savedToCustomization: 'محفوظ في تخصيصات {{package}}',
4944+
customizationEnvironment: 'تُحفظ هذه التغييرات في قاعدة بيانات هذه البيئة كعناصر في {{pair}}، وليست في الشيفرة المصدرية لمشروعك. لا تنتقل إلى بيئة أخرى إلا عبر {{command}}.',
49444945
loading: 'جارٍ تحميل التغييرات المعلّقة…',
49454946
loadFailed: 'تعذّر تحميل التغييرات المعلّقة:',
49464947
empty: 'لا شيء معلّق — نُشرت كل المسودات.',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,6 +4536,7 @@ const de = {
45364536
title: 'Ausstehende Änderungen',
45374537
description: 'Was die Veröffentlichung ändert. Neue Elemente werden hinzugefügt; Aktualisierungen überschreiben die Live-Version.',
45384538
savedToCustomization: 'Gespeichert in den Anpassungen von {{package}}',
4539+
customizationEnvironment: 'Diese Änderungen liegen in der Datenbank dieser Umgebung, als Elemente von {{pair}}, nicht im Quellcode Ihres Projekts. In eine andere Umgebung gelangen sie nur mit {{command}}.',
45394540
loading: 'Ausstehende Änderungen werden geladen…',
45404541
loadFailed: 'Ausstehende Änderungen konnten nicht geladen werden:',
45414542
empty: 'Nichts ausstehend — alle Entwürfe wurden veröffentlicht.',

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,9 @@ const en = {
39933993
description: 'What publishing will change. New items are added; updates overwrite the live version.',
39943994
// ADR-0146 D3 — where a customization of a read-only base is saved: its `.custom` pair.
39953995
savedToCustomization: 'Saved to {{package}}’s customizations',
3996+
// objectstack#30119 (ADR-0146 D2) — the pair lives in this environment's database and moves only by export;
3997+
// `command` is always the literal `os package export`, never translated.
3998+
customizationEnvironment: 'These changes are kept in this environment’s database as items of {{pair}}, not in your project’s source. They reach another environment only through {{command}}.',
39963999
loading: 'Loading pending changes…',
39974000
loadFailed: 'Could not load pending changes:',
39984001
empty: 'Nothing pending — every draft has been published.',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4638,6 +4638,7 @@ const es = {
46384638
title: 'Cambios pendientes',
46394639
description: 'Lo que cambiará al publicar. Los elementos nuevos se añaden; las actualizaciones sobrescriben la versión publicada.',
46404640
savedToCustomization: 'Guardado en las personalizaciones de {{package}}',
4641+
customizationEnvironment: 'Estos cambios se guardan en la base de datos de este entorno, como elementos de {{pair}}, no en el código fuente de su proyecto. Solo llegan a otro entorno mediante {{command}}.',
46414642
loading: 'Cargando cambios pendientes…',
46424643
loadFailed: 'No se pudieron cargar los cambios pendientes:',
46434644
empty: 'Nada pendiente — todos los borradores se han publicado.',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4634,6 +4634,7 @@ const fr = {
46344634
title: 'Modifications en attente',
46354635
description: 'Ce que la publication changera. Les nouveaux éléments sont ajoutés ; les mises à jour remplacent la version en ligne.',
46364636
savedToCustomization: 'Enregistré dans les personnalisations de {{package}}',
4637+
customizationEnvironment: 'Ces modifications sont stockées dans la base de données de cet environnement, comme éléments de {{pair}}, et non dans les sources de votre projet. Elles ne passent dans un autre environnement que par {{command}}.',
46374638
loading: 'Chargement des modifications en attente…',
46384639
loadFailed: 'Impossible de charger les modifications en attente :',
46394640
empty: 'Rien en attente — tous les brouillons ont été publiés.',

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,6 +4538,7 @@ const ja = {
45384538
title: '保留中の変更',
45394539
description: '公開で何が変わるか。新規項目は追加され、更新は公開中のバージョンを上書きします。',
45404540
savedToCustomization: '{{package}} のカスタマイズに保存',
4541+
customizationEnvironment: 'これらの変更はこの環境のデータベースに {{pair}} の項目として保存され、プロジェクトのソースには含まれません。別の環境へは {{command}} でのみ移せます。',
45414542
loading: '保留中の変更を読み込み中…',
45424543
loadFailed: '保留中の変更を読み込めませんでした:',
45434544
empty: '保留中の変更はありません — すべてのドラフトが公開済みです。',

0 commit comments

Comments
 (0)