From e927bc6bccb027466b5a7c6ce1d0677c0832e706 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 17:50:18 +0000 Subject: [PATCH 01/18] wip(studio): object designer fixed on one object, tabs in the address Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../src/views/studio-design/DataPillar.tsx | 899 ++++-------------- .../src/views/studio-design/dataTabsFold.ts | 56 +- .../views/studio-design/objectDesignerTabs.ts | 111 +++ 3 files changed, 353 insertions(+), 713 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx index 18c2c87d878..e582b156b14 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx @@ -1,11 +1,18 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The Data pillar — the object rail, the object canvas (Records, Field - * layout, Settings and the other tabs) and the New object dialog — with the - * records-grid slot and the object draft-save shape only it uses, moved out - * of `StudioDesignSurface.tsx` unchanged by objectstack#36893 (the move-only - * split's pillar slice; the surface re-exports it). + * The object designer — one object, full-screen on its metadata address + * (`/studio//metadata/object/`, objectstack#36904, epic + * objectstack#36890; ADR-0146 D1 as amended): the item header (× back to the + * object list, ‹ › through it), the tabs in #36513's order with the item + * tools after them (`objectDesignerTabs.ts`), and the object canvas — with the + * records-grid slot and the object draft-save shape only it uses. + * + * It has no object list of its own and no New: the list is the area's + * (`ResourceListPage`), and its 「新建」 creates an object + * (`MetadataListCreateDialog`). Another object opens through ×, ‹ › or ⌘K + * (decision 7). The area mounts it (`StudioMetadataArea`); the old + * `/data?surface=object:` address redirects there (`dataPillarRedirect`). */ import * as React from 'react'; @@ -20,24 +27,32 @@ import { type DraftChange, } from '@object-ui/data-objectstack'; import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui'; -import { customizationNamespace } from '@objectstack/spec/kernel'; import { type StudioSurfaceLabel } from './StudioAiCopilot.js'; import { useStudioRightSlot } from './studioRightSlotState.js'; import { StudioInspector } from './StudioInspector.js'; import { agentDraftMarkOf, DraftChip, DraftSourceLine, isAgentDraftSurface } from './StudioDraftMark.js'; -import { - StudioItemHeader, - StudioTab, -} from './StudioItemHeader.js'; -import { StudioItemTools } from '../item-tools/StudioItemTools.js'; +import { StudioTab } from './StudioItemHeader.js'; +import { ResourceDetailHeader } from '../metadata-admin/ResourceDetailHeader.js'; +import { ItemToolTabPanel, ItemToolTabStrip } from '../item-tools/ItemToolTabs.js'; +import { useCanAuthorMetadata, useCanReadAuthoringTrail } from '../../hooks/useCanAuthorMetadata.js'; import { useStudioItemDraftStatus } from './studioItemDraftStatus.js'; -import { DATA_CONTENT_CONTAINER, DATA_TAB_FLAT_ONLY, DATA_TAB_FOLDED_ONLY } from './dataTabsFold.js'; +import { + DATA_CONTENT_CONTAINER, + DATA_TAB_FLAT_ONLY, + DATA_TAB_FLAT_WIDE_ONLY, + DATA_TAB_FOLDED_FIRST_ONLY, + DATA_TAB_FOLDED_ONLY, +} from './dataTabsFold.js'; +import { + OBJECT_DESIGNER_ALWAYS_FLAT, + OBJECT_DESIGNER_FOLD_FIRST, + OBJECT_DESIGNER_TOOL_TABS, + OBJECT_DESIGNER_VIEWS, + useObjectDesignerTab, + type ObjectDesignerView, +} from './objectDesignerTabs.js'; import { RECORDS_SCROLLBAR_VISIBLE, revealColumn } from './recordsGridChrome.js'; -import { StudioRail, StudioRailRow } from './StudioRail.js'; import { StudioRefusalStrip } from './StudioRefusalStrip.js'; -import { StudioPicker } from './StudioPicker.js'; -import { PACKAGE_LIST_TOAST_ID } from './PackageSwitcher.js'; -import { addNewObjectToAppMenu } from './newObjectJoinsAppMenu.js'; import { pairIdOf } from './AutomationsFlowRail.js'; import { addedExtensionFieldName, @@ -48,16 +63,11 @@ import { formFieldNames, formPreviewSource, isCelPanelTab, - OWD_OPTION_DESC_KEY, - OWD_OPTION_LABEL_KEY, panelItemCelStamp, panelItemOf, STUDIO_SYSTEM_FIELD_NAMES, } from './DataPillarHelpers.js'; import { - confirmDropUnsavedWork, - CreateTakenNotice, - findTakenIdentifier, type StudioBaseCustomization, StudioHeldNotice, StudioReadOnlyLink, @@ -74,7 +84,6 @@ import { AlertDialogTitle, GridFieldAuthoringProvider, cn, - useIsMobile, Button, DropdownMenu, DropdownMenuTrigger, @@ -85,12 +94,11 @@ import { TooltipContent, TooltipProvider, TooltipTrigger, - ObjectIconTile, } from '@object-ui/components'; import { ObjectView as PluginObjectView } from '@object-ui/plugin-view'; import { ListView } from '@object-ui/plugin-list'; import { ObjectForm } from '@object-ui/plugin-form'; -import { Ban, Loader2, Plus, ChevronDown, Menu, Sparkles } from 'lucide-react'; +import { Ban, Loader2, Plus, ChevronDown, Sparkles } from 'lucide-react'; import { type MetadataSelection, } from '../metadata-admin/preview-registry.js'; @@ -128,16 +136,10 @@ import { } from './metadataError.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; import { type Surface } from './navSurface.js'; -import { useSurfaceDeepLink, useSurfaceActionDeepLink, resolveSurfaceDeepLink } from './useSurfaceDeepLink.js'; -import { useRequestedSurface } from './surfaceDeepLinkChannel.js'; -import { buildObjectSkeleton } from './skeletons.js'; -import { OWD_CREATE_MODELS, OWD_DEFAULT, type OwdCreateModel } from './owd-sharing.js'; -import { t, tFormat, useMetadataLocale } from '../metadata-admin/i18n.js'; +import { useSurfaceActionDeepLink } from './useSurfaceDeepLink.js'; +import { t, tFormat, translateMetadataType, useMetadataLocale } from '../metadata-admin/i18n.js'; import { InspectorShellHostProvider } from '../metadata-admin/inspectors/_shared.js'; import type { DestructiveChangeIssue } from '@objectstack/spec/api'; -import { - navItemLabelText, -} from '../metadata-admin/previews/navItemLabel.js'; import { readFields, writeFields, @@ -153,7 +155,6 @@ import { readExternalBinding, useExternalWriteState, } from '../metadata-admin/previews/external-object.js'; -import { CreateItemDialog } from './CreateItemDialog.js'; import { AddFieldPopover } from './AddFieldPopover.js'; import { StudioGridAddFieldButton, StudioGridAddFieldProvider, type StudioGridAddFieldValue } from './StudioGridAddField.js'; import { FormToolbar, ObjectFormDesigner } from './ObjectFormDesigner.js'; @@ -168,17 +169,7 @@ import { useObjectHooksBuffer } from './objectHooksBuffer.js'; import { usePairObjectActions, type PairActionsDoor } from './pairObjectActions.js'; import { ObjectActionsPanel } from './ObjectActionsPanel.js'; import { getIcon } from '../../utils/getIcon.js'; -import { fetchPackages, prefixObjectName } from './packages-io.js'; -import { - RailCustomizationFilter, - RailCustomizationMark, - StudioPairItemChip, - contributedItemTitle, - railCustomizationsOf, - useDeepLinkFallback, - useRailCustomizationsOnly, - withPairItems, -} from './StudioRailCustomizations.js'; +import { contributedItemTitle, railCustomizationsOf } from './StudioRailCustomizations.js'; import { baseContributionsOf, contributedFieldsOf, @@ -288,10 +279,10 @@ interface ObjDraftSend { body: Record; } -// Exported for tests (StudioDesignSurface.emptyPackage.test.tsx) — the empty- -// package behavior (no forced creator modal, empty-state CTA) lives here. +// Exported for tests and for the area's object page (`StudioMetadataArea`). export function DataPillar({ - packageId: railPackageId, + packageId, + objectName, publishNonce = 0, onDraftSaved, readOnly: packageReadOnly = false, @@ -301,6 +292,8 @@ export function DataPillar({ onReviewChanges, }: { packageId: string; + /** objectstack#36904 — the one object this page designs: the name in its metadata address. */ + objectName: string; publishNonce?: number; onDraftSaved?: (saved?: StudioSavedDraft) => void; /** objectstack#34725 — the open object's display label and tab, for the copilot's chip (see the Interfaces pillar's prop). */ @@ -309,7 +302,7 @@ export function DataPillar({ onReviewChanges?: () => void; /** Courtesy gate: hide/disable metadata-authoring affordances (records stay usable). */ readOnly?: boolean; - /** objectstack#28572 — on a read-only base, its pair: the rail lists the pair's objects too, and New lands there. */ + /** objectstack#28575 — on a read-only base, its pair: a base object's new fields and layout land there. */ customization?: StudioBaseCustomization | null; /** objectui#11786 — the clause of the edit the autosave holds unsent, for the surface's Publish. */ onHeldEditChange?: (clause: string | null) => void; @@ -333,60 +326,17 @@ export function DataPillar({ for (const e of metaTypes) idx[e.type] = e.form; return idx; }, [metaTypes]); - // Below the mobile breakpoint the Objects rail overlays the canvas instead - // of a permanent 208px column (which otherwise squeezed the grid/form - // canvas down to almost nothing on phones) — closed by default, toggled by - // the header's Menu button. - const isMobile = useIsMobile(); - const [railOpen, setRailOpen] = React.useState(false); - const [objects, setObjects] = React.useState([]); - const [objectsLoaded, setObjectsLoaded] = React.useState(false); - // objectstack#28572 — bumped after a New lands in the pair: the rail reads - // again, after the save, so the new object is in the pair's list it reads. - const [railNonce, setRailNonce] = React.useState(0); - // objectui#7255 — the copilot dock shares this document; a turn that staged - // or published metadata re-reads this rail in place. No hold is needed: the - // rail load only replaces the LIST (the per-object edit buffer is loaded by - // its own `loadedNameRef`-guarded effect and is never touched here). - const metadataRefreshNonce = useMetadataRefreshNonce(); - const [current, setCurrent] = React.useState(null); - // objectstack#28572 (ADR-0146 D3) — one surface for a read-only base and its - // pair. The rail is the base's (`railPackageId`); an object the pair adds - // (`current.addedIn`) opens writable, read and saved at the pair, so every - // read and write of the OPEN object below names `packageId` and asks - // `readOnly`, the open object's own. The rail's reads, its New and its - // namespace stay the base's. - const packageId = current?.addedIn ?? railPackageId; - const readOnly = packageReadOnly && !current?.addedIn; + // objectstack#36904 — the object is the address's: its label, icon and + // colour are the loaded object's (the label the app shows, a draft-only + // object's own), its machine name until it has loaded. + const [served, setServed] = React.useState<{ label?: string; icon?: string; color?: string }>({}); + const current = React.useMemo( + () => ({ type: 'object', name: objectName, label: served.label || objectName, icon: served.icon, color: served.color }), + [objectName, served], + ); + const readOnly = packageReadOnly; const railPairId = packageReadOnly && customization ? customization.pairId : null; - const railMarks = railCustomizationsOf(customization?.marks, railPackageId); - const [onlyCustomized, toggleOnlyCustomized] = useRailCustomizationsOnly(); - // New on a read-only base lands in its pair, through the ensure door. - const newInPair = packageReadOnly && customization !== null && !customization.walled; - // `?surface=object:` capture + mirror — the app→Studio bridge - // (ADR-0080, `appStudioObjectPath`) lands here with a specific object; - // shared plumbing (see useSurfaceDeepLink). - const initialSurface = useSurfaceDeepLink(current); - // objectstack#28572 — see `useDeepLinkFallback`. - const deepLinkUpgrade = useDeepLinkFallback(); - const currentRef = React.useRef(current); - React.useLayoutEffect(() => { - currentRef.current = current; - }); - // The LIVE half of the same plumbing (see surfaceDeepLinkChannel): a - // producer already inside this mounted pillar — the pending-changes sheet's - // security block, naming the object the publish door would refuse — asks for - // an object long after the capture ref above was read. - // - // Applied AT MOST ONCE, by id. A standing request re-resolved on every rail - // reload (publish, package switch) would drag the author back off whatever - // they had since selected, which is the regression the mount-time ref exists - // to prevent — so the id is marked spent as soon as the loaded rail has been - // consulted, whether or not it held a match. - // - // Applied below `objHeld`, which it asks about (objectstack#26845). - const requestedSurface = useRequestedSurface(); - const appliedRequestRef = React.useRef(0); + const railMarks = railCustomizationsOf(customization?.marks, packageId); const [objDraft, setObjDraft] = React.useState>({}); // objectstack#28575 (ADR-0146 D10) — a base object of a read-only base takes // fields as an extension in the base's pair, never in its own buffer: the @@ -395,7 +345,7 @@ export function DataPillar({ // served (which already folds the pair's PUBLISHED extension), and what the // pillar shows is `shownDraft`, the two folded. `published` names the // fields the published extension declares, so one the draft drops is gone. - const extendsBase = packageReadOnly && customization !== null && current !== null && !current.addedIn; + const extendsBase = packageReadOnly && customization !== null; const [ext, setExt] = React.useState<{ for: string; body: ObjectExtensionBody; @@ -515,11 +465,22 @@ export function DataPillar({ const [hasDraft, setHasDraft] = React.useState(false); const [saving, setSaving] = React.useState(false); const [gridVer, setGridVer] = React.useState(0); - // Records grid ⇄ Form ⇄ Validations ⇄ Settings — four views of the SAME + // Records grid ⇄ Field layout ⇄ Validations ⇄ … — views of the SAME // object. Grid/Form are the runtime renderer (same-renderer principle); // Validations edits `validations` rules; Settings edits object basics + // the ADR-0085 semantic roles. All patch the one `objDraft`. - const [viewMode, setViewMode] = React.useState<'grid' | 'form' | 'rules' | 'settings' | 'hooks' | 'actions' | 'api'>('grid'); + // objectstack#36904 — the open tab is in the address (`objectDesignerTabs.ts`), + // and the item tools are tabs after the views (epic decision 8): History + // only for a caller the authoring-trail doors admit, as on every item page. + const canReadTrail = useCanReadAuthoringTrail(); + const canAuthor = useCanAuthorMetadata(); + const toolTabs = React.useMemo( + () => OBJECT_DESIGNER_TOOL_TABS.filter((tab) => tab !== 'history' || canReadTrail), + [canReadTrail], + ); + const designerTab = useObjectDesignerTab(toolTabs); + const viewMode = designerTab.location.view; + const toolTab = designerTab.location.tool; // objectstack#34725 — lift the open object's label to the copilot's chip, // with the tab in view: 「正在看:会议 · 记录」, never the machine name. The // Interfaces pillar's report (objectui#8219) is the same seam; keyed on @@ -528,9 +489,14 @@ export function DataPillar({ React.useEffect(() => { onSurfaceLabelChangeRef.current = onSurfaceLabelChange; }); - const currentObjectName = current?.type === 'object' ? current.name : undefined; - const currentObjectLabel = current?.type === 'object' ? current.label : undefined; - const viewModeLabel = t(`engine.studio.data.tab.${viewMode === 'grid' ? 'records' : viewMode}`, locale); + const currentObjectName = current.name; + const currentObjectLabel = current.label; + const viewModeLabel = t( + toolTab + ? `engine.studio.itemTabs.${toolTab.tab}` + : (OBJECT_DESIGNER_VIEWS.find((v) => v.view === viewMode)?.label ?? 'engine.studio.data.tab.records'), + locale, + ); React.useEffect(() => { onSurfaceLabelChangeRef.current?.( currentObjectName && currentObjectLabel @@ -549,9 +515,9 @@ export function DataPillar({ // goes, and its blocking count expires with it (see `blockingReport`). Left // open, a Records/Form selection stayed beside Validations, Hooks, Actions, // API and Settings, where nothing on screen is that field. - const selectViewMode = (next: typeof viewMode) => { - if (next !== viewMode) setFieldSel(null); - setViewMode(next); + const selectViewMode = (next: ObjectDesignerView) => { + if (next !== viewMode || toolTab) setFieldSel(null); + designerTab.selectView(next); }; // objectstack#26736 — the action a refusal or a held line names, opened by // its "Show me": a fresh object per press, so pressing it again re-selects @@ -572,10 +538,10 @@ export function DataPillar({ } setFieldSel({ kind: target.kind, id: target.id }); }; - // objectstack#34724 — `?surface=object:&action=` opens the - // deep-linked object's Actions view on that action (Studio's landing links a - // switched-off action that lives in its object's `actions[]` here). - useSurfaceActionDeepLink(initialSurface, current, (name) => showObjTarget({ kind: 'action', id: name })); + // objectstack#34724 — `?action=` on the object's address opens its + // Actions view on that action (Studio's landing links a switched-off action + // that lives in its object's `actions[]` here; `switchedOffActionPath`). + useSurfaceActionDeepLink(current, current, (name) => showObjTarget({ kind: 'action', id: name })); // objectstack#26730 — a refusal's "Show me" also ends on the input it names: // in the field inspector, or in the actions panel for an action. const fieldInspectorBodyRef = React.useRef(null); @@ -742,25 +708,6 @@ export function DataPillar({ React.useLayoutEffect(() => { extReadPairRef.current = customization?.pairId ?? null; }); - // Left-rail search + inline "new object" creator (design §4: rail = search + New). - const [query, setQuery] = React.useState(''); - const [creating, setCreating] = React.useState(false); - // The OWD the create dialog will author (`7a90afdf9`). Pre-selected to the - // platform's own recommended baseline; the author sees it and can change it - // before the object exists. Reset by `openCreateDialog` below rather than by - // an effect on `creating` — the effect spelling re-renders the dialog a - // second time on every open purely to undo a previous session's pick. - const [createOwd, setCreateOwd] = React.useState(OWD_DEFAULT); - // objectstack#26917 — a create refused because the identifier is taken: - // which object holds it, and whether it is on this rail, so it can be opened. - const [createTaken, setCreateTaken] = React.useState<{ name: string; label: string; here: boolean } | null>(null); - const openCreateDialog = React.useCallback(() => { - setError(null); - setCreateTaken(null); - setCreateOwd(OWD_DEFAULT); - setCreating(true); - }, []); - const [createBusy, setCreateBusy] = React.useState(false); // Whether the selected object exists beyond the draft (published/code baseline). // A draft-only object has NO physical table yet (DDL lands at publish), so the // Records grid must not fire data SQL against it. @@ -784,148 +731,6 @@ export function DataPillar({ // another package folds on). The buffer holds what the author wrote; these // keep the header count and the records grid on the server's object. const [servedOnly, setServedOnly] = React.useState([]); - // The package's object-name namespace (framework#2694). New objects are - // auto-prefixed with `_` so an author can never draft a prefix-less - // object that publish would later reject (code NAMESPACE_PREFIX). - const [namespace, setNamespace] = React.useState(null); - const pairNamespace = customizationNamespace(namespace); - const newObjectNamespace = packageReadOnly ? (pairNamespace.ok ? pairNamespace.value : null) : namespace; - - React.useEffect(() => { - let cancelled = false; - fetchPackages() - .then((list) => { - if (!cancelled) setNamespace(list.find((p) => p.id === railPackageId)?.namespace ?? null); - }) - .catch((e: unknown) => { - // The namespace stays best-effort and publish still enforces the - // prefix server-side — but silently losing it means the author drafts - // prefix-less objects now and hears about it only at publish. Report - // it at the moment it breaks (objectui#7368), on the shared toast id. - if (cancelled) return; - toast.error(formatMetadataError(e), { id: PACKAGE_LIST_TOAST_ID }); - }); - return () => { - cancelled = true; - }; - }, [railPackageId]); - - React.useEffect(() => { - let cancelled = false; - const packageId = railPackageId; - (async () => { - try { - // Published objects + pending DRAFT objects, merged. `list()` only - // sees published/active metadata, so a freshly-created writable base - // whose objects are all drafts would render an empty (previously: - // forever-"loading") rail. - // - // objectui#11843 — written when a draft header carried no label (since - // objectstack-ai/objectstack#22200 the `_drafts` row carries one; this - // read predates it and still works, objectui#11862), a draft-only - // object takes its label from the draft-overlaid list - // (`GET /meta/object?package=…&preview=draft`), which serves each - // pending draft of the package with its own label and a `_draft` mark. - // That list is read for labels ONLY: - // - the rail's members are still the published list plus the draft - // headers, in that order; - // - a published object keeps its published label, even when a pending - // draft of it declares another one; - // - a draft that declares no label, a caller the server answers the - // published list (pending drafts are not served to everyone), and a - // failed read all leave a draft-only object on its name, as before. - // The read is an async function so that even a throw before it is - // sent rejects, and the rail never fails on it. - const readDraftLabels = async (): Promise> => { - const overlaid = await client - .withPreviewDrafts(true) - .list>('object', { packageId }); - const labels = new Map(); - for (const o of overlaid || []) { - if (!o || o._draft !== true || typeof o.name !== 'string') continue; - if (typeof o.label === 'string' && o.label.trim()) labels.set(o.name, o.label); - } - return labels; - }; - // objectstack#28572 — and, on a read-only base with a pair, the pair's - // published and draft objects: the ones the base's list does not hold - // are the objects the pair adds. A failed pair read lists none of them. - const readPair = async (): Promise => { - if (railPairId === null) return []; - const [pairList, pairDrafts] = await Promise.all([ - client.list('object', { packageId: railPairId }) as Promise>>, - client.listDrafts({ packageId: railPairId, type: 'object' }).catch(() => []), - ]); - const rows: Surface[] = (pairList || []) - .map((o) => ({ - type: 'object', - name: String(o.name ?? ''), - label: String(o.label ?? o.name ?? ''), - icon: o.icon ? String(o.icon) : undefined, - color: typeof o.color === 'string' ? o.color : undefined, - })) - .filter((o) => o.name); - const seen = new Set(rows.map((o) => o.name)); - for (const d of pairDrafts as Array<{ name?: string | null; label?: I18nLabel | null }>) { - if (d.name && !seen.has(d.name)) { - rows.push({ type: 'object', name: d.name, label: resolveI18nLabel(d.label ?? undefined, locale)?.trim() || d.name }); - seen.add(d.name); - } - } - return rows; - }; - const [list, draftHeaders, draftLabels, pairRows] = await Promise.all([ - client.list('object', { packageId }) as Promise>>, - client.listDrafts({ packageId, type: 'object' }).catch(() => []), - readDraftLabels().catch(() => new Map()), - readPair().catch(() => [] as Surface[]), - ]); - if (cancelled) return; - const baseItems: Surface[] = (list || []) - .map((o) => ({ - type: 'object', - name: String(o.name ?? ''), - label: String(o.label ?? o.name ?? ''), - icon: o.icon ? String(o.icon) : undefined, - color: typeof o.color === 'string' ? o.color : undefined, - })) - .filter((o) => o.name); - const known = new Set(baseItems.map((o) => o.name)); - for (const d of draftHeaders) { - if (d.name && !known.has(d.name)) { - baseItems.push({ type: 'object', name: d.name, label: draftLabels.get(d.name) ?? d.name, icon: undefined }); - } - } - const items = withPairItems(baseItems, pairRows, railPairId); - setObjects(items); - // Honor a `?surface=object:` deep-link when it names an object we - // actually have; otherwise open the first object as before. - const deepLinked = resolveSurfaceDeepLink(items, initialSurface, 'object'); - // objectstack#28572 — an object the pair adds is listed once the pair - // is known (`useDeepLinkFallback`). - if (deepLinked && deepLinkUpgrade.take(currentRef.current?.name ?? null, deepLinked.name)) { - setCurrent(deepLinked); - } else { - if (!deepLinked && initialSurface?.type === 'object' && currentRef.current === null) { - deepLinkUpgrade.note(items[0]?.name ?? null); - } - setCurrent((c) => c ?? deepLinked ?? items[0] ?? null); - } - // An empty writable package does NOT auto-open the creator dialog — - // it used to, which forced an unrequested modal on EVERY visit to an - // empty package (dogfood #2555). The empty-state panel carries the - // create CTA instead. - } catch (e) { - if (!cancelled) setError(plainRefusal(e)); - } finally { - if (!cancelled) setObjectsLoaded(true); - } - })(); - return () => { - cancelled = true; - }; - }, [client, railPackageId, packageReadOnly, railPairId, locale, metadataRefreshNonce, railNonce]); - React.useEffect(() => { if (!current) return; // Load once per selected object. Bail if this object's baseline is already @@ -1026,6 +831,15 @@ export function DataPillar({ setObjVerdict(editedItemDiagnostics({ hasDraft: !!draftBody, draftDiagnostics: draftVerdict, layered: lay })); setObjVerdictBody(draftBody && draftVerdict ? draftBody : lay.effective); setObjDraftFor(`object:${current.name}`); + // objectstack#36904 — the header's label, icon and colour: the object + // as served, a draft-only object's draft (its own label, objectui#11843). + const shown = (draftBody ?? baseline) as { label?: I18nLabel; icon?: unknown; color?: unknown }; + const next = { + label: resolveI18nLabel(shown.label, locale)?.trim() || undefined, + icon: typeof shown.icon === 'string' ? shown.icon : undefined, + color: typeof shown.color === 'string' ? shown.color : undefined, + }; + setServed((prev) => (prev.label === next.label && prev.icon === next.icon && prev.color === next.color ? prev : next)); setObjDraftChanges(draftBody ? readDraftChanges(draftRead.answer) : null); // objectui#11773 — the next save is pinned to what the draft read served. recordObjRead('object', current.name, packageId, draftRead.pin); @@ -1308,108 +1122,6 @@ export function DataPillar({ setDirty(true); }, []); - // "+ new object": create a fresh object in this package (runtime create — - // same path the classic Studio editor uses), seeded with one text field so - // the form/grid isn't empty, and land on Form · Layout. objectstack#36511 — - // it is written as a draft, then that one object is published, so it is - // live at once like every Save in Studio: no draft is left for a package - // publish, and Changes and Publish stay for the AI assistant's drafts. - const doCreateObject = React.useCallback( - async (label: string, rawName: string, sharingModel: OwdCreateModel) => { - if (packageReadOnly && !newInPair) return; - setCreateBusy(true); - setError(null); - setCreateTaken(null); - try { - // objectstack#28572 (ADR-0146 D3) — on a read-only base the object is - // created in its pair, which the ensure door answers (creating it on - // first use, without a prompt): its id and its namespace come from - // that answer, never from a spelling here. - const target = - packageReadOnly && customization - ? await customization.ensurePackage() - : { packageId: railPackageId, namespace }; - // Auto-prefix with the package namespace (framework#2694) so a prefix-less - // object can't be authored; the rule lives in packages-io/spec. - const name = prefixObjectName(rawName, target.namespace); - // A name an object already holds, published or as a draft, on this - // rail or in any other package, is refused here and nothing is - // written: over a published object the first-write pin below would - // write this blank skeleton as its pending draft - // (`findTakenIdentifier`). The namespace prefix makes a clash with - // another package's object rarer, not impossible. - const onRail = objects.find((o) => o.name === name); - const taken = onRail - ? { name, label: onRail.label || name } - : await findTakenIdentifier(client, 'object', name, locale); - if (taken) { - setCreateTaken({ ...taken, here: onRail !== undefined }); - return; - } - const body = buildObjectSkeleton(name, label, t('engine.studio.data.nameFieldLabel', locale), sharingModel); - // objectui#11773 — and the door refuses a draft row too (the - // first-write pin), for one that lands between the check above and - // this save. - await client.save('object', name, body, { - mode: 'draft', - packageId: target.packageId, - ifNoneMatch: '*', - surface: 'studio', - }); - // objectstack#36511 — and published at once. A refused publish takes - // back the draft it wrote, so nothing is created, and says why. - const live = await publishSavedItem(client, { type: 'object', name, packageId: target.packageId }, false); - if (!live.ok) { - setError(plainRefusal(live.error)); - return; - } - const surface: Surface = - target.packageId === railPackageId ? { type: 'object', name, label } : { type: 'object', name, label, addedIn: target.packageId }; - setObjects((prev) => [...prev, surface]); - if (surface.addedIn) setRailNonce((n) => n + 1); - setCurrent(surface); - setViewMode('form'); - setFormMode('layout'); - setCreating(false); - toast.success(tFormat('engine.studio.save.done', locale, { items: label }), { id: STUDIO_SAVE_TOAST_ID }); - // objectstack#36748 — and it joins the menu of its package's one app, - // so an app made before its objects does not open empty. Only in the - // rail's own package (not a customization pair); a failure keeps the - // object and says the menu was left as it was. - if (target.packageId === railPackageId && !packageReadOnly) { - const join = await addNewObjectToAppMenu( - client as unknown as Parameters[0], - { packageId: target.packageId, objectName: name }, - { - notListed: t('engine.studio.data.appMenu.unreadable', locale), - pendingDraft: t('engine.studio.data.appMenu.pendingDraft', locale), - noVersion: t('engine.studio.data.appMenu.unreadable', locale), - notWritable: t('engine.studio.data.appMenu.unreadable', locale), - }, - ); - if (join.kind === 'failed') { - const reason = plainRefusal(join.error).message; - toast.warning( - join.app - ? tFormat('engine.studio.data.appMenu.failed', locale, { - object: label, - app: navItemLabelText(join.app.label, locale) || join.app.name, - reason, - }) - : tFormat('engine.studio.data.appMenu.failedNoApp', locale, { object: label, reason }), - ); - } - } - } catch (e) { - // Shown in the create dialog, which prints the message only: kept whole. - setError(plainRefusal(e)); - } finally { - setCreateBusy(false); - } - }, - [objects, client, railPackageId, packageReadOnly, newInPair, customization, locale, namespace], - ); - // objectstack#34931 — a save the door refused `409 DESTRUCTIVE_CHANGE`, held // for the author's answer: what it would lose, and the save itself. const [destructive, setDestructive] = React.useState { - const object = objects.find((o) => o.name === name); - if (!object) return; - setCreating(false); - setCreateTaken(null); - setCurrent(object); - }; // objectui#12725 — the copilot's mark on the selected field: its key path is // `["fields", NAME]` in the object body, and only a `copilot` write answers — // or, objectstack#27176, an `mcp` one: an agent through the MCP build door. @@ -1775,7 +1477,7 @@ export function DataPillar({ // The sentence names each item as the rail does (its label, else its // name); the server's own words stay behind Details, never in it. const labelOf = (f: { type: string; name: string }) => - (f.type === 'object' && objects.find((o) => o.type === 'object' && o.name === f.name)?.label) || f.name; + (f.type === 'object' && f.name === current.name ? current.label : '') || f.name; const items = [...new Set(result.failed.map(labelOf))].join( t('engine.studio.copilotChanges.itemSeparator', locale), ); @@ -1791,7 +1493,7 @@ export function DataPillar({ reloadObjDraft(); emitMetadataRefresh(); } - }, [adapter, locale, objects, packageId, reloadObjDraft]); + }, [adapter, locale, current, packageId, reloadObjDraft]); useHeldEditReport(onHeldEditChange, objHeld?.clause ?? null); // objectstack#36511 — the object page's buffers, saved and cancelled by the // top bar's one Save and Cancel: the object (its fields, rules, actions and @@ -1839,9 +1541,6 @@ export function DataPillar({ disabled: readOnly, publishNonce, }); - // objectstack#36511 — opening another object replaces the buffers the open - // object's unsaved edits live in, so the author is asked first, as every - // departure asks (objectstack#26705); nothing is sent by the switch. // objectstack#30088 — a base object's new actions are items of the pair; // objectstack#36511 — read and buffered here, as the hooks are. const pairDoor: PairActionsDoor | null = @@ -1856,35 +1555,6 @@ export function DataPillar({ } : null; const pairActions = usePairObjectActions(pairDoor, current?.name ?? '', viewMode === 'actions'); - const pageDirty = dirty || extDirty || hooksBuffer.dirty || pairActions.dirty; - const openObject = React.useCallback( - (next: Surface): boolean => { - if (next.name !== current?.name && !confirmDropUnsavedWork(pageDirty, locale)) return false; - setCurrent(next); - return true; - }, - [current, pageDirty, locale], - ); - // The live request's apply (see `requestedSurface` above). objectstack#26845 - // — another object's load replaces the buffer a held edit lives in, so it - // goes through the rail's own switch (`openObject`): an unsent edit is sent - // first, or the author is asked; declined, the request is spent and the - // edit stays. A request for the open object drops nothing and asks nothing. - React.useEffect(() => { - if (!requestedSurface || !objectsLoaded) return; - if (requestedSurface.id === appliedRequestRef.current) return; - appliedRequestRef.current = requestedSurface.id; - const match = resolveSurfaceDeepLink(objects, requestedSurface.target, 'object'); - if (!match) return; - openObject(match); - }, [requestedSurface, objects, objectsLoaded, openObject]); - // objectstack#26845 — a created object opens at once, and its load replaces - // the buffer a held edit lives in: asked before the dialog opens, so Cancel - // costs nothing and the create itself asks nothing. - const openCreateObject = () => { - if (!confirmDropUnsavedWork(objHeld !== null, locale)) return; - openCreateDialog(); - }; // objectui#12725 — the header's draft line reads the badge's ledger. const objDraftStatus = useStudioItemDraftStatus( current ? { type: 'object', name: current.name } : null, @@ -2068,30 +1738,20 @@ export function DataPillar({ const hostFieldRail = (rail: React.ReactElement): React.ReactNode => inSlot ? slotPropsTarget && createPortal(rail, slotPropsTarget) : rail; - // The object-level tabs (Data pillar): underline tabs in the item header. - // objectui#5813 — the 90% path is Records / Form (fields ARE the grid's - // columns, so a separate fields tab would ADD a surface, not remove one). - // objectui#12450 — the five power panels are flat tabs beside them when the - // content column has room, and fold back into one "Advanced" menu when it - // does not (maintainer ruling 2026-10-15, decision B of epic objectui#12446; - // the rule lives in `dataTabsFold.ts`). - const dataTabs: ReadonlyArray<{ key: typeof viewMode; label: string }> = [ - { key: 'grid', label: t('engine.studio.data.tab.records', locale) }, - { key: 'form', label: t('engine.studio.data.tab.form', locale) }, - ]; - const advancedDataTabs: ReadonlyArray<{ key: typeof viewMode; label: string }> = [ - { key: 'rules', label: t('engine.studio.data.tab.rules', locale) }, - { key: 'hooks', label: t('engine.studio.data.tab.hooks', locale) }, - { key: 'actions', label: t('engine.studio.data.tab.actions', locale) }, - { key: 'api', label: t('engine.studio.data.tab.api', locale) }, - { key: 'settings', label: t('engine.studio.data.tab.settings', locale) }, - ]; - const activeAdvancedTab = advancedDataTabs.find((tabDef) => tabDef.key === viewMode); + // The object's tabs, in #36513's order (`objectDesignerTabs.ts`): + // underline tabs in the item header. objectui#5813 — the 90% path is + // Records / Field layout (fields ARE the grid's columns). objectui#12450 — + // the five power panels are flat tabs beside them when the content column + // has room, and fold into "Advanced" when it does not, Hooks and API first + // (the rule lives in `dataTabsFold.ts`). + const dataTabs = OBJECT_DESIGNER_VIEWS.map((v) => ({ key: v.view, label: t(v.label, locale) })); + const advancedDataTabs = dataTabs.filter((tab) => !OBJECT_DESIGNER_ALWAYS_FLAT.includes(tab.key)); + const foldFirstTabs = advancedDataTabs.filter((tab) => OBJECT_DESIGNER_FOLD_FIRST.includes(tab.key)); // objectui#12450 — the Records grid draws flush with the content column. - const recordsFlush = Boolean(current) && objLoaded && viewMode === 'grid' && hasBaseline; + const recordsFlush = !toolTab && objLoaded && viewMode === 'grid' && hasBaseline; // objectui#12451 — so does the Form tab: its one toolbar row spans the // column, and the canvas below it carries its own padding. - const formFlush = Boolean(current) && objLoaded && viewMode === 'form'; + const formFlush = !toolTab && objLoaded && viewMode === 'form'; const bodyFlush = recordsFlush || formFlush; // objectui#12451 — the Form tab's compact Layout / Preview control (24 px // items). The caption that used to trail it is each item's title. @@ -2180,37 +1840,24 @@ export function DataPillar({ // the console's menu draws for it; the draft's, as it is being edited. const headerColor = objLoaded && typeof objDraft.color === 'string' ? (objDraft.color as string) : current?.color; - // objectui#12459 — the object's tab row lives in the item header (the - // skeleton's scaffold). objectui#12450 — seven flat tabs at a content column - // of `DATA_TABS_FOLD_WIDTH` and wider; narrower, the five power panels fold - // into "Advanced". Both forms are rendered and a container query on the - // content column displays exactly one of them (see `dataTabsFold.ts`). - // Folded, the trigger keeps its own name whichever panel is open - // (objectui#11794): renamed to the panel ("Validations ▾") it hid the one - // word that says sibling panels sit behind it. Where you are still shows - // twice — the trigger takes the active look while one of its panels is - // open, and the menu marks that panel as the checked radio item. - const dataTabRowEl = current ? ( - <> - {dataTabs.map((tab) => ( - selectViewMode(tab.key)}> - {tab.label} - - ))} - {advancedDataTabs.map((tab) => ( - selectViewMode(tab.key)} - className={DATA_TAB_FLAT_ONLY} - > - {tab.label} - - ))} + // objectui#12459 — the object's tab row lives in the item header. + // objectui#12450 — every view flat at a wide content column; narrower, + // Hooks and API fold into "Advanced", then the other three panels too. Every + // form is rendered and a container query on the content column displays + // exactly one of each (see `dataTabsFold.ts`); each trigger's menu holds what + // is folded at its width. Folded, the trigger keeps its own name whichever + // panel is open (objectui#11794): renamed to the panel ("Validations ▾") it + // hid the one word that says sibling panels sit behind it. Where you are + // still shows twice — the trigger takes the active look while one of its + // panels is open, and the menu marks that panel as the checked radio item. + // objectstack#36904 — the item tools follow as tabs (`ItemToolTabStrip`). + const viewActive = (key: ObjectDesignerView) => !toolTab && viewMode === key; + const advancedMenu = (tabs: typeof advancedDataTabs, testId: string, className: string) => { + const open = tabs.find((tab) => viewActive(tab.key)); + return ( - + {t('engine.studio.data.tab.advanced', locale)} @@ -2218,8 +1865,8 @@ export function DataPillar({ {/* The group only marks which item is checked; each item selects its own panel, as the plain items did. */} - - {advancedDataTabs.map((tab) => ( + + {tabs.map((tab) => ( selectViewMode(tab.key)}> {tab.label} @@ -2227,16 +1874,39 @@ export function DataPillar({ + ); + }; + const dataTabRowEl = ( + <> + {dataTabs.map((tab) => + OBJECT_DESIGNER_ALWAYS_FLAT.includes(tab.key) ? ( + selectViewMode(tab.key)}> + {tab.label} + + ) : ( + selectViewMode(tab.key)} + className={OBJECT_DESIGNER_FOLD_FIRST.includes(tab.key) ? DATA_TAB_FLAT_WIDE_ONLY : DATA_TAB_FLAT_ONLY} + > + {tab.label} + + ), + )} + {advancedMenu(foldFirstTabs, 'data-tabs-advanced-first', DATA_TAB_FOLDED_FIRST_ONLY)} + {advancedMenu(advancedDataTabs, 'data-tabs-advanced', DATA_TAB_FOLDED_ONLY)} + { + setFieldSel(null); + designerTab.selectTool({ tab }); + }} + locale={locale} + /> - ) : undefined; - - const objectNeedle = query.trim().toLowerCase(); - // objectstack#28572 — "only customizations" narrows the rail to its marked rows. - const markedObjects = railMarks ? objects.filter((o) => railMarks.markOf(o) !== null).length : 0; - const shownObjects = objects.filter( - (o) => - (!objectNeedle || o.label.toLowerCase().includes(objectNeedle) || o.name.toLowerCase().includes(objectNeedle)) && - (!onlyCustomized || railMarks?.markOf(o) != null), ); return ( @@ -2282,79 +1952,28 @@ export function DataPillar({ {extConflictDialog}
- {isMobile && railOpen && ( -
setRailOpen(false)} - aria-hidden="true" - /> - )} - - } - isMobile={isMobile} - open={railOpen} - > - {objects.length === 0 && ( -

- {error ? t('engine.studio.loadFailed', locale) : objectsLoaded ? t('engine.studio.data.noObjects', locale) : t('engine.studio.loading', locale)} -

- )} - {shownObjects.map((o) => { - const Icon = getIcon(o.icon); - return ( - { - // objectstack#26705, objectstack#27511 — another object's load - // replaces the buffer the open one's edits live in: they are - // sent first, or the author is asked (`openObject`). - if (openObject(o) && isMobile) setRailOpen(false); - }} - icon={} - trailing={} - > - {o.label} - - ); - })} -
-
- {/* objectui#12459 — the object header sits inside the content column, - over the thing it names, instead of spanning the rail. */} - 0 || extHasDraft || extDirty))) ? ( + customization !== null && extOpen !== null && (extOpen.published.size > 0 || extHasDraft || extDirty) ? ( ) : undefined } - leading={ - - } - icon={current ? HeaderIcon : undefined} - objectTile={current ? { color: headerColor } : undefined} - title={current ? current.label : t('engine.studio.data.objects', locale)} - // objectstack#34794 — the object's machine name is the title's - // tooltip, not a chip beside it: the header reads as the label - // the app shows, and the name stays one hover away. - titleProps={current ? { title: current.name } : { className: 'text-[13px] font-normal text-muted-foreground' }} - chips={current?.addedIn ? : undefined} - meta={current && objLoaded ? fieldCountText : undefined} + meta={objLoaded ? fieldCountText : undefined} status={objDraftStatus} - actions={ + primaryAction={ <> - {/* objectstack#28239 — the item tools Setup's item page opens. */} - {current && objLoaded && ( - { - setObjDraft(next); - setDirty(true); - }, - }} - onRolledBack={() => setObjReloadNonce((n) => n + 1)} - locale={locale} - /> - )} {/* objectui#12511 — the header holds no actions of its own, so - it reads the same on every tab. Object settings retired: the - Settings tab is that control. Add field is a field action, + it reads the same on every tab. Add field is a field action, offered where fields are laid out: the Form toolbar, the Records toolbar (objectstack#34794) and the Records grid's - own "+" column, all opening the Add field popover that - runs `addField` (objectui#12516). The - More menu went with it, since the header has no object-level - action left to put in one. */} - {/* objectui#12453 — on the Form tab it carries the layout's - read-only sentence the Layout control no longer does. */} + own "+" column (objectui#12516). The item tools are tabs. */} {/* objectstack#28575 — the ensure door refuses this caller: Add field draws disabled, in the console's own sentence. */} - {extendsBase && extWalled && objLoaded && !objIsExternal && (viewMode === 'grid' || viewMode === 'form') && ( + {extendsBase && extWalled && objLoaded && !objIsExternal && !toolTab && (viewMode === 'grid' || viewMode === 'form') && ( )} + {/* objectui#12453 — on the Form tab it carries the layout's + read-only sentence the Layout control no longer does. */} {readOnly && ( - {!current ? ( - objectsLoaded && objects.length === 0 ? ( - /* Fresh package: the first act is creating an object — say so and - * offer the creator right here (no auto-opened modal, dogfood #2555). */ -
-

{t('engine.studio.data.firstObjectTitle', locale)}

-

- {t('engine.studio.data.firstObjectHint', locale)} -

- {!(packageReadOnly && !newInPair) && ( - - )} -
- ) : ( -
{t('engine.studio.data.pickObject', locale)}
- ) + {toolTab ? ( + // objectstack#36904 — References, History and Source, as on every + // item page; Source edits the same buffer the Save sends. + designerTab.selectTool({ tab: toolTab.tab, view })} + type="object" + name={current.name} + packageId={packageId} + source={ + objLoaded + ? { + value: objDraft, + onChange: + objIsExternal || readOnly + ? undefined + : (next) => { + setObjDraft(next); + setDirty(true); + }, + } + : undefined + } + onRolledBack={!readOnly && canAuthor ? () => setObjReloadNonce((n) => n + 1) : undefined} + locale={locale} + className="min-h-0 flex-1 overflow-auto" + /> ) : ( <> {error && ( @@ -3056,73 +2638,6 @@ export function DataPillar({ )}
- - prefixObjectName(identifier, newObjectNamespace)} - extra={ - <> - {createTaken && ( - openTakenObject(createTaken.name) : undefined} - /> - )} - {/* Record sharing (OWD) — the third thing `New object` must ask for - (`7a90afdf9`). Without it the object saves as a draft happily and - is then REFUSED at Publish → Publish all by `security-owd-unset`, a - wall the author meets only after building the whole object. The - gloss is the SAME string the Settings tab shows for each model, so - the two surfaces cannot describe one baseline two ways. - - `controlled_by_parent` is absent on purpose — see OWD_CREATE_MODELS: - a just-created object has no master-detail field for it to derive - access from. */} - - - } - onSubmit={({ label, name }) => void doCreateObject(label, name, createOwd)} - />
); } diff --git a/ui/packages/app-shell/src/views/studio-design/dataTabsFold.ts b/ui/packages/app-shell/src/views/studio-design/dataTabsFold.ts index 2df2c8f67ab..f2018da8c96 100644 --- a/ui/packages/app-shell/src/views/studio-design/dataTabsFold.ts +++ b/ui/packages/app-shell/src/views/studio-design/dataTabsFold.ts @@ -1,37 +1,51 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * dataTabsFold — where the Data pillar's five power panels sit: flat in the - * object's tab row, or folded into "Advanced ▾" (objectui#12450, decision B of - * epic objectui#12446). + * dataTabsFold — where the object designer's five power panels sit: flat in + * the object's tab row, or folded into "Advanced ▾" (objectui#12450, decision + * B of epic objectui#12446). * - * The maintainer's ruling: seven flat tabs — Records, Form, Validations, - * Hooks, Actions, API, Settings — when the content column is at least - * {@link DATA_TABS_FOLD_WIDTH} px wide; narrower than that, the last five fold - * back into "Advanced ▾", whose trigger keeps its own name whichever panel is - * open (objectui#11794). + * The tab order is #36513's (section 一, kept by epic objectstack#36890): + * Records, Field layout, Validations, Actions, Settings, Hooks, API, business + * first and the technical two last. Records and Field layout are always flat. + * The other five fold in two steps, the technical two first: * - * The rule is a CSS container query on the pillar's content column, not a JS - * width read: the column narrows when the field inspector opens beside it or - * the copilot dock expands, and a container query answers those moves with no - * resize observer and no re-render. Both forms are in the DOM and exactly one - * of them is displayed at any width, so the folded form keeps its pins - * (`DataPillar.advancedKeepsName-11794.test.tsx`) and the flat form has its - * own (`DataPillar.flatTabs-12450.test.tsx`). + * - at {@link DATA_TABS_FOLD_FIRST_WIDTH} px and wider, all five are flat; + * - below it, Hooks and API fold into "Advanced ▾" + * ({@link DATA_TAB_FOLDED_FIRST_ONLY}); + * - below {@link DATA_TABS_FOLD_WIDTH} px, all five do ({@link DATA_TAB_FOLDED_ONLY}). * - * The class strings are literals, not built from the number: Tailwind finds a + * The trigger keeps its own name whichever panel is open (objectui#11794). + * + * The rule is a CSS container query on the designer's content column, not a + * JS width read: the column narrows when the field inspector opens beside it + * or the copilot dock expands, and a container query answers those moves with + * no resize observer and no re-render. Every form is in the DOM and exactly + * one of each is displayed at any width; each "Advanced ▾" trigger carries its + * own menu, so a menu lists only what is folded at that width. + * + * The class strings are literals, not built from the numbers: Tailwind finds a * class by scanning source text, so a template literal would generate no CSS. - * The flat-tab pin checks that both strings name {@link DATA_TABS_FOLD_WIDTH}. + * The flat-tab pin checks that the strings name the two widths. */ -/** The content-column width (px) at and above which the five panels are flat tabs. */ +/** The content-column width (px) at and above which Validations, Actions and Settings are flat tabs. */ export const DATA_TABS_FOLD_WIDTH = 1000; -/** On the pillar's content column: the container the two classes below measure. */ +/** The content-column width (px) at and above which Hooks and API are flat tabs too. */ +export const DATA_TABS_FOLD_FIRST_WIDTH = 1200; + +/** On the designer's content column: the container the classes below measure. */ export const DATA_CONTENT_CONTAINER = '@container'; -/** On each of the five flat tabs: not displayed below the fold width, an inline flex at and above it. */ +/** On Validations, Actions and Settings: not displayed below the fold width, an inline flex at and above it. */ export const DATA_TAB_FLAT_ONLY = 'hidden @min-[1000px]:inline-flex'; -/** On the "Advanced ▾" trigger: displayed below the fold width, not displayed at and above it. */ +/** On Hooks and API: not displayed below the first fold width, an inline flex at and above it. */ +export const DATA_TAB_FLAT_WIDE_ONLY = 'hidden @min-[1200px]:inline-flex'; + +/** On the "Advanced ▾" trigger that holds all five: displayed below the fold width only. */ export const DATA_TAB_FOLDED_ONLY = '@min-[1000px]:hidden'; + +/** On the "Advanced ▾" trigger that holds Hooks and API: displayed between the two widths only. */ +export const DATA_TAB_FOLDED_FIRST_ONLY = 'hidden @min-[1000px]:inline-flex @min-[1200px]:hidden'; diff --git a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts new file mode 100644 index 00000000000..f3ba88cb0f4 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts @@ -0,0 +1,111 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * The object designer's tabs and their address (objectstack#36904, epic + * objectstack#36890; #36513 section 一). + * + * The designer's own views come first, in #36513's order: Records, Field + * layout, Validations, Actions, Settings, Hooks, API (`dataTabsFold.ts` folds + * Hooks and API first). The item tools follow as tabs of the same row + * (epic decision 8, `ItemToolTabs`): References, History (its audit log + * inside it) and Source (its layered comparison inside it). + * + * The open tab is in the address, `?tab=` (the console's reserved `tab`, the + * key the generic item page writes), so a refresh, a shared link or ‹ › reopens + * it. Records is the default and writes nothing. A tool tab writes the + * `ItemToolTabs` value (`history`, `audit`, `source`, `layers`, `references`), + * so `/history` on the area's history address lands on History here as on + * every item page. + */ + +import * as React from 'react'; +import { useSearchParams } from 'react-router-dom'; +import { + ITEM_TOOL_TAB_PARAM, + itemToolAddress, + readItemToolLocation, + type ItemToolLocation, + type ItemToolTab, +} from '../item-tools/ItemToolTabs.js'; + +/** A view of the designer's own (the buffer it edits is the same object for all of them). */ +export type ObjectDesignerView = 'grid' | 'form' | 'rules' | 'actions' | 'settings' | 'hooks' | 'api'; + +/** The designer's views in #36513's order, each with its address value and label key. */ +export const OBJECT_DESIGNER_VIEWS: ReadonlyArray<{ view: ObjectDesignerView; address: string; label: string }> = [ + { view: 'grid', address: 'records', label: 'engine.studio.data.tab.records' }, + { view: 'form', address: 'layout', label: 'engine.studio.data.tab.form' }, + { view: 'rules', address: 'validations', label: 'engine.studio.data.tab.rules' }, + { view: 'actions', address: 'actions', label: 'engine.studio.data.tab.actions' }, + { view: 'settings', address: 'settings', label: 'engine.studio.data.tab.settings' }, + { view: 'hooks', address: 'hooks', label: 'engine.studio.data.tab.hooks' }, + { view: 'api', address: 'api', label: 'engine.studio.data.tab.api' }, +]; + +/** The views that are always flat; the rest fold (`dataTabsFold.ts`). */ +export const OBJECT_DESIGNER_ALWAYS_FLAT: readonly ObjectDesignerView[] = ['grid', 'form']; + +/** The views folded first at a narrow width: the technical two. */ +export const OBJECT_DESIGNER_FOLD_FIRST: readonly ObjectDesignerView[] = ['hooks', 'api']; + +/** The item tools the designer offers as tabs, after its own views. */ +export const OBJECT_DESIGNER_TOOL_TABS: readonly ItemToolTab[] = ['references', 'history', 'source']; + +/** Where the designer is open: one of its views, or an item tool. */ +export type ObjectDesignerLocation = { view: ObjectDesignerView; tool: null } | { view: 'grid'; tool: ItemToolLocation }; + +/** The location an address value names, or Records for a value that opens nothing here. */ +export function readObjectDesignerTab(raw: string | null | undefined, tools: readonly ItemToolTab[]): ObjectDesignerLocation { + const own = OBJECT_DESIGNER_VIEWS.find((v) => v.address === raw); + if (own) return { view: own.view, tool: null }; + const tool = readItemToolLocation(raw, tools); + return tool ? { view: 'grid', tool } : { view: 'grid', tool: null }; +} + +/** The address value of a location, `null` on the default (Records). */ +export function objectDesignerTabAddress(location: ObjectDesignerLocation): string | null { + if (location.tool) return itemToolAddress(location.tool); + return location.view === 'grid' ? null : (OBJECT_DESIGNER_VIEWS.find((v) => v.view === location.view)?.address ?? null); +} + +export interface ObjectDesignerTabState { + location: ObjectDesignerLocation; + /** The `?tab=` value in force, `null` on Records. */ + address: string | null; + selectView: (view: ObjectDesignerView) => void; + selectTool: (tool: ItemToolLocation) => void; +} + +/** + * The open tab, seeded from the address and written back to it (replace), as + * `useItemToolTab` does for the generic item page: read in the initializer, + * written with `history.replaceState`, re-written after a router navigation + * drops it. A tool tab not offered to this caller (History without the trail + * capabilities) opens Records. + */ +export function useObjectDesignerTab(tools: readonly ItemToolTab[]): ObjectDesignerTabState { + const [choice, setChoice] = React.useState(() => + typeof window === 'undefined' ? null : new URLSearchParams(window.location.search).get(ITEM_TOOL_TAB_PARAM), + ); + const location = readObjectDesignerTab(choice, tools); + const address = objectDesignerTabAddress(location); + + const [searchParams] = useSearchParams(); + const routerSearch = searchParams.toString(); + React.useEffect(() => { + if (typeof window === 'undefined') return; + const url = new URL(window.location.href); + if ((url.searchParams.get(ITEM_TOOL_TAB_PARAM) ?? null) === address) return; + if (address) url.searchParams.set(ITEM_TOOL_TAB_PARAM, address); + else url.searchParams.delete(ITEM_TOOL_TAB_PARAM); + window.history.replaceState(window.history.state, '', url.toString()); + }, [address, routerSearch]); + + const selectView = React.useCallback((view: ObjectDesignerView) => { + setChoice(objectDesignerTabAddress({ view, tool: null })); + }, []); + const selectTool = React.useCallback((tool: ItemToolLocation) => { + setChoice(itemToolAddress(tool)); + }, []); + return { location, address, selectView, selectTool }; +} From 0ac0cc0a639f6e1dddb8169a73abc13a3410d8b4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 17:52:43 +0000 Subject: [PATCH 02/18] wip(studio): mount the object designer on its metadata address; redirect the Data pillar Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- ui/packages/app-shell/src/utils/appRoute.ts | 20 ++---- .../app-shell/src/views/RecordTabsConfig.tsx | 2 +- .../studio-design/StudioDesignSurface.tsx | 61 ++++++++++-------- .../studio-design/StudioMetadataArea.tsx | 64 ++++++++++++++++--- .../src/views/studio-design/metadataArea.ts | 37 +++++++++++ .../src/views/studio-design/studioAddress.ts | 19 ++++-- .../views/studio-design/studioAddressTable.ts | 3 + .../views/studio-design/studioMenuModel.ts | 8 ++- .../studio-design/switchedOffActionTargets.ts | 11 ++-- 9 files changed, 163 insertions(+), 62 deletions(-) diff --git a/ui/packages/app-shell/src/utils/appRoute.ts b/ui/packages/app-shell/src/utils/appRoute.ts index 74f1cf2f9de..e69d601fae8 100644 --- a/ui/packages/app-shell/src/utils/appRoute.ts +++ b/ui/packages/app-shell/src/utils/appRoute.ts @@ -292,16 +292,12 @@ export function appStudioSurfacePath( } /** - * Deep-link from a running app straight to a specific **object's** design - * surface in Studio's Data pillar — e.g. viewing the `account` records page - * opens `/studio/:packageId/data?surface=object:account`, which the Data - * pillar's `?surface=` restore honors (see `DataPillar` in - * `StudioDesignSurface`). Same admin/package guards as - * {@link appStudioDesignPath}; returns null when the object name is missing so - * the caller can fall back to the plain Data tab. - * - * The `surface` param value is `object:`; only the name is - * percent-encoded (`object` is a fixed keyword). + * Deep-link from a running app straight to a specific **object's** designer + * in Studio — e.g. viewing the `account` records page opens + * `/studio/:packageId/metadata/object/account`, the object designer + * full-screen on its own address (objectstack#36904). Same admin/package + * guards as {@link appStudioDesignPath}; returns null when the object name is + * missing so the caller can fall back. */ export function appStudioObjectPath( app: AppRouteLike | null | undefined, @@ -312,9 +308,7 @@ export function appStudioObjectPath( const packageId = studioPackageId(app); if (!packageId) return null; if (!objectName) return null; - // The `'name'` spelling (`object:` as written, the name encoded), as this - // bridge has always spelled it. - return studioItemPath(packageId, 'object', objectName, { spelling: 'name' }); + return studioItemPath(packageId, 'object', objectName); } /** diff --git a/ui/packages/app-shell/src/views/RecordTabsConfig.tsx b/ui/packages/app-shell/src/views/RecordTabsConfig.tsx index d320166d037..173e197db8c 100644 --- a/ui/packages/app-shell/src/views/RecordTabsConfig.tsx +++ b/ui/packages/app-shell/src/views/RecordTabsConfig.tsx @@ -105,7 +105,7 @@ export function objectPackageId(objectDef: RecordTabsObjectDef | null | undefine */ export type RecordTabsMode = 'own' | 'pair'; -/** Where 「Adjust field groups」 goes: the object in Studio's Data pillar. */ +/** Where 「Adjust field groups」 goes: the object's designer in Studio. */ export function recordTabsStudioPath(objectDef: RecordTabsObjectDef | null | undefined): string | null { const packageId = objectPackageId(objectDef); const name = objectDef?.name; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 4051b0f6fa9..406be554053 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -132,7 +132,7 @@ import { isStudioOrgScope, studioOrgScopePath, } from './studioScope.js'; -import { STUDIO_METADATA_AREA, isStudioAllPackagesScope } from './metadataArea.js'; +import { STUDIO_METADATA_AREA, dataPillarRedirect, isStudioAllPackagesScope } from './metadataArea.js'; import { StudioMenu, StudioMenuProvider, StudioMenuTrigger } from './StudioMenu.js'; import { StudioMetadataArea } from './StudioMetadataArea.js'; import { useMetadataRefreshNonce } from './useMetadataRefreshNonce.js'; @@ -170,7 +170,7 @@ import { type DraftPublishOptions, } from '../../preview/DraftChangesPanel.js'; import { toast } from 'sonner'; -import { studioPillarItemAddress, studioPillarPath } from './studioAddress.js'; +import { studioItemPath, studioPillarItemAddress, studioPillarPath } from './studioAddress.js'; /** The batch door's `backfillApplied` receipt, by reference to what the client returns (objectui#12929). */ type PublishBackfillReceipt = NonNullable< @@ -198,13 +198,15 @@ function formatBackfillReceipt(receipt: PublishBackfillReceipt, locale: string): // The pillar segments `/studio//` serves. objectstack#36899 // (ADR-0084, amended) — they are no longer a navigation: Studio's one -// navigation is the left menu (`StudioMenu`), and these pages are where an -// object, a flow or a permission set opens until each becomes a full-screen -// item page. Data stays the Studio home. objectstack#36502 — the Interfaces -// pillar is retired (`studioInterfacesRetired.tsx`). The "All metadata" area +// navigation is the left menu (`StudioMenu`), and these pages are where a +// flow or a permission set opens until each becomes a full-screen item page. +// objectstack#36904 — the Data pillar is retired: an object opens its designer +// on its metadata address, and `/data` redirects (`dataPillarRedirect`). +// objectstack#36502 — the Interfaces pillar is retired +// (`studioInterfacesRetired.tsx`). The "All metadata" area // (`/studio//metadata/…`, `metadataArea.ts`) is not a pillar, so the // not-found check does not hold it. -const PILLARS: readonly string[] = [STUDIO_HOME_PILLAR, 'automations', 'access']; +const PILLARS: readonly string[] = ['automations', 'access']; // objectstack#29988 — the pillar kit moved to its own module; re-exported for its pins. export { StudioHeldNotice, StudioReadOnlyLink, type StudioBaseCustomization }; @@ -217,7 +219,6 @@ export { StudioHeldNotice, StudioReadOnlyLink, type StudioBaseCustomization }; * buys nothing. */ const PILLAR_FOR_SURFACE_TYPE: Readonly> = { - object: 'data', flow: 'automations', permission: 'access', }; @@ -267,6 +268,13 @@ export function StudioDesignSurface(props: StudioDesignSurfaceProps): React.Reac const scope = customizationPairBaseOf(params.packageId ?? null) ?? params.packageId ?? 'com.example.showcase'; return ; } + // objectstack#36904 — the retired Data pillar (Studio's old home, and the + // old object address) lands on the object list or the object's designer, a + // pair's in its own area (`dataPillarRedirect`). + const segment = params.packageId ?? ''; + if (!props.area && params.tab === STUDIO_HOME_PILLAR && segment && !isStudioOrgScope(segment) && !isStudioAllPackagesScope(segment)) { + return ; + } const pairBase = props.area ? null : customizationPairBaseOf(params.packageId ?? null); if (pairBase !== null) { const tab = params.tab ?? STUDIO_HOME_PILLAR; @@ -1199,8 +1207,19 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re * * Either way the sheet closes: a selection nobody can see is not navigation. */ + const currentPathname = useLocation().pathname; const requestSurface = React.useCallback( (target: SurfaceTarget): boolean | void => { + // objectstack#36904 — an object is its designer's own address. + if (target.type === 'object' && packageId !== null) { + const to = studioItemPath(packageId, 'object', target.name); + if (to !== currentPathname) { + if (!confirmLeavePillar()) return false; + shellNavigate(to); + } + setChangesOpen(false); + return; + } const pillar = PILLAR_FOR_SURFACE_TYPE[target.type]; // objectui#11553 — the package-less scope has one pillar; a surface // owned by another is not in this scope, so nothing to navigate to. @@ -1211,7 +1230,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re } setChangesOpen(false); }, - [tab, allScope, packageId, scopeSegment, confirmLeavePillar, shellNavigate], + [tab, allScope, packageId, scopeSegment, confirmLeavePillar, shellNavigate, currentPathname], ); // objectstack#36899 — a menu entry that re-enters the open pillar on another // `?surface=` (the default sharing overview, on the Access pillar) opens the @@ -1223,7 +1242,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re // pillar remounted before it would capture the old deep link. const [pillarEntry, setPillarEntry] = React.useState(0); const reentryPending = React.useRef(false); - const currentSearch = useLocation().search; + const { search: currentSearch } = useLocation(); const reenterPillar = React.useCallback((): boolean => { if (!confirmLeavePillar()) return false; reentryPending.current = true; @@ -1529,21 +1548,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re publishNonce={publishNonce} onDraftSaved={onDraftSaved} publishRefusalFor={publishRefusalFor} - /> - ) : !pillarKnown ? ( - - ) : tab === 'data' ? ( - { @@ -1551,6 +1556,12 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re setChangesOpen(true); }} /> + ) : !pillarKnown ? ( + ) : tab === 'automations' ? ( /_diagnostics diagnostics * /:type a type's list * /:type/new create (a writable package only) - * /:type/:name the generic item page, the item's pillar, or - * the form editor of an email template or a - * translation (`StudioBundleItemEditor`, #28569), - * and of a read-only package's dataset (#30064) + * /:type/:name the generic item page, the item's pillar, the + * object designer (#36904), or the form editor + * of an email template or a translation + * (`StudioBundleItemEditor`, #28569), and of a + * read-only package's dataset (#30064) * /:type/:name/history the item's history: its History tab * (`?tab=history`), the old address redirected; * the history page for a type with an editor of @@ -46,11 +47,14 @@ import { fetchListedPackageManifests } from './packages-io.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, areaItemOpensFormEditor, + areaItemOpensObjectDesigner, areaItemPillarPath, areaLocationRedirect, studioMetadataAreaPath, } from './metadataArea.js'; import { StudioBundleItemEditor } from './StudioBundleItemEditor.js'; +import { DataPillar } from './DataPillar.js'; +import type { StudioSurfaceLabel } from './StudioAiCopilot.js'; import { BUNDLE_MEMBER_PARAM, getMetadataResource } from '../metadata-admin/registry.js'; import { ITEM_TOOL_TAB_PARAM } from '../item-tools/ItemToolTabs.js'; import type { StudioBaseCustomization } from './StudioDesignSurface.js'; @@ -130,10 +134,16 @@ interface AreaEditorProps { publishNonce: number; onDraftSaved?: (saved?: { type: string; name: string }) => void; publishRefusalFor?: (type: string, name: string) => StudioRefusal | null; + /** objectstack#36904 — the object designer's reports to the surface: its held edit and the copilot's chip. */ + onHeldEditChange?: (clause: string | null) => void; + onSurfaceLabelChange?: (surface: StudioSurfaceLabel | null) => void; + /** The object designer's copilot-changes line opens the surface's Changes. */ + onReviewChanges?: () => void; } /** - * `/:type/:name`: a pillar type opens its pillar, an email template or a + * `/:type/:name`: a pillar type opens its pillar, an object the object + * designer (`areaItemOpensObjectDesigner`), an email template or a * translation the form editor (`areaItemOpensFormEditor`), every other type * the generic item page (`areaItemPillarPath` lists when). * @@ -164,10 +174,29 @@ function AreaItemOpen({ const host = useMetadataAreaHost(); const [opens] = React.useState(() => { const at = { packageId: host?.packageId ?? null, type, search }; - if (areaItemOpensFormEditor({ ...at, readOnly: host?.readOnly === true })) return { formEditor: true, pillarPath: null }; - return { formEditor: false, pillarPath: areaItemPillarPath({ ...at, name }) }; + if (areaItemOpensObjectDesigner(at)) return { designer: true, formEditor: false, pillarPath: null }; + if (areaItemOpensFormEditor({ ...at, readOnly: host?.readOnly === true })) return { designer: false, formEditor: true, pillarPath: null }; + return { designer: false, formEditor: false, pillarPath: areaItemPillarPath({ ...at, name }) }; }); if (opens.pillarPath) return ; + if (opens.designer && host?.packageId) { + // objectstack#36904 — the object designer, full-screen on the object's address. + return ( +
+ +
+ ); + } if (opens.formEditor && host?.packageId) { return ( (); @@ -295,6 +326,10 @@ export interface StudioMetadataAreaProps { * at the item it refused. */ publishRefusalFor?: (type: string, name: string) => StudioRefusal | null; + /** objectstack#36904 — handed to the object designer (`AreaEditorProps`). */ + onHeldEditChange?: (clause: string | null) => void; + onSurfaceLabelChange?: (surface: StudioSurfaceLabel | null) => void; + onReviewChanges?: () => void; } export function StudioMetadataArea({ @@ -303,6 +338,9 @@ export function StudioMetadataArea({ publishNonce = 0, onDraftSaved, publishRefusalFor, + onHeldEditChange, + onSurfaceLabelChange, + onReviewChanges, }: StudioMetadataAreaProps): React.ReactElement { const { pathname, search } = useLocation(); const locale = useMetadataLocale(); @@ -321,7 +359,15 @@ export function StudioMetadataArea({ () => ({ packageId, readOnly, basePath, ...(pairCreate ? { pairCreate } : {}) }), [packageId, readOnly, basePath, pairCreate], ); - const editor: AreaEditorProps = { customization, publishNonce, onDraftSaved, publishRefusalFor }; + const editor: AreaEditorProps = { + customization, + publishNonce, + onDraftSaved, + publishRefusalFor, + onHeldEditChange, + onSurfaceLabelChange, + onReviewChanges, + }; // The query names the leg (`areaLocationRedirect`). Settled before any page // mounts, so no page reads a scope the URL is about to change. diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 73395992479..1712798961e 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -35,6 +35,7 @@ */ import { CATALOG_SCOPE_PARAM, ENVIRONMENT_SCOPE } from '../metadata-admin/catalog-scope.js'; +import { DESIGNER_SURFACE_PARAM, parseSurfaceParam } from '../metadata-admin/nav-selection.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, STUDIO_ITEM_PILLAR, @@ -44,9 +45,11 @@ import { studioMetadataAreaAddress, studioMetadataAreaRoot, studioMetadataItemAddress, + studioMetadataTypePath, studioPillarItemAddress, type StudioPillarKey, } from './studioAddress.js'; +import { DESIGNER_SURFACE_NAV_PARAM, DESIGNER_SURFACE_VIEW_PARAM } from './useSurfaceDeepLink.js'; import { isStudioOrgScope, studioOrgScopePath } from './studioScope.js'; // objectstack#36895 — the area's segments are Studio address vocabulary, owned @@ -112,6 +115,40 @@ export function areaItemPillarPath(input: { return studioPillarItemPath(input.packageId, pillar, { type: input.type, name: input.name }); } +/** + * objectstack#36904 (ADR-0146 D1 as amended) — whether an item of the area + * opens the object designer, full-screen on its own address: an object, on a + * package's leg, under the same exceptions as {@link areaItemPillarPath} (the + * cross-package leg and the environment scope name no package to design in, + * and `?review=1` opens the generic page's draft review). + */ +export function areaItemOpensObjectDesigner(input: { packageId: string | null; type: string; search: URLSearchParams }): boolean { + if (input.type !== 'object' || !input.packageId) return false; + if (input.search.get(CATALOG_SCOPE_PARAM) === ENVIRONMENT_SCOPE) return false; + return input.search.get(STUDIO_ITEM_REVIEW_PARAM) !== STUDIO_ITEM_REVIEW_VALUE; +} + +/** + * objectstack#36904 — where the retired Data pillar's address lands + * (`/studio//data`, Studio's old home): the object designer of the + * object its `?surface=object:` names, or else the package's object + * list. The pillar's own qualifiers go (`?surface=`, and `?view=` and `?nav=`, + * which opened nothing on an object); everything else is kept verbatim — + * `?action=` (the designer opens its Actions tab on it) and `?changes=review` + * (the server's draft review link, `studioChangesReviewLink`). + * + * `search` is the URL's query, with or without its `?`. + */ +export function dataPillarRedirect(packageId: string, search: string): string { + const params = new URLSearchParams(search); + const target = parseSurfaceParam(params.get(DESIGNER_SURFACE_PARAM)); + for (const key of [DESIGNER_SURFACE_PARAM, DESIGNER_SURFACE_VIEW_PARAM, DESIGNER_SURFACE_NAV_PARAM]) params.delete(key); + if (target?.type === 'object' && target.name) return studioMetadataItemAddress(packageId, 'object', target.name, { query: params }); + const list = studioMetadataTypePath(packageId, 'object'); + const query = params.toString(); + return query ? `${list}?${query}` : list; +} + /** * objectstack#28569 (ADR-0146 Consequences) — the types whose item opens the * area's simplified form editor (`StudioBundleItemEditor`): the fields Setup's diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts index 90c076380c7..63594ce4e9f 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.ts @@ -96,9 +96,11 @@ export type StudioPillarKey = 'data' | 'automations' | 'access'; * * objectstack#36502 — pages, dashboards, reports and views have no pillar * since the Interfaces pillar retired. + * + * objectstack#36904 — an object opens its designer on its metadata address; + * the old `/data?surface=object:` redirects there (`dataPillarRedirect`). */ export const STUDIO_ITEM_PILLAR: Readonly> = Object.freeze({ - object: 'data', flow: 'automations', permission: 'access', }); @@ -234,7 +236,11 @@ export function studioSurfaceQuery( export interface StudioItemOptions { /** How the `?surface=` value is written, when the item opens a pillar. Default `'component'`. */ spelling?: StudioSurfaceSpelling; - /** Qualifiers after `?surface=`, when the item opens a pillar: `action`, `view`, `nav`. */ + /** + * Qualifiers after `?surface=`, when the item opens a pillar: `action`, + * `view`, `nav`. On the metadata address they are its query + * (objectstack#36904: `?action=` opens the object designer's Actions tab on it). + */ qualifiers?: Readonly>; /** How the scope segment is written. Default `'component'`. */ segmentEncoding?: StudioSegmentEncoding; @@ -287,13 +293,16 @@ export function studioMetadataItemAddress(segment: string, type: string, name: s /** * Where one item of a package opens today: its pillar on a `?surface=` deep * link when {@link STUDIO_ITEM_PILLAR} names one for its type, otherwise its - * page in the "All metadata" area. `spelling` and `qualifiers` apply to the - * pillar address only. + * page in the "All metadata" area. `spelling` applies to the pillar address + * only; `qualifiers` are the metadata address's query. */ export function studioItemPath(packageId: string, type: string, name: string, options: StudioItemOptions = {}): string { const pillar = studioItemPillar(type); if (pillar) return studioPillarItemAddress(packageId, pillar, { type, name }, options); - return studioMetadataItemAddress(packageId, type, name, { segmentEncoding: options.segmentEncoding }); + return studioMetadataItemAddress(packageId, type, name, { + segmentEncoding: options.segmentEncoding, + query: options.qualifiers ? new URLSearchParams(options.qualifiers as Record) : null, + }); } // --------------------------------------------------------------------------- diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts index c4730e3adb9..dfcbb76deb8 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts @@ -135,6 +135,9 @@ export interface StudioItemTypeRow { export const STUDIO_ITEM_TYPES: readonly StudioItemTypeRow[] = Object.freeze([ { + // objectstack#36904 — switched: an object opens on its metadata address, + // and this pillar address redirects there (`dataPillarRedirect`), keeping + // `?action=` as the designer's query and dropping `?view=` and `?nav=`. type: 'object', pillar: 'data', surface: 'object:', diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts index 8b56aa389bb..47c154d2866 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.ts @@ -62,8 +62,12 @@ export const STUDIO_MENU_COOKIE = 'studio_menu_state'; export const STUDIO_MENU_GROUPS = ['data', 'ui', 'automation', 'system', 'security', 'ai'] as const; export type StudioMenuGroup = (typeof STUDIO_MENU_GROUPS)[number]; -/** The types a designer creates in: listed on every package, holding one or not. */ -export const STUDIO_MENU_DESIGNER_TYPES: readonly string[] = Object.keys(AREA_PILLAR_FOR_TYPE); +/** + * The types a designer creates in: listed on every package, holding one or not. + * objectstack#36904 — the object's designer is on its metadata address, no + * longer a pillar's, and it is still listed first. + */ +export const STUDIO_MENU_DESIGNER_TYPES: readonly string[] = ['object', ...Object.keys(AREA_PILLAR_FOR_TYPE)]; /** The OWD overview's address on the Access pillar (`AccessPillar`'s deep link). */ const OWD_OVERVIEW_SURFACE = { type: 'owd', name: 'overview' } as const; diff --git a/ui/packages/app-shell/src/views/studio-design/switchedOffActionTargets.ts b/ui/packages/app-shell/src/views/studio-design/switchedOffActionTargets.ts index e1a33c0c857..18e459eaa03 100644 --- a/ui/packages/app-shell/src/views/studio-design/switchedOffActionTargets.ts +++ b/ui/packages/app-shell/src/views/studio-design/switchedOffActionTargets.ts @@ -7,8 +7,8 @@ * * - An action an object holds (its served `actions[]`, which carries the * actions declared inside the object and the top-level ones bound to it by - * `objectName`) is switched on the object's Actions view in the Data - * pillar: `?surface=object:&action=` opens that view on it. + * `objectName`) is switched on the object designer's Actions tab: + * `/metadata/object/?action=` opens that tab on it. * An action declared inside its object has no item of its own, so this is * the only page that shows it. * - Any other action (one bound to no object) is a standalone `action` item: @@ -57,11 +57,8 @@ export async function readActionObjects(client: ActionObjectClient, packageId: s */ export function switchedOffActionPath(packageId: string, name: string, object: string | null | undefined): string { if (object) { - // `URLSearchParams` serialisation, as this link has always been spelled. - return studioItemPath(packageId, 'object', object, { - spelling: 'form', - qualifiers: { [DESIGNER_SURFACE_ACTION_PARAM]: name }, - }); + // objectstack#36904 — `?action=` on the object designer's address. + return studioItemPath(packageId, 'object', object, { qualifiers: { [DESIGNER_SURFACE_ACTION_PARAM]: name } }); } return studioItemPath(packageId, 'action', name); } From 7417c314515918903440e53c2aca66b48bd3cbc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 17:54:43 +0000 Subject: [PATCH 03/18] wip(studio): pin the object designer's tab order, address and redirect Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../CommandPalette.studioScope-11863.test.tsx | 2 +- .../__tests__/SidebarAppMenu-36112.test.tsx | 4 +- .../__tests__/SidebarItemMenu-12427.test.tsx | 4 +- ...rItemMenu.designAsksUnsaved-13231.test.tsx | 2 +- ...rItemMenu.designOpensStudio-12520.test.tsx | 6 +- ...nifiedSidebar.favoritesMenu-12427.test.tsx | 4 +- .../src/utils/__tests__/appRoute.test.ts | 13 +-- ...HeaderChrome.objectSettings-36487.test.tsx | 2 +- ...ewPageHeader.objectSettings-36487.test.tsx | 4 +- ...Landing.customizationCounts-28566.test.tsx | 6 +- ...erLanding.envCustomizations-34714.test.tsx | 2 +- .../DataPillar.flatTabs-12450.test.tsx | 103 ++++++++++-------- .../views/studio-design/metadataArea.test.ts | 41 ++++++- .../studio-design/objectDesignerTabs.test.ts | 57 ++++++++++ .../views/studio-design/studioAddress.test.ts | 17 ++- .../studio-design/studioMenuModel.test.ts | 3 +- 16 files changed, 188 insertions(+), 82 deletions(-) create mode 100644 ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx index 7bb1cda2ac8..d697a04cb44 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx @@ -200,7 +200,7 @@ describe('the palette in the `studio` scope lists the Studio, not an app (object mountStudio(); await studioListed(); pick('studio-object Account '); - await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.crm/data?surface=object%3Acrm_account')); + await waitFor(() => expect(locationNow()).toBe('/studio/com.acme.crm/metadata/object/crm_account')); }); it("opens a packaged flow in its package's Automations pillar, on that flow", async () => { diff --git a/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx b/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx index 6c95e33cd90..4ea6a9d0f07 100644 --- a/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/SidebarAppMenu-36112.test.tsx @@ -402,7 +402,7 @@ describe('「Edit app」 in the app menu opens this app in Studio (objectstack#3 expect(item).toHaveTextContent(/^Edit app$/); expect(item!.querySelector('svg.lucide-pencil')).not.toBeNull(); // The app switcher's target: the object route opens the package's Data tab on that object. - expect(item).toHaveAttribute('href', '/studio/com.acme.crm/data?surface=object:crm_lead'); + expect(item).toHaveAttribute('href', '/studio/com.acme.crm/metadata/object/crm_lead'); expect(viewInStudio()).toBeNull(); }); @@ -419,7 +419,7 @@ describe('「Edit app」 in the app menu opens this app in Studio (objectstack#3 expect(item).not.toBeNull(); expect(item).toHaveTextContent(/^View in Studio$/); expect(item!.querySelector('svg.lucide-eye')).not.toBeNull(); - expect(item).toHaveAttribute('href', '/studio/com.acme.crm/data?surface=object:crm_lead'); + expect(item).toHaveAttribute('href', '/studio/com.acme.crm/metadata/object/crm_lead'); }); it('it is drawn with no shell holding the design mode: its gate is Studio\'s, not the mode\'s', async () => { diff --git a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu-12427.test.tsx b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu-12427.test.tsx index 6bfabf69b15..4f573a7d39a 100644 --- a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu-12427.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu-12427.test.tsx @@ -181,7 +181,7 @@ describe('SidebarItemMenu: what each entry does (objectui#12427)', () => { await openMenu(); fireEvent.click(screen.getByRole('menuitem', { name: 'Object settings' })); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.crm/data?surface=object:crm_lead'), + expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.crm/metadata/object/crm_lead'), ); }); @@ -248,7 +248,7 @@ describe('SidebarItemMenu: right-click (objectui#12427)', () => { describe('sidebarItemDesignPath: only an object entry has a Studio entry (objectui#12520, objectstack#36487)', () => { it('an object entry opens its object in the Data surface', () => { - expect(sidebarItemDesignPath(LEADS, APP)).toBe('/studio/com.acme.crm/data?surface=object:crm_lead'); + expect(sidebarItemDesignPath(LEADS, APP)).toBe('/studio/com.acme.crm/metadata/object/crm_lead'); }); it('a dashboard, page or report entry has none: each is edited on its own page', () => { diff --git a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designAsksUnsaved-13231.test.tsx b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designAsksUnsaved-13231.test.tsx index 693db91d594..ee7a2dd16bb 100644 --- a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designAsksUnsaved-13231.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designAsksUnsaved-13231.test.tsx @@ -52,7 +52,7 @@ import { registerUnsavedEdits } from '../../chrome/unsavedEdits'; const BASE_PATH = '/apps/crm'; const APP = { name: 'crm', _packageId: 'com.acme.crm' }; const LEADS = { id: 'nav_leads', type: 'object', objectName: 'crm_lead', label: 'Leads' } as NavigationItem; -const STUDIO = '/studio/com.acme.crm/data?surface=object:crm_lead'; +const STUDIO = '/studio/com.acme.crm/metadata/object/crm_lead'; const QUESTION = 'You have unsaved changes. Are you sure you want to leave?'; function Where() { diff --git a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designOpensStudio-12520.test.tsx b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designOpensStudio-12520.test.tsx index a8b37fabb98..5f03d163768 100644 --- a/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designOpensStudio-12520.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/SidebarItemMenu.designOpensStudio-12520.test.tsx @@ -233,7 +233,7 @@ afterEach(() => { describe('a navigation entry\'s Object settings opens what the app bar\'s Edit app opens (objectui#12520)', () => { it('an object entry: the Data surface for the object, the bar\'s path on the object\'s list', async () => { const appBar = await appBarEditAppPath(entryRoute(LEADS, CRM)); - expect(appBar).toBe('/studio/com.acme.crm/data?surface=object:crm_lead'); + expect(appBar).toBe('/studio/com.acme.crm/metadata/object/crm_lead'); expect(sidebarItemDesignPath(LEADS, CRM)).toBe(appBar); }); @@ -249,7 +249,7 @@ describe('a favorite\'s Object settings opens what the app bar\'s Edit app opens it('an object favorite matches the bar on the favorite\'s own route', async () => { const fav = favorite('object:crm_lead', '/apps/com.acme.crm/crm_lead'); const appBar = await appBarEditAppPath(fav.href); - expect(appBar).toBe('/studio/com.acme.crm/data?surface=object:crm_lead'); + expect(appBar).toBe('/studio/com.acme.crm/metadata/object/crm_lead'); expect(favoriteDesignPath(fav, APPS)).toBe(appBar); }); @@ -261,7 +261,7 @@ describe('a favorite\'s Object settings opens what the app bar\'s Edit app opens it('a favorite starred in another app resolves in that app\'s package, not the one the sidebar is in', async () => { const fav = favorite('object:sales_quote', '/apps/com.acme.sales/sales_quote'); const appBar = await appBarEditAppPath(fav.href); - expect(appBar).toBe('/studio/com.acme.sales/data?surface=object:sales_quote'); + expect(appBar).toBe('/studio/com.acme.sales/metadata/object/sales_quote'); expect(favoriteDesignPath(fav, APPS)).toBe(appBar); }); diff --git a/ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.favoritesMenu-12427.test.tsx b/ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.favoritesMenu-12427.test.tsx index f1a6d3a6ebd..9dbba984ddb 100644 --- a/ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.favoritesMenu-12427.test.tsx +++ b/ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.favoritesMenu-12427.test.tsx @@ -345,7 +345,7 @@ describe('UnifiedSidebar: Object settings opens the Studio surface the app bar o await openMenu('Leads'); fireEvent.click(screen.getByRole('menuitem', { name: 'Object settings' })); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.crm/data?surface=object:crm_lead'), + expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.crm/metadata/object/crm_lead'), ); }); @@ -356,7 +356,7 @@ describe('UnifiedSidebar: Object settings opens the Studio surface the app bar o expect(await openMenu('Quotes')).toEqual(['Remove from favorites', 'Open in new tab', 'Copy link', 'Object settings']); fireEvent.click(screen.getByRole('menuitem', { name: 'Object settings' })); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.sales/data?surface=object:sales_quote'), + expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.acme.sales/metadata/object/sales_quote'), ); }); diff --git a/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts b/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts index e2969b4b13c..ccb2cbef718 100644 --- a/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts +++ b/ui/packages/app-shell/src/utils/__tests__/appRoute.test.ts @@ -317,14 +317,13 @@ describe('appStudioSurfacePath', () => { describe('appStudioObjectPath', () => { const crm = { name: 'crm', _packageId: 'com.acme.crm' }; - it('deep-links to the object surface in the Data pillar', () => { - expect(appStudioObjectPath(crm, true, 'showcase_task')).toBe( - '/studio/com.acme.crm/data?surface=object:showcase_task', - ); + // objectstack#36904 — the object designer on its metadata address. + it("deep-links to the object's designer", () => { + expect(appStudioObjectPath(crm, true, 'showcase_task')).toBe('/studio/com.acme.crm/metadata/object/showcase_task'); }); it('URL-encodes the package id and the object name', () => { expect(appStudioObjectPath({ _packageId: 'com.acme/crm' }, true, 'my object')).toBe( - '/studio/com.acme%2Fcrm/data?surface=object:my%20object', + '/studio/com.acme%2Fcrm/metadata/object/my%20object', ); }); it('returns null for non-admins', () => { @@ -370,11 +369,11 @@ describe('appStudioRoutePath', () => { it('deep-links an object route (routeType is the object name) to its Data-pillar surface', () => { // The fix: an object records page now opens THAT object, not the generic Data tab. expect(appStudioRoutePath(crm, true, { type: 'showcase_task', name: undefined })).toBe( - '/studio/com.acme.crm/data?surface=object:showcase_task', + '/studio/com.acme.crm/metadata/object/showcase_task', ); // A record-detail route (name='record') still keys off the object route type. expect(appStudioRoutePath(crm, true, { type: 'account', name: 'record' })).toBe( - '/studio/com.acme.crm/data?surface=object:account', + '/studio/com.acme.crm/metadata/object/account', ); }); diff --git a/ui/packages/app-shell/src/views/__tests__/objectViewHeaderChrome.objectSettings-36487.test.tsx b/ui/packages/app-shell/src/views/__tests__/objectViewHeaderChrome.objectSettings-36487.test.tsx index f2418723291..1d626029832 100644 --- a/ui/packages/app-shell/src/views/__tests__/objectViewHeaderChrome.objectSettings-36487.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/objectViewHeaderChrome.objectSettings-36487.test.tsx @@ -162,6 +162,6 @@ describe('the folded list menu leads with Object settings (objectstack#36487)', confirm.mockReturnValue(true); act(() => entry.onClick()); - expect(where()).toBe('/studio/com.example.my_base/data?surface=object:account'); + expect(where()).toBe('/studio/com.example.my_base/metadata/object/account'); }); }); diff --git a/ui/packages/app-shell/src/views/objectViewPageHeader.objectSettings-36487.test.tsx b/ui/packages/app-shell/src/views/objectViewPageHeader.objectSettings-36487.test.tsx index a1039f40a30..52a268611e6 100644 --- a/ui/packages/app-shell/src/views/objectViewPageHeader.objectSettings-36487.test.tsx +++ b/ui/packages/app-shell/src/views/objectViewPageHeader.objectSettings-36487.test.tsx @@ -175,7 +175,7 @@ describe('the list page\'s ⋮ More leads with Object settings (objectstack#3648 fireEvent.keyDown(screen.getByTestId('object-view-more-actions'), { key: 'Enter' }); fireEvent.click(await screen.findByRole('menuitem', { name: 'Object settings' })); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.example.my_base/data?surface=object:account'), + expect(screen.getByTestId('where')).toHaveTextContent('/studio/com.example.my_base/metadata/object/account'), ); }); @@ -185,7 +185,7 @@ describe('the list page\'s ⋮ More leads with Object settings (objectstack#3648 await openMore('app.objectstack.hotcrm'); fireEvent.click(screen.getByRole('menuitem', { name: 'Object settings' })); await waitFor(() => - expect(screen.getByTestId('where')).toHaveTextContent('/studio/app.objectstack.hotcrm/data?surface=object:account'), + expect(screen.getByTestId('where')).toHaveTextContent('/studio/app.objectstack.hotcrm/metadata/object/account'), ); expect(confirm).not.toHaveBeenCalled(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx index 95b7b83109d..d7fade17bce 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.customizationCounts-28566.test.tsx @@ -362,7 +362,7 @@ describe('Studio landing: "m switched off" leads to the switched-off actions (ob label: 'Task', actions: [{ name: 'showcase_embedded_probe' }, { name: 'showcase_mark_done', objectName: 'showcase_task' }], }; - const embeddedPath = '/studio/com.example.showcase/data?surface=object%3Ashowcase_task&action=showcase_embedded_probe'; + const embeddedPath = '/studio/com.example.showcase/metadata/object/showcase_task?action=showcase_embedded_probe'; it('one switched-off action its object holds: the count opens the object\'s Actions view on it', async () => { packages.list = [SHOWCASE]; @@ -375,8 +375,8 @@ describe('Studio landing: "m switched off" leads to the switched-off actions (ob expect(off).toHaveAttribute('href', embeddedPath); expect(requested.some((u) => OBJECT_LIST_RE.test(u))).toBe(true); fireEvent.click(off); - await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/com.example.showcase/data')); - expect(screen.getByTestId('location-search')).toHaveTextContent('?surface=object%3Ashowcase_task&action=showcase_embedded_probe'); + await waitFor(() => expect(screen.getByTestId('location')).toHaveTextContent('/studio/com.example.showcase/metadata/object/showcase_task')); + expect(screen.getByTestId('location-search')).toHaveTextContent('?action=showcase_embedded_probe'); }); it('several: each named action links where it is switched, its object\'s Actions view or its own page', async () => { diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx index 349cd687c2d..cc7406ac582 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.envCustomizations-34714.test.tsx @@ -343,7 +343,7 @@ describe('the panel’s rows and labels (objectstack#34714)', () => { const hrefs = (objects?: Record) => customizationRowsOf(HOTCRM, read, objects).map((r) => [r.name, r.href]); expect(hrefs({ clone_opportunity: 'opportunity' })).toEqual([ - ['clone_opportunity', '/studio/app.objectstack.hotcrm/data?surface=object%3Aopportunity&action=clone_opportunity'], + ['clone_opportunity', '/studio/app.objectstack.hotcrm/metadata/object/opportunity?action=clone_opportunity'], ['export_all', '/studio/app.objectstack.hotcrm/metadata/action/export_all'], ]); // With no object read (none made, or it failed), every action opens its own page. diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx index 3809fad20f2..02bc926dcbb 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx @@ -1,24 +1,19 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * objectui#12450 — the Data pillar's flat tab row. The object header's icon - * buttons this file also pinned retired with objectui#12511; the header's - * actions are pinned in `DataPillar.headerActions-12511.test.tsx`. + * objectui#12450, objectstack#36904 — the object designer's tab row. * - * Decision B of epic objectui#12446 (maintainer, 2026-10-15): seven flat tabs - * — Records, Form, Validations, Hooks, Actions, API, Settings — when the - * content column is 1000 px or wider; narrower, the last five fold back into - * "Advanced ▾". The folded form keeps its own pins in - * `DataPillar.advancedKeepsName-11794.test.tsx`; this file pins the flat form. + * #36513 section 一 (kept by epic objectstack#36890), verbatim: 「记录、字段布局 + * (或表单)、验证、操作、设置、钩子、API」; narrow widths fold 钩子 and API + * first. The item tools follow as tabs (epic decision 8): References, + * History, Source. The open tab is in the address (`?tab=`). * * What a DOM test can and cannot see: happy-dom evaluates no container query, - * so both forms are in the tree here, exactly as they are in a browser, and - * which one is DISPLAYED is decided by CSS this environment does not run. The - * pins therefore read what decides it — the content column is the query - * container, the five flat tabs carry the class that displays them at the - * fold width and above, the Advanced trigger carries the class that hides it - * there, and both classes name `DATA_TABS_FOLD_WIDTH` — and the browser - * screenshots on the pull request show the two widths rendered. + * so every form is in the tree here, exactly as in a browser, and which one is + * DISPLAYED is decided by CSS this environment does not run. The pins read + * what decides it — the content column is the query container, each flat tab + * and each "Advanced ▾" trigger carries the class for its width band, and the + * classes name the two widths. * * The REAL `DataPillar`; the records grid and two panels are stubbed, because * only which panel is open is under test, not what it draws. @@ -72,13 +67,21 @@ import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel'; import { DATA_CONTENT_CONTAINER, DATA_TAB_FLAT_ONLY, + DATA_TAB_FLAT_WIDE_ONLY, + DATA_TAB_FOLDED_FIRST_ONLY, DATA_TAB_FOLDED_ONLY, + DATA_TABS_FOLD_FIRST_WIDTH, DATA_TABS_FOLD_WIDTH, } from './dataTabsFold'; import { t } from '../metadata-admin/i18n'; -const FLAT_KEYS = ['rules', 'hooks', 'actions', 'api', 'settings'] as const; -const ROW_NAMES = ['records', 'form', ...FLAT_KEYS].map((k) => t(`engine.studio.data.tab.${k}`, 'en')); +const FLAT_KEYS = ['rules', 'actions', 'settings'] as const; +const FOLD_FIRST_KEYS = ['hooks', 'api'] as const; +// #36513's order: records, field layout, validations, actions, settings, hooks, API. +const ROW_NAMES = ['records', 'form', 'rules', 'actions', 'settings', 'hooks', 'api'].map((k) => + t(`engine.studio.data.tab.${k}`, 'en'), +); +const TOOL_NAMES = ['references', 'history', 'source'].map((k) => t(`engine.studio.itemTabs.${k}`, 'en')); const ADVANCED = t('engine.studio.data.tab.advanced', 'en'); afterEach(() => { @@ -88,9 +91,9 @@ afterEach(() => { async function renderPillar(props: { readOnly?: boolean } = {}) { render( - + - + , ); @@ -109,20 +112,23 @@ function classesOf(el: Element): string[] { return (el.getAttribute('class') ?? '').split(/\s+/).filter(Boolean); } -describe('the Data pillar’s seven flat tabs (objectui#12450)', () => { - it('both class strings name the fold width, so the rule and its constant cannot drift apart', () => { - const query = `@min-[${DATA_TABS_FOLD_WIDTH}px]:`; - expect(DATA_TABS_FOLD_WIDTH).toBe(1000); - expect(DATA_TAB_FLAT_ONLY.split(' ')).toEqual(['hidden', `${query}inline-flex`]); - expect(DATA_TAB_FOLDED_ONLY.split(' ')).toEqual([`${query}hidden`]); +describe('the object designer’s tab row (objectui#12450, objectstack#36904)', () => { + it('the class strings name the two widths, so the rule and its constants cannot drift apart', () => { + const fold = `@min-[${DATA_TABS_FOLD_WIDTH}px]:`; + const first = `@min-[${DATA_TABS_FOLD_FIRST_WIDTH}px]:`; + expect([DATA_TABS_FOLD_WIDTH, DATA_TABS_FOLD_FIRST_WIDTH]).toEqual([1000, 1200]); + expect(DATA_TAB_FLAT_ONLY.split(' ')).toEqual(['hidden', `${fold}inline-flex`]); + expect(DATA_TAB_FLAT_WIDE_ONLY.split(' ')).toEqual(['hidden', `${first}inline-flex`]); + expect(DATA_TAB_FOLDED_ONLY.split(' ')).toEqual([`${fold}hidden`]); + expect(DATA_TAB_FOLDED_FIRST_ONLY.split(' ')).toEqual(['hidden', `${fold}inline-flex`, `${first}hidden`]); }); - it('the tab row holds the seven tabs in the artboard’s order, then the folded trigger', async () => { + it('the row holds the seven views in #36513’s order, the two folded triggers, then the item tools', async () => { await renderPillar(); - const row = tabRow(); - const buttons = within(row).getAllByRole('button'); - expect(buttons.map((b) => b.textContent)).toEqual([...ROW_NAMES, ADVANCED]); - expect(buttons.at(-1)).toBe(screen.getByTestId('data-tabs-advanced')); + const buttons = within(tabRow()).getAllByRole('button'); + expect(buttons.map((b) => b.textContent)).toEqual([...ROW_NAMES, ADVANCED, ADVANCED, ...TOOL_NAMES]); + expect(buttons[7]).toBe(screen.getByTestId('data-tabs-advanced-first')); + expect(buttons[8]).toBe(screen.getByTestId('data-tabs-advanced')); }); it('the content column is the query container, and it holds the tab row it measures for', async () => { @@ -132,24 +138,31 @@ describe('the Data pillar’s seven flat tabs (objectui#12450)', () => { expect(column).toContainElement(tabRow()); }); - it('the five panels’ flat tabs display only at the fold width and above; the trigger only below it', async () => { + it('Hooks and API fold first; Validations, Actions and Settings fold below the fold width', async () => { await renderPillar(); - for (const key of FLAT_KEYS) { - const tab = screen.getByTestId(`data-tab-flat-${key}`); - for (const cls of DATA_TAB_FLAT_ONLY.split(' ')) expect(classesOf(tab)).toContain(cls); - // `cn` merges the tab's own `inline-flex` away: an unconditional - // display class left beside `hidden` would show the tab at every width. - expect(classesOf(tab)).not.toContain('inline-flex'); + for (const [keys, cls] of [ + [FLAT_KEYS, DATA_TAB_FLAT_ONLY], + [FOLD_FIRST_KEYS, DATA_TAB_FLAT_WIDE_ONLY], + ] as const) { + for (const key of keys) { + const tab = screen.getByTestId(`data-tab-flat-${key}`); + for (const c of cls.split(' ')) expect(classesOf(tab), key).toContain(c); + // `cn` merges the tab's own `inline-flex` away: an unconditional + // display class left beside `hidden` would show the tab at every width. + expect(classesOf(tab), key).not.toContain('inline-flex'); + } + } + for (const c of DATA_TAB_FOLDED_FIRST_ONLY.split(' ')) { + expect(classesOf(screen.getByTestId('data-tabs-advanced-first'))).toContain(c); } - const trigger = screen.getByTestId('data-tabs-advanced'); - expect(classesOf(trigger)).toContain(DATA_TAB_FOLDED_ONLY); - expect(classesOf(trigger)).not.toContain('hidden'); + expect(classesOf(screen.getByTestId('data-tabs-advanced'))).toContain(DATA_TAB_FOLDED_ONLY); + expect(classesOf(screen.getByTestId('data-tabs-advanced'))).not.toContain('hidden'); }); - it('CONTROL: Records and Form are displayed at every width', async () => { + it('CONTROL: Records, Field layout and the item tools are displayed at every width', async () => { await renderPillar(); const row = tabRow(); - for (const name of ROW_NAMES.slice(0, 2)) { + for (const name of [...ROW_NAMES.slice(0, 2), ...TOOL_NAMES]) { const tab = within(row).getByRole('button', { name }); expect(classesOf(tab)).toContain('inline-flex'); expect(classesOf(tab)).not.toContain('hidden'); @@ -165,14 +178,16 @@ describe('the Data pillar’s seven flat tabs (objectui#12450)', () => { await userEvent.click(validations); await waitFor(() => expect(screen.getByTestId('rules-panel')).toBeInTheDocument()); expect(validations).toHaveAttribute('aria-pressed', 'true'); - // The two forms say the same thing: at the narrower width the trigger is - // the one on screen, and it shows a power panel is open. expect(screen.getByTestId('data-tabs-advanced')).toHaveAttribute('aria-pressed', 'true'); + // Validations is not one of the two the middle band folds. + expect(screen.getByTestId('data-tabs-advanced-first')).toHaveAttribute('aria-pressed', 'false'); + expect(new URL(window.location.href).searchParams.get('tab')).toBe('validations'); await userEvent.click(screen.getByTestId('data-tab-flat-settings')); await waitFor(() => expect(screen.getByTestId('settings-panel')).toBeInTheDocument()); expect(screen.queryByTestId('rules-panel')).toBeNull(); expect(validations).toHaveAttribute('aria-pressed', 'false'); expect(screen.getByTestId('data-tab-flat-settings')).toHaveAttribute('aria-pressed', 'true'); + expect(new URL(window.location.href).searchParams.get('tab')).toBe('settings'); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts index 89e3445e93d..1734c927fd8 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts @@ -14,8 +14,10 @@ import { AREA_PILLAR_FOR_TYPE, STUDIO_ALL_PACKAGES_SEGMENT, areaItemOpensFormEditor, + areaItemOpensObjectDesigner, areaItemPillarPath, areaLocationRedirect, + dataPillarRedirect, isStudioAllPackagesScope, studioMetadataAreaPath, } from './metadataArea'; @@ -92,9 +94,8 @@ describe('areaItemPillarPath — a pillar type opens its pillar', () => { const open = (type: string, q = '', packageId: string | null = PKG) => areaItemPillarPath({ packageId, type, name: 'n_1', search: search(q) }); - it('object, flow and permission open their pillar with `?surface=`', () => { + it('flow and permission open their pillar with `?surface=`', () => { const expected: Record = { - object: 'data', flow: 'automations', permission: 'access', }; @@ -110,7 +111,8 @@ describe('areaItemPillarPath — a pillar type opens its pillar', () => { it('every other type opens the generic item page', () => { // objectstack#36502 — page, dashboard, report and view lost their pillar with Interfaces. - for (const type of ['translation', 'email_template', 'agent', 'position', 'sharing_rule', 'app', 'page', 'dashboard', 'report', 'view']) { + // objectstack#36904 — an object opens its designer on its own address. + for (const type of ['object', 'translation', 'email_template', 'agent', 'position', 'sharing_rule', 'app', 'page', 'dashboard', 'report', 'view']) { expect(open(type), type).toBeNull(); } }); @@ -162,3 +164,36 @@ describe('areaItemOpensFormEditor — a read-only package’s dataset opens its expect(areaItemOpensFormEditor(at('object', true))).toBe(false); }); }); + +describe('the object designer on its address, and the retired Data pillar (objectstack#36904)', () => { + const at = (q = '', packageId: string | null = PKG, type = 'object') => + areaItemOpensObjectDesigner({ packageId, type, search: new URLSearchParams(q) }); + + it("an object opens its designer on a package's leg", () => { + expect(at()).toBe(true); + expect(at('package=' + PKG + '&tab=hooks')).toBe(true); + }); + + it('keeps the generic page for the cross-package leg, the environment scope and the draft review', () => { + expect(at('', null)).toBe(false); + expect(at('scope=environment')).toBe(false); + expect(at('review=1')).toBe(false); + // CONTROL: another type never opens it. + expect(at('', PKG, 'flow')).toBe(false); + }); + + it('the old object address lands on its designer, keeping `?action=` and dropping `?view=` and `?nav=`', () => { + expect(dataPillarRedirect(PKG, '?surface=object%3Aaccount')).toBe(`/studio/${PKG}/metadata/object/account`); + expect(dataPillarRedirect(PKG, 'surface=object:account&view=account.all&nav=n1&action=approve')).toBe( + `/studio/${PKG}/metadata/object/account?action=approve`, + ); + // A name the URL encodes stays one segment. + expect(dataPillarRedirect(PKG, `?surface=${encodeURIComponent('object:a/b')}`)).toBe(`/studio/${PKG}/metadata/object/a%2Fb`); + }); + + it('the old home and any other surface land on the object list, with the query kept (the draft review link)', () => { + expect(dataPillarRedirect(PKG, '')).toBe(`/studio/${PKG}/metadata/object`); + expect(dataPillarRedirect(PKG, '?changes=review')).toBe(`/studio/${PKG}/metadata/object?changes=review`); + expect(dataPillarRedirect(PKG, '?surface=flow%3Anotify')).toBe(`/studio/${PKG}/metadata/object`); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts new file mode 100644 index 00000000000..475a1352eb4 --- /dev/null +++ b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts @@ -0,0 +1,57 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#36904 — the object designer's tabs and their address. + * + * #36513 section 一, verbatim: 「记录、字段布局(或表单)、验证、操作、设置、钩子、API」, + * and the two technical tabs fold first. The item tools follow (epic + * decision 8). The address value is the tab's own word, Records writes none, + * and a tool tab writes the value every item page reads (`ItemToolTabs`). + */ + +import { describe, expect, it } from 'vitest'; +import { + OBJECT_DESIGNER_ALWAYS_FLAT, + OBJECT_DESIGNER_FOLD_FIRST, + OBJECT_DESIGNER_TOOL_TABS, + OBJECT_DESIGNER_VIEWS, + objectDesignerTabAddress, + readObjectDesignerTab, +} from './objectDesignerTabs'; +import { t } from '../metadata-admin/i18n'; + +const TOOLS = OBJECT_DESIGNER_TOOL_TABS; + +describe('the object designer’s tabs (objectstack#36904)', () => { + it('are in #36513’s order, word for word', () => { + expect(OBJECT_DESIGNER_VIEWS.map((v) => t(v.label, 'zh-CN')).join('、')).toBe('记录、字段布局、验证、操作、设置、钩子、API'); + expect(OBJECT_DESIGNER_FOLD_FIRST).toEqual(['hooks', 'api']); + expect(OBJECT_DESIGNER_ALWAYS_FLAT).toEqual(['grid', 'form']); + expect(TOOLS).toEqual(['references', 'history', 'source']); + }); + + it('every view round-trips through its address; Records is the default and writes none', () => { + for (const { view, address } of OBJECT_DESIGNER_VIEWS) { + const location = readObjectDesignerTab(address, TOOLS); + expect(location, address).toEqual({ view, tool: null }); + expect(objectDesignerTabAddress(location), address).toBe(view === 'grid' ? null : address); + } + }); + + it('a tool tab reads the item pages’ values, its second view included', () => { + expect(readObjectDesignerTab('history', TOOLS).tool).toEqual({ tab: 'history' }); + expect(readObjectDesignerTab('audit', TOOLS).tool).toEqual({ tab: 'history', view: 'audit' }); + expect(readObjectDesignerTab('layers', TOOLS).tool).toEqual({ tab: 'source', view: 'layers' }); + expect(objectDesignerTabAddress(readObjectDesignerTab('audit', TOOLS))).toBe('audit'); + }); + + it('a value that opens nothing here opens Records: unknown, absent, or a tool not offered', () => { + for (const raw of [null, '', 'grid', 'details', 'preview', 'bogus']) { + expect(readObjectDesignerTab(raw, TOOLS), String(raw)).toEqual({ view: 'grid', tool: null }); + } + // History without the authoring-trail capabilities. + expect(readObjectDesignerTab('history', ['references', 'source'])).toEqual({ view: 'grid', tool: null }); + // CONTROL: offered, it opens. + expect(readObjectDesignerTab('history', TOOLS).tool).toEqual({ tab: 'history' }); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts index 209034b8c31..bc81552c443 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddress.test.ts @@ -96,16 +96,15 @@ describe("today's addresses, byte for byte", () => { }); it('an item opens its pillar today when the table names one, else its "All metadata" page', () => { - expect(studioItemPath('crm', 'object', 'account')).toBe('/studio/crm/data?surface=object%3Aaccount'); + // objectstack#36904 — an object opens its designer on its metadata address. + expect(studioItemPath('crm', 'object', 'account')).toBe('/studio/crm/metadata/object/account'); expect(studioItemPath('crm', 'flow', 'notify')).toBe('/studio/crm/automations?surface=flow%3Anotify'); expect(studioItemPath('crm', 'permission', 'admin')).toBe('/studio/crm/access?surface=permission%3Aadmin'); expect(studioItemPath('crm', 'dashboard', 'sales')).toBe('/studio/crm/metadata/dashboard/sales'); expect(studioItemPath('crm', 'action', 'approve')).toBe('/studio/crm/metadata/action/approve'); - // The app → Studio bridge's spelling. - expect(studioItemPath('crm', 'object', 'account', { spelling: 'name' })).toBe('/studio/crm/data?surface=object:account'); - // The switched-off action's spelling. - expect(studioItemPath('crm', 'object', 'account', { spelling: 'form', qualifiers: { action: 'approve' } })).toBe( - '/studio/crm/data?surface=object%3Aaccount&action=approve', + // On the metadata address a qualifier is its query (the switched-off action's `?action=`). + expect(studioItemPath('crm', 'object', 'account', { qualifiers: { action: 'approve' } })).toBe( + '/studio/crm/metadata/object/account?action=approve', ); // A name that is an Object.prototype member is not a pillar type. expect(studioItemPath('crm', 'constructor', 'x')).toBe('/studio/crm/metadata/constructor/x'); @@ -143,10 +142,10 @@ describe("today's addresses, byte for byte", () => { expect(studioPillarItemPath('crm', 'access', { type: 'permission', name: 'p' })).toBe('/studio/crm/access?surface=permission%3Ap'); expect(studioMetadataItemPath('crm', { type: 'object', name: 'account' })).toBe('/studio/crm/metadata/object/account'); expect( - areaItemPillarPath({ packageId: 'crm', type: 'object', name: 'account', search: new URLSearchParams() }), - ).toBe('/studio/crm/data?surface=object%3Aaccount'); + areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams() }), + ).toBe('/studio/crm/automations?surface=flow%3Anotify'); expect( - areaItemPillarPath({ packageId: 'crm', type: 'object', name: 'account', search: new URLSearchParams('review=1') }), + areaItemPillarPath({ packageId: 'crm', type: 'flow', name: 'notify', search: new URLSearchParams('review=1') }), ).toBeNull(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts index 9f19b373fb0..fbce39a03d8 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts @@ -97,7 +97,8 @@ describe('the current entry (aria-current)', () => { }); it('a pillar page is the type it designs; the Access pillar on its OWD overview is that entry', () => { - expect(current(PKG, `/studio/${PKG}/data?surface=object:account`)).toBe('type:object'); + // objectstack#36904 — the object designer is an area page: its type. + expect(current(PKG, `/studio/${PKG}/metadata/object/account`)).toBe('type:object'); expect(current(PKG, `/studio/${PKG}/automations`)).toBe('type:flow'); expect(current(PKG, `/studio/${PKG}/access?surface=permission:admin`)).toBe('type:permission'); expect(current(PKG, `/studio/${PKG}/access?surface=owd:overview`)).toBe('owd'); From 10e30949d2644e7b6103d61b3af759d69b9fbcf5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 22:16:34 +0000 Subject: [PATCH 04/18] test(studio): rehost the object create pins on the list dialog; give the designer suites their object Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- ...ListCreateDialog.pairCreate-36897.test.tsx | 39 ++- ...uiltinDesigners.lateArrival-11939.test.tsx | 2 +- .../CreateItemDialog.labels-13128.test.tsx | 11 +- ...CreateItemDialog.storedName-11792.test.tsx | 78 +----- .../DataPillar.actionDeepLink-34724.test.tsx | 2 +- .../DataPillar.actionRefusal-26736.test.tsx | 2 +- ...DataPillar.actionServedRows-35650.test.tsx | 2 +- .../DataPillar.addFieldPopover-12516.test.tsx | 2 +- ...ataPillar.advancedKeepsName-11794.test.tsx | 2 +- .../DataPillar.aiDraftDiscard-36511.test.tsx | 2 +- .../DataPillar.authorRefusal-11785.test.tsx | 4 +- .../DataPillar.authoredBuffer-29793.test.tsx | 2 +- ...aPillar.baseObjectExtension-28575.test.tsx | 6 +- .../studio-design/DataPillar.celGate.test.tsx | 2 +- ...Pillar.choiceWithoutOptions-11253.test.tsx | 4 +- ...taPillar.copilotChangesLine-34725.test.tsx | 2 +- ...ataPillar.copilotDraftMarks-12725.test.tsx | 2 +- ...aPillar.designerRegistryPopulated.test.tsx | 2 +- ...ataPillar.destructiveChange-34931.test.tsx | 2 +- ...DataPillar.draftObjectLabel-11843.test.tsx | 189 ------------- ...ataPillar.draftOnlyNoLayers-12508.test.tsx | 12 +- .../DataPillar.draftSavedNamed-28984.test.tsx | 2 +- .../DataPillar.draftUnreadable-29148.test.tsx | 2 +- ...llar.extensionPublishPinned-36726.test.tsx | 2 +- .../DataPillar.externalObject-27279.test.tsx | 2 +- ...DataPillar.formDraftPreview-12515.test.tsx | 12 +- .../DataPillar.formToolbar-12451.test.tsx | 2 +- .../DataPillar.gridProjection.test.tsx | 2 +- .../DataPillar.headerActions-12511.test.tsx | 2 +- .../DataPillar.heldIncomplete-11786.test.tsx | 6 +- ...taPillar.hiddenSystemFields-11780.test.tsx | 2 +- .../DataPillar.hookServedRows-36725.test.tsx | 2 +- ...llar.inspectorBelongsToView-11781.test.tsx | 2 +- ...aPillar.internalFormRetired-36425.test.tsx | 2 +- .../DataPillar.layoutBadge.test.tsx | 2 +- ...DataPillar.layoutSaveCancel-36511.test.tsx | 2 +- .../DataPillar.pairActions-30088.test.tsx | 2 +- ...ar.pairActionsPublishPinned-36726.test.tsx | 2 +- .../DataPillar.panelGate.test.tsx | 2 +- .../DataPillar.panelHold-27629.test.tsx | 2 +- ...illar.picklistServedOptions-10202.test.tsx | 2 +- .../DataPillar.pulseAfterSave-36648.test.tsx | 2 +- .../DataPillar.railSwitchFlush-27511.test.tsx | 256 ------------------ ...taPillar.readOnlyRailReason-12303.test.tsx | 2 +- .../DataPillar.recordsScroll-35061.test.tsx | 2 +- .../DataPillar.recordsTab-34794.test.tsx | 2 +- .../DataPillar.saveCancel-36511.test.tsx | 2 +- .../DataPillar.showMeFocus-26730.test.tsx | 2 +- .../DataPillar.summaryHeld-27461.test.tsx | 2 +- .../DataPillar.surfaceRequest.test.tsx | 147 ---------- ...illar.validationVerdictHold-27644.test.tsx | 2 +- ...alog.newObjectJoinsAppMenu-36748.test.tsx} | 18 +- ...udioDesignSurface.createObjectOwd.test.tsx | 160 ----------- ...ioDesignSurface.createTaken-26917.test.tsx | 29 +- .../StudioDesignSurface.emptyPackage.test.tsx | 121 --------- .../StudioDesignSurface.formFields.test.tsx | 2 +- .../StudioDesignSurface.gridColumns.test.tsx | 2 +- ...signSurface.readOnlyWording-11781.test.tsx | 2 +- ...oDesignSurface.sharedSelect-11865.test.tsx | 10 +- 59 files changed, 137 insertions(+), 1049 deletions(-) delete mode 100644 ui/packages/app-shell/src/views/studio-design/DataPillar.draftObjectLabel-11843.test.tsx delete mode 100644 ui/packages/app-shell/src/views/studio-design/DataPillar.railSwitchFlush-27511.test.tsx delete mode 100644 ui/packages/app-shell/src/views/studio-design/DataPillar.surfaceRequest.test.tsx rename ui/packages/app-shell/src/views/studio-design/{DataPillar.newObjectJoinsAppMenu-36748.test.tsx => MetadataListCreateDialog.newObjectJoinsAppMenu-36748.test.tsx} (91%) delete mode 100644 ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createObjectOwd.test.tsx delete mode 100644 ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.emptyPackage.test.tsx diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx index dfbd1b91204..3d1c7276ab4 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx @@ -11,6 +11,11 @@ * - The object carries the organization-wide default it was given. * - A flow is created from a starting point; one that watches an object * writes nothing until it has one. + * + * objectstack#36904 — the object designer has no 「新建」 of its own any more; + * this dialog is where an object is created, so the pins its old dialog held + * live here too: the default OWD is written explicitly, the stored name is + * previewed and saved as shown, and a taken identifier writes nothing. */ // Paid at collection, not inside a case's clock (check:test-source-alias). @@ -46,9 +51,10 @@ vi.mock('../studio-design/studioSaveBar.js', async (importOriginal) => ({ ...(await importOriginal>()), publishSavedItem: (...args: unknown[]) => publish(...(args as [])), })); +const taken = vi.fn(async (..._args: unknown[]): Promise<{ name: string; label: string } | null> => null); vi.mock('../studio-design/StudioPillarKit.js', async (importOriginal) => ({ ...(await importOriginal>()), - findTakenIdentifier: async () => null, + findTakenIdentifier: (...args: unknown[]) => taken(...args), })); const joinMenu = vi.fn(async () => ({ kind: 'joined' })); vi.mock('../studio-design/newObjectJoinsAppMenu.js', async (importOriginal) => ({ @@ -138,3 +144,34 @@ describe('list 「新建」 lands in the paired .custom package on a read-only b expect(onCreated).not.toHaveBeenCalled(); }); }); + +describe('list 「新建」 for an object: the create the object designer no longer has (objectstack#36904)', () => { + it('writes the default record sharing explicitly when the author leaves it (objectui#5418)', async () => { + const onCreated = open('object', 'com.example.crm', false); + fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); + await waitFor(() => expect(onCreated).toHaveBeenCalled()); + const [, , body, opts] = save.mock.calls[0] as unknown as [string, string, any, any]; + expect(body).toHaveProperty('sharingModel', 'private'); + expect(opts).toMatchObject({ mode: 'draft' }); + }); + + it('previews `_` and saves exactly that name (objectui#11792)', async () => { + const onCreated = open('object', 'com.example.crm', false); + fireEvent.change(screen.getByLabelText(t('engine.studio.data.nameLabel', L)), { target: { value: 'Repair Ticket' } }); + await waitFor(() => expect(screen.getByTestId('create-item-stored-name')).toHaveTextContent('crm_repair_ticket')); + fireEvent.click(screen.getByRole('button', { name: t('engine.studio.createLive', L) })); + await waitFor(() => expect(onCreated).toHaveBeenCalledWith({ name: 'crm_repair_ticket', packageId: 'com.example.crm' })); + expect(save.mock.calls[0]?.[1]).toBe('crm_repair_ticket'); + }); + + it('a taken identifier is refused and nothing is written (objectstack#26917)', async () => { + taken.mockResolvedValueOnce({ name: 'crm_visit', label: 'Visit' }); + const onCreated = open('object', 'com.example.crm', false); + fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); + await waitFor(() => expect(taken).toHaveBeenCalled()); + expect(await screen.findByText(/crm_visit/)).toBeInTheDocument(); + expect(save).not.toHaveBeenCalled(); + expect(publish).not.toHaveBeenCalled(); + expect(onCreated).not.toHaveBeenCalled(); + }); +}); diff --git a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx index 35145bd024e..bba0ac09418 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/__tests__/builtinDesigners.lateArrival-11939.test.tsx @@ -92,7 +92,7 @@ describe('Data pillar field rail — the built-in designers arrive after it rend render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx index 26b9bb77d05..3304ec50274 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx @@ -44,7 +44,8 @@ vi.mock('./packages-io', async (importOriginal) => { vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -import { DataPillar, StudioDesignSurface } from './StudioDesignSurface'; +import { StudioDesignSurface } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { t } from '../metadata-admin/i18n'; window.matchMedia = ((query: string) => ({ @@ -93,12 +94,12 @@ function expectBound(dialog: HTMLElement, labelText: string): HTMLInputElement { describe('Studio create dialogs bind each label to its input (objectui#13128)', () => { it('New object: "Object name" and "Identifier" each find their input', async () => { + // objectstack#36904 — New object is the object list's create dialog. render( - - + + {}} packageId="app.a" inPair={false} locale="en" onCreated={() => {}} /> , ); - fireEvent.click(await screen.findByTestId('empty-state-new-object')); const dialog = await screen.findByRole('dialog'); const nameInput = expectBound(dialog, t('engine.studio.data.nameLabel', 'en')); @@ -112,7 +113,7 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)', it('Create app (a sibling dialog on the same component): "App name" and "Identifier" each find their input', async () => { render( - + } /> diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.storedName-11792.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.storedName-11792.test.tsx index d03873f7455..4be9da28d3f 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.storedName-11792.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.storedName-11792.test.tsx @@ -8,10 +8,12 @@ * `repair_ticket` and created `repairs_repair_ticket`, because the Data pillar * prefixes the name with the package namespace on save. The dialog now takes * the caller's own rule as an optional prop and shows its output; the first - * block drives the dialog with the same `prefixObjectName` the pillar saves - * with, the second pins that a caller passing nothing — the app, automation - * and access dialogs — renders exactly as before, and the third drives the - * REAL Data pillar end to end. + * block drives the dialog with the same `prefixObjectName` the create saves + * with, and the second pins that a caller passing nothing — the app, + * automation and access dialogs — renders exactly as before. + * objectstack#36904 — the end-to-end half is the list create dialog's + * (`MetadataListCreateDialog.pairCreate-36897.test.tsx`), the object designer + * having no 「新建」 of its own. */ // Warmed at module top so the first load of the console's lazily loaded @@ -20,40 +22,13 @@ import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; +import { cleanup, fireEvent, render, screen, within } from '@testing-library/react'; import { CreateItemDialog } from './CreateItemDialog'; -import type { PkgEntry } from './packages-io'; - -const mockClient = { - list: vi.fn(async () => []), - listDrafts: vi.fn(async () => []), - layered: vi.fn(async () => ({ effective: null, code: null })), - getDraft: vi.fn(async () => null), - save: vi.fn(async () => ({})), -}; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ entries: [] }), - }; -}); - -let packagesFixture: PkgEntry[] = []; -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => packagesFixture) }; -}); import { prefixObjectName } from './packages-io'; -import { DataPillar } from './StudioDesignSurface'; beforeEach(() => { vi.clearAllMocks(); - packagesFixture = []; }); afterEach(cleanup); @@ -117,42 +92,3 @@ describe('CreateItemDialog — callers that pass no rule are unchanged (objectui expect(dialog.querySelectorAll('input')).toHaveLength(2); }); }); - -describe('Data pillar — New object previews the name it saves (objectui#11792)', () => { - async function openAndType(label: string) { - render( - - - , - ); - fireEvent.click(await screen.findByTestId('empty-state-new-object')); - const dialog = await screen.findByRole('dialog'); - fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: label } }); - return dialog; - } - - function savedName(): string { - const call = mockClient.save.mock.calls.at(-1) as unknown as [string, string]; - return call[1]; - } - - it('previews `_` and saves exactly that name', async () => { - packagesFixture = [{ id: 'com.test.repairs', name: 'Repairs', writable: true, namespace: 'repairs' }]; - const dialog = await openAndType('Repair Ticket'); - await waitFor(() => - expect(screen.getByTestId('create-item-stored-name')).toHaveTextContent('repairs_repair_ticket'), - ); - fireEvent.click(within(dialog).getByRole('button', { name: /^(create|创建)$/i })); - await waitFor(() => expect(mockClient.save).toHaveBeenCalled()); - expect(savedName()).toBe('repairs_repair_ticket'); - }); - - it('previews the bare identifier when the package has no namespace — and that is what it saves', async () => { - packagesFixture = [{ id: 'com.test.repairs', name: 'Repairs', writable: true, namespace: null }]; - const dialog = await openAndType('Repair Ticket'); - expect(await screen.findByTestId('create-item-stored-name')).toHaveTextContent('repair_ticket'); - fireEvent.click(within(dialog).getByRole('button', { name: /^(create|创建)$/i })); - await waitFor(() => expect(mockClient.save).toHaveBeenCalled()); - expect(savedName()).toBe('repair_ticket'); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx index 4114bee8ca1..0e6989dfc4d 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx @@ -161,7 +161,7 @@ function mountAt(search: string): void { render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx index 4e291a6b3ff..9589d5b6347 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx @@ -153,7 +153,7 @@ async function mountOnView(def: Record, tabKey: string): Promis objectDef = def; render( - + , ); // The first match is the flat tab (the passthrough menu draws a second). diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx index c8df36e43d0..199e1af9c80 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx @@ -125,7 +125,7 @@ async function openActionsView(): Promise { objectDef = { name: 'showcase_task', label: 'Task', fields: [{ name: 'title', label: 'Title', type: 'text' }], actions: [SIGN] }; render( - + , ); // The first match is the flat tab (the passthrough menu draws a second). diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx index 374bf0d88e4..48aca900f0b 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx @@ -103,7 +103,7 @@ afterEach(() => { async function renderPillar(props: { readOnly?: boolean } = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx index 5e91b889fdb..b02e083e296 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx @@ -73,7 +73,7 @@ async function renderPillar() { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx index f28f7599c2f..d9b581a5abd 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx @@ -116,7 +116,7 @@ function renderPillar(onDraftSaved = vi.fn()): { onDraftSaved: ReturnType - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx index dbda5d759bc..cd61ed9df53 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx @@ -104,7 +104,7 @@ describe('Studio data page — a held Picklist reads as a sentence (objectui#117 it('names the field by its label and shows no developer text', async () => { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); @@ -138,7 +138,7 @@ describe('Studio data page — a held Picklist reads as a sentence (objectui#117 it('"Show me" opens the named field\'s inspector after it was closed', async () => { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx index e0733265ff5..c366387f7a4 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx @@ -176,7 +176,7 @@ function renderZh() { return render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx index 6481853408d..e81a3b6f568 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx @@ -213,7 +213,7 @@ afterEach(() => { async function renderBase(over: Partial = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); @@ -459,7 +459,7 @@ describe('CONTROL: a writable package’s add-field is unchanged (objectstack#28 it('a plain name into the object’s own body, and a fully editable inspector', async () => { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); @@ -542,7 +542,7 @@ describe('the object header says where a base object’s extension is saved (obj it('CONTROL: an object of a writable package says nothing of the kind', async () => { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx index e38670b10fc..59a0cf770b4 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx @@ -158,7 +158,7 @@ async function openFormulaField() { stubEngine(); render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx index 420b96791de..60ea16649dd 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx @@ -154,7 +154,7 @@ function heldOptionsLine(label: string): string { async function addFieldAndType(typeLabel: RegExp): Promise { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); @@ -207,7 +207,7 @@ describe('Studio data page — an object that already stores an empty select (ob served = storedEmptySelect; render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx index 061fe31a72a..f88f3c48fca 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx @@ -98,7 +98,7 @@ function serveDraft(draftChanges?: unknown[]) { function renderPillar(props: Partial> = {}) { return render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx index 41b2049d5be..73d042bd6f5 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx @@ -128,7 +128,7 @@ function serveDraft(draftChanges?: unknown[]) { async function openRail(label: string, name: string): Promise { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: L('engine.studio.data.tab.form') })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx index 486a5950044..32630aa016e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx @@ -161,7 +161,7 @@ function expectNoEmptyStateSentence(): void { function renderPillar() { render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx index 0c04be2f90a..9a94610a725 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx @@ -105,7 +105,7 @@ async function removePlace(first: Response) { answers = [first]; render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftObjectLabel-11843.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftObjectLabel-11843.test.tsx deleted file mode 100644 index 9a7fa76d7e8..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftObjectLabel-11843.test.tsx +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#11843 — the Data pillar's Objects rail lists a draft-only object by - * the label its draft declares, as it lists a published object by its label. - * - * Measured on the card: a draft-only object labelled "Repair Ticket" was - * listed as `repairs_repair_ticket`, while its published sibling read - * "Technician". The rail merges the published list with the package's draft - * headers, and a draft header carries no label. The draft-overlaid list - * (`GET /meta/object?package=…&preview=draft`) serves each pending draft with - * its own label and a `_draft` mark, so the rail now reads its draft-only rows' - * labels from it, and from nothing else. - * - * The client is a real `MetadataClient`, so the three reads are the ones the - * production client sends; only the transport under it is a double. The - * per-object load on selection (`layered`, `getDraft`) is stubbed, as in - * `DataPillar.heldIncomplete-11786.test.tsx`: it is not what this card is about. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, describe, expect, it, vi } from 'vitest'; -import { render, screen, cleanup, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; -import { MetadataClient } from '@object-ui/data-objectstack'; - -const PKG = 'com.example.repairs'; -const BASE = 'http://test.local/api/v1/meta'; -const PUBLISHED_URL = `${BASE}/object?package=${PKG}`; -const DRAFTS_URL = `${BASE}/_drafts?package=${PKG}&type=object`; -const OVERLAID_URL = `${BASE}/object?package=${PKG}&preview=draft`; - -const technician = { - name: 'repairs_technician', - label: 'Technician', - fields: [{ name: 'title', label: 'Title', type: 'text' }], -}; - -/** The package's published objects, in the order the server lists them. */ -const published = [ - { name: 'repairs_technician', label: 'Technician', _packageId: PKG }, - { name: 'repairs_site', label: 'Site', _packageId: PKG }, -]; - -/** - * The package's pending object drafts: one draft-only object that declares a - * label, one that declares none, and a draft over the published Technician. - */ -const draftHeaders = [ - { type: 'object', name: 'repairs_repair_ticket', packageId: PKG, updatedAt: null, updatedBy: null }, - { type: 'object', name: 'repairs_note', packageId: PKG, updatedAt: null, updatedBy: null }, - { type: 'object', name: 'repairs_technician', packageId: PKG, updatedAt: null, updatedBy: null }, -]; - -/** - * What the draft-overlaid list serves for that package: the draft wins over the - * published Technician (with its own, different label), the draft-only objects - * surface with their own bodies, and every draft carries `_draft: true`. Listed - * in a different order from the rail, and with one draft the two membership - * reads do not name, so that neither the rail's order nor its members can come - * from this read without a pin seeing it. - */ -const overlaid = [ - { name: 'repairs_repair_ticket', label: 'Repair Ticket', _packageId: PKG, _draft: true }, - { name: 'repairs_site', label: 'Site', _packageId: PKG }, - { name: 'repairs_orphan', label: 'Orphan', _packageId: PKG, _draft: true }, - { name: 'repairs_note', _packageId: PKG, _draft: true }, - { name: 'repairs_technician', label: 'Field Technician', _packageId: PKG, _draft: true }, -]; - -const json = (body: unknown, status = 200) => - new Response(JSON.stringify(body), { status, headers: { 'content-type': 'application/json' } }); - -/** How the draft-overlaid read is answered in the current test. */ -let answerOverlaid: () => Response = () => json({ type: 'object', items: overlaid }); -/** Every GET the transport received. */ -const gets: string[] = []; - -const fetchImpl = vi.fn(async (input: unknown, init?: RequestInit) => { - const url = String(input); - if ((init?.method ?? 'GET').toUpperCase() === 'GET') gets.push(url); - if (url === PUBLISHED_URL) return json({ type: 'object', items: published }); - if (url === DRAFTS_URL) return json({ success: true, data: { drafts: draftHeaders } }); - if (url === OVERLAID_URL) return answerOverlaid(); - return json(null, 404); -}); - -const client = new MetadataClient({ baseUrl: 'http://test.local', fetch: fetchImpl as unknown as typeof fetch }); -Object.assign(client, { - layered: vi.fn(async () => ({ effective: technician, code: technician })), - getDraft: vi.fn(async () => null), -}); - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useMetadataClient: () => client, useMetadataTypes: () => ({ entries: [] }) }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => dataSource }; -}); - -// The console's preview and authoring code loads `@objectstack/lint` lazily; -// warmed here so its first load is paid at import, not inside a test's clock. -import '@objectstack/lint'; -import { DataPillar } from './StudioDesignSurface'; -import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; -import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; -import { t } from '../metadata-admin/i18n'; - -const dataSource = createEmptyDataSource(); -failOnAbsorbedFetchError(); -registerBuiltinInspectors(); - -afterEach(() => { - cleanup(); - gets.length = 0; - fetchImpl.mockClear(); - answerOverlaid = () => json({ type: 'object', items: overlaid }); -}); - -function renderPillar() { - return render( - - - , - ); -} - -/** The rail's rows, top to bottom, as the author reads them (the New object button excluded). */ -function railRows(): string[] { - const nav = screen.getByPlaceholderText(t('engine.studio.data.searchObjects', 'en')).closest('nav'); - expect(nav, 'the Objects rail did not render: the harness is dead').not.toBeNull(); - const newObject = t('engine.studio.data.newObject', 'en'); - return within(nav as HTMLElement) - .getAllByRole('button') - // objectstack#35061 — the narrow rail's 「»」 control is no row. - .filter((b) => b.getAttribute('data-testid') !== 'studio-rail-float') - .map((b) => (b.textContent ?? '').trim()) - .filter((text) => text !== newObject); -} - -describe('Studio Data pillar — a draft-only object is listed by its draft\'s label (objectui#11843)', () => { - it('lists a draft-only object that declares a label by that label, read from the package-scoped draft-overlaid list', async () => { - renderPillar(); - expect(await screen.findByRole('button', { name: 'Repair Ticket' })).toBeInTheDocument(); - expect(screen.queryByRole('button', { name: 'repairs_repair_ticket' })).toBeNull(); - // The label came from the overlaid list of THIS package, asked once. - expect(gets.filter((u) => u === OVERLAID_URL)).toHaveLength(1); - }); - - it('lists a draft-only object that declares no label by its name', async () => { - renderPillar(); - expect(await screen.findByRole('button', { name: 'repairs_note' })).toBeInTheDocument(); - }); - - it('control: published rows, the members and their order are as before; a pending draft does not relabel a published object', async () => { - renderPillar(); - await screen.findByRole('button', { name: 'Technician' }); - // Published first, in the published list's order, then the draft-only - // objects in the draft headers' order. `repairs_orphan` is served only by - // the overlaid read and is not a member; the published Technician keeps - // its published label although its pending draft declares another. - expect(railRows()).toEqual(['Technician', 'Site', 'Repair Ticket', 'repairs_note']); - expect(screen.queryByRole('button', { name: 'Field Technician' })).toBeNull(); - expect(screen.queryByRole('button', { name: 'Orphan' })).toBeNull(); - }); - - it.each([ - ['the overlaid read fails', () => json({ success: false, error: { code: 'INTERNAL_ERROR', message: 'store unavailable' } }, 500)], - // A caller the server does not admit to pending drafts is answered the - // published list: no entry carries `_draft`, so no draft label is served. - ['the overlaid read is answered the published list', () => json({ type: 'object', items: published })], - ])('leaves the rail as it was when %s: draft-only objects by name, no failure shown', async (_case, answer) => { - answerOverlaid = answer; - renderPillar(); - expect(await screen.findByRole('button', { name: 'repairs_repair_ticket' })).toBeInTheDocument(); - expect(railRows()).toEqual(['Technician', 'Site', 'repairs_repair_ticket', 'repairs_note']); - expect(screen.queryByText(t('engine.studio.loadFailed', 'en'))).toBeNull(); - expect(gets.filter((u) => u === OVERLAID_URL)).toHaveLength(1); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index 7d0729c4449..87c8db9fdfd 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -116,10 +116,10 @@ beforeEach(() => { }); afterEach(cleanup); -async function openPillar() { +async function openPillar(objectName: string) { render( - + , ); await act(async () => { @@ -136,7 +136,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 it('a draft-only object: /layers answers its draft layer, nothing fails, and the editor holds its draft', async () => { server.drafts.set('st_ticket', ticket); server.draftHeaders = ['st_ticket']; - await openPillar(); + await openPillar('st_ticket'); expect(reads('st_ticket', ''), 'the draft read never ran: the harness is dead').toEqual([200]); expect(reads('st_ticket', '/layers')).toEqual([200]); @@ -147,7 +147,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 it('CONTROL: a name the drafts list holds but whose draft is no longer served still reads its /layers', async () => { server.draftHeaders = ['st_ticket']; - await openPillar(); + await openPillar('st_ticket'); expect(reads('st_ticket', '')).toEqual([404]); expect(reads('st_ticket', '/layers')).toEqual([404]); @@ -155,7 +155,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 it('CONTROL: a published object still reads its layers', async () => { server.published = [kase]; - await openPillar(); + await openPillar('st_case'); expect(reads('st_case', '/layers')).toEqual([200]); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); @@ -165,7 +165,7 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 it('CONTROL: a 5xx on a published object\'s /layers still surfaces as the pillar\'s refusal', async () => { server.published = [kase]; server.failLayers.add('st_case'); - await openPillar(); + await openPillar('st_case'); expect(reads('st_case', '/layers')).toEqual([500]); expect(await screen.findByTestId('studio-refusal')).toBeInTheDocument(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx index eeb699da788..75fba6a0284 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx @@ -117,7 +117,7 @@ function mount(): void { <> - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx index cd67d5702b8..2b6906b5b39 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx @@ -170,7 +170,7 @@ afterEach(() => { async function renderBase(over: Partial = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx index b1e7d6ce4cb..5c0be81e369 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx @@ -219,7 +219,7 @@ async function openOnForm(): Promise { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx index af69b83f77f..243a1305420 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx @@ -102,7 +102,7 @@ async function renderPillar(object: Record) { servedObject = object; render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx index 1ff4cc14fdd..d9c9f2e54f4 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx @@ -154,10 +154,10 @@ const settle = () => for (let i = 0; i < 40; i++) await new Promise((r) => setTimeout(r, 0)); }); -async function openPreview() { +async function openPreview(objectName: string) { render( - + , ); await settle(); @@ -177,7 +177,7 @@ describe('DataPillar Form Preview renders the draft definition (objectui#12515)' it('a draft-only object with three draft fields shows the three fields', async () => { server.drafts.set('st_ticket', ticket); server.draftHeaders = ['st_ticket']; - await openPreview(); + await openPreview('st_ticket'); expect(await screen.findByText('Subject')).toBeInTheDocument(); expect(screen.getByText('Priority')).toBeInTheDocument(); @@ -194,7 +194,7 @@ describe('DataPillar Form Preview renders the draft definition (objectui#12515)' server.published = [asset]; server.drafts.set('st_asset', assetDraft); server.draftHeaders = ['st_asset']; - await openPreview(); + await openPreview('st_asset'); expect(await screen.findByText('Warranty Ends')).toBeInTheDocument(); expect(screen.queryByText('Serial Number')).toBeNull(); @@ -218,7 +218,7 @@ describe('DataPillar Form Preview renders the draft definition (objectui#12515)' it('CONTROL: a published object with no pending change has neither chip nor toggle', async () => { server.published = [asset]; - await openPreview(); + await openPreview('st_asset'); expect(await screen.findByText('Serial Number')).toBeInTheDocument(); expect(toolbar().queryByText(DRAFT_CHIP)).toBeNull(); @@ -229,7 +229,7 @@ describe('DataPillar Form Preview renders the draft definition (objectui#12515)' it('Preview never saves: a submitted preview form writes nothing', async () => { server.drafts.set('st_ticket', ticket); server.draftHeaders = ['st_ticket']; - await openPreview(); + await openPreview('st_ticket'); const subject = (await screen.findByText('Subject')).closest('[data-field]')?.querySelector('input'); expect(subject, 'the Subject input never rendered: the harness is dead').toBeTruthy(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx index 5bee7855f19..7a75bc8fe8e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx @@ -90,7 +90,7 @@ afterEach(() => { async function openForm(props: { readOnly?: boolean } = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx index 04e3ae1d146..ef267a3835e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx @@ -116,7 +116,7 @@ function renderPillar(packageId = 'com.example.showcase') { return render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx index 3e91f7903d4..484fe40d767 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx @@ -84,7 +84,7 @@ afterEach(() => { async function renderPillar(props: { readOnly?: boolean } = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx index 20093574319..c0d25627c66 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx @@ -116,7 +116,7 @@ function lastSentField(name: string): Record | undefined { async function addFieldAs(typeOption: RegExp): Promise<{ name: string; label: string }> { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); @@ -203,7 +203,7 @@ describe('Studio data page — complete bodies are sent as before (objectui#1178 it('a complete edit is sent by Save, with no held line', async () => { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); @@ -227,7 +227,7 @@ describe('Studio data page — complete bodies are sent as before (objectui#1178 }; render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx index 400293b84cb..ff48be9ddd5 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx @@ -224,7 +224,7 @@ function renderPillar() { return render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx index fbfd92346c7..fd01f0b77c7 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx @@ -123,7 +123,7 @@ afterEach(() => { async function openHook(): Promise { render( - + , ); // The first match is the flat tab (the passthrough menu draws a second). diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx index d8af70a9eb2..ff0d9a02928 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx @@ -97,7 +97,7 @@ const rail = () => screen.queryByText(INSPECTOR); async function openInspectorOnForm(): Promise { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: L('engine.studio.data.tab.form') })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx index 224dadd55e9..183dd15a65a 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx @@ -163,7 +163,7 @@ afterEach(() => { async function openForm(props: { readOnly?: boolean; customization?: StudioBaseCustomization } = {}) { render( - + , ); await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx index 89675462783..64eea919c03 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx @@ -83,7 +83,7 @@ const CLAIM = /your unsaved changes/i; async function openFormTab(props: Partial> = {}) { render( - + , ); // First object auto-selects; the Form tab is the second segmented control. diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx index 5ac79af036f..207bc068cfc 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx @@ -108,7 +108,7 @@ async function mountOnLayout(): Promise { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx index 350438d9a8e..482c9e0e2c1 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx @@ -234,7 +234,7 @@ afterEach(() => { async function mountOnActions(props: { readOnly: boolean; customization?: StudioBaseCustomization | null }) { render( - + , ); // The first match is the flat tab (the passthrough menu draws a second). diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx index 917a6da98ae..eba9a11befb 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx @@ -264,7 +264,7 @@ async function mountOnActions(): Promise { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx index 66a0954c426..1dd9a2522e2 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx @@ -140,7 +140,7 @@ afterEach(() => { async function openRuleGuard() { render( - + , ); // objectui#12450 — the flat tab; the passthrough menu draws the folded diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx index c307678c213..dcd6477f9a2 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx @@ -150,7 +150,7 @@ const rawEditorIn = (root: HTMLElement) => function mount() { render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx index 24fdba5b025..b8b9740d2f1 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx @@ -167,7 +167,7 @@ afterEach(() => { function renderData() { render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx index c5b61236286..3c009d5c03a 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx @@ -154,7 +154,7 @@ afterEach(() => { async function openRuleGuard(): Promise { render( - + , ); fireEvent.click(await screen.findByTestId('data-tab-flat-rules')); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.railSwitchFlush-27511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.railSwitchFlush-27511.test.tsx deleted file mode 100644 index ffdff986de0..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.railSwitchFlush-27511.test.tsx +++ /dev/null @@ -1,256 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectstack#27511 — an object switch in the Data pillar's rail never drops - * an unsaved edit with nothing on screen. - * - * objectstack#36511 — the object page saves with the top bar's Save, so a - * switch sends nothing: the rail's switch reloads the one buffer the edit lives - * in, and an edit Save has not sent (or whose save was refused) is the - * author's to drop, so the switch asks. A saved edit leaves nothing to ask - * about. - * - * The client is a server double that records every save and can hold or - * refuse one; the records grid is a double that draws only its "+" column. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -// Module scope as well as in the `vi.mock` factory below: the cold transform is paid -// during collection, which no test or hook timeout clocks (AGENTS.md, flaky-test discipline). -import '@object-ui/components'; -import { render, screen, fireEvent, cleanup, waitFor, act } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; - -const PKG = 'com.acme.app'; - -const TASK = { - name: 'acme_task', - label: 'Task', - fields: [ - { name: 'title', label: 'Title', type: 'text' }, - { name: 'status', label: 'Status', type: 'text' }, - ], -}; -const NOTE = { name: 'acme_note', label: 'Note', fields: [{ name: 'body', label: 'Body', type: 'text' }] }; - -const server = vi.hoisted(() => ({ - active: new Map>(), - drafts: new Map>(), - /** Every save, as the server received it. */ - saves: [] as Array<{ name: string; body: Record }>, - /** While set, the next save waits on it (a save held in flight). */ - saveHold: null as Promise | null, - /** While true, every save is refused. */ - refuse: false, -})); - -// A server double: a save lands as the object's draft, and a later load serves it. -const mockClient = vi.hoisted(() => ({ - list: vi.fn(async () => [...server.active.values()].map((row) => ({ name: row.name, label: row.label }))), - listDrafts: vi.fn(async () => []), - listTypes: vi.fn(async () => ({ entries: [] })), - get: vi.fn(async () => null), - withPreviewDrafts: vi.fn((): unknown => mockClient), - references: vi.fn(async () => []), - layered: vi.fn(async (_type: string, name: string) => { - const eff = server.active.get(name) ?? null; - // objectstack#29793 — the stored draft is the `draft` layer, the pillar's buffer. - const draft = server.drafts.get(name) ?? null; - return { code: null, overlay: eff, overlayScope: eff ? 'env' : null, effective: eff, draft: draft && (JSON.parse(JSON.stringify(draft)) as Record), editable: true, deletable: true, resettable: false, lock: 'none' }; - }), - getDraft: vi.fn(async (type: string, name: string) => { - const draft = server.drafts.get(name); - if (draft) return { item: JSON.parse(JSON.stringify(draft)) as Record }; - throw Object.assign(new Error(`No pending draft exists for ${type}/${name}.`), { code: 'NO_DRAFT', status: 404 }); - }), - // The Save's own publish (objectstack#36511): the draft goes live. - publish: vi.fn(async (_type: string, name: string, _opts?: unknown) => { - const draft = server.drafts.get(name); - if (draft) server.active.set(name, draft); - server.drafts.delete(name); - return {}; - }), - reset: vi.fn(async () => ({})), - save: vi.fn(async (_type: string, name: string, item: unknown) => { - const body = JSON.parse(JSON.stringify(item)) as Record; - server.saves.push({ name, body }); - const hold = server.saveHold; - server.saveHold = null; - if (hold) await hold; - if (server.refuse) throw Object.assign(new Error('The server refused this draft.'), { status: 500 }); - server.drafts.set(name, body); - return { type: 'object', name, item }; - }), -})); - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useMetadataClient: () => mockClient, useMetadataTypes: () => ({ loading: false, error: null, entries: [] }) }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => [{ id: PKG, name: 'Acme', writable: true, namespace: 'acme' }]) }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => dataSource }; -}); - -// The records grid: only its "+" column, drawn from the grid's authoring -// context the way the real grid draws it (objectui#12511). -vi.mock('@object-ui/plugin-view', async (importOriginal) => { - const mod = await importOriginal>(); - const { useGridFieldAuthoring } = await import('@object-ui/components'); - function GridDouble() { - const authoring = useGridFieldAuthoring(); - return authoring?.onAddColumn ? ( - - ) : null; - } - return { ...mod, ObjectView: GridDouble }; -}); - -vi.mock('sonner', () => ({ - toast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), dismiss: vi.fn() }, - Toaster: () => null, -})); - -// The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). -import '@objectstack/lint'; -import { DataPillar } from './StudioDesignSurface'; -import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; -import { addFieldFromGrid } from './__tests__/dataPillarAddField'; -import { createEmptyDataSource } from './__tests__/emptyDataSource'; -import { readFields } from '../metadata-admin/previews/object-fields-io'; - -const dataSource = createEmptyDataSource(); - -window.matchMedia = ((query: string) => ({ - matches: false, - media: query, - onchange: null, - addEventListener: () => {}, - removeEventListener: () => {}, - addListener: () => {}, - removeListener: () => {}, - dispatchEvent: () => false, -})) as unknown as typeof window.matchMedia; -(globalThis as unknown as { ResizeObserver: unknown }).ResizeObserver = - (globalThis as unknown as { ResizeObserver?: unknown }).ResizeObserver ?? - class { - observe() {} - unobserve() {} - disconnect() {} - }; - -// This environment ships no window.confirm: the pillar's discard question. -let confirmSpy: ReturnType; - -beforeEach(() => { - server.active.clear(); - server.drafts.clear(); - server.saves.length = 0; - server.saveHold = null; - server.refuse = false; - server.active.set(TASK.name, JSON.parse(JSON.stringify(TASK))); - server.active.set(NOTE.name, JSON.parse(JSON.stringify(NOTE))); - confirmSpy = vi.fn(() => false); - window.confirm = confirmSpy as unknown as typeof window.confirm; - vi.stubGlobal( - 'fetch', - vi.fn(async () => new Response('null', { status: 404, headers: { 'content-type': 'application/json' } })), - ); -}); - -afterEach(() => { - cleanup(); - vi.unstubAllGlobals(); -}); - -const SLOW = { timeout: 8000 }; - -const fieldNamesOf = (body: Record) => readFields(body.fields).entries.map((e) => e.name); -const savesRead = () => server.saves.map((s) => [s.name, fieldNamesOf(s.body)]); -const fieldCount = () => screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/); - -async function openTask(): Promise { - render( - - - , - ); - await waitFor(() => expect(fieldCount()).toHaveTextContent('2 fields'), SLOW); -} - -/** Lets time pass: what was sent by then is what will be. */ -async function pastDebounce(ms = 2500): Promise { - await act(async () => { - await new Promise((r) => setTimeout(r, ms)); - }); -} - -describe('Data pillar — an object switch over an unsaved edit (objectstack#27511, objectstack#36511)', () => { - it('sends nothing: the switch asks; declined, the edit stays; agreed, Note opens and Task is as stored', async () => { - await openTask(); - await addFieldFromGrid(); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - expect(confirmSpy).toHaveBeenCalledTimes(1); - expect(fieldCount()).toHaveTextContent('3 fields'); - - confirmSpy.mockReturnValue(true); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('1 field'), SLOW); - expect(server.saves).toEqual([]); - fireEvent.click(screen.getByRole('button', { name: /Task/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('2 fields'), SLOW); - }, 30000); - - it('a saved edit is the stored object: the switch opens Note at once, and Task keeps the edit', async () => { - await openTask(); - await addFieldFromGrid(); - await pressStudioSave(); - expect(savesRead()).toEqual([['acme_task', ['title', 'status', 'new_field']]]); - expect(mockClient.publish).toHaveBeenCalledWith('object', 'acme_task', { packageId: PKG }); - - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('1 field'), SLOW); - expect(confirmSpy).not.toHaveBeenCalled(); - fireEvent.click(screen.getByRole('button', { name: /Task/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('3 fields'), SLOW); - }, 30000); - - it('an edit whose save was refused is not dropped silently: the switch asks, and a declined ask keeps it', async () => { - await openTask(); - server.refuse = true; - await addFieldFromGrid(); - await pressStudioSave(); - await waitFor(() => expect(server.saves).toHaveLength(1), SLOW); - await pastDebounce(300); - - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - expect(confirmSpy).toHaveBeenCalledTimes(1); - await pastDebounce(300); - expect(fieldCount()).toHaveTextContent('3 fields'); - - // Agreed to: the edit is dropped and Note opens; nothing more was sent. - confirmSpy.mockReturnValue(true); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('1 field'), SLOW); - expect(server.saves).toHaveLength(1); - }, 30000); - - it('a switch with nothing pending opens the next object at once and sends nothing', async () => { - await openTask(); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - await waitFor(() => expect(fieldCount()).toHaveTextContent('1 field'), SLOW); - await pastDebounce(); - expect(server.saves).toEqual([]); - expect(confirmSpy).not.toHaveBeenCalled(); - }, 30000); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx index efbfc761202..8b14738476b 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx @@ -88,7 +88,7 @@ const describedBy = (el: HTMLElement) => { async function openRail(readOnly: boolean): Promise { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: L('engine.studio.data.tab.form') })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx index 5385db384f2..18710061d33 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx @@ -199,7 +199,7 @@ describe('revealColumn (objectstack#35061)', () => { async function renderGrid() { render( - + , ); await waitFor(() => expect(document.querySelector('thead th[data-column-key="title"]')).not.toBeNull(), { diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx index 0a4fdf1ccc0..cbea863f7da 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx @@ -127,7 +127,7 @@ afterEach(() => { async function renderGrid(props: { readOnly?: boolean } = {}) { render( - + , ); await waitFor(() => expect(document.querySelector('thead th[data-column-key="title"]')).not.toBeNull(), { diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx index a401442409f..da1d3130f86 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx @@ -142,7 +142,7 @@ async function mountOnForm(): Promise { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx index eda46e9aada..842c574c396 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx @@ -137,7 +137,7 @@ async function mountOnView(def: Record, tabKey: string): Promis objectDef = def; render( - + , ); // The first match is the flat tab (the passthrough menu draws a second). diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx index b2d130601f6..910c49c3994 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx @@ -108,7 +108,7 @@ function lastSentField(name: string): Record | undefined { async function addRollup(): Promise<{ name: string; label: string }> { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.surfaceRequest.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.surfaceRequest.test.tsx deleted file mode 100644 index 10b612b8717..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.surfaceRequest.test.tsx +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * The Data pillar applies a LIVE surface request — objectui#5476. - * - * Studio's pre-publish security block names `object/crmext_visit` from a sheet - * opened over this pillar while it is already mounted, so the `?surface=` - * capture (read once, at mount) can never serve it. The pillar subscribes to - * the channel instead, and this suite drives that end to end through the - * pillar's OWN mirror: the surface param the pillar writes back is the - * observable proof that its selection actually moved, not a spy on the wiring. - * - * The second test is the more important one. The request is applied AT MOST - * ONCE by construction, because a standing request re-resolved on the next - * rail reload would drag the author off whatever they had since chosen — the - * exact regression the mount-time ref was introduced to prevent. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, screen, fireEvent, cleanup, waitFor } from '@testing-library/react'; -import { MemoryRouter, useSearchParams } from 'react-router-dom'; - -const objectDef = { - name: 'showcase_project', - label: 'Project', - fields: [{ name: 'title', label: 'Title', type: 'text' }], -}; - -const mockClient = { - list: vi.fn(async () => [ - { name: 'showcase_project', label: 'Project' }, - { name: 'crmext_visit', label: 'Visit' }, - ]), - listDrafts: vi.fn(async () => []), - layered: vi.fn(async () => ({ effective: objectDef, code: objectDef })), - getDraft: vi.fn(async () => null), -}; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ entries: [] }), - }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); - -// objectui#8620: the records grid calls `find()` on this adapter. `{}` had no -// `find()`, so `ListView`'s fetch threw and its `catch` swallowed the error. -// `dataSource` is an empty-backend `DataSource`, created once below the imports -// so every render gets the same object. -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => dataSource }; -}); - -import { DataPillar } from './StudioDesignSurface'; -import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; -import { SurfaceDeepLinkProvider, useSurfaceNavigator } from './surfaceDeepLinkChannel'; -import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; - -const dataSource = createEmptyDataSource(); -failOnAbsorbedFetchError(); - -registerBuiltinInspectors(); - -afterEach(cleanup); - -/** What the pillar mirrored back to the URL — i.e. what it currently has open. */ -function OpenSurface(): React.ReactElement { - const [params] = useSearchParams(); - return {params.get('surface') ?? 'none'}; -} - -/** Stands in for the pending-changes sheet's security block. */ -function Producer(): React.ReactElement { - const openSurface = useSurfaceNavigator(); - return ( - - ); -} - -function renderPillar(packageId = 'com.example.showcase') { - return render( - - - - - - - , - ); -} - -const openSurface = () => screen.getByTestId('open-surface'); - -describe('DataPillar — a surface requested after mount (objectui#5476)', () => { - it('opens the object the request names, with no remount and no URL to capture', async () => { - renderPillar(); - // Nothing deep-linked: the rail opens its first item, as it always has. - await waitFor(() => expect(openSurface()).toHaveTextContent('object:showcase_project')); - - fireEvent.click(screen.getByRole('button', { name: 'object/crmext_visit' })); - - await waitFor(() => expect(openSurface()).toHaveTextContent('object:crmext_visit')); - }); - - it('never re-applies it: a later selection survives the next rail reload', async () => { - const { rerender } = renderPillar(); - await waitFor(() => expect(openSurface()).toHaveTextContent('object:showcase_project')); - fireEvent.click(screen.getByRole('button', { name: 'object/crmext_visit' })); - await waitFor(() => expect(openSurface()).toHaveTextContent('object:crmext_visit')); - - // The author moves on, by hand, in the rail. - fireEvent.click(screen.getByRole('button', { name: 'Project' })); - await waitFor(() => expect(openSurface()).toHaveTextContent('object:showcase_project')); - - // Now the rail reloads (here: a package switch — same list, fresh array). - // A request that is still standing would yank them back to the object the - // sheet named, minutes after they left it. - const loadsBefore = mockClient.list.mock.calls.length; - rerender( - - - - - - - , - ); - // The reload has to have actually HAPPENED for the rest to mean anything: - // an assertion that nothing moved is satisfied perfectly by nothing - // running at all. - await waitFor(() => expect(mockClient.list.mock.calls.length).toBeGreaterThan(loadsBefore)); - await new Promise((r) => setTimeout(r, 50)); - expect(openSurface()).toHaveTextContent('object:showcase_project'); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx index 058bc56b62c..e0dc2450bce 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx @@ -183,7 +183,7 @@ function mount(draft: Record | null) { server = { draft, sent: [] }; render( - + , ); } diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.newObjectJoinsAppMenu-36748.test.tsx b/ui/packages/app-shell/src/views/studio-design/MetadataListCreateDialog.newObjectJoinsAppMenu-36748.test.tsx similarity index 91% rename from ui/packages/app-shell/src/views/studio-design/DataPillar.newObjectJoinsAppMenu-36748.test.tsx rename to ui/packages/app-shell/src/views/studio-design/MetadataListCreateDialog.newObjectJoinsAppMenu-36748.test.tsx index 739dc37e62e..55e338a3e61 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.newObjectJoinsAppMenu-36748.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/MetadataListCreateDialog.newObjectJoinsAppMenu-36748.test.tsx @@ -7,7 +7,8 @@ * With no app nothing more is written; a refused menu save, or a failed read * of the package's apps, keeps the object and says so in a warning. * - * The REAL `DataPillar` over a recording client; the package list the menu + * objectstack#36904 — the create is the object list's (`MetadataListCreateDialog`), + * the object designer having none; the REAL dialog over a recording client; the package list the menu * save reads (`GET /api/v1/packages`) is a fetch stub. */ @@ -71,7 +72,7 @@ vi.mock('sonner', () => ({ })); import { toast } from 'sonner'; -import { DataPillar } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; beforeEach(() => { vi.clearAllMocks(); @@ -99,17 +100,18 @@ afterEach(() => { async function createObject(label: string) { render( - - + + {}} packageId={PKG} inPair={false} locale="en-US" onCreated={created} /> , ); - fireEvent.click(await screen.findByTestId('empty-state-new-object')); await screen.findByTestId('create-object-owd'); const dialog = screen.getByRole('dialog'); fireEvent.change(dialog.querySelectorAll('input')[0], { target: { value: label } }); fireEvent.click(within(dialog).getByRole('button', { name: /^(create|创建)$/i })); } +const created = vi.fn(); + /** The object's name, as its draft was saved. */ const objectName = () => String(mockClient.save.mock.calls.find((c) => c[0] === 'object')?.[1]); @@ -142,8 +144,8 @@ describe('新建对象 joins the package’s one app menu (objectstack#36748)', expect.stringMatching(/^“Visit” was created, but it could not be added to the menu of “Visits”: The app has unpublished changes in Studio\. /), )); expect(srv.calls).toEqual(['save object draft', 'publish object', 'save app draft']); - // The object is open on the rail all the same. - expect(await screen.findByTestId('form-toolbar')).toBeInTheDocument(); + // The object is created all the same: the list opens it. + expect(created).toHaveBeenCalledTimes(1); }); it('a failed read of the package’s apps keeps the object, warns, and draws no refusal over it', async () => { @@ -153,7 +155,7 @@ describe('新建对象 joins the package’s one app menu (objectstack#36748)', expect.stringMatching(/^“Visit” was created, but it could not be added to its app’s menu: /), )); expect(srv.calls).toEqual(['save object draft', 'publish object']); - expect(await screen.findByTestId('form-toolbar')).toBeInTheDocument(); + expect(created).toHaveBeenCalledTimes(1); // The create's own refusal strip is not drawn over the live object. expect(toast.error).not.toHaveBeenCalled(); expect(screen.queryByRole('alert')).toBeNull(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createObjectOwd.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createObjectOwd.test.tsx deleted file mode 100644 index 8942d3a5e3f..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createObjectOwd.test.tsx +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * `新建对象` must ask for the record-sharing baseline — objectui#5418. - * - * Measured walk on the card: the create dialog collected exactly two fields - * (对象名称 / 标识), `buildObjectSkeleton` emitted `{ name, label, fields }`, - * and the object was refused at 发布 → 全部发布 by `security-owd-unset`. The - * gate is right — an OWD must be an authored decision — so the fix is to ask, - * at the one moment the author is thinking about the object. - * - * This suite drives the REAL `DataPillar` and asserts on the body it hands to - * `client.save`, because "the dialog renders a select" is not the claim; the - * claim is that the SAVED DRAFT carries an authored baseline. - */ - -// Warmed at module top so the first load of the console's lazily loaded -// authoring code is paid during collection, not inside a test's clock. -import '@objectstack/lint'; -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; - -const mockClient = { - list: vi.fn(async () => []), - listDrafts: vi.fn(async () => []), - layered: vi.fn(async () => ({ effective: null, code: null })), - getDraft: vi.fn(async () => null), - save: vi.fn(async () => ({})), -}; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ entries: [] }), - }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); - -import { DataPillar } from './StudioDesignSurface'; -import { t } from '../metadata-admin/i18n'; - -/** - * A model's label in the create dialog: the Settings tab's own string, read by - * its key. The picker is the shared `Select` since objectui#11865, so what it - * holds is read off its trigger and its list, by label. - */ -const modelLabel = (key: string) => t(`engine.studio.settings.${key}`, 'en'); - -/** Open the record-sharing picker and return the labels it lists, in order. */ -async function listedModels(trigger: HTMLElement): Promise { - fireEvent.keyDown(trigger, { key: 'ArrowDown' }); - return within(await screen.findByRole('listbox')) - .getAllByRole('option') - .map((o) => o.textContent ?? ''); -} - -beforeEach(() => { - vi.clearAllMocks(); -}); -afterEach(cleanup); - -function renderPillar() { - return render( - - - , - ); -} - -/** Open the create dialog from the empty-state affordance. */ -async function openCreateDialog() { - renderPillar(); - const opener = await screen.findByTestId('empty-state-new-object'); - fireEvent.click(opener); - return await screen.findByTestId('create-object-owd'); -} - -/** - * Type a display name and submit. Selected structurally rather than by copy: - * this suite is about the saved body, and pinning it to a placeholder string - * would make it fail the next time that copy is reworded — in either of the - * two locales the Studio catalog carries. - */ -function fillAndSubmit(label: string) { - const dialog = screen.getByRole('dialog'); - const inputs = dialog.querySelectorAll('input'); - // CreateItemDialog renders the display-name field first; the identifier - // auto-slugs from it, which is the path a real author walks. - fireEvent.change(inputs[0], { target: { value: label } }); - // By accessible name, NOT by position: DialogContent renders Radix's own - // sr-only close button AFTER the footer, so "the last button" is Close and a - // positional pick silently dismisses the dialog instead of submitting it. - // Matched loosely so the suite survives either of the Studio catalog's two locales. - fireEvent.click(within(dialog).getByRole('button', { name: /^(create|创建)$/i })); -} - -/** The body `client.save` was called with for the object draft. */ -function savedBody(): Record { - expect(mockClient.save).toHaveBeenCalled(); - const call = mockClient.save.mock.calls.at(-1) as unknown as [string, string, Record]; - return call[2]; -} - -describe('新建对象 asks for the OWD (objectui#5418)', () => { - it('offers the baseline, defaulted to the platform’s own recommended value', async () => { - const trigger = await openCreateDialog(); - expect(trigger.textContent).toBe(modelLabel('sharingPrivate')); - }); - - it('offers exactly the three models a brand-new object can author', async () => { - // `controlled_by_parent` derives access from a master relation, and a - // just-created object has none — offering it would swap the - // `security-owd-unset` publish wall for the - // `security-controlled-by-parent-no-relation` one. The Settings tab keeps - // all four, where the object may since have gained a master-detail field. - const labels = await listedModels(await openCreateDialog()); - expect(labels).toEqual([ - modelLabel('sharingPrivate'), - modelLabel('sharingPublicRead'), - modelLabel('sharingPublicReadWrite'), - ]); - expect(labels).not.toContain(modelLabel('sharingControlledByParent')); - }); - - it('saves the accepted default as an EXPLICIT baseline on the draft', async () => { - await openCreateDialog(); - fillAndSubmit('Visit'); - await waitFor(() => expect(mockClient.save).toHaveBeenCalled()); - // The whole point: the key is PRESENT. An absent one is what the publish - // door refuses, and "the runtime would have defaulted to private anyway" - // is precisely the accident ADR-0090 D1 forbids as a baseline. - expect(savedBody()).toHaveProperty('sharingModel', 'private'); - }); - - it('saves a changed choice instead of the default', async () => { - const trigger = await openCreateDialog(); - fireEvent.keyDown(trigger, { key: 'ArrowDown' }); - fireEvent.click(within(await screen.findByRole('listbox')).getByRole('option', { name: modelLabel('sharingPublicRead') })); - fillAndSubmit('Visit'); - await waitFor(() => expect(mockClient.save).toHaveBeenCalled()); - expect(savedBody()).toHaveProperty('sharingModel', 'public_read'); - }); - - it('saves it as a DRAFT — creation still does not publish anything', async () => { - await openCreateDialog(); - fillAndSubmit('Visit'); - await waitFor(() => expect(mockClient.save).toHaveBeenCalled()); - const call = mockClient.save.mock.calls.at(-1) as unknown as [string, string, unknown, { mode?: string }]; - expect(call[3]?.mode).toBe('draft'); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx index 037f7022d4e..5bc07001a7e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx @@ -123,7 +123,8 @@ vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -import { AutomationsPillar, DataPillar, StudioDesignSurface } from './StudioDesignSurface'; +import { AutomationsPillar, StudioDesignSurface } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { t, tFormat } from '../metadata-admin/i18n'; @@ -274,14 +275,16 @@ describe('objectstack#26917 — Automations: New automation over a taken identif }); }); +// objectstack#36904 — New object is the object list's create dialog; the +// designer has no object list, so an identifier this package holds is refused +// the same way as one another package holds. describe('objectstack#26917 — Data: New object over a taken identifier', () => { async function openNewObject() { render( - - + + {}} packageId={PKG} inPair={false} locale="en" onCreated={() => {}} /> , ); - fireEvent.click(await screen.findByRole('button', { name: en('engine.studio.data.newObject') }, { timeout: 8000 })); const dialog = await screen.findByRole('dialog'); // The identifier is stored with the package's namespace prefix // (`prefixObjectName`): wait until the dialog previews it. @@ -309,24 +312,6 @@ describe('objectstack#26917 — Data: New object over a taken identifier', () => expect(door.published.get('object/acme_ticket')!.body).toEqual(before); }); - it("an object on this package's rail: refused, nothing written, and Open opens it", async () => { - publish('object', PKG, OBJ_ACCOUNT); - publish('object', PKG, OBJ_TICKET); - const dialog = await openNewObject(); - submitCreate(dialog, 'Ticket'); - - const taken = await within(dialog).findByTestId('object-create-taken'); - expect(taken).toHaveTextContent( - tFormat('engine.studio.data.createTaken', 'en', { name: 'acme_ticket', label: 'Ticket' }), - ); - expect(save).not.toHaveBeenCalled(); - - fireEvent.click(within(taken).getByTestId('object-create-open-existing')); - await waitFor(() => expect(screen.queryByRole('dialog')).toBeNull()); - await waitFor(() => expect(getDraft.mock.calls.some(([type, name]) => type === 'object' && name === 'acme_ticket')).toBe(true)); - expect(save).not.toHaveBeenCalled(); - }); - it('a fresh identifier is created as before, under the first-write pin', async () => { publish('object', PKG, OBJ_ACCOUNT); const dialog = await openNewObject(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.emptyPackage.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.emptyPackage.test.tsx deleted file mode 100644 index c82d846a6c8..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.emptyPackage.test.tsx +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * Empty-package behavior of the Data pillar (dogfood #2555): - * - * Visiting an empty writable package used to FORCE the "new object" creator - * dialog open on every mount — an unrequested modal, duplicating the guidance - * the empty-state panel already gives. Now the dialog stays closed and the - * empty state carries its own create CTA instead. - * - * The rail beside it says the same thing in one sentence, and that sentence - * points at the rail's own "+" (objectui#13127). - */ -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { afterEach, describe, expect, it, vi } from 'vitest'; -import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; - -// ── mocks ────────────────────────────────────────────────────────────────── -// DataPillar's data deps: the metadata client (list/listDrafts) and the -// package list (namespace lookup). Everything else renders for real. -const mockClient = { - list: vi.fn(async () => []), - listDrafts: vi.fn(async () => []), -}; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ entries: [] }), - }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - fetchPackages: vi.fn(async () => []), - }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useAdapter: () => ({}), - }; -}); - -import { DataPillar } from './StudioDesignSurface'; -import { t } from '../metadata-admin/i18n'; - -// The designer rows this suite reads in zh live in `@object-ui/i18n`'s `studio` -// namespace, whose `zh` catalogue is fetched on demand (objectstack#25922). -// Resident before any case, so the zh rows below read synchronously. -import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; -await loadStudioCatalogue('zh'); - -afterEach(cleanup); - -function renderPillar(props: Partial> = {}) { - return render( - - - , - ); -} - -describe('DataPillar — empty package', () => { - it('does NOT auto-open the new-object dialog and shows the empty-state CTA instead', async () => { - renderPillar(); - - // Wait for the object load to settle into the empty state. - const cta = await screen.findByTestId('empty-state-new-object'); - expect(cta).toBeInTheDocument(); - - // The creator dialog must NOT be open (no dialog content in the tree). - expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); - }); - - it('opens the creator dialog when the empty-state CTA is clicked', async () => { - renderPillar(); - - const cta = await screen.findByTestId('empty-state-new-object'); - fireEvent.click(cta); - - await waitFor(() => expect(screen.getByRole('dialog')).toBeInTheDocument()); - }); - - // objectui#13127 — the rail's empty sentence used to send the author - // "below", where the rail draws nothing; its only create control is the - // "+" in the heading row above the list. The sentence names that control, - // as the Automations and Access rails' empty sentences do (objectui#12514). - it('the rail’s empty sentence names the “+” it points at, and the rail draws that “+” above it', async () => { - renderPillar(); - await screen.findByTestId('empty-state-new-object'); - - const rail = screen.getByTestId('studio-rail-data'); - const sentence = within(rail).getByText(t('engine.studio.data.noObjects', 'en')); - const add = within(rail).getByTestId('studio-rail-add'); - - expect(t('engine.studio.data.noObjects', 'en')).toContain('“+”'); - expect(t('engine.studio.data.noObjects', 'zh-CN')).toContain('「+」'); - expect(add.compareDocumentPosition(sentence) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy(); - }); - - it('hides the CTA on a read-only package', async () => { - renderPillar({ readOnly: true }); - - // Empty state still renders… - await waitFor(() => expect(mockClient.list).toHaveBeenCalled()); - // …but with no create affordance and no dialog. - await waitFor(() => - expect(screen.queryByTestId('empty-state-new-object')).not.toBeInTheDocument(), - ); - expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx index 6b65d962621..002374c57c3 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx @@ -172,7 +172,7 @@ function Harness(): React.ReactElement { - + ); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx index 2b80b7a7a15..6cb11c415d3 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx @@ -138,7 +138,7 @@ function Harness(): React.ReactElement { - + ); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx index 284268cbb25..96bfe071900 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx @@ -87,7 +87,7 @@ const absent = (key: string) => t(key, 'en-US'); async function openForm(readOnly: boolean): Promise { render( - + , ); fireEvent.click(await screen.findByRole('button', { name: row('engine.studio.data.tab.form') })); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx index 720cbc9774e..0164b8d3316 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx @@ -100,7 +100,8 @@ vi.mock('@object-ui/react', async (importOriginal) => { vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.fn(), dismiss: vi.fn() } })); -import { AutomationsPillar, DataPillar } from './StudioDesignSurface'; +import { AutomationsPillar } from './StudioDesignSurface'; +import { MetadataListCreateDialog } from '../metadata-admin/MetadataListCreateDialog'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { t } from '../metadata-admin/i18n'; @@ -163,14 +164,13 @@ const owdName = (descKey: string) => const OBJECT_PKG = 'com.test.crmext'; async function openNewObject(): Promise { - // An empty package: the pillar offers *New object* from its empty state. + // objectstack#36904 — New object is the object list's create dialog. server.rows = []; render( - - + + {}} packageId={OBJECT_PKG} inPair={false} locale="en" onCreated={() => {}} /> , ); - fireEvent.click(await screen.findByTestId('empty-state-new-object', undefined, { timeout: 8000 })); return await screen.findByTestId('create-object-owd'); } From 1aa14944e2551d19d566af0e33eeace21158b397 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 22:44:36 +0000 Subject: [PATCH 05/18] test(studio): the designer's header, tab order and action link on the object's address Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../ai/__tests__/artifactStudioPath.test.ts | 4 +- .../__tests__/RecordTabsConfig-36499.test.tsx | 2 +- ...ListCreateDialog.pairCreate-36897.test.tsx | 2 +- .../DataPillar.actionDeepLink-34724.test.tsx | 33 +++++----------- ...ataPillar.advancedKeepsName-11794.test.tsx | 3 +- .../studio-design/DataPillar.celGate.test.tsx | 27 ------------- .../DataPillar.flatTabs-12450.test.tsx | 13 +++++-- .../DataPillar.headerActions-12511.test.tsx | 30 +++++++-------- .../DataPillar.recordsTab-34794.test.tsx | 8 ++-- .../views/studio-design/objectDesignerTabs.ts | 38 ++++++++++--------- 10 files changed, 65 insertions(+), 95 deletions(-) diff --git a/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts b/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts index 5673fa67ed9..54120a65cb0 100644 --- a/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts +++ b/ui/packages/app-shell/src/console/ai/__tests__/artifactStudioPath.test.ts @@ -10,9 +10,9 @@ import { artifactStudioPath } from '../artifactStudioPath'; describe('artifactStudioPath', () => { const pkg = 'app.rmpe'; - it('object → Data pillar with an object surface', () => { + it("object → the object designer's address (objectstack#36904)", () => { expect(artifactStudioPath(pkg, { type: 'object', name: 'rmpe_customer' })).toBe( - '/studio/app.rmpe/data?surface=object%3Armpe_customer', + '/studio/app.rmpe/metadata/object/rmpe_customer', ); }); diff --git a/ui/packages/app-shell/src/views/__tests__/RecordTabsConfig-36499.test.tsx b/ui/packages/app-shell/src/views/__tests__/RecordTabsConfig-36499.test.tsx index 583959a8905..61a770f3b24 100644 --- a/ui/packages/app-shell/src/views/__tests__/RecordTabsConfig-36499.test.tsx +++ b/ui/packages/app-shell/src/views/__tests__/RecordTabsConfig-36499.test.tsx @@ -168,7 +168,7 @@ describe('「Configure tabs」 (objectstack#36499)', () => { const shown = Array.from(editor.querySelectorAll('[data-record-tabs-tab]')).map((el) => el.getAttribute('data-record-tabs-tab')); expect(shown).toEqual(['contact.account', 'task.account', 'sys_approval_request', 'sys_activity']); expect(screen.getByTestId('record-tabs-hidden').querySelector('[data-record-tabs-hidden-tab="case.account"]')).not.toBeNull(); - expect(screen.getByTestId('record-tabs-field-groups')).toHaveAttribute('href', expect.stringContaining('/studio/app.crm/data')); + expect(screen.getByTestId('record-tabs-field-groups')).toHaveAttribute('href', expect.stringContaining('/studio/app.crm/metadata/object/')); }); it("another package's list is drawn fixed after the object's own tabs: no move, hide or rename", async () => { diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx index 3d1c7276ab4..d91716a72ed 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx @@ -169,7 +169,7 @@ describe('list 「新建」 for an object: the create the object designer no lon const onCreated = open('object', 'com.example.crm', false); fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); await waitFor(() => expect(taken).toHaveBeenCalled()); - expect(await screen.findByText(/crm_visit/)).toBeInTheDocument(); + expect(await screen.findByTestId('object-create-taken')).toHaveTextContent('crm_visit'); expect(save).not.toHaveBeenCalled(); expect(publish).not.toHaveBeenCalled(); expect(onCreated).not.toHaveBeenCalled(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx index 0e6989dfc4d..3519b8f38ea 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx @@ -1,9 +1,9 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * objectstack#34724 (ADR-0146 D4 as amended 2026-11-17) — a Data pillar link - * can open an object's Actions view on one action: - * `?surface=object:&action=`. Studio's landing links a + * objectstack#34724 (ADR-0146 D4 as amended 2026-11-17) — an object designer + * link can open its Actions view on one action: `?action=` on the + * object's address (objectstack#36904). Studio's landing links a * switched-off action that lives in its object's `actions[]` here, since such * an action has no item page and its switch is on the Actions view. * @@ -12,10 +12,8 @@ * (its inspector shows its label, not the first action's); * - CONTROL: the same link without `action=` opens the object on Records, as * before, with no action inspector; - * - the param is read once: picking another view afterwards stays there; - * - the param leaves the URL once another object opens, so a reload or a - * shared copy never opens that object on an action (seat L2 S4); the first - * write, naming the deep-linked object, keeps it. + * - the param is read once: picking another view afterwards stays there. + * (Another object is another address, so the param never follows it.) */ import '@testing-library/jest-dom/vitest'; @@ -159,7 +157,7 @@ function UrlProbe(): React.ReactElement { function mountAt(search: string): void { objectDef = TASK; render( - + , @@ -171,13 +169,13 @@ const labelInput = async () => describe('Studio data page — `?action=` opens the object\'s Actions view on that action (objectstack#34724)', () => { it('lands on the Actions view with the named action selected, not the first one', async () => { - mountAt('?surface=object%3Ashowcase_task&action=showcase_task_send'); + mountAt('?action=showcase_task_send'); expect(await labelInput()).toHaveValue('Send'); expect(screen.queryByDisplayValue('Archive')).not.toBeInTheDocument(); }); it('CONTROL: without `action=` the object opens on Records, with no action inspector', async () => { - mountAt('?surface=object%3Ashowcase_task'); + mountAt(''); // The object loaded: its tabs are drawn. await screen.findAllByRole('button', { name: L('engine.studio.data.tab.actions') }); await act(async () => { @@ -187,7 +185,7 @@ describe('Studio data page — `?action=` opens the object\'s Actions view on th }); it('is read once: a later pick of another view stays there', async () => { - mountAt('?surface=object%3Ashowcase_task&action=showcase_task_send'); + mountAt('?action=showcase_task_send'); expect(await labelInput()).toHaveValue('Send'); fireEvent.click(screen.getAllByRole('button', { name: L('engine.studio.data.tab.form') })[0]); await act(async () => { @@ -195,17 +193,4 @@ describe('Studio data page — `?action=` opens the object\'s Actions view on th }); expect(screen.queryByText(L('engine.inspector.action.label'), { selector: 'label' })).not.toBeInTheDocument(); }); - - it('drops `action=` from the URL once another object opens, and keeps it until then', async () => { - mountAt('?surface=object%3Ashowcase_task&action=showcase_task_send'); - expect(await labelInput()).toHaveValue('Send'); - const url = () => new URLSearchParams(screen.getByTestId('url').textContent ?? ''); - // The mirror's first write names the deep-linked object: the key stays. - expect(url().get('surface')).toBe('object:showcase_task'); - expect(url().get('action')).toBe('showcase_task_send'); - - fireEvent.click(screen.getByRole('button', { name: 'Note' })); - await waitFor(() => expect(url().get('surface')).toBe('object:showcase_note')); - expect(url().has('action')).toBe(false); - }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx index b02e083e296..aef5b1071a8 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx @@ -61,7 +61,8 @@ import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel'; import { t } from '../metadata-admin/i18n'; const ADVANCED = t('engine.studio.data.tab.advanced', 'en'); -const PANELS = ['rules', 'hooks', 'actions', 'api', 'settings'].map((k) => t(`engine.studio.data.tab.${k}`, 'en')); +// #36513's order (objectstack#36904): validations, actions, settings, hooks, API. +const PANELS = ['rules', 'actions', 'settings', 'hooks', 'api'].map((k) => t(`engine.studio.data.tab.${k}`, 'en')); const VALIDATIONS = t('engine.studio.data.tab.rules', 'en'); afterEach(() => { diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx index 59a0cf770b4..1386a4492fb 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx @@ -206,33 +206,6 @@ describe('DataPillar — Save is gated on the field inspector’s CEL verdict (# * flush-or-ask switch: an edit the CEL verdict holds cannot be sent, so a * switch to another object asks before its load replaces the buffer. */ -describe('DataPillar — a switch to another object over a held formula (objectstack#27485)', () => { - it('asks; declined, the edit stays; agreed, it is dropped unsent', async () => { - const box = await openFormulaField(); - fireEvent.change(box, { target: { value: 'record.est_hours *' } }); - await new Promise((r) => setTimeout(r, 2300)); - expect(mockClient.save).not.toHaveBeenCalled(); - - fireEvent.click(screen.getByRole('button', { name: /Site/ })); - expect(confirmSpy).toHaveBeenCalledTimes(1); - expect(box.value).toBe('record.est_hours *'); - - confirmSpy.mockReturnValue(true); - fireEvent.click(screen.getByRole('button', { name: /Site/ })); - await waitFor(() => expect(screen.queryByText('Est hours')).toBeNull(), { timeout: 3000 }); - await new Promise((r) => setTimeout(r, 2300)); - expect(mockClient.save).not.toHaveBeenCalled(); - }); -}); - -/** The ways the field inspector closes (the card's step 4). */ -const CLOSERS: Array<[string, () => void]> = [ - ['its Close button', () => fireEvent.click(screen.getAllByRole('button', { name: 'Close' })[0])], - ['Escape', () => fireEvent.keyDown(document.body, { key: 'Escape' })], - ['another field card', () => fireEvent.click((screen.getByText('Est hours').closest('.cursor-grab') as HTMLElement))], - ['the Records tab', () => fireEvent.click(screen.getByRole('button', { name: 'Records' }))], -]; - describe('DataPillar — the CEL hold belongs to the draft, not to the open inspector (objectstack#27485)', () => { async function breakFormula(): Promise { const box = await openFormulaField(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx index 02bc926dcbb..c1c45939dd4 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx @@ -23,7 +23,7 @@ import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { MemoryRouter } from 'react-router-dom'; +import { MemoryRouter, useLocation } from 'react-router-dom'; const servedObject = { name: 'showcase_account', @@ -89,11 +89,18 @@ afterEach(() => { vi.clearAllMocks(); }); +/** The router's query: the address the designer writes its tab into. */ +function Where() { + return {useLocation().search}; +} +const tabInAddress = () => new URLSearchParams(screen.getByTestId('where').textContent ?? '').get('tab'); + async function renderPillar(props: { readOnly?: boolean } = {}) { render( + , ); @@ -181,13 +188,13 @@ describe('the object designer’s tab row (objectui#12450, objectstack#36904)', expect(screen.getByTestId('data-tabs-advanced')).toHaveAttribute('aria-pressed', 'true'); // Validations is not one of the two the middle band folds. expect(screen.getByTestId('data-tabs-advanced-first')).toHaveAttribute('aria-pressed', 'false'); - expect(new URL(window.location.href).searchParams.get('tab')).toBe('validations'); + await waitFor(() => expect(tabInAddress()).toBe('validations')); await userEvent.click(screen.getByTestId('data-tab-flat-settings')); await waitFor(() => expect(screen.getByTestId('settings-panel')).toBeInTheDocument()); expect(screen.queryByTestId('rules-panel')).toBeNull(); expect(validations).toHaveAttribute('aria-pressed', 'false'); expect(screen.getByTestId('data-tab-flat-settings')).toHaveAttribute('aria-pressed', 'true'); - expect(new URL(window.location.href).searchParams.get('tab')).toBe('settings'); + await waitFor(() => expect(tabInAddress()).toBe('settings')); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx index 484fe40d767..992506f1d2d 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx @@ -11,9 +11,10 @@ * - the More menu went with it: its one entry was Add field, and the header * has no object-level action to put in one. * - * objectstack#28239 (maintainer rulings D-5 / D-7) — the one group the header - * does carry is the item toolbar: the item tools Setup's item page opens, - * the same five on every tab. + * objectstack#36904 (epic objectstack#36890 decisions 7 and 8) — the header is + * the full-screen item header: × back to the list and ‹ › through it, the same + * on every tab. The five item tools it carried (objectstack#28239) are tabs + * now (`DataPillar.flatTabs-12450.test.tsx`), so no tool button is left. * * The REAL `DataPillar`; the records grid and the Settings panel are stubbed, * because only the header is under test. @@ -66,15 +67,12 @@ import { t } from '../metadata-admin/i18n'; const RECORDS = t('engine.studio.data.tab.records', 'en'); const FORM = t('engine.studio.data.tab.form', 'en'); -const TOGGLE_RAIL = t('engine.studio.toggleRail', 'en'); -/** objectstack#28239 — the item toolbar, the same on every tab. */ -const ITEM_TOOLS = [ - ['layers', t('engine.edit.layers', 'en')], - ['references', t('engine.edit.references', 'en')], - ['history', t('engine.edit.history', 'en')], - ['audit', t('engine.edit.auditTab', 'en')], - ['source', t('engine.edit.inspector.source', 'en')], -].map(([tool, label]) => `button|studio-item-tool-${tool}|${label}|`); +/** objectstack#36904 — × and ‹ ›, the same on every tab. */ +const DETAIL_CONTROLS = [ + ['close', t('engine.studio.detailHeader.close', 'en')], + ['previous', t('engine.studio.detailHeader.previous', 'en')], + ['next', t('engine.studio.detailHeader.next', 'en')], +].map(([control, label]) => `button|studio-detail-${control}|${label}|`); afterEach(() => { cleanup(); @@ -136,9 +134,9 @@ describe('the Data pillar’s object header actions (objectui#12511)', () => { expect(seen.form).toEqual(seen.records); expect(seen.settings).toEqual(seen.records); expect(seen.recordsAgain).toEqual(seen.records); - // And that set is the mobile rail toggle and the item toolbar: the header - // draws no other action of its own on any tab. - expect(seen.records).toEqual([`button||${TOGGLE_RAIL}|`, ...ITEM_TOOLS]); + // And that set is × and ‹ ›: the header draws no other action of its own + // on any tab, and no item tool button. + expect(seen.records).toEqual(DETAIL_CONTROLS); }); it('Object settings, More and the header Add field are gone; the Settings tab opens the panel', async () => { @@ -159,7 +157,7 @@ describe('the Data pillar’s object header actions (objectui#12511)', () => { expect(seen.settings).toEqual(seen.records); // An object takes no environment overlay, so the read-only mark is plain // text, not a control (#27356 row 13). - expect(seen.records).toEqual([`button||${TOGGLE_RAIL}|`, ...ITEM_TOOLS]); + expect(seen.records).toEqual(DETAIL_CONTROLS); expect(screen.getByTestId('studio-readonly-link')).toHaveTextContent(t('engine.studio.pkg.readonly', 'en-US')); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx index cbea863f7da..980b7f5d0ca 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx @@ -195,10 +195,12 @@ describe('Data pillar Records tab (objectstack#34794)', () => { expect(screen.queryByTestId('field-label-input')).not.toBeInTheDocument(); }); - it("the object's machine name is the title's tooltip, not a chip beside it", async () => { + // objectstack#36904 — the full-screen item header (objectstack#36892) reads + // the label, then the machine name beside it, as every item page does. + it("the header reads the object's label, then its machine name", async () => { await renderGrid(); const head = screen.getByTestId('data-object-header'); - expect(within(head).getByRole('heading', { level: 1 })).toHaveAttribute('title', OBJECT); - expect(within(head).queryByTestId('studio-item-api-name')).not.toBeInTheDocument(); + expect(within(head).getByTestId('studio-detail-title')).toHaveTextContent('Meeting'); + expect(within(head).getByTestId('studio-item-api-name')).toHaveTextContent(OBJECT); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts index f3ba88cb0f4..c1aea2464f5 100644 --- a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts +++ b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.ts @@ -77,29 +77,33 @@ export interface ObjectDesignerTabState { } /** - * The open tab, seeded from the address and written back to it (replace), as - * `useItemToolTab` does for the generic item page: read in the initializer, - * written with `history.replaceState`, re-written after a router navigation - * drops it. A tool tab not offered to this caller (History without the trail - * capabilities) opens Records. + * The open tab, seeded from the address and written back to it (a replace + * navigation of the router's own location, so the router and the address + * never disagree, and ‹ › and × read the same query). A tool tab not offered + * to this caller (History without the trail capabilities) opens Records. */ export function useObjectDesignerTab(tools: readonly ItemToolTab[]): ObjectDesignerTabState { - const [choice, setChoice] = React.useState(() => - typeof window === 'undefined' ? null : new URLSearchParams(window.location.search).get(ITEM_TOOL_TAB_PARAM), - ); + const [searchParams, setSearchParams] = useSearchParams(); + const [choice, setChoice] = React.useState(() => searchParams.get(ITEM_TOOL_TAB_PARAM)); const location = readObjectDesignerTab(choice, tools); const address = objectDesignerTabAddress(location); - const [searchParams] = useSearchParams(); - const routerSearch = searchParams.toString(); + const inAddress = searchParams.get(ITEM_TOOL_TAB_PARAM); React.useEffect(() => { - if (typeof window === 'undefined') return; - const url = new URL(window.location.href); - if ((url.searchParams.get(ITEM_TOOL_TAB_PARAM) ?? null) === address) return; - if (address) url.searchParams.set(ITEM_TOOL_TAB_PARAM, address); - else url.searchParams.delete(ITEM_TOOL_TAB_PARAM); - window.history.replaceState(window.history.state, '', url.toString()); - }, [address, routerSearch]); + if ((inAddress ?? null) === address) return; + setSearchParams( + (prev) => { + const next = new URLSearchParams(prev); + if (address) next.set(ITEM_TOOL_TAB_PARAM, address); + else next.delete(ITEM_TOOL_TAB_PARAM); + return next; + }, + { replace: true }, + ); + // Keyed on the values alone: `setSearchParams` is re-minted with every + // search change (objectui#8640 — never key on a hook's identity). + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [address, inAddress]); const selectView = React.useCallback((view: ObjectDesignerView) => { setChoice(objectDesignerTabAddress({ view, tool: null })); From 2398bdce6d510fcfebd4993a138972c26b2f654b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 22:46:03 +0000 Subject: [PATCH 06/18] fix(studio): a discard's refusal outlives the re-read it asks for; tests route the area Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../src/views/studio-design/DataPillar.tsx | 13 +++++++++---- ...StudioDesignSurface.accessSegment-12452.test.tsx | 1 + ...tudioDesignSurface.autosaveSwitch-11232.test.tsx | 1 + .../StudioDesignSurface.backToApp-36501.test.tsx | 1 + .../StudioDesignSurface.copilotDoors-12894.test.tsx | 2 ++ ...ioDesignSurface.createAppAccessibleName.test.tsx | 1 + .../StudioDesignSurface.desktopHint-11795.test.tsx | 1 + ...tudioDesignSurface.entryReadsOnce-11797.test.tsx | 1 + ...tudioDesignSurface.heldDataCreate-26845.test.tsx | 1 + ...StudioDesignSurface.itemDraftLine-12725.test.tsx | 2 ++ ...tudioDesignSurface.kernelReadOnly-29567.test.tsx | 1 + .../StudioDesignSurface.publishCount-11807.test.tsx | 2 ++ .../StudioDesignSurface.saveBar-36511.test.tsx | 1 + 13 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx index 626aa09292f..01711751753 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx @@ -1501,9 +1501,14 @@ export function DataPillar({ // which drops every pending draft of the package, the author's own too; the // confirm says so. There is no per-turn undo. const [discardingDrafts, setDiscardingDrafts] = React.useState(false); + // objectstack#36904 — what the discard refused, kept apart from `error`: + // the discard re-reads the object, and a load clears `error` as it starts, + // so the refusal set here was wiped by the very read it asked for. + const [discardRefusal, setDiscardRefusal] = React.useState(null); const discardAllDrafts = React.useCallback(async () => { if (!adapter || !window.confirm(t('engine.studio.copilotChanges.discardConfirm', locale))) return; setDiscardingDrafts(true); + setDiscardRefusal(null); try { const result = await adapter.getClient().packages.discardDrafts(packageId); if (!result.success || result.failedCount > 0) { @@ -1514,13 +1519,13 @@ export function DataPillar({ const items = [...new Set(result.failed.map(labelOf))].join( t('engine.studio.copilotChanges.itemSeparator', locale), ); - setError({ + setDiscardRefusal({ message: tFormat('engine.studio.copilotChanges.discardFailed', locale, { items }), detail: result.failed.map((f) => `${f.type}/${f.name}: ${f.error}`).join('\n') || undefined, }); } } catch (e) { - setError(plainRefusal(e)); + setDiscardRefusal(plainRefusal(e)); } finally { setDiscardingDrafts(false); reloadObjDraft(); @@ -2102,9 +2107,9 @@ export function DataPillar({ /> ) : ( <> - {error && ( + {(error ?? discardRefusal) && ( + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx index 72dad7620f4..658bcbdaf4a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx @@ -527,6 +527,7 @@ describe('a package switch: Automations and Data open nothing of the previous pa + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx index 8ec2e8b67ea..8910df15f6b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx @@ -141,6 +141,7 @@ function renderAt(entry: string) { return render( + } /> } /> } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx index 24ebc662fd3..c931620ab9b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx @@ -251,6 +251,7 @@ function renderStudio(entry = `/studio/${PACKAGE_ID}/data?surface=object%3Ahcpl_ + } /> } /> , @@ -319,6 +320,7 @@ describe('the Studio copilot\'s composer (objectui#12725 Target item 4)', () => + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx index 4b94e17253e..b405714927c 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx @@ -125,6 +125,7 @@ async function renderSurface() { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx index b1d9842ec72..04c9e515521 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx @@ -100,6 +100,7 @@ function renderSurfaceAt(width: number) { return render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx index 7ba3e3ebbbe..f89417b1a48 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx @@ -142,6 +142,7 @@ describe('StudioDesignSurface — entry reads each question once (objectui#11797 render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index 004717a7d2e..479b7ed97b5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -162,6 +162,7 @@ async function openTask(): Promise { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx index df87a421601..6c618a3677b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx @@ -164,6 +164,7 @@ async function openTask() { render( + } /> } /> , @@ -245,6 +246,7 @@ describe('the item header\'s draft line after the copilot\'s undo, the object op render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx index d495eaa708e..adc6d963c77 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx @@ -197,6 +197,7 @@ function renderAt(packageId: string) { return render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx index 59ebc5357f2..ef1f164bd44 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx @@ -157,6 +157,7 @@ async function publishAt(path: string, expectPosts: number): Promise { render( + } /> } /> , @@ -312,6 +313,7 @@ describe('a publish that put an app or object live points the author to Access ( render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx index a31a8064363..3fdec2a3241 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx @@ -132,6 +132,7 @@ async function mountAndEdit(): Promise { render( + } /> } /> , From 12940d0d99781cd3240fab506b2e9e9752ceb11a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 22:53:15 +0000 Subject: [PATCH 07/18] test(studio): surface suites open the object designer on its address; drop the rail-only cases Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- ...tudioDesignSurface.aiApplyRefresh.test.tsx | 145 ------------------ ...ignSurface.autosaveInFlight-11204.test.tsx | 2 +- ...esignSurface.autosaveSwitch-11232.test.tsx | 93 +---------- ...DesignSurface.cancelledLoad-11331.test.tsx | 2 +- ...gnSurface.designerRegistryMissing.test.tsx | 2 +- ...signSurface.draftUnreadable-29148.test.tsx | 2 +- ...urface.draftVersionConflict-11773.test.tsx | 2 +- ...esignSurface.expectedMisses-11799.test.tsx | 16 +- ...esignSurface.heldDataCreate-26845.test.tsx | 43 ++---- ...DesignSurface.heldDataLeave-26705.test.tsx | 42 ++--- ...ignSurface.lateRegistration-11939.test.tsx | 2 +- ...urface.servedDraftTakenAsIs-10765.test.tsx | 2 +- ...dioDesignSurface.twoHolders-28584.test.tsx | 2 +- ...tudioItemHeader.statusPlace-12524.test.tsx | 2 +- 14 files changed, 55 insertions(+), 302 deletions(-) delete mode 100644 ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiApplyRefresh.test.tsx diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiApplyRefresh.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiApplyRefresh.test.tsx deleted file mode 100644 index 626cf4ea467..00000000000 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.aiApplyRefresh.test.tsx +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * objectui#7255 — the Studio workbench converges on an AI copilot apply - * WITHOUT a page reload. - * - * Measured symptom: the copilot staged/published a new object and pushed a nav - * item into the app's `navigation`; the tenant registry had both (object - * `active`, item present in `sys_metadata`) — and the workbench's left rail - * still showed the pre-apply tree until the author reloaded the page. - * - * The channel was already there and already production-safe: the copilot is - * the RIGHT DOCK of this same document (ADR-0057 P3c), and `ChatPane` - * announces every authoring turn on the assistant bus (`emitMetadataRefresh`, - * the same pulse `usePendingDrafts` / `MetadataProvider` already converge on). - * What was missing was a subscriber on the rails. These tests pin that the - * rails now re-read on the pulse — the SAME mounted tree, so the assertion - * would still fail if someone "fixed" it by remounting or reloading. - * - * Deliberately NOT asserted here: which tool result emits the pulse. That - * predicate is `ChatPane`'s and is covered where it lives; duplicating it - * would pin two producers to one test. - */ - -import '@testing-library/jest-dom/vitest'; -import * as React from 'react'; -import { describe, it, expect, vi, afterEach } from 'vitest'; -import { render, screen, cleanup, act, waitFor } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; - -import type { NavNode } from './navSurface.js'; - -/** The nav BEFORE the copilot turn — the two blueprint items the card names. */ -const NAV_BEFORE: NavNode[] = [ - { id: 'nav_dashboard', type: 'page', label: '首页仪表盘', pageName: 'home', icon: 'layout_dashboard' }, - { id: 'nav_customer', type: 'object', label: '客户', objectName: 'b2r4_customer', icon: 'building_2' }, -]; - -/** …and AFTER: the copilot's follow-up table, already live in the registry. */ -const NAV_AFTER: NavNode[] = [ - ...NAV_BEFORE, - { id: 'nav_b2r4_follow_up_record', type: 'object', label: '跟进记录', objectName: 'b2r4_follow_up_record' }, -]; - -/** - * One mutable world both pillars read, flipped by `applyCopilotTurn()` — the - * server-side half of the scenario. The client itself is uncached - * (`cache: 'no-store'` on every `/meta/*` GET), so a re-read is all it takes. - */ -let world = { nav: NAV_BEFORE, objects: [{ name: 'b2r4_customer', label: '客户' }] }; - -function applyCopilotTurn(): void { - world = { - nav: NAV_AFTER, - objects: [ - { name: 'b2r4_customer', label: '客户' }, - { name: 'b2r4_follow_up_record', label: '跟进记录' }, - ], - }; -} - -const mockClient = { - list: vi.fn(async (type: string) => { - if (type === 'app') return [{ name: 'b2r4_app', label: '客户管理' }]; - if (type === 'object') return world.objects; - return []; - }), - listDrafts: vi.fn(async () => []), - layered: vi.fn(async (type: string, name: string) => { - if (type === 'app') { - return { effective: { name: 'b2r4_app', label: '客户管理', navigation: world.nav } }; - } - return { effective: { name, label: name, fields: [] }, code: { name, label: name, fields: [] } }; - }), - getDraft: vi.fn(async () => null), - save: vi.fn(async () => ({})), - get: vi.fn(async () => undefined), -}; - -vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { - const mod = await importOriginal(); - return { - ...mod, - useMetadataClient: () => mockClient, - useMetadataTypes: () => ({ entries: [] }), - }; -}); - -vi.mock('./packages-io', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, fetchPackages: vi.fn(async () => []) }; -}); - -vi.mock('@object-ui/react', async (importOriginal) => { - const mod = await importOriginal(); - return { ...mod, useAdapter: () => ({}) }; -}); - -// The Data pillar's canvas is the runtime records grid; this test is about the -// RAIL, so the grid is stubbed exactly as `DataPillar.gridProjection.test.tsx` -// stubs it — same seam, no plugin-view tree dragged into this file's graph. -vi.mock('@object-ui/plugin-view', async (importOriginal) => { - const mod = await importOriginal>(); - return { ...mod, ObjectView: () =>
}; -}); - -import { emitMetadataRefresh } from '../../assistant/assistantBus.js'; -import { DataPillar } from './StudioDesignSurface'; -import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel'; -// The source under test reaches dynamic imports of `@objectstack/lint`; their first -// load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). -import '@objectstack/lint'; - -afterEach(() => { - cleanup(); - world = { nav: NAV_BEFORE, objects: [{ name: 'b2r4_customer', label: '客户' }] }; - vi.clearAllMocks(); -}); - -describe('Studio rails converge on an AI copilot apply (objectui#7255)', () => { - - it('Data rail grows the new object on the pulse', async () => { - render( - - - - - , - ); - - // The objects rail lists labels (no title attribute), and the selected - // object's label also titles the canvas — so `getAllByText`, scoped by the - // assertion that the NEW label appears at all (it has no canvas presence - // until it is selected, which this test never does). - await screen.findAllByText('客户'); - expect(screen.queryByText('跟进记录')).toBeNull(); - - applyCopilotTurn(); - await act(async () => { - emitMetadataRefresh(); - }); - - await waitFor(() => expect(screen.getAllByText('跟进记录').length).toBeGreaterThan(0)); - }); -}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveInFlight-11204.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveInFlight-11204.test.tsx index cc5430a54cd..d348bb67630 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveInFlight-11204.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveInFlight-11204.test.tsx @@ -307,7 +307,7 @@ describe('Data pillar — an edit taken while an object Save is in flight (objec return render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx index 658bcbdaf4a..0712f6843c8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx @@ -19,10 +19,9 @@ * (the new item's load installs its own buffer and clears it), and a save's * claim on its buffer reads moved once the item has changed. The previous * item's pending edit is dropped by the hook, which is what every pillar did - * whenever the new load landed inside the debounce. The Data pillar is the - * control: it saves with the top bar's Save (objectstack#36511), so its rail - * asks before a switch drops an unsaved edit, and nothing of it reaches either - * object. + * whenever the new load landed inside the debounce. objectstack#36904 — the + * object designer has no in-place switch any more (another object is another + * address), so its cases left this file. * * objectui#11203 (folded in): a package switch keeps the Interfaces pillar * mounted, so the nav editor's dirty flag and open editing survived into the @@ -207,7 +206,7 @@ vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -import { AutomationsPillar, DataPillar, StudioDesignSurface } from './StudioDesignSurface'; +import { AutomationsPillar, StudioDesignSurface } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { ADD_FIELD_OFFERED, addFieldFromGrid } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; @@ -382,37 +381,6 @@ describe('Automations pillar — a flow switch inside the debounce (objectui#112 }, 30000); }); -describe('Data pillar — an object switch over an unsaved edit, the control (objectui#11232)', () => { - it('sends nothing to either object; an edit on the opened object goes to it on Save (objectstack#36511)', async () => { - render( - - - - - , - ); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toHaveTextContent('2 fields'), SLOW); - - await addFieldFromGrid(); - const release = holdLoad('object', 'acme_note'); - // The edit is unsaved: the switch asks, and the author drops it. - confirmSpy.mockReturnValue(true); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - expect(confirmSpy).toHaveBeenCalledTimes(1); - await release(); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toHaveTextContent('1 field'), SLOW); - await pastDebounce(1800); - expect(server.saves).toEqual([]); - // The control's own control: an edit on the opened object saves to it. - await addFieldFromGrid(); - await pressStudioSave(); - expect(savesOf('object', 'acme_note').map((b) => readFields(b.fields).entries.map((e) => e.name))).toEqual([ - ['body', 'new_field'], - ]); - expect(savesOf('object', 'acme_task')).toEqual([]); - }, 30000); -}); - // --------------------------------------------------------------------------- // objectui#11272 — a pillar never accepts an edit or a save on a buffer that is // not the open item's. One rule, three members: the load window on all three @@ -480,43 +448,6 @@ describe("the load window: nothing of the previous item is offered, shown or sav expect(shownDuringLoad).toEqual({ enableSwitch: false }); }, 30000); - it('Data: a field added during the load saves nothing; one added after the load saves once, to the object opened', async () => { - render( - - - - - , - ); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toHaveTextContent('2 fields'), SLOW); - - const release = holdLoad('object', 'acme_note'); - fireEvent.click(screen.getByRole('button', { name: /Note/ })); - // objectui#12511 — Add field on the Records tab is the grid's "+" column, - // drawn exactly when it is offered. - if (screen.queryByTestId(ADD_FIELD_OFFERED)) await addFieldFromGrid(); - await pastDebounce(); - expect(savesRead()).toEqual([]); - const shownDuringLoad = { - fieldCount: screen.queryByText(/^\d+ fields?( \(\+\d+ system\))?$/) !== null, - addField: screen.queryByTestId(ADD_FIELD_OFFERED) !== null, - }; - - await release(); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toHaveTextContent('1 field'), SLOW); - await pastDebounce(1800); - expect(server.saves).toEqual([]); - - // The control: a field added after the load saves once, to its own object. - await addFieldFromGrid(); - await pressStudioSave(); - await waitFor(() => expect(server.saves).toHaveLength(1), SLOW); - expect(server.saves.map((s) => [s.type, s.name, s.body.label, fieldNamesOf(s.body)])).toEqual([ - ['object', 'acme_note', 'Note', ['body', 'new_field']], - ]); - // No field count or add-field of `acme_task` was shown under `acme_note`. - expect(shownDuringLoad).toEqual({ fieldCount: false, addField: false }); - }, 30000); }); describe('a package switch: Automations and Data open nothing of the previous package (objectui#11272)', () => { @@ -527,7 +458,6 @@ describe('a package switch: Automations and Data open nothing of the previous pa - } /> } /> @@ -559,20 +489,5 @@ describe('a package switch: Automations and Data open nothing of the previous pa ]); }, 30000); - it("Data: package A's open object is not kept; a field added saves package B's own object, in B", async () => { - seedPackageB(); - render(surfaceTree('data')); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toHaveTextContent('2 fields'), SLOW); - - await switchToBeta(); - await screen.findByRole('button', { name: /Beta item/ }, SLOW); - await waitFor(() => expect(screen.getByText(/^\d+ fields?( \(\+\d+ system\))?$/)).toBeInTheDocument(), SLOW); - await addFieldFromGrid(); - await pressStudioSave(); - await waitFor(() => expect(server.saves).toHaveLength(1), SLOW); - expect(server.saves.map((s) => [s.type, s.name, s.packageId, s.body.label, fieldNamesOf(s.body)])).toEqual([ - ['object', 'beta_item', PKG_B, 'Beta item', ['name', 'new_field']], - ]); - }, 30000); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx index 81849609d87..41112389345 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx @@ -172,7 +172,7 @@ function canvas(): HTMLElement { function dataTree() { return ( - + ); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx index 671360e8da8..65ae112f4f5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx @@ -214,7 +214,7 @@ describe('Data pillar field rail — a field click must never be a no-op (#6795 render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx index e267b81971e..0a45bd4b0f2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx @@ -214,7 +214,7 @@ function renderData() { render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx index 105264efd57..e1530943a59 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx @@ -242,7 +242,7 @@ function openEditor(): HTMLElement { const { container } = render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx index bbe98cf5909..c09bc80c094 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx @@ -210,16 +210,20 @@ describe('Data pillar — the draft read follows the ledger (objectui#11799)', ( it('a saved object with no draft is not asked for one; an unsaved object is', async () => { put(server.active, 'object', 'acme_account', { name: 'acme_account', label: 'Account', fields: { title: { type: 'text' } } }); put(server.drafts, 'object', 'acme_fresh', { name: 'acme_fresh', label: 'Fresh', fields: { title: { type: 'text' } } }); - render( - - - , - ); + // objectstack#36904 — one object per page: each opens on its own address. + const open = (name: string) => + render( + + + , + ); + open('acme_account'); await waitFor(() => expect(asked('object', 'acme_account', '/layers')).toBe(1)); await settle(); expect(asked('object', 'acme_account', '?state=draft')).toBe(0); + cleanup(); - fireEvent.click(await screen.findByText('acme_fresh')); + open('acme_fresh'); await waitFor(() => expect(asked('object', 'acme_fresh', '?state=draft')).toBe(1)); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index 479b7ed97b5..d3847f45601 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -147,10 +147,10 @@ afterEach(() => { window.history.replaceState(null, '', '/'); }); -/** The object the header names: its title's tooltip (objectstack#34794). */ +/** The object the header names: its machine name beside the label (objectstack#36904). */ async function openObjectIs(name: string): Promise { await waitFor( - () => expect(within(screen.getByTestId('data-object-header')).getByRole('heading', { level: 1 })).toHaveAttribute('title', name), + () => expect(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-item-api-name')[0]).toHaveTextContent(name), { timeout: 8000 }, ); } @@ -158,9 +158,11 @@ async function openObjectIs(name: string): Promise { async function openTask(): Promise { // The shell's link guard reads the window's URL to skip a link to the page // already shown; `BrowserRouter` keeps the two equal, so this does too. - window.history.replaceState(null, '', `/studio/${PKG}/data`); + // objectstack#36904 — the object designer is the object's address. + const at = `/studio/${PKG}/metadata/object/acme_task?package=${PKG}`; + window.history.replaceState(null, '', at); render( - + } /> } /> @@ -177,33 +179,12 @@ async function holdAPicklist(): Promise { await screen.findByTestId('studio-held', undefined, { timeout: 8000 }); } -const newObject = () => fireEvent.click(within(screen.getByTestId('studio-rail-data')).getByTestId('studio-rail-add')); const pendingRequest = (name: string) => fireEvent.click(screen.getByRole('button', { name: `Pending object/${name}` })); -describe('a held Data field guards create and Pending changes (objectstack#26845)', () => { - it('New object asks; Cancel opens no dialog and keeps the held field, OK opens it and the create asks nothing', async () => { - await openTask(); - await holdAPicklist(); - - confirmSpy.mockReturnValueOnce(false); - newObject(); - expect(confirmSpy).toHaveBeenCalledTimes(1); - expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); - expect(screen.queryByRole('dialog')).toBeNull(); - expect(screen.getByTestId('studio-held')).toBeInTheDocument(); - - confirmSpy.mockReturnValueOnce(true); - newObject(); - expect(confirmSpy).toHaveBeenCalledTimes(2); - const dialog = await screen.findByRole('dialog'); - fireEvent.change(within(dialog).getByLabelText(t('engine.studio.data.nameLabel', 'en')), { - target: { value: 'Ticket' }, - }); - fireEvent.click(within(dialog).getByRole('button', { name: t('engine.studio.createLive', 'en') })); - await openObjectIs('acme_ticket'); - expect(confirmSpy).toHaveBeenCalledTimes(2); - }); - +// objectstack#36904 — the designer has no 「新建」 (the object list's dialog is the +// create), so what is left to guard here is the Pending changes request, which +// now opens the object's own address. +describe('a held Data field guards Pending changes (objectstack#26845)', () => { it('a Pending changes request for another object asks; Cancel keeps the held field, OK opens the object', async () => { await openTask(); await holdAPicklist(); @@ -229,13 +210,11 @@ describe('a held Data field guards create and Pending changes (objectstack#26845 }); // CONTROL: nothing held, nothing asked. - it('with no edit held, New object and a Pending changes request never ask', async () => { + it('with no edit held, a Pending changes request never asks', async () => { await openTask(); pendingRequest('acme_note'); await openObjectIs('acme_note'); - newObject(); - await screen.findByRole('dialog'); expect(confirmSpy).not.toHaveBeenCalled(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx index 10534ce6e41..99eb3821fb8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx @@ -10,6 +10,8 @@ * with no question. Now the surface folds the held edit into the guard a dirty * pillar already raises (the leave confirm, the shell's link guard and * `beforeunload`), and the rail asks before it opens another object. + * objectstack#36904 — the designer has no rail: another object is another + * address, so × back to the list is the departure pinned here beside the menu. * * Rendered through the REAL `StudioDesignSurface` on the real route shape; the * field is added the way the pillar offers it (`dataPillarAddField`). @@ -130,10 +132,10 @@ afterEach(() => { window.history.replaceState(null, '', '/'); }); -/** The object the header names: its title's tooltip (objectstack#34794). */ +/** The object the header names: its machine name beside the label (objectstack#36904). */ async function openObjectIs(name: string): Promise { await waitFor( - () => expect(within(screen.getByTestId('data-object-header')).getByRole('heading', { level: 1 })).toHaveAttribute('title', name), + () => expect(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-item-api-name')[0]).toHaveTextContent(name), { timeout: 8000 }, ); } @@ -141,13 +143,16 @@ async function openObjectIs(name: string): Promise { async function openTask(): Promise { // The shell's link guard reads the window's URL to skip a link to the page // already shown; `BrowserRouter` keeps the two equal, so this does too. - window.history.replaceState(null, '', `/studio/${PKG}/data`); + // objectstack#36904 — the object designer is the object's address. + const at = `/studio/${PKG}/metadata/object/acme_task?package=${PKG}`; + window.history.replaceState(null, '', at); render( - + - } /> - {/* objectstack#36899 — a menu type entry opens that type's area list. */} - } /> + {/* objectstack#36899 — a menu type entry opens that type's area list; × the object list. */} + } /> + } /> + } /> , ); @@ -170,7 +175,8 @@ function reloadAsks(): boolean { /** objectstack#36899 — the left menu's entry for a type: a link to that type's area list. */ const menuEntry = (type: string) => within(screen.getByTestId('studio-menu')).getByTestId(`studio-menu-entry-type:${type}`); -const railRow = (label: string) => within(screen.getByTestId('studio-rail-data')).getByRole('button', { name: label }); +/** × of the designer's header: back to the object list. */ +const closeDesigner = () => fireEvent.click(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-detail-close')[0]); describe('a held Data field guards every departure (objectstack#26705)', () => { it('leaving the pillar through the menu asks; Cancel keeps the held field, OK leaves and clears the guard', async () => { @@ -182,7 +188,7 @@ describe('a held Data field guards every departure (objectstack#26705)', () => { expect(confirmSpy).toHaveBeenCalledTimes(1); expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); expect(screen.getByTestId('studio-held')).toBeInTheDocument(); - expect(screen.getByTestId('studio-rail-data')).toBeInTheDocument(); + expect(screen.getByTestId('data-object-header')).toBeInTheDocument(); confirmSpy.mockReturnValueOnce(true); fireEvent.click(menuEntry('flow')); @@ -192,26 +198,22 @@ describe('a held Data field guards every departure (objectstack#26705)', () => { expect(reloadAsks()).toBe(false); }); - it('opening another object in the rail asks; Cancel keeps the held field, OK opens the other object', async () => { + it('× back to the list asks; Cancel keeps the held field, OK leaves for the list', async () => { await openTask(); await holdAPicklist(); confirmSpy.mockReturnValueOnce(false); - fireEvent.click(railRow('Note')); + closeDesigner(); expect(confirmSpy).toHaveBeenCalledTimes(1); expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); await openObjectIs('acme_task'); expect(screen.getByTestId('studio-held')).toBeInTheDocument(); - // Re-picking the open object drops nothing, so it asks nothing. - fireEvent.click(railRow('Task')); - expect(confirmSpy).toHaveBeenCalledTimes(1); - confirmSpy.mockReturnValueOnce(true); - fireEvent.click(railRow('Note')); + closeDesigner(); expect(confirmSpy).toHaveBeenCalledTimes(2); - await openObjectIs('acme_note'); - expect(screen.queryByTestId('studio-held')).toBeNull(); + await screen.findByTestId('list-landed'); + expect(reloadAsks()).toBe(false); }); it('a reload asks while the field is held', async () => { @@ -222,11 +224,9 @@ describe('a held Data field guards every departure (objectstack#26705)', () => { }); // CONTROL: nothing held, nothing asked. - it('with no edit held, the rail, the reload and the menu link never ask', async () => { + it('with no edit held, the reload and the menu link never ask', async () => { await openTask(); - fireEvent.click(railRow('Note')); - await openObjectIs('acme_note'); expect(reloadAsks()).toBe(false); fireEvent.click(menuEntry('flow')); await screen.findByTestId('area-landed'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx index b60f77234f9..401e1cff4be 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx @@ -151,7 +151,7 @@ describe('Data pillar field rail — a late object inspector fills the open rail render( - + , ); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx index d61ee72387d..1d491d0fbdf 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx @@ -164,7 +164,7 @@ describe('StudioDesignSurface — every load site takes the served draft as-is, render( - + , ); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx index 26ed44335a4..1ae8246061c 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx @@ -194,7 +194,7 @@ describe('Studio pillars — an item two packages hold is read at this package ( ); render( - + , ); await waitFor(() => expect(layersReads('object', 'acme_account')).toHaveLength(1)); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx index 924c51a9503..654c1f9a5ec 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx @@ -173,7 +173,7 @@ const CASES: PillarCase[] = [ { pillar: 'Data', testId: 'data-object-header', - element: (readOnly) => , + element: (readOnly) => , // objectstack#34794 — the object's machine name is the title's tooltip. settled: async (header) => { await waitFor(() => expect(within(header).getByRole('heading', { level: 1 })).toHaveAttribute('title', OBJECT.name), { From 0e3a9a28c60d305c4a3f09b2633ed8bbe9b36efa Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:01:26 +0000 Subject: [PATCH 08/18] test(studio): convert the pair, retired-Interfaces, not-found and copilot suites to the designer's address Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- ...DesignSurface.cancelledLoad-11331.test.tsx | 5 +- ...oDesignSurface.copilotDoors-12894.test.tsx | 13 ++- ...urface.draftVersionConflict-11773.test.tsx | 29 +------ ...gnSurface.interfacesRetired-36502.test.tsx | 28 +++--- ...DesignSurface.itemDraftLine-12725.test.tsx | 11 ++- ...esignSurface.kernelReadOnly-29567.test.tsx | 3 +- ...tudioDesignSurface.notFound-26708.test.tsx | 2 + ...dioDesignSurface.oneSurface-28572.test.tsx | 87 ++++--------------- ...StudioDesignSurface.saveBar-36511.test.tsx | 2 +- .../studio-design/StudioDesignSurface.tsx | 24 ++--- ...tudioItemHeader.statusPlace-12524.test.tsx | 5 +- .../StudioRail.noMatches-26733.test.tsx | 13 +-- 12 files changed, 78 insertions(+), 144 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx index 41112389345..28693e7ef4b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx @@ -213,8 +213,9 @@ describe('Data pillar — a new metadata client while the open object loads (obj remintClient(); rerender(dataTree()); // The new client has to have reached the pillar for the count below to - // mean anything: its rail list read is the proof that it did. - await waitFor(() => expect(client.list).toHaveBeenCalledWith('object', expect.anything())); + // mean anything: the header's list read (its ‹ ›, objectstack#36904) is + // the proof that it did. + await waitFor(() => expect(client.list).toHaveBeenCalledWith('object', undefined)); await act(async () => { await new Promise((resolve) => setTimeout(resolve, 0)); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx index c931620ab9b..87accb9d3a2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx @@ -231,6 +231,10 @@ beforeEach(() => { return json({ drafts: serverDrafts }); } if (url === `/api/v1/meta/object?package=${encodeURIComponent(PACKAGE_ID)}`) return json(objectRows); + // objectstack#36904 — the object designer reads its one object's layers. + const layers = /^\/api\/v1\/meta\/object\/([^/?]+)\/layers/.exec(url); + const row = layers && objectRows.find((r) => r.name === decodeURIComponent(layers[1])); + if (row) return json({ code: row, overlay: null, overlayScope: null, effective: row }); return json([]); }) as unknown as typeof fetch, ); @@ -241,6 +245,9 @@ afterEach(() => { vi.unstubAllGlobals(); }); +/** objectstack#36904 — where the old Studio home (`/data`) lands: the package's object list. */ +const OBJECT_LIST = `/studio/${PACKAGE_ID}/metadata/object?package=${encodeURIComponent(PACKAGE_ID)}`; + function LocationProbe(): React.ReactElement { const location = useLocation(); return
{`${location.pathname}${location.search}`}
; @@ -293,7 +300,7 @@ describe('the Studio copilot\'s applied card opens the 变更 drawer in place (o renderStudio(`/studio/${PACKAGE_ID}/data?changes=review`); await waitFor(() => expect(screen.getByTestId('draft-changes-panel')).toHaveAttribute('data-open', 'true')); expect(screen.getByTestId('draft-changes-panel')).toHaveAttribute('data-posture', 'review'); - await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(`/studio/${PACKAGE_ID}/data`)); + await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(OBJECT_LIST)); }); // objectstack#36502 — the link printed before the Interfaces pillar retired @@ -302,12 +309,12 @@ describe('the Studio copilot\'s applied card opens the 变更 drawer in place (o renderStudio(`/studio/${PACKAGE_ID}/interfaces?changes=review`); await waitFor(() => expect(screen.getByTestId('draft-changes-panel')).toHaveAttribute('data-open', 'true')); expect(screen.getByTestId('draft-changes-panel')).toHaveAttribute('data-posture', 'review'); - await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(`/studio/${PACKAGE_ID}/data`)); + await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(OBJECT_LIST)); }); it('CONTROL: a value the surface does not know opens nothing, and is dropped all the same', async () => { renderStudio(`/studio/${PACKAGE_ID}/data?changes=publish`); - await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(`/studio/${PACKAGE_ID}/data`)); + await waitFor(() => expect(screen.getByTestId('location').textContent).toBe(OBJECT_LIST)); await act(drain); expect(screen.getByTestId('draft-changes-panel')).toHaveAttribute('data-open', 'false'); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx index e1530943a59..f25bb64a330 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx @@ -399,32 +399,9 @@ describe('Data pillar — a draft saved elsewhere is not overwritten in silence }); }); -describe('Data pillar — a create sends If-None-Match: * (objectui#11773)', () => { - it('the new object\'s skeleton is sent with the first-write pin; it is live at once, so each Save after the load asserts no draft', async () => { - server.active.clear(); - const a = openEditor(); - fireEvent.click(await within(a).findByTestId('empty-state-new-object', undefined, { timeout: 8000 })); - const dialog = await screen.findByRole('dialog'); - fireEvent.change(dialog.querySelectorAll('input')[0]!, { target: { value: 'Ticket' } }); - fireEvent.click(within(dialog).getByRole('button', { name: /^create$/i })); - await waitFor(() => expect(server.saves).toHaveLength(1), { timeout: 8000 }); - expect([server.saves[0]!.ifMatch, server.saves[0]!.ifNoneMatch]).toEqual([undefined, '*']); - - await loaded(a, '1 field'); - fireEvent.click(within(a).getAllByRole('button', { name: 'Field layout' })[0]!); - await addFieldAndSave(a, addFieldFromFormToolbar); - await addFieldAndSave(a, addFieldFromFormToolbar, SECOND); - // The skeleton's draft, which the create publishes at once (objectstack#36511): - // no draft is left, so each Save after the load asserts none. - expect(mockClient.publish).toHaveBeenCalledWith('object', expect.stringMatching(/ticket$/), expect.anything()); - expect(server.saves.map((s) => [s.ifMatch, s.ifNoneMatch])).toEqual([ - [undefined, '*'], - [undefined, '*'], - [undefined, '*'], - ]); - }); -}); - +// objectstack#36904 — the object designer has no 「新建」: the create's first-write +// pin is pinned on the list's dialog (`MetadataListCreateDialog.pairCreate-36897`, +// `ifNoneMatch: '*'`), and each later Save asserting no draft by the case above. describe('Data pillar — two Saves over one published object are not last-writer-wins (objectstack#36601)', () => { /** The live row's version both editors open at. */ const LIVE = 'hmac-sha256:live0'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx index 6f1e83ed86f..e1e3e253427 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx @@ -12,7 +12,8 @@ * sentence 「界面的修改已经搬到应用里」 with a link back to the app. * * Pinned: - * - the bare URL and a `?surface=` deep link land on `/studio//data`, + * - the bare URL and a `?surface=` deep link land on `/studio//data` + * (objectstack#36904: which lands on the area's object list), * the deep link dropped; `?changes=review` travels; * - the notice reads the card's sentence in zh-CN and its English in en, * and its link goes to the package's app, as 「‹ Back to app」 does; @@ -181,8 +182,11 @@ function LocationProbe() { return {`${location.pathname}${location.search}`}; } const where = () => screen.getByTestId('location-path').textContent; -/** The path alone: the Data pillar opens its first object with a `?surface=` of its own. */ +/** The path alone: the area writes its `?package=` after the landing. */ const pathname = () => (where() ?? '').split('?')[0]; +/** objectstack#36904 — the Studio home: the package's object list, `/data` redirected. */ +const HOME_PATH = `/studio/${PKG}/metadata/object`; +const HOME = `${HOME_PATH}?package=${PKG}`; function renderAt(path: string) { render( @@ -192,9 +196,11 @@ function renderAt(path: string) { } /> {/* objectstack#36899 — a menu type entry opens that type's area list; this stand-in links back to Data. */} Data} /> + {/* objectstack#36904 — the Studio home (`/data`) is the area's object list. */} + } />
, @@ -207,7 +213,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('the bare URL: Data pillar, the notice, and a link back to the app', async () => { renderAt(`/studio/${PKG}/interfaces`); await screen.findByTestId('studio-shell-header'); - expect(where()).toBe(`/studio/${PKG}/data`); + await waitFor(() => expect(where()).toBe(HOME)); const strip = await screen.findByTestId('studio-interfaces-retired'); expect(strip).toHaveAttribute('role', 'status'); @@ -225,7 +231,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('a `?surface=` deep link lands on the same home, its retired parameter dropped', async () => { renderAt(`/studio/${PKG}/interfaces?surface=${encodeURIComponent('page:home')}`); await screen.findByTestId('studio-shell-header'); - expect(where()).toBe(`/studio/${PKG}/data`); + await waitFor(() => expect(where()).toBe(HOME)); expect(await screen.findByTestId('studio-interfaces-retired')).toBeInTheDocument(); }); @@ -236,7 +242,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( // on an old link, with the real drawer mounted, is `copilotDoors-12894`'s. renderAt(`/studio/${PKG}/interfaces?surface=${encodeURIComponent('page:home')}&changes=review`); await screen.findByTestId('studio-shell-header'); - expect(pathname()).toBe(`/studio/${PKG}/data`); + expect(pathname()).toBe(HOME_PATH); expect(where()).not.toContain('surface=page'); expect(await screen.findByTestId('studio-interfaces-retired')).toBeInTheDocument(); }); @@ -246,13 +252,13 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( const strip = await screen.findByTestId('studio-interfaces-retired'); fireEvent.click(within(strip).getByRole('button', { name: t('engine.studio.interfacesRetired.dismiss', 'en') })); await waitFor(() => expect(notice()).toBeNull()); - expect(pathname()).toBe(`/studio/${PKG}/data`); + expect(pathname()).toBe(HOME_PATH); }); - it('the notice outlasts the Data pillar opening its first object (a `?surface=` written with no state)', async () => { + it('the notice outlasts the area writing its `?package=` (a navigation with no state)', async () => { renderAt(`/studio/${PKG}/interfaces`); await screen.findByTestId('studio-interfaces-retired'); - await waitFor(() => expect(where()).toContain('surface=')); + await waitFor(() => expect(where()).toContain('package=')); expect(screen.getByTestId('studio-interfaces-retired')).toBeInTheDocument(); }); @@ -263,7 +269,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( await waitFor(() => expect(pathname()).toBe(`/studio/${PKG}/metadata/flow`)); expect(notice()).toBeNull(); fireEvent.click(screen.getByTestId('back-to-data')); - await waitFor(() => expect(pathname()).toBe(`/studio/${PKG}/data`)); + await waitFor(() => expect(pathname()).toBe(HOME_PATH)); await screen.findByTestId('studio-shell-header'); expect(notice()).toBeNull(); }); @@ -279,7 +285,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('CONTROL: an ordinary arrival on the Data pillar shows no notice', async () => { renderAt(`/studio/${PKG}/data`); await screen.findByTestId('studio-shell-header'); - expect(where()).toBe(`/studio/${PKG}/data`); + await waitFor(() => expect(where()).toBe(HOME)); expect(notice()).toBeNull(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx index 6c618a3677b..8448ede9423 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx @@ -159,18 +159,18 @@ const COPILOT_DRAFTS = [ { type: 'view', name: `${OBJECT.name}.board`, label: 'Board', packageId: PACKAGE_ID, updatedAt: null, updatedBy: 'u1' }, ]; -/** Open the Data pillar on the Task object, with an empty ledger. */ +/** Open the object designer on the Task object, with an empty ledger. */ async function openTask() { render( - + } /> } /> , ); - fireEvent.click(await screen.findByRole('button', { name: /Task/ }, SLOW)); - await waitFor(() => expect(within(header()).getByText('Task')).toBeInTheDocument(), SLOW); + // objectstack#36904 — the object designer opens on the object's address. + await waitFor(() => expect(within(header()).getAllByText('Task')[0]).toBeInTheDocument(), SLOW); expect(headerStatus()).toBeNull(); expect(screen.queryByTestId('studio-changes-count')).toBeNull(); } @@ -244,14 +244,13 @@ describe('the item header\'s draft line after the copilot\'s undo, the object op server.objectDraft = { ...OBJECT, description: 'copilot draft' }; server.drafts = COPILOT_DRAFTS; render( - + } /> } /> , ); - fireEvent.click(await screen.findByRole('button', { name: /Task/ }, SLOW)); await waitFor(() => expect(headerStatus()).toHaveTextContent(draftLine(2)), SLOW); const before = objectDraftReads(); expect(before).toBeGreaterThan(0); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx index adc6d963c77..5f99508df2b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx @@ -195,7 +195,8 @@ afterEach(() => { function renderAt(packageId: string) { return render( - + // objectstack#36904 — an object designer's header, on its own address. + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx index 6c5611a7543..967d1f5e40f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx @@ -104,6 +104,8 @@ function renderAt(path: string, surface: React.ReactElement = } /> + {/* objectstack#36904 — `/data` lands on the area's object list. */} + , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx index 0bf439a983d..51259a29416 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx @@ -367,40 +367,28 @@ function renderAt(path: string) { ); } -const dataRail = () => screen.getByTestId('studio-rail-data'); -const markOf = (row: HTMLElement | null) => row?.querySelector('[data-testid="customization-mark"]')?.getAttribute('data-kind') ?? null; - -describe('the Data rail lists the pair’s objects with the base’s (objectstack#28572)', () => { - it('marks the pair’s object "added"; the base’s objects carry no mark; opening it names the pair', async () => { - renderAt(`/studio/${BASE}/data`); - await waitFor(() => expect(within(dataRail()).getByText('Survey')).toBeInTheDocument(), { timeout: 8000 }); - const survey = within(dataRail()).getByText('Survey').closest('button'); - await waitFor(() => expect(markOf(survey)).toBe('added'), { timeout: 8000 }); - // The extension the pair adds to `crm_account` is no override and no - // added item: the object is the base's, unmarked. - expect(markOf(within(dataRail()).getByText('Account').closest('button'))).toBeNull(); - expect(markOf(within(dataRail()).getByText('Deal').closest('button'))).toBeNull(); - - fireEvent.click(survey!); - await waitFor( - () => expect(within(screen.getByTestId('data-object-header')).getByTestId('studio-pair-item-chip')).toBeInTheDocument(), - { timeout: 8000 }, - ); - }); -}); +// objectstack#36904 — the object designer has no rail: the base's object list +// marks the pair's rows (`ResourceListPage`), and a pair's object opens at the +// pair's own address. describe('the pair’s URLs (objectstack#28572)', () => { // The package switcher's case (the pair has no row, named under its base) // left with the switcher, objectstack#36501; the Studio landing's cards // fold the pair the same way (`foldCustomizationPairs`). - it('a pillar URL of the pair lands on the base’s surface, its query kept', async () => { + // objectstack#36904 — the pair's old object address opens the object's + // designer on the pair's own address (`dataPillarRedirect`), read at the + // pair, its owner (objectstack#28584). + it('the pair’s old object address opens the object at the pair', async () => { renderAt(`/studio/${encodeURIComponent(PAIR)}/data?surface=object:hotcrm_custom_survey`); - await waitFor(() => expect(screen.getByTestId('location').textContent).toMatch(new RegExp(`^/studio/${BASE}/data\\?`))); - // The item the pair adds opens once the pair is known, at the pair. - await waitFor( - () => expect(within(screen.getByTestId('data-object-header')).getByTestId('studio-pair-item-chip')).toBeInTheDocument(), - { timeout: 8000 }, + await waitFor(() => + expect(screen.getByTestId('location').textContent).toMatch( + new RegExp(`^/studio/${encodeURIComponent(PAIR)}/metadata/object/hotcrm_custom_survey`), + ), ); + await screen.findByTestId('data-object-header', undefined, { timeout: 8000 }); + const layers = () => srv.reads.filter((r) => r.startsWith('/api/v1/meta/object/hotcrm_custom_survey/layers')); + await waitFor(() => expect(layers()).not.toEqual([]), { timeout: 8000 }); + for (const read of layers()) expect(new URL(read, 'http://localhost').searchParams.get('package')).toBe(PAIR); }); it('the pair’s "All metadata" URL stays on the pair: it is not sent to the base, so nothing loops', async () => { @@ -412,47 +400,6 @@ describe('the pair’s URLs (objectstack#28572)', () => { }); }); -describe('a third package’s lists are never asked (objectstack#28722, objectstack#29786)', () => { - it('the rails ask no list of another package, and with no contribution served no row names one', async () => { - renderAt(`/studio/${BASE}/data`); - await waitFor(() => expect(markOf(within(dataRail()).getByText('Survey').closest('button'))).toBe('added'), { timeout: 8000 }); - expect(srv.reads.filter((r) => r.includes(encodeURIComponent(ADDON)) || r.includes(`package=${ADDON}`))).toEqual([]); - expect(within(dataRail()).queryByText(/acme/i)).toBeNull(); - }); -}); - -describe('CONTROL: a base with no pair is unchanged (objectstack#28572)', () => { - it('reads no pair list, and draws no mark and no filter', async () => { - srv.pairListed = false; - renderAt(`/studio/${BASE}/data`); - await waitFor(() => expect(within(dataRail()).getByText('Account')).toBeInTheDocument(), { timeout: 8000 }); - await new Promise((r) => setTimeout(r, 300)); - expect(srv.reads.filter((r) => r.includes(`package=${encodeURIComponent(PAIR)}`))).toEqual([]); - expect(within(dataRail()).queryByTestId('customization-mark')).toBeNull(); - expect(within(dataRail()).queryByTestId('studio-rail-customizations-only')).toBeNull(); - expect(within(dataRail()).queryByText('Survey')).toBeNull(); - }); -}); - -describe('an item the pair adds reads its layers at the pair (objectstack#28584)', () => { - // A layered read naming no package is refused (409) for a name two packages - // hold, and a read naming the base finds nothing the base does not hold: the - // pair's own item is read at the pair, its owner. - const layersOf = (type: string, name: string) => - srv.reads.filter((r) => r.startsWith(`/api/v1/meta/${type}/${name}/layers`)); - - it('the Data pillar reads the pair’s object at the pair', async () => { - renderAt(`/studio/${BASE}/data`); - await waitFor(() => expect(within(dataRail()).getByText('Survey')).toBeInTheDocument(), { timeout: 8000 }); - fireEvent.click(within(dataRail()).getByText('Survey').closest('button')!); - await waitFor(() => expect(layersOf('object', 'hotcrm_custom_survey')).not.toEqual([]), { timeout: 8000 }); - for (const read of layersOf('object', 'hotcrm_custom_survey')) { - expect(new URL(read, 'http://localhost').searchParams.get('package')).toBe(PAIR); - } - }); - -}); - /** * objectstack#29786 — what a third package contributes to the base, drawn on * each pillar from the base's one customization read: greyed, named by the @@ -465,9 +412,7 @@ describe('items another package contributes are drawn greyed, with the package ( it('Data: the contributed field is marked in the Form layout, once, and its properties are read-only while the base’s are not', async () => { srv.contributed = true; - renderAt(`/studio/${BASE}/data`); - await waitFor(() => expect(within(dataRail()).getByText('Account')).toBeInTheDocument(), { timeout: 8000 }); - fireEvent.click(within(dataRail()).getByText('Account').closest('button')!); + renderAt(`/studio/${BASE}/metadata/object/crm_account`); fireEvent.click(await screen.findByText(t('engine.studio.data.tab.form', 'en'), undefined, { timeout: 8000 })); const card = await waitFor( diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx index 3fdec2a3241..dfccec0921a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx @@ -130,7 +130,7 @@ const PUBLISH = new RegExp(`^${t('engine.studio.publish', 'en')}$`); async function mountAndEdit(): Promise { render( - + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index 406be554053..3f0acb67725 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -303,24 +303,26 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re const locale = useMetadataLocale(); // objectstack#36502 — a landing from an old Interfaces URL says once where // interface editing went. The landing's history state is read once and - // latched here, keyed on the pillar it landed on: the Data pillar writes - // its own `?surface=` (the first object) and the Changes drawer drops - // `?changes=` right after the landing, and those navigations carry no state. - // It goes when dismissed or when the author leaves for another pillar; - // another old URL is a new history state, so it shows again. - const landingState: unknown = useLocation().state; + // latched here, keyed on the page it landed on: the Changes drawer drops + // `?changes=` right after the landing, and the area writes its `?package=`, + // and those navigations carry no state. objectstack#36904 — keyed on the + // path, not the pillar: the home is the area's object list now, and the + // area's other pages share its segment. It goes when dismissed or when the + // author leaves for another page; another old URL is a new history state, + // so it shows again. + const { state: landingState, pathname: landingPath }: { state: unknown; pathname: string } = useLocation(); const [retiredOn, setRetiredOn] = React.useState(() => - isRetiredInterfacesLanding(landingState) ? tab : null, + isRetiredInterfacesLanding(landingState) ? landingPath : null, ); React.useEffect(() => { - if (isRetiredInterfacesLanding(landingState)) setRetiredOn(tab); + if (isRetiredInterfacesLanding(landingState)) setRetiredOn(landingPath); // Keyed on the state object alone: a new landing is a new object. // eslint-disable-next-line react-hooks/exhaustive-deps }, [landingState]); React.useEffect(() => { - if (retiredOn !== null && retiredOn !== tab) setRetiredOn(null); - }, [retiredOn, tab]); - const retiredLanding = retiredOn !== null && retiredOn === tab; + if (retiredOn !== null && retiredOn !== landingPath) setRetiredOn(null); + }, [retiredOn, landingPath]); + const retiredLanding = retiredOn !== null && retiredOn === landingPath; // Courtesy gate (the framework's ADR-0124 D1 — server enforces, client is // courtesy): a read-only code/installed package refuses authoring diff --git a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx index 654c1f9a5ec..177c0646ce8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.statusPlace-12524.test.tsx @@ -174,9 +174,10 @@ const CASES: PillarCase[] = [ pillar: 'Data', testId: 'data-object-header', element: (readOnly) => , - // objectstack#34794 — the object's machine name is the title's tooltip. + // objectstack#36904 — the full-screen item header: settled once it reads + // the loaded object's label. settled: async (header) => { - await waitFor(() => expect(within(header).getByRole('heading', { level: 1 })).toHaveAttribute('title', OBJECT.name), { + await waitFor(() => expect(within(header).getAllByTestId('studio-detail-title')[0]).toHaveTextContent(OBJECT.label), { timeout: 8000, }); }, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx index 314475d4d09..86011c509f4 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx @@ -69,7 +69,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); // The pillars reach `@objectstack/lint` through a dynamic import; paid here, at collection, not in a case's clock. import '@objectstack/lint'; -import { AccessPillar, AutomationsPillar, DataPillar } from './StudioDesignSurface'; +import { AccessPillar, AutomationsPillar } from './StudioDesignSurface'; import { StudioRail, StudioRailRow } from './StudioRail'; import { railAbbreviation } from './railAbbreviation'; import { @@ -152,16 +152,9 @@ interface RailCase { pillar: () => React.ReactElement; } +// objectstack#36904 — the object designer has no rail: objects are listed on +// the area's object list, so the Data rail's cases left this file. const CASES: RailCase[] = [ - { - name: 'Data', - railTestId: 'studio-rail-data', - placeholderKey: 'engine.studio.data.searchObjects', - labels: ['Account', 'Contact'], - match: 'acc', - emptyKey: 'engine.studio.data.noObjects', - pillar: () => , - }, { name: 'Automations', railTestId: 'studio-rail-automations', From 048290208d24e898a5d0c3fcfbaeb47eb7758e6b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:14:22 +0000 Subject: [PATCH 09/18] fix(studio): the copilot names the item a metadata address opens; tests reach the designer's address Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .changeset/36904-object-designer-fullscreen.md | 15 +++++++++++++++ .../BuilderLanding.newAppDoor-36748.test.tsx | 1 + .../studio-design/DataPillar.celGate.test.tsx | 18 +++++++++++++----- ...DataPillar.draftOnlyNoLayers-12508.test.tsx | 2 ++ .../views/studio-design/StudioAiCopilot.tsx | 6 +++++- ...signSurface.customizePublish-28562.test.tsx | 1 + ...DesignSurface.heldFlowCreate-26845.test.tsx | 6 +++--- ...ignSurface.interfacesRetired-36502.test.tsx | 8 ++++---- ...ignSurface.packageListErrorPosture.test.tsx | 1 + ...signSurface.pillarsClaimSlot-12725.test.tsx | 12 ++++++------ ...rface.publishAdvisoryReachesAuthor.test.tsx | 1 + ...esignSurface.publishBackfill-12929.test.tsx | 1 + ...urface.publishReadOnlyReason-12303.test.tsx | 1 + ...esignSurface.readOnlyPosture-12453.test.tsx | 5 ++++- ...tudioDesignSurface.rightSlot-12725.test.tsx | 1 + .../views/studio-design/metadataArea.test.ts | 14 ++++++++++++++ .../src/views/studio-design/metadataArea.ts | 16 ++++++++++++++++ 17 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 .changeset/36904-object-designer-fullscreen.md diff --git a/.changeset/36904-object-designer-fullscreen.md b/.changeset/36904-object-designer-fullscreen.md new file mode 100644 index 00000000000..5b86ab9d72f --- /dev/null +++ b/.changeset/36904-object-designer-fullscreen.md @@ -0,0 +1,15 @@ +--- +'@object-ui/app-shell': patch +--- + +feat(studio): the object designer opens full-screen on the object's metadata address + +Clause-②: no +Metadata-protocol: none + +Studio redesign (epic #36890), the object designer's card (#36904); it also delivers #36513's tab order. + +- **One object, one address.** An object opens its designer full-screen at `/studio//metadata/object/`, under the item header every Studio item page uses: × back to the object list (its filter and sort kept), ‹ › through the list, Esc to close. The designer has no object list of its own and no 「新建」: the object list is the area's, and its 「新建」 creates an object (organization-wide default, the app-menu join, a read-only base's `.custom` pair). +- **Tabs in #36513's order.** Records, Field layout, Validations, Actions, Settings, Hooks, API; on a narrower column Hooks and API fold into "Advanced" first, then the other three. The item tools are tabs after them (References, History with the audit log, Source with the layered comparison), in place of the header's five icons. The open tab is in the address (`?tab=`), so a refresh, a shared link and ‹ › keep it. +- **The old addresses redirect.** `/studio//data?surface=object:` opens that object's designer (`?action=` kept, `?view=` and `?nav=` dropped); `/studio//data` with no object, Studio's old home, opens the package's object list, `?changes=review` kept. The app's 「对象设置」, the record page's 「配置页面」, ⌘K, the AI artifact link and the switched-off action link open the new address; a switched-off action is `?action=` on it. +- **Fixed on the way:** an AI-drafts discard that the server partly refused now keeps its message on the page; the object re-read the discard triggers used to clear it at once. diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx index 780e94039c2..424e28dbdd3 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx @@ -156,6 +156,7 @@ function renderLanding() { } /> + } /> } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx index 1386a4492fb..e8d46d3b497 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx @@ -201,11 +201,19 @@ describe('DataPillar — Save is gated on the field inspector’s CEL verdict (# }); }); -/** - * objectstack#27485, the switch arm — shared with objectstack#27511's - * flush-or-ask switch: an edit the CEL verdict holds cannot be sent, so a - * switch to another object asks before its load replaces the buffer. - */ +// objectstack#36904 — the switch arm of objectstack#27485 (a switch to another +// object over a held formula asks) left with the object rail: another object +// is another address, and leaving one is the shell's leave guard +// (`StudioDesignSurface.heldDataLeave-26705.test.tsx`). + +/** The ways the field inspector closes (the card's step 4). */ +const CLOSERS: Array<[string, () => void]> = [ + ['its Close button', () => fireEvent.click(screen.getAllByRole('button', { name: 'Close' })[0])], + ['Escape', () => fireEvent.keyDown(document.body, { key: 'Escape' })], + ['another field card', () => fireEvent.click((screen.getByText('Est hours').closest('.cursor-grab') as HTMLElement))], + ['the Records tab', () => fireEvent.click(screen.getByRole('button', { name: 'Records' }))], +]; + describe('DataPillar — the CEL hold belongs to the draft, not to the open inspector (objectstack#27485)', () => { async function breakFormula(): Promise { const box = await openFormulaField(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index 87c8db9fdfd..1dac7ebaff6 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -141,6 +141,8 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 expect(reads('st_ticket', ''), 'the draft read never ran: the harness is dead').toEqual([200]); expect(reads('st_ticket', '/layers')).toEqual([200]); expect(server.requests.filter((r) => r.status >= 400)).toEqual([]); + // objectstack#36904 — the header reads the label the draft declares, not the name. + expect((await screen.findAllByTestId('studio-detail-title'))[0]).toHaveTextContent('Ticket'); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); expect(await screen.findByText('Subject')).toBeInTheDocument(); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx b/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx index 8c40813d647..f3293cfceca 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx @@ -15,6 +15,7 @@ import { ConversationsSidebar } from '../../console/ai/ConversationsSidebar.js'; import { resolvePublicShareBase } from '../../console/organizations/resolveHomeUrl.js'; import { AiUsageIndicator } from '../../layout/AiUsageIndicator.js'; import { usePlanApprovalPendingCount } from '../../assistant/assistantBus.js'; +import { metadataAddressArtifact } from './metadataArea.js'; /** * objectui#8219 — the display label of the artifact a pillar has open, tagged @@ -84,9 +85,12 @@ export function StudioCopilotConversation({ artifact = { type: raw.slice(0, idx), name: raw.slice(idx + 1) }; } } + // objectstack#36904 — an item open on its metadata address (the object + // designer, full-screen) is named by the path itself, not a `?surface=`. + if (!artifact) artifact = metadataAddressArtifact(copilotLocation.pathname); if (!tab && !artifact) return undefined; return { ...(tab ? { pillar: tab } : {}), ...(artifact ? { artifact } : {}) }; - }, [tab, copilotLocation.search]); + }, [tab, copilotLocation.search, copilotLocation.pathname]); // objectui#8219 — the chip's display label, read beside the context rather // than inside it. Shown only when it labels the artifact the URL names: the // URL stays the single source of WHAT is discussed, so a label that lags or diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx index 6b763438c54..16af1da76a5 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx @@ -251,6 +251,7 @@ function renderWorkbench() { return render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx index 592789805ba..f2834d3f16f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx @@ -179,6 +179,7 @@ async function openFlow(): Promise { render( + } /> } /> , @@ -197,11 +198,10 @@ async function holdANotifyStep(): Promise { const newFlow = () => fireEvent.click(within(screen.getByTestId('studio-rail-automations')).getByTestId('studio-rail-add')); const pendingRequest = () => fireEvent.click(screen.getByRole('button', { name: 'Pending object/acme_note' })); -/** The Data pillar is open on the Pending changes request's object. */ +/** The object designer is open on the Pending changes request's object (objectstack#36904: on its own address). */ async function noteIsOpen(): Promise { - await screen.findByTestId('studio-rail-data', undefined, { timeout: 8000 }); await waitFor( - () => expect(within(screen.getByTestId('data-object-header')).getByRole('heading', { level: 1 })).toHaveAttribute('title', 'acme_note'), + () => expect(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-item-api-name')[0]).toHaveTextContent('acme_note'), { timeout: 8000 }, ); } diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx index e1e3e253427..6ef154d1f09 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx @@ -186,7 +186,7 @@ const where = () => screen.getByTestId('location-path').textContent; const pathname = () => (where() ?? '').split('?')[0]; /** objectstack#36904 — the Studio home: the package's object list, `/data` redirected. */ const HOME_PATH = `/studio/${PKG}/metadata/object`; -const HOME = `${HOME_PATH}?package=${PKG}`; +const STUDIO_HOME = `${HOME_PATH}?package=${PKG}`; function renderAt(path: string) { render( @@ -213,7 +213,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('the bare URL: Data pillar, the notice, and a link back to the app', async () => { renderAt(`/studio/${PKG}/interfaces`); await screen.findByTestId('studio-shell-header'); - await waitFor(() => expect(where()).toBe(HOME)); + await waitFor(() => expect(where()).toBe(STUDIO_HOME)); const strip = await screen.findByTestId('studio-interfaces-retired'); expect(strip).toHaveAttribute('role', 'status'); @@ -231,7 +231,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('a `?surface=` deep link lands on the same home, its retired parameter dropped', async () => { renderAt(`/studio/${PKG}/interfaces?surface=${encodeURIComponent('page:home')}`); await screen.findByTestId('studio-shell-header'); - await waitFor(() => expect(where()).toBe(HOME)); + await waitFor(() => expect(where()).toBe(STUDIO_HOME)); expect(await screen.findByTestId('studio-interfaces-retired')).toBeInTheDocument(); }); @@ -285,7 +285,7 @@ describe('an old Interfaces URL lands on the Studio home (objectstack#36502)', ( it('CONTROL: an ordinary arrival on the Data pillar shows no notice', async () => { renderAt(`/studio/${PKG}/data`); await screen.findByTestId('studio-shell-header'); - await waitFor(() => expect(where()).toBe(HOME)); + await waitFor(() => expect(where()).toBe(STUDIO_HOME)); expect(notice()).toBeNull(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx index 240a372c584..24d9ae627ae 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx @@ -116,6 +116,7 @@ function renderSurface(tab = 'data') { return render( + } /> } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx index 23a56a167e2..b3e94d702f7 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx @@ -199,6 +199,7 @@ function renderAt(tab: string) { render( + } /> } /> , @@ -206,13 +207,14 @@ function renderAt(tab: string) { } const SLOW = { timeout: 4000 }; +/** objectstack#36904 — the Task object's designer, on its own address. */ +const TASK_DESIGNER = 'metadata/object/acme_task'; const slot = () => screen.getByTestId('studio-right-slot'); const slotProps = () => screen.getByTestId('studio-slot-props'); /** Data: open the object's Form tab and click its one field's card. */ async function selectDataField() { - renderAt('data'); - fireEvent.click(await screen.findByRole('button', { name: /Task/ }, SLOW)); + renderAt(TASK_DESIGNER); fireEvent.click(await screen.findByRole('button', { name: t('engine.studio.data.tab.form', 'en') }, SLOW)); const card = (await screen.findByText('Title', undefined, SLOW)).closest('[role="button"]') as HTMLElement; fireEvent.click(card); @@ -229,8 +231,7 @@ async function openFlow() { describe('Data: the field inspector is in the right slot (objectui#12725)', () => { it('claims nothing while no field is selected: the slot shows the copilot alone', async () => { - renderAt('data'); - fireEvent.click(await screen.findByRole('button', { name: /Task/ }, SLOW)); + renderAt(TASK_DESIGNER); fireEvent.click(await screen.findByRole('button', { name: t('engine.studio.data.tab.form', 'en') }, SLOW)); await screen.findByText('Title', undefined, SLOW); await waitFor(() => expect(slot()).toHaveAttribute('data-mode', 'copilot')); @@ -299,8 +300,7 @@ describe('Data: the field inspector is in the right slot (objectui#12725)', () = it('no copilot served: a selection shows the slot with the properties alone', async () => { copilot.available = false; - renderAt('data'); - fireEvent.click(await screen.findByRole('button', { name: /Task/ }, SLOW)); + renderAt(TASK_DESIGNER); fireEvent.click(await screen.findByRole('button', { name: t('engine.studio.data.tab.form', 'en') }, SLOW)); const card = (await screen.findByText('Title', undefined, SLOW)).closest('[role="button"]') as HTMLElement; await act(async () => {}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx index 96ed895a1fd..95e454b2766 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx @@ -174,6 +174,7 @@ async function publishFromTheWorkbench(): Promise { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx index 2f6bcf980a1..774024455b6 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx @@ -175,6 +175,7 @@ async function openSheet(): Promise { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx index 2a5e14e7181..6af254179b1 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx @@ -118,6 +118,7 @@ function renderWorkbench() { + } /> } /> diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx index 70407670da3..b1f479309eb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx @@ -61,7 +61,9 @@ import { StudioDesignSurface } from './StudioDesignSurface'; import { t } from '../metadata-admin/i18n'; const answer = (body: unknown) => ({ ok: true, status: 200, json: async () => body }); -const PILLARS = ['data', 'automations', 'interfaces', 'access'] as const; +// objectstack#36904 — an object opens its designer on its own address; the +// old Data and Interfaces addresses land on the object list, which is no item. +const PILLARS = ['metadata/object/fo_job', 'automations', 'access'] as const; const READ_ONLY = t('engine.studio.pkg.readonly', 'en'); function servePackage(writable: boolean) { @@ -79,6 +81,7 @@ function renderPillar(pillar: (typeof PILLARS)[number]) { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx index d5c377c2aa1..b21c1997301 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx @@ -148,6 +148,7 @@ function renderAt(tab: string, props: { aiSlot?: React.ReactNode } = {}) { render( + } /> } /> , diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts index 1734c927fd8..e05647be10c 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts @@ -19,6 +19,7 @@ import { areaLocationRedirect, dataPillarRedirect, isStudioAllPackagesScope, + metadataAddressArtifact, studioMetadataAreaPath, } from './metadataArea'; import { STUDIO_ORG_SCOPE_SEGMENT } from './studioScope'; @@ -197,3 +198,16 @@ describe('the object designer on its address, and the retired Data pillar (objec expect(dataPillarRedirect(PKG, '?surface=flow%3Anotify')).toBe(`/studio/${PKG}/metadata/object`); }); }); + +describe('metadataAddressArtifact — the item an address names, for the copilot (objectstack#36904)', () => { + it('names the item of an item address, its history page included', () => { + expect(metadataAddressArtifact(`/studio/${PKG}/metadata/object/account`)).toEqual({ type: 'object', name: 'account' }); + expect(metadataAddressArtifact(`/studio/${PKG}/metadata/object/a%2Fb/history`)).toEqual({ type: 'object', name: 'a/b' }); + }); + + it('names nothing on a list, the directory, diagnostics or another page', () => { + for (const path of [`/studio/${PKG}/metadata/object`, `/studio/${PKG}/metadata`, `/studio/${PKG}/metadata/_diagnostics/x`, `/studio/${PKG}/automations`]) { + expect(metadataAddressArtifact(path), path).toBeUndefined(); + } + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 1712798961e..388ee6e5e64 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -149,6 +149,22 @@ export function dataPillarRedirect(packageId: string, search: string): string { return query ? `${list}?${query}` : list; } +/** + * objectstack#36904 — the item a Studio metadata address names, + * `/studio//metadata//` (a trailing `/history` included), + * or `undefined` for any other path (a list, the directory, diagnostics). The + * copilot reads the open item from it where no `?surface=` names one. + */ +export function metadataAddressArtifact(pathname: string): { type: string; name: string } | undefined { + const m = /^\/studio\/[^/]+\/metadata\/([^/]+)\/([^/]+)/.exec(pathname); + if (!m || m[1].startsWith('_')) return undefined; + try { + return { type: decodeURIComponent(m[1]), name: decodeURIComponent(m[2]) }; + } catch { + return undefined; + } +} + /** * objectstack#28569 (ADR-0146 Consequences) — the types whose item opens the * area's simplified form editor (`StudioBundleItemEditor`): the fields Setup's From 2ac0235986831b941401e3f00697ba18ee84028b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:23:55 +0000 Subject: [PATCH 10/18] test(studio): the pair suite uses the real area; the live journey opens the designer's address Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- ui/e2e/live/studio-customize-journey.spec.ts | 3 ++- .../StudioDesignSurface.oneSurface-28572.test.tsx | 9 ++------- .../StudioDesignSurface.packageListErrorPosture.test.tsx | 9 +++++---- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/ui/e2e/live/studio-customize-journey.spec.ts b/ui/e2e/live/studio-customize-journey.spec.ts index 0895d59d0fb..8e29c1a3957 100644 --- a/ui/e2e/live/studio-customize-journey.spec.ts +++ b/ui/e2e/live/studio-customize-journey.spec.ts @@ -230,7 +230,8 @@ test('a read-only base is customized, restored and extended through Studio, and }); await test.step(`Add ${FIELD.name}: an extension in the pair, served on the base object`, async () => { - await page.goto(`/studio/${BASE}/data?surface=${encodeURIComponent(`object:${OBJECT}`)}`); + // objectstack#36904 — the object designer, on the object's own address. + await page.goto(`/studio/${BASE}/metadata/object/${encodeURIComponent(OBJECT)}`); await page.getByTestId('data-object-header').getByRole('button', { name: 'Field layout', exact: true }).click(); await page.getByTestId('data-form-add-extension-field').click(); await page.getByTestId('add-field-label-input').fill(FIELD.label); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx index 51259a29416..f237752ebef 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx @@ -80,11 +80,7 @@ vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPan vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null })); vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null })); -vi.mock('./StudioMetadataArea', () => ({ - StudioMetadataArea: ({ packageId }: { packageId: string | null }) => ( -
- ), -})); +// objectstack#36904 — the REAL area: it mounts the object designer. // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. @@ -393,8 +389,7 @@ describe('the pair’s URLs (objectstack#28572)', () => { it('the pair’s "All metadata" URL stays on the pair: it is not sent to the base, so nothing loops', async () => { renderAt(`/studio/${encodeURIComponent(PAIR)}/metadata`); - const area = await screen.findByTestId('metadata-area', undefined, { timeout: 8000 }); - expect(area).toHaveAttribute('data-package', PAIR); + await screen.findByTestId('studio-metadata-area', undefined, { timeout: 8000 }); await new Promise((r) => setTimeout(r, 300)); expect(screen.getByTestId('location')).toHaveTextContent(`/studio/${encodeURIComponent(PAIR)}/metadata`); }); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx index 24d9ae627ae..ba729caff32 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx @@ -141,13 +141,14 @@ describe('Studio top bar — package-list fetch failure is reported, not swallow }); it('one outage is one toast: every call site reports on the same sonner id', async () => { - // The `data` tab mounts both `fetchPackages()` callers at once — the - // writability courtesy gate and the namespace lookup. + // objectstack#36904 — the Studio home mounts one `fetchPackages()` caller + // now, the writability courtesy gate: the namespace lookup left with the + // object designer's own 「新建」. Every report it makes rides the one id. fetchPackagesMock.mockRejectedValue(new Error('Service Unavailable')); renderSurface('data'); - await waitFor(() => expect(fetchPackagesMock.mock.calls.length).toBeGreaterThanOrEqual(2)); - await waitFor(() => expect(toastError.mock.calls.length).toBeGreaterThanOrEqual(2)); + await waitFor(() => expect(fetchPackagesMock).toHaveBeenCalled()); + await waitFor(() => expect(toastError).toHaveBeenCalled()); // Sonner collapses same-id toasts into one, so the rejections of one // endpoint surface as a single message rather than a stack. From 5790a826c8d6cef212f9e784dfaa28da17d2b898 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:25:14 +0000 Subject: [PATCH 11/18] chore(studio): drop imports the trimmed suites no longer use Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../studio-design/DataPillar.actionDeepLink-34724.test.tsx | 2 +- ui/packages/app-shell/src/views/studio-design/DataPillar.tsx | 2 +- .../StudioDesignSurface.autosaveSwitch-11232.test.tsx | 1 - .../StudioDesignSurface.draftVersionConflict-11773.test.tsx | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx index 3519b8f38ea..eca68bdbcd8 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx @@ -21,7 +21,7 @@ import '@testing-library/jest-dom/vitest'; import '@objectstack/lint'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; -import { render, screen, fireEvent, cleanup, act, waitFor } from '@testing-library/react'; +import { render, screen, fireEvent, cleanup, act } from '@testing-library/react'; import { MemoryRouter, useSearchParams } from 'react-router-dom'; import { MetadataClient } from '@object-ui/data-objectstack'; import { ActionSchema } from '@objectstack/spec/ui'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx index 01711751753..e43b768d282 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx @@ -122,7 +122,7 @@ import { type ServerDiagnostics, } from '../metadata-admin/draftVerdict.js'; import { emitMetadataRefresh } from '../../assistant/assistantBus.js'; -import { publishSavedItem, readPublishedPin, STUDIO_SAVE_TOAST_ID, useStudioSaveEntry, type StudioSaveResult } from './studioSaveBar.js'; +import { publishSavedItem, readPublishedPin, useStudioSaveEntry, type StudioSaveResult } from './studioSaveBar.js'; import { irreversibleFieldChanges } from './objectSaveConfirm.js'; import { destructiveFindings, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx index 0712f6843c8..9f5e581d708 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.autosaveSwitch-11232.test.tsx @@ -208,7 +208,6 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul import { AutomationsPillar, StudioDesignSurface } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; -import { ADD_FIELD_OFFERED, addFieldFromGrid } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx index f25bb64a330..15c7457c031 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx @@ -216,7 +216,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f import '@objectstack/lint'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness } from './__tests__/studioSaveHarness'; -import { addFieldFromFormToolbar, addFieldFromGrid, type AddFieldInput } from './__tests__/dataPillarAddField'; +import { addFieldFromGrid, type AddFieldInput } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { readFields } from '../metadata-admin/previews/object-fields-io'; From dd7e129f5baf715ee5dd79307d81917efbe038a3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 24 Nov 2026 23:46:21 +0000 Subject: [PATCH 12/18] test(studio): pay the lazy loads at collection in the suites this card edits Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../src/chrome/CommandPalette.studioScope-11863.test.tsx | 3 +++ .../views/studio-design/CreateItemDialog.labels-13128.test.tsx | 2 ++ .../studio-design/DataPillar.advancedKeepsName-11794.test.tsx | 2 ++ .../studio-design/DataPillar.externalObject-27279.test.tsx | 2 ++ .../src/views/studio-design/DataPillar.flatTabs-12450.test.tsx | 2 ++ .../views/studio-design/DataPillar.formToolbar-12451.test.tsx | 2 ++ .../src/views/studio-design/DataPillar.gridProjection.test.tsx | 2 ++ .../studio-design/DataPillar.headerActions-12511.test.tsx | 2 ++ .../DataPillar.inspectorBelongsToView-11781.test.tsx | 2 ++ .../StudioDesignSurface.createAppAccessibleName.test.tsx | 2 ++ .../studio-design/StudioDesignSurface.gridColumns.test.tsx | 2 ++ .../StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx | 2 ++ .../StudioDesignSurface.publishBackfill-12929.test.tsx | 2 ++ .../StudioDesignSurface.readOnlyWording-11781.test.tsx | 2 ++ .../src/views/studio-design/objectDesignerTabs.test.ts | 3 +++ 15 files changed, 32 insertions(+) diff --git a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx index d697a04cb44..f0ca6340901 100644 --- a/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx +++ b/ui/packages/app-shell/src/chrome/CommandPalette.studioScope-11863.test.tsx @@ -30,6 +30,9 @@ * metadata cache is a hand-rolled `MetadataCtx` value that counts its reads. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, fireEvent, waitFor, cleanup, screen } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx index 3304ec50274..3237026ed79 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx @@ -15,6 +15,8 @@ * not on the copy. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx index aef5b1071a8..061dc5f9705 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx @@ -13,6 +13,8 @@ * stubbed: only which one is open is under test, not what it draws. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx index 243a1305420..f789a9aa12f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx @@ -12,6 +12,8 @@ * affordances it draws from the grid's authoring context. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; // Module scope as well as in the `vi.mock` factory below: the cold transform is paid diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx index c1c45939dd4..073cc358d47 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx @@ -19,6 +19,8 @@ * only which panel is open is under test, not what it draws. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx index 7a75bc8fe8e..8b63fcf5af1 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx @@ -16,6 +16,8 @@ * from the grid's authoring context the way the real grid draws it. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; // Module scope as well as in the `vi.mock` factory below: the cold transform is paid diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx index ef267a3835e..d75286ddf58 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx @@ -23,6 +23,8 @@ * would move the bug back without reddening anything. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx index 992506f1d2d..d65ee075b8e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx @@ -20,6 +20,8 @@ * because only the header is under test. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx index ff0d9a02928..d918604dd82 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx @@ -18,6 +18,8 @@ * "no inspector" note: the rail's presence is the observable, whatever it holds. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx index b405714927c..0f0e1cb0599 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx @@ -40,6 +40,8 @@ * reader and an automation harness compute. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx index 6cb11c415d3..9d42819b8ef 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx @@ -34,6 +34,8 @@ * `columns` to work around this very defect — those tests stay as they are. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx index 95e454b2766..476a8d84357 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx @@ -26,6 +26,8 @@ * what is under test, so it is reduced to the button that fires `onPublish`. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx index 774024455b6..0d564794a0f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx @@ -23,6 +23,8 @@ * panels no assertion reads. */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx index 96bfe071900..d4e193e4622 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx @@ -15,6 +15,8 @@ * does not redden this file and a missing row does (`t` echoes a missing key). */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts index 475a1352eb4..06e9a9b83e4 100644 --- a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts @@ -9,6 +9,9 @@ * and a tool tab writes the value every item page reads (`ItemToolTabs`). */ +// Paid at collection, not inside a case's clock (check:test-source-alias). +import '@objectstack/lint'; +import '@object-ui/plugin-editor'; import { describe, expect, it } from 'vitest'; import { OBJECT_DESIGNER_ALWAYS_FLAT, From e1a2904f109d7d49675330079bb37e7e643e32ac Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 00:32:22 +0000 Subject: [PATCH 13/18] test(studio): the area mounts the object designer on its address; review keeps the generic page Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../StudioMetadataArea.routes-28561.test.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx index cfde5f18fb6..3f59880a988 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx @@ -65,6 +65,12 @@ vi.mock('./StudioBundleItemEditor.js', () => ({ /** `GET /api/v1/packages` as the listed manifests read it: one writable, one read-only, one kernel. */ let listed: Map }>; let listFails = false; +// objectstack#36904 — the object designer, stubbed: only where the area mounts it is under test. +vi.mock('./DataPillar.js', () => ({ + DataPillar: (props: { packageId: string; objectName: string; readOnly?: boolean }) => ( +
+ ), +})); vi.mock('./packages-io.js', async (importOriginal) => ({ ...(await importOriginal>()), fetchListedPackageManifests: vi.fn(async () => { @@ -285,7 +291,6 @@ describe("a read-only base's create opens in its .custom pair (objectstack#36897 describe('a pillar type opened from the area opens its pillar', () => { for (const [type, pillar] of [ - ['object', 'data'], ['flow', 'automations'], ['permission', 'access'], ] as const) { @@ -298,6 +303,22 @@ describe('a pillar type opened from the area opens its pillar', () => { }); } + // objectstack#36904 — an object opens its designer on its own address. + it('an object opens the object designer on its own address, bound to the package', async () => { + mount(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}`); + const designer = await screen.findByTestId('object-designer'); + expect(designer).toHaveAttribute('data-package', WRITABLE); + expect(designer).toHaveAttribute('data-object', 'item_1'); + expect(designer).toHaveAttribute('data-readonly', 'false'); + expect(new URL(where(), 'http://x').pathname).toBe(`/studio/${WRITABLE}/metadata/object/item_1`); + }); + + it('CONTROL: an object under `?review=1` keeps the generic page and its draft review', async () => { + mount(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}&review=1`); + expect((await page()).page).toBe('item'); + expect(screen.queryByTestId('object-designer')).toBeNull(); + }); + it('a type no pillar designs opens the generic page', async () => { mount(`/studio/${WRITABLE}/metadata/agent/support_bot?package=${WRITABLE}`); expect((await page()).page).toBe('item'); From efd179cc41b2a14ac54f5b02373204871d33f5d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 00:54:28 +0000 Subject: [PATCH 14/18] =?UTF-8?q?test(studio):=20CI=20follow-ups=20?= =?UTF-8?q?=E2=80=94=20collection-time=20detail-surface=20load,=20supporte?= =?UTF-8?q?d=20locales,=20the=20retired=20rail's=20census=20row,=20?= =?UTF-8?q?=E2=8C=98K=20on=20a=20pillar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01QSeKYkkwuF6UuFtu85Yd5H Co-authored-by: Claude --- .../studio-design/BuilderLanding.newAppDoor-36748.test.tsx | 1 + .../studio-design/CreateItemDialog.labels-13128.test.tsx | 3 ++- .../studio-design/DataPillar.actionDeepLink-34724.test.tsx | 1 + .../studio-design/DataPillar.actionRefusal-26736.test.tsx | 1 + .../DataPillar.actionServedRows-35650.test.tsx | 1 + .../studio-design/DataPillar.addFieldPopover-12516.test.tsx | 1 + .../DataPillar.advancedKeepsName-11794.test.tsx | 1 + .../studio-design/DataPillar.aiDraftDiscard-36511.test.tsx | 1 + .../studio-design/DataPillar.authorRefusal-11785.test.tsx | 1 + .../studio-design/DataPillar.authoredBuffer-29793.test.tsx | 1 + .../DataPillar.baseObjectExtension-28575.test.tsx | 1 + .../src/views/studio-design/DataPillar.celGate.test.tsx | 1 + .../DataPillar.choiceWithoutOptions-11253.test.tsx | 1 + .../DataPillar.copilotChangesLine-34725.test.tsx | 1 + .../DataPillar.copilotDraftMarks-12725.test.tsx | 1 + .../DataPillar.designerRegistryPopulated.test.tsx | 1 + .../DataPillar.destructiveChange-34931.test.tsx | 1 + .../DataPillar.draftOnlyNoLayers-12508.test.tsx | 1 + .../studio-design/DataPillar.draftSavedNamed-28984.test.tsx | 1 + .../studio-design/DataPillar.draftUnreadable-29148.test.tsx | 1 + .../DataPillar.extensionPublishPinned-36726.test.tsx | 1 + .../studio-design/DataPillar.externalObject-27279.test.tsx | 1 + .../views/studio-design/DataPillar.flatTabs-12450.test.tsx | 1 + .../DataPillar.formDraftPreview-12515.test.tsx | 1 + .../studio-design/DataPillar.formToolbar-12451.test.tsx | 1 + .../views/studio-design/DataPillar.gridProjection.test.tsx | 1 + .../studio-design/DataPillar.headerActions-12511.test.tsx | 1 + .../studio-design/DataPillar.heldIncomplete-11786.test.tsx | 1 + .../DataPillar.hiddenSystemFields-11780.test.tsx | 1 + .../studio-design/DataPillar.hookServedRows-36725.test.tsx | 1 + .../DataPillar.inspectorBelongsToView-11781.test.tsx | 1 + .../DataPillar.internalFormRetired-36425.test.tsx | 1 + .../src/views/studio-design/DataPillar.layoutBadge.test.tsx | 1 + .../DataPillar.layoutSaveCancel-36511.test.tsx | 1 + .../studio-design/DataPillar.pairActions-30088.test.tsx | 1 + .../DataPillar.pairActionsPublishPinned-36726.test.tsx | 1 + .../src/views/studio-design/DataPillar.panelGate.test.tsx | 1 + .../views/studio-design/DataPillar.panelHold-27629.test.tsx | 1 + .../DataPillar.picklistServedOptions-10202.test.tsx | 1 + .../studio-design/DataPillar.pulseAfterSave-36648.test.tsx | 1 + .../DataPillar.readOnlyRailReason-12303.test.tsx | 1 + .../studio-design/DataPillar.recordsScroll-35061.test.tsx | 1 + .../studio-design/DataPillar.recordsTab-34794.test.tsx | 1 + .../studio-design/DataPillar.saveCancel-36511.test.tsx | 1 + .../studio-design/DataPillar.showMeFocus-26730.test.tsx | 1 + .../studio-design/DataPillar.summaryHeld-27461.test.tsx | 1 + .../DataPillar.validationVerdictHold-27644.test.tsx | 1 + .../StudioDesignSurface.accessSegment-12452.test.tsx | 1 + .../StudioDesignSurface.backToApp-36501.test.tsx | 1 + .../StudioDesignSurface.cancelledLoad-11331.test.tsx | 1 + .../StudioDesignSurface.copilotDoors-12894.test.tsx | 1 + .../StudioDesignSurface.createAppAccessibleName.test.tsx | 1 + .../StudioDesignSurface.createTaken-26917.test.tsx | 3 ++- .../StudioDesignSurface.customizePublish-28562.test.tsx | 1 + .../StudioDesignSurface.designerRegistryMissing.test.tsx | 1 + .../StudioDesignSurface.desktopHint-11795.test.tsx | 1 + .../StudioDesignSurface.draftUnreadable-29148.test.tsx | 1 + .../StudioDesignSurface.draftVersionConflict-11773.test.tsx | 1 + .../StudioDesignSurface.entryReadsOnce-11797.test.tsx | 1 + .../StudioDesignSurface.expectedMisses-11799.test.tsx | 1 + .../studio-design/StudioDesignSurface.formFields.test.tsx | 1 + .../studio-design/StudioDesignSurface.gridColumns.test.tsx | 1 + .../StudioDesignSurface.heldDataCreate-26845.test.tsx | 1 + .../StudioDesignSurface.heldDataLeave-26705.test.tsx | 1 + .../StudioDesignSurface.heldFlowCreate-26845.test.tsx | 1 + .../StudioDesignSurface.interfacesRetired-36502.test.tsx | 1 + .../StudioDesignSurface.itemDraftLine-12725.test.tsx | 1 + .../StudioDesignSurface.kernelReadOnly-29567.test.tsx | 1 + .../StudioDesignSurface.lateRegistration-11939.test.tsx | 1 + .../StudioDesignSurface.metadataArea-28561.test.tsx | 6 ++++-- .../StudioDesignSurface.notFound-26708.test.tsx | 3 ++- .../StudioDesignSurface.oneSurface-28572.test.tsx | 1 + .../StudioDesignSurface.packageListErrorPosture.test.tsx | 1 + .../StudioDesignSurface.pillarsClaimSlot-12725.test.tsx | 1 + ...tudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx | 1 + .../StudioDesignSurface.publishBackfill-12929.test.tsx | 1 + .../StudioDesignSurface.publishCount-11807.test.tsx | 1 + ...StudioDesignSurface.publishReadOnlyReason-12303.test.tsx | 1 + .../StudioDesignSurface.readOnlyPosture-12453.test.tsx | 1 + .../StudioDesignSurface.readOnlyWording-11781.test.tsx | 1 + .../StudioDesignSurface.rightSlot-12725.test.tsx | 1 + .../StudioDesignSurface.saveBar-36511.test.tsx | 1 + .../StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx | 1 + .../StudioDesignSurface.sharedSelect-11865.test.tsx | 3 ++- .../StudioDesignSurface.twoHolders-28584.test.tsx | 1 + .../views/studio-design/StudioRail.noMatches-26733.test.tsx | 1 + .../src/__tests__/clickableNonControlCensus-13461.test.ts | 1 - 87 files changed, 93 insertions(+), 7 deletions(-) diff --git a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx index 424e28dbdd3..487be0c03ee 100644 --- a/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/BuilderLanding.newAppDoor-36748.test.tsx @@ -26,6 +26,7 @@ import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; await loadStudioCatalogue('zh'); diff --git a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx index 3237026ed79..149064e1464 100644 --- a/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/CreateItemDialog.labels-13128.test.tsx @@ -17,6 +17,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; @@ -99,7 +100,7 @@ describe('Studio create dialogs bind each label to its input (objectui#13128)', // objectstack#36904 — New object is the object list's create dialog. render( - {}} packageId="app.a" inPair={false} locale="en" onCreated={() => {}} /> + {}} packageId="app.a" inPair={false} locale="en-US" onCreated={() => {}} /> , ); const dialog = await screen.findByRole('dialog'); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx index eca68bdbcd8..0237fd04c1c 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionDeepLink-34724.test.tsx @@ -19,6 +19,7 @@ import '@testing-library/jest-dom/vitest'; // The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { render, screen, fireEvent, cleanup, act } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx index 9589d5b6347..ca010ba9bec 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionRefusal-26736.test.tsx @@ -132,6 +132,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx index 199e1af9c80..612c0a28d3c 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.actionServedRows-35650.test.tsx @@ -107,6 +107,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx index 48aca900f0b..382fabfdcd2 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.addFieldPopover-12516.test.tsx @@ -71,6 +71,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx index 061dc5f9705..9caa4134338 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.advancedKeepsName-11794.test.tsx @@ -15,6 +15,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx index d9b581a5abd..78f2204ea80 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.aiDraftDiscard-36511.test.tsx @@ -75,6 +75,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { }); import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx index cd61ed9df53..0f20c6a5a2c 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.authorRefusal-11785.test.tsx @@ -78,6 +78,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx index c366387f7a4..541cf229078 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.authoredBuffer-29793.test.tsx @@ -127,6 +127,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t, tFormat } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx index e81a3b6f568..9e48ba71f4e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.baseObjectExtension-28575.test.tsx @@ -148,6 +148,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { ObjectExtensionSchema } from '@objectstack/spec/data'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx index e8d46d3b497..ddc3c6f7b79 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.celGate.test.tsx @@ -114,6 +114,7 @@ import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { __setCelFormulaLoader } from '../metadata-admin/celAuthoring'; const dataSource = createEmptyDataSource(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx index 60ea16649dd..0cf4187f7b0 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.choiceWithoutOptions-11253.test.tsx @@ -96,6 +96,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx index f88f3c48fca..0f7dbd083f6 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx @@ -65,6 +65,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { }); import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { t, tFormat } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx index 73d042bd6f5..29b6c308a48 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotDraftMarks-12725.test.tsx @@ -90,6 +90,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx index 32630aa016e..aad0b4fefe1 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.designerRegistryPopulated.test.tsx @@ -117,6 +117,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx index 9a94610a725..38436f0c883 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.destructiveChange-34931.test.tsx @@ -87,6 +87,7 @@ import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); registerBuiltinInspectors(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index 1dac7ebaff6..b1c53712ad6 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -97,6 +97,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx index 75fba6a0284..6bd27f27d59 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftSavedNamed-28984.test.tsx @@ -87,6 +87,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx index 2b6906b5b39..dcbf416aaff 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftUnreadable-29148.test.tsx @@ -113,6 +113,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx index 5c0be81e369..f73730b09fa 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.extensionPublishPinned-36726.test.tsx @@ -166,6 +166,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx index f789a9aa12f..3a37585598e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.externalObject-27279.test.tsx @@ -14,6 +14,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; // Module scope as well as in the `vi.mock` factory below: the cold transform is paid diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx index 073cc358d47..0579664a980 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx @@ -21,6 +21,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx index d9c9f2e54f4..6b63da21be3 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formDraftPreview-12515.test.tsx @@ -98,6 +98,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx index 8b63fcf5af1..02035488eff 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.formToolbar-12451.test.tsx @@ -18,6 +18,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; // Module scope as well as in the `vi.mock` factory below: the cold transform is paid diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx index d75286ddf58..8ec8a2f7b4a 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.gridProjection.test.tsx @@ -25,6 +25,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, afterEach } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx index d65ee075b8e..a926f9a6375 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.headerActions-12511.test.tsx @@ -22,6 +22,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { cleanup, render, screen, waitFor } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx index c0d25627c66..ea289c8f66f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.heldIncomplete-11786.test.tsx @@ -81,6 +81,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx index ff48be9ddd5..2c541ab31e3 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.hiddenSystemFields-11780.test.tsx @@ -203,6 +203,7 @@ vi.mock('@dnd-kit/core', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx index fd01f0b77c7..cd3d6c9c40f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.hookServedRows-36725.test.tsx @@ -106,6 +106,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx index d918604dd82..0b433b60fcd 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.inspectorBelongsToView-11781.test.tsx @@ -20,6 +20,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx index 183dd15a65a..674c5d46589 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.internalFormRetired-36425.test.tsx @@ -140,6 +140,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx index 64eea919c03..b16bedcff96 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutBadge.test.tsx @@ -27,6 +27,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; import { render, screen, fireEvent, cleanup } from '@testing-library/react'; // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { completeAddFieldPopover } from './__tests__/dataPillarAddField'; import { MemoryRouter } from 'react-router-dom'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx index 207bc068cfc..d485febff28 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.layoutSaveCancel-36511.test.tsx @@ -88,6 +88,7 @@ import { StudioSaveHarness, pressStudioCancel, pressStudioSave } from './__tests import { t } from '../metadata-admin/i18n'; // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx index 482c9e0e2c1..9f7c05f5bab 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActions-30088.test.tsx @@ -178,6 +178,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The pillar reaches a dynamic `import('@objectstack/lint')`: pay its load at // collection, never inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioCancel, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx index eba9a11befb..ac14bb2b1f1 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pairActionsPublishPinned-36726.test.tsx @@ -198,6 +198,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The pillar reaches a dynamic `import('@objectstack/lint')`: pay its load at // collection, never inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar, type StudioBaseCustomization } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx index 1dd9a2522e2..94a21366796 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx @@ -100,6 +100,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx index dcd6477f9a2..e54ba632df2 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.panelHold-27629.test.tsx @@ -106,6 +106,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx index b8b9740d2f1..9016db56110 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.picklistServedOptions-10202.test.tsx @@ -146,6 +146,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromGrid } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx index 3c009d5c03a..352080cfd77 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.pulseAfterSave-36648.test.tsx @@ -116,6 +116,7 @@ vi.mock('./useMetadataRefreshNonce', async () => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import * as React from 'react'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx index 8b14738476b..c473d62d438 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.readOnlyRailReason-12303.test.tsx @@ -62,6 +62,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emptyDataSource'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx index 18710061d33..8d87a4a190f 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsScroll-35061.test.tsx @@ -80,6 +80,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { registerMetadataInspector } from '../metadata-admin/inspector-registry'; import { ObjectFieldInspector } from '../metadata-admin/inspectors/ObjectFieldInspector'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx index 980b7f5d0ca..bdc13a87c10 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.recordsTab-34794.test.tsx @@ -92,6 +92,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { t } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx index da1d3130f86..578a1bfca94 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.saveCancel-36511.test.tsx @@ -115,6 +115,7 @@ import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; import { t, tFormat } from '../metadata-admin/i18n'; // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); registerBuiltinInspectors(); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx index 842c574c396..59274ec4280 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.showMeFocus-26730.test.tsx @@ -114,6 +114,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx index 910c49c3994..b4b38f4187b 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.summaryHeld-27461.test.tsx @@ -71,6 +71,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness, pressStudioSave } from './__tests__/studioSaveHarness'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx index e0dc2450bce..f9f8b8160e0 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.validationVerdictHold-27644.test.tsx @@ -24,6 +24,7 @@ import { MemoryRouter } from 'react-router-dom'; // The CEL authoring code loads `@objectstack/lint` lazily; warmed here so its // first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const REFUSED = 'record.amount > 100'; const ACCEPTED = 'record.amount != null && record.amount > 100'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx index b849bb10c07..8fc0632e761 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.accessSegment-12452.test.tsx @@ -123,6 +123,7 @@ import { translateMetadataDomain } from '../metadata-admin/i18n'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; window.matchMedia = ((query: string) => ({ matches: false, diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx index 8910df15f6b..859882c5a0f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.backToApp-36501.test.tsx @@ -31,6 +31,7 @@ import { MemoryRouter, Route, Routes, useLocation } from 'react-router-dom'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const OWN = 'com.example.sales'; const FLAT_KERNEL = 'sys.env-artifact-cache'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx index 28693e7ef4b..12149547d57 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.cancelledLoad-11331.test.tsx @@ -143,6 +143,7 @@ import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emp // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx index 87accb9d3a2..3c902fb886d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.copilotDoors-12894.test.tsx @@ -131,6 +131,7 @@ import { I18nProvider } from '@object-ui/i18n'; // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { subscribeMetadataRefresh } from '../../assistant/assistantBus'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx index 0f0e1cb0599..3ee139d8a7b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createAppAccessibleName.test.tsx @@ -42,6 +42,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx index 5bc07001a7e..1bff424d6d8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.createTaken-26917.test.tsx @@ -27,6 +27,7 @@ // Warmed at module top so the first load of the console's lazily loaded // authoring code is paid during collection, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -282,7 +283,7 @@ describe('objectstack#26917 — Data: New object over a taken identifier', () => async function openNewObject() { render( - {}} packageId={PKG} inPair={false} locale="en" onCreated={() => {}} /> + {}} packageId={PKG} inPair={false} locale="en-US" onCreated={() => {}} /> , ); const dialog = await screen.findByRole('dialog'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx index 16af1da76a5..8f5ae092580 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.customizePublish-28562.test.tsx @@ -116,6 +116,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx index 65ae112f4f5..41fa2b55dfe 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.designerRegistryMissing.test.tsx @@ -109,6 +109,7 @@ import { getStudioCanvasPreview } from './studio-canvas-preview'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx index 04c9e515521..3fb60349efb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.desktopHint-11795.test.tsx @@ -13,6 +13,7 @@ import '@testing-library/jest-dom/vitest'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { act, cleanup, render, screen } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx index 0a45bd4b0f2..7dcf0bae1a6 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftUnreadable-29148.test.tsx @@ -139,6 +139,7 @@ import { registerMetadataPreview, getMetadataPreview } from '../metadata-admin/p // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx index 15c7457c031..ff5e39dd9f8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.draftVersionConflict-11773.test.tsx @@ -214,6 +214,7 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), info: vi.f // The source reaches a dynamic import of it: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { StudioSaveHarness } from './__tests__/studioSaveHarness'; import { addFieldFromGrid, type AddFieldInput } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx index f89417b1a48..a203bf490c2 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.entryReadsOnce-11797.test.tsx @@ -63,6 +63,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; window.matchMedia = ((query: string) => ({ diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx index c09bc80c094..d210e997c47 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.expectedMisses-11799.test.tsx @@ -130,6 +130,7 @@ vi.mock('@object-ui/react', async (importOriginal) => { // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { AutomationsPillar, DataPillar } from './StudioDesignSurface'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { DashboardPreview } from '../metadata-admin/previews/DashboardPreview'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx index 002374c57c3..aaa3ccea0f9 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.formFields.test.tsx @@ -142,6 +142,7 @@ vi.mock('@object-ui/plugin-form', async (importOriginal) => { // The source reaches a dynamic `import('@objectstack/lint')`: its first load is paid at collection (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx index 9d42819b8ef..c983ec65c64 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.gridColumns.test.tsx @@ -36,6 +36,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index d3847f45601..280e0a9585c 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -90,6 +90,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx index 99eb3821fb8..d7cc9148ee0 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx @@ -75,6 +75,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx index f2834d3f16f..35b96058558 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldFlowCreate-26845.test.tsx @@ -101,6 +101,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { // The source under test reaches a dynamic import of `@objectstack/lint`: its first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx index 6ef154d1f09..35cf2811468 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.interfacesRetired-36502.test.tsx @@ -128,6 +128,7 @@ import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; await loadStudioCatalogue('zh'); window.matchMedia = ((query: string) => ({ diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx index 8448ede9423..028468f2c74 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.itemDraftLine-12725.test.tsx @@ -106,6 +106,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { t, tFormat } from '../metadata-admin/i18n'; import { emitMetadataRefresh } from '../../assistant/assistantBus'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx index 5f99508df2b..65393799232 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kernelReadOnly-29567.test.tsx @@ -28,6 +28,7 @@ import '@testing-library/jest-dom/vitest'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import * as React from 'react'; import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { act, cleanup, render, screen, waitFor } from '@testing-library/react'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx index 401e1cff4be..7a9cf5a0aa1 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.lateRegistration-11939.test.tsx @@ -92,6 +92,7 @@ import { getStudioCanvasPreview } from './studio-canvas-preview'; // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx index eea40c4c4b4..f3995d4a36e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.metadataArea-28561.test.tsx @@ -295,13 +295,15 @@ describe('⌘K on the builder (objectstack#36900)', () => { it("on a package's pillar, Ctrl+K opens the palette with the menu's entries, and a pick opens through the surface", async () => { servePackages(); - renderAt(`/studio/${PACKAGE_ID}/data`); + // objectstack#36904 — the Data pillar is retired (`/data` lands on the + // object list); the Automations pillar is a pillar page still. + renderAt(`/studio/${PACKAGE_ID}/automations`); await waitFor(() => menu().getByTestId('studio-menu-entry-type:flow')); expect(overlay()).toBeNull(); fireEvent.keyDown(document, { key: 'k', ctrlKey: true }); await waitFor(() => expect(overlay()).not.toBeNull()); - expect(where()).toBe(`/studio/${PACKAGE_ID}/data?palette=1`); + expect(where()).toBe(`/studio/${PACKAGE_ID}/automations?palette=1`); await waitFor(() => expect(paletteItem('studio-entry type:flow')).not.toBeNull()); expect(paletteItem('studio-entry orgFlows')).not.toBeNull(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx index 967d1f5e40f..43e488da3f9 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.notFound-26708.test.tsx @@ -23,6 +23,7 @@ import '@testing-library/jest-dom/vitest'; // The source under test reaches `import('@objectstack/lint')`: paid here, at collection, never inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { act, cleanup, render, screen, waitFor, within } from '@testing-library/react'; import * as React from 'react'; @@ -105,7 +106,7 @@ function renderAt(path: string, surface: React.ReactElement = } /> {/* objectstack#36904 — `/data` lands on the area's object list. */} - + , { area: 'metadata' })} /> , diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx index f237752ebef..8466aeb95a6 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.oneSurface-28572.test.tsx @@ -85,6 +85,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => nul // The console's preview and authoring code loads `@objectstack/lint` lazily; // warmed here so its first load is paid at import, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; import { t, tFormat } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx index ba729caff32..50a493e6f3e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.packageListErrorPosture.test.tsx @@ -19,6 +19,7 @@ import '@testing-library/jest-dom/vitest'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx index b3e94d702f7..b9d56bb6bfa 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.pillarsClaimSlot-12725.test.tsx @@ -116,6 +116,7 @@ vi.mock('./StudioAiCopilot', () => ({ // The source loads `@objectstack/lint` lazily; paid here, at collection, not // inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { t } from '../metadata-admin/i18n'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx index 476a8d84357..968bb3596a8 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishAdvisoryReachesAuthor.test.tsx @@ -28,6 +28,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx index 0d564794a0f..4abbe28e48a 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishBackfill-12929.test.tsx @@ -25,6 +25,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx index ef1f164bd44..f4395d8b42b 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishCount-11807.test.tsx @@ -83,6 +83,7 @@ import { toast } from 'sonner'; // first load is paid here, at collection, never inside a case's clock // (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { t, tFormat } from '../metadata-admin/i18n'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx index 6af254179b1..657b358ed3e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.publishReadOnlyReason-12303.test.tsx @@ -36,6 +36,7 @@ import { I18nProvider } from '@object-ui/i18n'; // The surface loads the linter lazily; pay that load at collection, not inside // a case's clocked window. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const PACKAGE_ID = 'com.acme.app'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx index b1f479309eb..7aa8c0b50fc 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyPosture-12453.test.tsx @@ -18,6 +18,7 @@ import '@testing-library/jest-dom/vitest'; // The surface's reach loads `@objectstack/lint` lazily; pay that load during // collection, not inside a case's clocked window (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { act, cleanup, render, screen, waitFor } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx index d4e193e4622..0c28c2ecacb 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.readOnlyWording-11781.test.tsx @@ -17,6 +17,7 @@ // Paid at collection, not inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, describe, expect, it, vi } from 'vitest'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx index b21c1997301..f157c32c5c9 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx @@ -87,6 +87,7 @@ vi.mock('./StudioAiCopilot', () => ({ // The source loads `@objectstack/lint` lazily; paid here, at collection, not // inside a case's clock (check:test-source-alias). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { t } from '../metadata-admin/i18n'; import { registerMetadataPreview } from '../metadata-admin/preview-registry'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx index dfccec0921a..759e14dfd20 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx @@ -79,6 +79,7 @@ vi.mock('../../preview/DraftChangesPanel', () => ({ import { toast } from 'sonner'; import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx index 1d491d0fbdf..d7293a506f3 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.servedDraftTakenAsIs-10765.test.tsx @@ -116,6 +116,7 @@ import { registerMetadataPreview, getMetadataPreview } from '../metadata-admin/p // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx index 0164b8d3316..8a74174f7de 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.sharedSelect-11865.test.tsx @@ -36,6 +36,7 @@ // Warmed at module top so the first load of the console's lazily loaded // authoring code is paid during collection, not inside a test's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -168,7 +169,7 @@ async function openNewObject(): Promise { server.rows = []; render( - {}} packageId={OBJECT_PKG} inPair={false} locale="en" onCreated={() => {}} /> + {}} packageId={OBJECT_PKG} inPair={false} locale="en-US" onCreated={() => {}} /> , ); return await screen.findByTestId('create-object-owd'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx index 1ae8246061c..ad3302aff3d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.twoHolders-28584.test.tsx @@ -125,6 +125,7 @@ import { createEmptyDataSource, failOnAbsorbedFetchError } from './__tests__/emp // The source under test reaches dynamic imports of `@objectstack/lint`; their first // load is paid here, at collection, never inside a case's clock (`check:test-source-alias`). import '@objectstack/lint'; +import '@object-ui/plugin-detail'; const dataSource = createEmptyDataSource(); failOnAbsorbedFetchError(); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx index 86011c509f4..0d50c8bb51f 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioRail.noMatches-26733.test.tsx @@ -69,6 +69,7 @@ vi.mock('./StudioAiCopilot', () => ({ StudioChatDock: () => null })); // The pillars reach `@objectstack/lint` through a dynamic import; paid here, at collection, not in a case's clock. import '@objectstack/lint'; +import '@object-ui/plugin-detail'; import { AccessPillar, AutomationsPillar } from './StudioDesignSurface'; import { StudioRail, StudioRailRow } from './StudioRail'; import { railAbbreviation } from './railAbbreviation'; diff --git a/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts b/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts index a306d9c8b47..dab79c0d847 100644 --- a/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts +++ b/ui/packages/components/src/__tests__/clickableNonControlCensus-13461.test.ts @@ -231,7 +231,6 @@ const NOT_CONTROLS: Array<[file: string, key: string, reason: string]> = [ ['packages/app-shell/src/views/studio-design/AutomationsPillar.tsx', 'div · setRailOpen', SCRIM], ['packages/app-shell/src/views/studio-design/DataPillar.tsx', 'div · clearFieldSelOnEmpty', CANVAS], ['packages/app-shell/src/views/studio-design/DataPillar.tsx', 'div · clearFieldSelOnEmpty', CANVAS], - ['packages/app-shell/src/views/studio-design/DataPillar.tsx', 'div · setRailOpen', SCRIM], ['packages/app-shell/src/views/studio-design/StudioRightSlot.tsx', 'div · onOverlayDismiss', SCRIM], ['packages/components/src/renderers/complex/data-table.tsx', 'div · stopPropagation', DRAG], ['packages/plugin-dashboard/src/DashboardRenderer.tsx', 'div · handleBackgroundClick', CANVAS], From a9e7bb7213034452084e7055753ba0cfdf055c1c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 03:18:27 +0000 Subject: [PATCH 15/18] fix(studio): rework round on the object designer's address The L1 review's M1 and S2-S8 with the nits: - the unsaved-edit guard (saveBar.dirty) is pinned on the designer's x and next, on the real surface; - a Changes-sheet object request opens in the package holding the draft (draftScope); - the history address and ?tab= open their tabs, the partly refused discard keeps its message, and the copilot reads the item off the designer's address, each pinned; - the zone's designer-page helper (AREA_DESIGNER_PAGE_TYPES, areaItemOpensDesignerPage, areaDesignerItemOf) replaces the object-only helpers; - an address naming no object says it was not found (found on the browser walk); - README, changeset and stale comments in user terms; two dropped controls carried over. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QSeKYoFqGdRM9Qmg7M2o2B --- .../36904-object-designer-fullscreen.md | 10 +- ui/packages/app-shell/README.md | 10 +- .../app-shell/src/layout/SidebarItemMenu.tsx | 3 +- ...ListCreateDialog.pairCreate-36897.test.tsx | 12 ++ ...taPillar.copilotChangesLine-34725.test.tsx | 15 ++- ...ataPillar.draftOnlyNoLayers-12508.test.tsx | 26 ++++ .../DataPillar.flatTabs-12450.test.tsx | 38 +++++- .../src/views/studio-design/DataPillar.tsx | 24 +++- .../views/studio-design/StudioAiCopilot.tsx | 24 ++-- ...esignSurface.heldDataCreate-26845.test.tsx | 45 ++++++- ...DesignSurface.heldDataLeave-26705.test.tsx | 114 +++++++++++++++++- .../studio-design/StudioDesignSurface.tsx | 11 +- .../StudioMetadataArea.routes-28561.test.tsx | 9 ++ .../studio-design/StudioMetadataArea.tsx | 7 +- .../__tests__/studioSurfaceContext.test.tsx | 28 +++++ .../studioSurfaceLabel-8219.test.tsx | 21 ++++ .../views/studio-design/metadataArea.test.ts | 37 ++++-- .../src/views/studio-design/metadataArea.ts | 76 +++++++----- .../views/studio-design/studioAddressTable.ts | 4 +- .../studio-design/studioInterfacesRetired.ts | 3 +- 20 files changed, 435 insertions(+), 82 deletions(-) diff --git a/.changeset/36904-object-designer-fullscreen.md b/.changeset/36904-object-designer-fullscreen.md index 5b86ab9d72f..3c0e22b895d 100644 --- a/.changeset/36904-object-designer-fullscreen.md +++ b/.changeset/36904-object-designer-fullscreen.md @@ -2,14 +2,14 @@ '@object-ui/app-shell': patch --- -feat(studio): the object designer opens full-screen on the object's metadata address +feat(studio): an object opens its designer full-screen, on its own address Clause-②: no Metadata-protocol: none Studio redesign (epic #36890), the object designer's card (#36904); it also delivers #36513's tab order. -- **One object, one address.** An object opens its designer full-screen at `/studio//metadata/object/`, under the item header every Studio item page uses: × back to the object list (its filter and sort kept), ‹ › through the list, Esc to close. The designer has no object list of its own and no 「新建」: the object list is the area's, and its 「新建」 creates an object (organization-wide default, the app-menu join, a read-only base's `.custom` pair). -- **Tabs in #36513's order.** Records, Field layout, Validations, Actions, Settings, Hooks, API; on a narrower column Hooks and API fold into "Advanced" first, then the other three. The item tools are tabs after them (References, History with the audit log, Source with the layered comparison), in place of the header's five icons. The open tab is in the address (`?tab=`), so a refresh, a shared link and ‹ › keep it. -- **The old addresses redirect.** `/studio//data?surface=object:` opens that object's designer (`?action=` kept, `?view=` and `?nav=` dropped); `/studio//data` with no object, Studio's old home, opens the package's object list, `?changes=review` kept. The app's 「对象设置」, the record page's 「配置页面」, ⌘K, the AI artifact link and the switched-off action link open the new address; a switched-off action is `?action=` on it. -- **Fixed on the way:** an AI-drafts discard that the server partly refused now keeps its message on the page; the object re-read the discard triggers used to clear it at once. +- **One object, one page.** Opening an object in Studio opens its designer full-screen beside the left menu, with its own address you can bookmark or share. × goes back to the object list with its filter and sort as you left them, ‹ › open the previous and next object in that list, and Esc closes. The designer no longer has its own column of objects or its own 「新建」 button: you pick another object from the list, and you create one with the object list's 「新建」, which keeps the organization-wide default sharing choice, the option to add the object to the app's menu, and, on a read-only package, the save into its customization package. +- **Tabs in a fixed order.** Records, Field layout, Validations, Actions, Settings, Hooks, API; when the page is narrow, Hooks and API fold into "Advanced" first, then Validations, Actions and Settings. References, History (with the audit log) and Source (with the layer comparison) are now tabs after them, in place of the five header icons. The tab you are on is part of the page's address, so refreshing, sharing the link or moving to the next object keeps it. +- **Old links still work.** A bookmark or link to an object in Studio's old Data screen opens that object's designer; a link to the Data screen itself opens the package's object list, and the review link for unpublished changes still opens that review. The app's 「对象设置」, the record page's 「配置页面」, the command palette, links in AI replies and the link to a switched-off action all open the new page. +- **Fixed on the way:** when discarding the AI's unpublished changes partly fails, the message saying which items could not be discarded now stays on the page instead of disappearing at once. A link to an object that does not exist (a deleted object's bookmark, a mistyped link) now says the object was not found, instead of offering it as a new object to design. diff --git a/ui/packages/app-shell/README.md b/ui/packages/app-shell/README.md index b24a2b4849e..0c21b3fad82 100644 --- a/ui/packages/app-shell/README.md +++ b/ui/packages/app-shell/README.md @@ -635,10 +635,12 @@ dashboard, page, or report — it opens that item's page in Studio's "All metadata" area (`/studio/:packageId/metadata//`), where it is read and edited as metadata; interfaces themselves are designed in the running app, since objectstack#36502 retired Studio's Interfaces pillar. On an object route -it opens that object in the Data pillar -(`/studio/:packageId/data?surface=object:`), and at the app root the -package's Data tab (`/studio/:packageId/data`). An old -`/studio/:packageId/interfaces` link lands on the Data tab with a one-line +it opens that object's designer full-screen on its own address +(`/studio/:packageId/metadata/object/`, objectstack#36904), and at the +app root the package's Studio home, which lands on the package's object list +(`/studio/:packageId/metadata/object`; the retired Data pillar's +`/studio/:packageId/data` redirects there). An old +`/studio/:packageId/interfaces` link lands on the object list with a one-line notice that interface editing moved into the app. The route-type → surface-type decision lives in `appStudioRoutePath`. It is the reverse of the builder's "Open app" bridge (ADR-0080): the entry only renders diff --git a/ui/packages/app-shell/src/layout/SidebarItemMenu.tsx b/ui/packages/app-shell/src/layout/SidebarItemMenu.tsx index 72f7509e57f..990c82ceb5a 100644 --- a/ui/packages/app-shell/src/layout/SidebarItemMenu.tsx +++ b/ui/packages/app-shell/src/layout/SidebarItemMenu.tsx @@ -55,7 +55,8 @@ import { confirmUnsavedLeave } from '../chrome/unsavedEdits.js'; /** * Where Object settings takes an object of `app` (objectstack#36487): the - * object in Studio's Data surface (`surface=object:NAME`), through the + * object's designer in Studio, full-screen on its own address + * (`/studio/PKG/metadata/object/NAME`, objectstack#36904), through the * derivation the app bar's Studio entry reads on the object's list, * `appStudioObjectPath` (objectui#12520). `null` when the app has no owning * package Studio can open, or names no object, so the entry hides as the app diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx index d91716a72ed..92a0ee23aa1 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx @@ -44,6 +44,7 @@ vi.mock('../studio-design/packages-io.js', async (importOriginal) => ({ fetchPackages: async () => [ { id: 'com.vendor.hr', namespace: 'hr' }, { id: 'com.example.crm', namespace: 'crm' }, + { id: 'com.example.bare', namespace: null }, ], })); const publish = vi.fn(async () => ({ ok: true })); @@ -164,6 +165,17 @@ describe('list 「新建」 for an object: the create the object designer no lon expect(save.mock.calls[0]?.[1]).toBe('crm_repair_ticket'); }); + // CONTROL: a package that declares no namespace previews, and saves, the bare identifier. + it('previews the bare identifier when the package has no namespace, and saves exactly that', async () => { + const onCreated = open('object', 'com.example.bare', false); + fireEvent.change(screen.getByLabelText(t('engine.studio.data.nameLabel', L)), { target: { value: 'Repair Ticket' } }); + await waitFor(() => expect(screen.getByTestId('create-item-stored-name')).toHaveTextContent('repair_ticket')); + expect(screen.getByTestId('create-item-stored-name').textContent).not.toMatch(/_repair_ticket/); + fireEvent.click(screen.getByRole('button', { name: t('engine.studio.createLive', L) })); + await waitFor(() => expect(onCreated).toHaveBeenCalledWith({ name: 'repair_ticket', packageId: 'com.example.bare' })); + expect(save.mock.calls[0]?.[1]).toBe('repair_ticket'); + }); + it('a taken identifier is refused and nothing is written (objectstack#26917)', async () => { taken.mockResolvedValueOnce({ name: 'crm_visit', label: 'Visit' }); const onCreated = open('object', 'com.example.crm', false); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx index 0f7dbd083f6..7411f49e437 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.copilotChangesLine-34725.test.tsx @@ -20,7 +20,7 @@ import '@testing-library/jest-dom/vitest'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; -import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; +import { act, cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; const objectDef = { @@ -172,8 +172,17 @@ describe('the AI assistant’s drafts on the Data canvas (objectstack#34725)', ( const original = window.confirm; window.confirm = vi.fn(() => true); renderPillar(); - fireEvent.click(await screen.findByTestId('studio-copilot-changes-discard')); - const message = await screen.findByTestId('studio-refusal-message'); + const discard = await screen.findByTestId('studio-copilot-changes-discard'); + const reads = mockClient.getDraft.mock.calls.length; + fireEvent.click(discard); + // objectstack#36904 — the discard re-reads the object, and a load clears the + // pillar's error as it starts: the refusal must outlive that read, not + // flash for one render before it. + await waitFor(() => expect(mockClient.getDraft.mock.calls.length).toBeGreaterThan(reads)); + await act(async () => { + await new Promise((r) => setTimeout(r, 200)); + }); + const message = screen.getByTestId('studio-refusal-message'); expect(message).toHaveTextContent( tFormat('engine.studio.copilotChanges.discardFailed', 'en-US', { items: ['Task', 'showcase_task_grid'].join(L('engine.studio.copilotChanges.itemSeparator')), diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx index b1c53712ad6..4cd7d9e152e 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.draftOnlyNoLayers-12508.test.tsx @@ -101,6 +101,7 @@ import '@object-ui/plugin-detail'; import { DataPillar } from './StudioDesignSurface'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; +import { t } from '../metadata-admin/i18n'; const dataSource = createEmptyDataSource(); registerBuiltinInspectors(); @@ -144,10 +145,24 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 expect(server.requests.filter((r) => r.status >= 400)).toEqual([]); // objectstack#36904 — the header reads the label the draft declares, not the name. expect((await screen.findAllByTestId('studio-detail-title'))[0]).toHaveTextContent('Ticket'); + expect(screen.queryByTestId('data-object-not-found')).toBeNull(); fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); expect(await screen.findByText('Subject')).toBeInTheDocument(); }); + // CONTROL (objectui#11843): a draft-only object that declares no label is titled by its name. + it('CONTROL: a draft-only object with no label is titled by its name', async () => { + const { label: _label, ...unlabelled } = ticket; + server.drafts.set('st_ticket', unlabelled); + server.draftHeaders = ['st_ticket']; + await openPillar('st_ticket'); + + expect(reads('st_ticket', '')).toEqual([200]); + const title = (await screen.findAllByTestId('studio-detail-title'))[0]; + expect(title).toHaveTextContent('st_ticket'); + expect(title).not.toHaveTextContent('Ticket'); + }); + it('CONTROL: a name the drafts list holds but whose draft is no longer served still reads its /layers', async () => { server.draftHeaders = ['st_ticket']; await openPillar('st_ticket'); @@ -156,6 +171,17 @@ describe('DataPillar — a draft-only object logs no failed read (objectui#12508 expect(reads('st_ticket', '/layers')).toEqual([404]); }); + // objectstack#36904 — the address can name an object that is not there. + it('an address naming no object, published or drafted, says it was not found', async () => { + server.published = [kase]; + await openPillar('st_gone'); + + expect(reads('st_gone', '/layers')).toEqual([404]); + expect(await screen.findByTestId('data-object-not-found')).toHaveTextContent('st_gone'); + // Not offered as a new object to design. + expect(screen.queryByText(t('engine.studio.data.draftObjectTitle', 'en'))).toBeNull(); + }); + it('CONTROL: a published object still reads its layers', async () => { server.published = [kase]; await openPillar('st_case'); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx index 0579664a980..3b4dbd5e6b5 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.flatTabs-12450.test.tsx @@ -64,6 +64,7 @@ vi.mock('@object-ui/plugin-view', async (importOriginal) => { vi.mock('./ObjectValidationsPanel', () => ({ ObjectValidationsPanel: () =>
})); vi.mock('./ObjectSettingsPanel', () => ({ ObjectSettingsPanel: () =>
})); +vi.mock('./ObjectHooksPanel', () => ({ ObjectHooksPanel: () =>
})); import { DataPillar } from './StudioDesignSurface'; import { SurfaceDeepLinkProvider } from './surfaceDeepLinkChannel'; @@ -98,16 +99,17 @@ function Where() { } const tabInAddress = () => new URLSearchParams(screen.getByTestId('where').textContent ?? '').get('tab'); -async function renderPillar(props: { readOnly?: boolean } = {}) { +async function renderPillar(props: { readOnly?: boolean; query?: string } = {}) { render( - + , ); - await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); + if (props.query) await waitFor(() => expect(screen.getByTestId('data-object-header')).toBeInTheDocument(), { timeout: 8000 }); + else await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); } /** The header's tab row: the `nav` the item header draws its tabs into. */ @@ -201,3 +203,33 @@ describe('the object designer’s tab row (objectui#12450, objectstack#36904)', await waitFor(() => expect(tabInAddress()).toBe('settings')); }); }); + +/* + * objectstack#36904 — the address opens the tab it names: a link to the + * designer (and ‹ ›, which carries it) lands on that tab, not on Records. + */ +describe('the object designer opens on the tab its address names (objectstack#36904)', () => { + it('`?tab=hooks` opens Hooks, its flat tab and the folded trigger pressed', async () => { + await renderPillar({ query: '?tab=hooks' }); + await waitFor(() => expect(screen.getByTestId('hooks-panel')).toBeInTheDocument(), { timeout: 8000 }); + expect(screen.queryByTestId('records-panel')).toBeNull(); + expect(screen.getByTestId('data-tab-flat-hooks')).toHaveAttribute('aria-pressed', 'true'); + expect(screen.getByTestId('data-tabs-advanced-first')).toHaveAttribute('aria-pressed', 'true'); + expect(tabInAddress()).toBe('hooks'); + }); + + it('`?tab=history` opens the History tool tab', async () => { + await renderPillar({ query: '?tab=history' }); + await waitFor(() => expect(screen.getByTestId('item-tab-panel-history')).toBeInTheDocument(), { timeout: 8000 }); + expect(screen.queryByTestId('records-panel')).toBeNull(); + expect(within(tabRow()).getByTestId('item-tab-history')).toHaveAttribute('aria-pressed', 'true'); + expect(tabInAddress()).toBe('history'); + }); + + // CONTROL: a value that names no tab opens Records. + it('`?tab=nonsense` opens Records', async () => { + await renderPillar({ query: '?tab=nonsense' }); + await waitFor(() => expect(screen.getByTestId('records-panel')).toBeInTheDocument(), { timeout: 8000 }); + expect(screen.queryByTestId('hooks-panel')).toBeNull(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx index e43b768d282..45b057d9acc 100644 --- a/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx +++ b/ui/packages/app-shell/src/views/studio-design/DataPillar.tsx @@ -327,8 +327,9 @@ export function DataPillar({ return idx; }, [metaTypes]); // objectstack#36904 — the object is the address's: its label, icon and - // colour are the loaded object's (the label the app shows, a draft-only - // object's own), its machine name until it has loaded. + // colour are the loaded object's as it is being edited (its draft when it + // has one, a draft-only object's included, else as served; set where the + // object loads), its machine name until it has loaded. const [served, setServed] = React.useState<{ label?: string; icon?: string; color?: string }>({}); const current = React.useMemo( () => ({ type: 'object', name: objectName, label: served.label || objectName, icon: served.icon, color: served.color }), @@ -836,8 +837,9 @@ export function DataPillar({ setObjVerdict(editedItemDiagnostics({ hasDraft: !!draftBody, draftDiagnostics: draftVerdict, layered: lay })); setObjVerdictBody(draftBody && draftVerdict ? draftBody : lay.effective); setObjDraftFor(`object:${current.name}`); - // objectstack#36904 — the header's label, icon and colour: the object - // as served, a draft-only object's draft (its own label, objectui#11843). + // objectstack#36904 — the header's label, icon and colour: the draft + // when there is one (a draft-only object's own label, objectui#11843), + // else the object as served. const shown = (draftBody ?? baseline) as { label?: I18nLabel; icon?: unknown; color?: unknown }; const next = { label: resolveI18nLabel(shown.label, locale)?.trim() || undefined, @@ -1263,6 +1265,11 @@ export function DataPillar({ // objectui#11272 — the buffer is the open object's own once its load installed it. const objLoaded = current !== null && objDraftFor === `object:${current.name}`; + // objectstack#36904 — the address names the object, so it can name one that + // is not there (a deleted object's bookmark, a mistyped link): loaded with + // neither a stored object nor a draft, it says so rather than offering an + // "unpublished new object" to design. A draft-only object has its draft. + const objMissing = objLoaded && !hasBaseline && !hasDraft; // objectstack#28575 — the ensure door's answer for this base's extension // writes: asked by the first add (no prompt), once per base, and again only @@ -2208,6 +2215,15 @@ export function DataPillar({ {t('engine.studio.loading', locale)}
) + ) : objMissing ? ( +
+ {t('engine.form.objectNotFound', locale)} + {current.name} +
) : viewMode === 'rules' ? ( diff --git a/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx b/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx index f3293cfceca..f6506d39eca 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioAiCopilot.tsx @@ -15,7 +15,7 @@ import { ConversationsSidebar } from '../../console/ai/ConversationsSidebar.js'; import { resolvePublicShareBase } from '../../console/organizations/resolveHomeUrl.js'; import { AiUsageIndicator } from '../../layout/AiUsageIndicator.js'; import { usePlanApprovalPendingCount } from '../../assistant/assistantBus.js'; -import { metadataAddressArtifact } from './metadataArea.js'; +import { STUDIO_METADATA_AREA, areaDesignerItemOf } from './metadataArea.js'; /** * objectui#8219 — the display label of the artifact a pillar has open, tagged @@ -74,23 +74,31 @@ export function StudioCopilotConversation({ // deep-link every pillar already mirrors (useSurfaceDeepLink). Derived per // render; the ChatPane transport reads it per send, so each turn carries // what the user is looking at RIGHT NOW. - const { tab } = useParams<{ tab?: string }>(); + const { tab, packageId: segment } = useParams<{ tab?: string; packageId?: string }>(); const copilotLocation = useLocation(); const surfaceContext = React.useMemo(() => { const raw = new URLSearchParams(copilotLocation.search).get('surface'); let artifact: { type: string; name: string } | undefined; + let pillar = tab; if (raw) { const idx = raw.indexOf(':'); if (idx > 0 && idx < raw.length - 1) { artifact = { type: raw.slice(0, idx), name: raw.slice(idx + 1) }; } } - // objectstack#36904 — an item open on its metadata address (the object - // designer, full-screen) is named by the path itself, not a `?surface=`. - if (!artifact) artifact = metadataAddressArtifact(copilotLocation.pathname); - if (!tab && !artifact) return undefined; - return { ...(tab ? { pillar: tab } : {}), ...(artifact ? { artifact } : {}) }; - }, [tab, copilotLocation.search, copilotLocation.pathname]); + // objectstack#36904, objectstack#36905 — a designer that opens full-screen + // at its metadata address (the object designer) carries its item in the + // path, under the area's segment, not in a `?surface=`. + if (!tab && !artifact) { + const item = areaDesignerItemOf(copilotLocation.pathname, segment); + if (item) { + artifact = item; + pillar = STUDIO_METADATA_AREA; + } + } + if (!pillar && !artifact) return undefined; + return { ...(pillar ? { pillar } : {}), ...(artifact ? { artifact } : {}) }; + }, [tab, segment, copilotLocation.pathname, copilotLocation.search]); // objectui#8219 — the chip's display label, read beside the context rather // than inside it. Shown only when it labels the artifact the URL names: the // URL stays the single source of WHAT is discussed, so a label that lags or diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx index 280e0a9585c..2fa013329a4 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataCreate-26845.test.tsx @@ -20,7 +20,7 @@ import '@testing-library/jest-dom/vitest'; import * as React from 'react'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; -import { render, screen, fireEvent, cleanup, waitFor, within } from '@testing-library/react'; +import { render, screen, fireEvent, cleanup, waitFor, within, act } from '@testing-library/react'; import { MemoryRouter, Route, Routes } from 'react-router-dom'; const PKG = 'com.acme.app'; @@ -50,11 +50,26 @@ vi.mock('../metadata-admin/useMetadata', async (importOriginal) => { return { ...mod, useMetadataClient: () => mockClient, useMetadataTypes: () => ({ entries: [] }) }; }); +const PAIR = `${PKG}.custom`; +/** objectstack#36904 — while set, the package is a read-only base whose `.custom` pair is listed. */ +const pkgs = vi.hoisted(() => ({ readOnlyBase: false })); + vi.mock('./packages-io', async (importOriginal) => { const mod = await importOriginal(); return { ...mod, - fetchPackages: vi.fn(async () => [{ id: 'com.acme.app', name: 'Acme', writable: true, namespace: 'acme' }]), + fetchPackages: vi.fn(async () => [{ id: 'com.acme.app', name: 'Acme', writable: !pkgs.readOnlyBase, namespace: 'acme' }]), + fetchListedPackageManifests: vi.fn( + async () => + new Map( + pkgs.readOnlyBase + ? [ + ['com.acme.app', { name: 'Acme', writable: false, manifest: { version: '1.0.0' } }], + ['com.acme.app.custom', { name: 'Acme (custom)', writable: true, manifest: {} }], + ] + : [], + ), + ), }; }); @@ -92,6 +107,7 @@ vi.mock('../../preview/DraftChangesPanel', async () => { import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; +import { fetchListedPackageManifests } from './packages-io'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; @@ -138,6 +154,7 @@ beforeEach(() => { overlayScope: null, effective: type === 'object' && OBJECTS[name] ? JSON.parse(JSON.stringify(OBJECTS[name])) : null, })); + pkgs.readOnlyBase = false; confirmSpy = vi.fn(); window.confirm = confirmSpy as unknown as typeof window.confirm; }); @@ -165,6 +182,8 @@ async function openTask(): Promise { render( + {/* objectstack#36904 — the pair's own object address (the request's landing on a read-only base). */} + } /> } /> } /> @@ -219,3 +238,25 @@ describe('a held Data field guards Pending changes (objectstack#26845)', () => { expect(confirmSpy).not.toHaveBeenCalled(); }); }); + +/* + * objectstack#36904 — on a read-only base the Pending changes sheet reviews + * the `.custom` pair's drafts (`draftScope`), so an object it names opens on + * the pair's address, where an object the pair adds resolves; the base's + * address does not name it. + */ +describe('a Pending changes request on a read-only base opens the pair\'s address (objectstack#36904)', () => { + it('the request for another object lands on /studio/PAIR/metadata/object/NAME', async () => { + pkgs.readOnlyBase = true; + await openTask(); + // The pair is read off the package list after the entries read settles. + await waitFor(() => expect(fetchListedPackageManifests).toHaveBeenCalled()); + await act(async () => { + await new Promise((r) => setTimeout(r, 50)); + }); + + pendingRequest('acme_note'); + await screen.findByTestId('pair-landed', undefined, { timeout: 8000 }); + expect(confirmSpy).not.toHaveBeenCalled(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx index d7cc9148ee0..39194980702 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.heldDataLeave-26705.test.tsx @@ -78,6 +78,7 @@ import '@objectstack/lint'; import '@object-ui/plugin-detail'; import { StudioDesignSurface } from './StudioDesignSurface'; import { addFieldFromFormToolbar } from './__tests__/dataPillarAddField'; +import { pressStudioSave } from './__tests__/studioSaveHarness'; import { createEmptyDataSource } from './__tests__/emptyDataSource'; import { registerBuiltinInspectors } from '../metadata-admin/inspectors'; import { t } from '../metadata-admin/i18n'; @@ -123,6 +124,7 @@ beforeEach(() => { overlayScope: null, effective: type === 'object' && OBJECTS[name] ? JSON.parse(JSON.stringify(OBJECTS[name])) : null, })); + mockClient.save.mockImplementation(async () => ({ success: true })); confirmSpy = vi.fn(); window.confirm = confirmSpy as unknown as typeof window.confirm; }); @@ -141,11 +143,11 @@ async function openObjectIs(name: string): Promise { ); } -async function openTask(): Promise { +async function openTask(name = 'acme_task'): Promise { // The shell's link guard reads the window's URL to skip a link to the page // already shown; `BrowserRouter` keeps the two equal, so this does too. // objectstack#36904 — the object designer is the object's address. - const at = `/studio/${PKG}/metadata/object/acme_task?package=${PKG}`; + const at = `/studio/${PKG}/metadata/object/${name}?package=${PKG}`; window.history.replaceState(null, '', at); render( @@ -157,7 +159,7 @@ async function openTask(): Promise { , ); - await openObjectIs('acme_task'); + await openObjectIs(name); } /** The card's repro: add a Picklist "Priority" with no option yet; the autosave holds it. */ @@ -234,3 +236,109 @@ describe('a held Data field guards every departure (objectstack#26705)', () => { expect(confirmSpy).not.toHaveBeenCalled(); }); }); + +/* + * objectstack#27511, objectstack#36511 — an edit the top bar's Save has not + * sent, or whose Save was refused, is unsaved work too (`saveBar.dirty` in the + * surface's `unsavedPillarWork`): the designer's departures ask before they + * drop it, and a saved edit leaves nothing to ask about. objectstack#36904 — + * the rail's object switch these cases pinned is the designer's › (the next + * object, by name with no list context: Note, then Task) and its ×. + */ +describe('an unsaved Data edit guards the designer\'s × and › (objectstack#27511, objectstack#36511)', () => { + const next = () => fireEvent.click(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-detail-next')[0]); + const nextReady = () => + waitFor(() => expect(within(screen.getByTestId('data-object-header')).getAllByTestId('studio-detail-next')[0]).toBeEnabled(), { + timeout: 8000, + }); + /** A Text field: complete as added, so nothing is held; it waits for Save. */ + async function addUnsavedField(): Promise { + fireEvent.click(await screen.findByRole('button', { name: 'Field layout' })); + await addFieldFromFormToolbar(); + await screen.findByTestId('studio-save', undefined, { timeout: 8000 }); + expect(screen.queryByTestId('studio-held')).toBeNull(); + } + + it('› over an unsaved edit asks and sends nothing; declined, the edit stays; agreed, Task opens', async () => { + await openTask('acme_note'); + await nextReady(); + await addUnsavedField(); + + confirmSpy.mockReturnValueOnce(false); + next(); + expect(confirmSpy).toHaveBeenCalledTimes(1); + expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); + await openObjectIs('acme_note'); + expect(screen.getByTestId('studio-save')).toBeInTheDocument(); + expect(reloadAsks()).toBe(true); + + confirmSpy.mockReturnValueOnce(true); + next(); + expect(confirmSpy).toHaveBeenCalledTimes(2); + await openObjectIs('acme_task'); + expect(mockClient.save).not.toHaveBeenCalled(); + }); + + it('× over an unsaved edit asks; Cancel keeps it, OK leaves for the list', async () => { + await openTask('acme_note'); + await addUnsavedField(); + + confirmSpy.mockReturnValueOnce(false); + closeDesigner(); + expect(confirmSpy).toHaveBeenCalledTimes(1); + expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); + await openObjectIs('acme_note'); + + confirmSpy.mockReturnValueOnce(true); + closeDesigner(); + await screen.findByTestId('list-landed'); + expect(mockClient.save).not.toHaveBeenCalled(); + }); + + it('an edit whose Save was refused is not dropped silently: › asks, and a declined ask keeps it', async () => { + mockClient.save.mockImplementation(async () => { + throw Object.assign(new Error('The server refused this draft.'), { status: 500 }); + }); + await openTask('acme_note'); + await nextReady(); + await addUnsavedField(); + await pressStudioSave(); + expect(mockClient.save).toHaveBeenCalledTimes(1); + + confirmSpy.mockReturnValueOnce(false); + next(); + expect(confirmSpy).toHaveBeenCalledTimes(1); + expect(confirmSpy).toHaveBeenCalledWith(LEAVE_QUESTION); + await openObjectIs('acme_note'); + expect(reloadAsks()).toBe(true); + + confirmSpy.mockReturnValueOnce(true); + next(); + await openObjectIs('acme_task'); + expect(mockClient.save).toHaveBeenCalledTimes(1); + }); + + // CONTROL: a saved edit is the stored object; nothing is left to ask about. + it('a saved edit leaves at once: › opens Task with no question', async () => { + await openTask('acme_note'); + await nextReady(); + await addUnsavedField(); + await pressStudioSave(); + expect(mockClient.save).toHaveBeenCalledTimes(1); + await waitFor(() => expect(reloadAsks()).toBe(false), { timeout: 8000 }); + + next(); + await openObjectIs('acme_task'); + expect(confirmSpy).not.toHaveBeenCalled(); + }); + + // CONTROL: nothing pending, nothing asked, nothing sent. + it('with nothing pending, › opens Task at once and sends nothing', async () => { + await openTask('acme_note'); + await nextReady(); + next(); + await openObjectIs('acme_task'); + expect(confirmSpy).not.toHaveBeenCalled(); + expect(mockClient.save).not.toHaveBeenCalled(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx index e139c72e254..07a259af6df 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx @@ -1226,9 +1226,12 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re const currentPathname = useLocation().pathname; const requestSurface = React.useCallback( (target: SurfaceTarget): boolean | void => { - // objectstack#36904 — an object is its designer's own address. - if (target.type === 'object' && packageId !== null) { - const to = studioItemPath(packageId, 'object', target.name); + // objectstack#36904 — an object is its designer's own address, in the + // package that holds the draft the sheet names (`draftScope`): on a + // read-only base, the `.custom` pair, where an object the pair adds + // resolves and the base's address does not. + if (target.type === 'object' && draftScope !== null) { + const to = studioItemPath(draftScope, 'object', target.name); if (to !== currentPathname) { if (!confirmLeavePillar()) return false; shellNavigate(to); @@ -1246,7 +1249,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re } setChangesOpen(false); }, - [tab, allScope, packageId, scopeSegment, confirmLeavePillar, shellNavigate, currentPathname], + [tab, allScope, packageId, draftScope, scopeSegment, confirmLeavePillar, shellNavigate, currentPathname], ); // objectstack#36899 — a menu entry that re-enters the open pillar on another // `?surface=` (the default sharing overview, on the Access pillar) opens the diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx index 3f59880a988..b44c5be934e 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.routes-28561.test.tsx @@ -313,6 +313,15 @@ describe('a pillar type opened from the area opens its pillar', () => { expect(new URL(where(), 'http://x').pathname).toBe(`/studio/${WRITABLE}/metadata/object/item_1`); }); + // objectstack#36904 — the object's old history address is its designer's History tab. + it("an object's history address opens its designer on the History tab, the query kept", async () => { + mount(`/studio/${WRITABLE}/metadata/object/item_1/history?package=${WRITABLE}`); + const designer = await screen.findByTestId('object-designer'); + expect(designer).toHaveAttribute('data-object', 'item_1'); + expect(where()).toBe(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}&tab=history`); + expect(screen.queryByTestId('area-page')).toBeNull(); + }); + it('CONTROL: an object under `?review=1` keeps the generic page and its draft review', async () => { mount(`/studio/${WRITABLE}/metadata/object/item_1?package=${WRITABLE}&review=1`); expect((await page()).page).toBe('item'); diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx index fa58e4c761e..035e82a3f6d 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMetadataArea.tsx @@ -46,8 +46,9 @@ import { t, useMetadataLocale } from '../metadata-admin/i18n.js'; import { fetchListedPackageManifests } from './packages-io.js'; import { STUDIO_ALL_PACKAGES_SEGMENT, + areaItemAsksGenericPage, + areaItemOpensDesignerPage, areaItemOpensFormEditor, - areaItemOpensObjectDesigner, areaItemPillarPath, areaLocationRedirect, studioMetadataAreaPath, @@ -143,7 +144,7 @@ interface AreaEditorProps { /** * `/:type/:name`: a pillar type opens its pillar, an object the object - * designer (`areaItemOpensObjectDesigner`), an email template or a + * designer (`areaItemOpensDesignerPage`), an email template or a * translation the form editor (`areaItemOpensFormEditor`), every other type * the generic item page (`areaItemPillarPath` lists when). * @@ -174,7 +175,7 @@ function AreaItemOpen({ const host = useMetadataAreaHost(); const [opens] = React.useState(() => { const at = { packageId: host?.packageId ?? null, type, search }; - if (areaItemOpensObjectDesigner(at)) return { designer: true, formEditor: false, pillarPath: null }; + if (areaItemOpensDesignerPage(at) && !areaItemAsksGenericPage(search)) return { designer: true, formEditor: false, pillarPath: null }; if (areaItemOpensFormEditor({ ...at, readOnly: host?.readOnly === true })) return { designer: false, formEditor: true, pillarPath: null }; return { designer: false, formEditor: false, pillarPath: areaItemPillarPath({ ...at, name }) }; }); diff --git a/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceContext.test.tsx b/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceContext.test.tsx index 90402abdd74..ec7f5e630e6 100644 --- a/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceContext.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceContext.test.tsx @@ -136,6 +136,8 @@ function renderAt(url: string) { render( + {/* objectstack#36904 — the area's routes carry no :tab; a designer page names its item in the path. */} + } /> } @@ -172,3 +174,29 @@ describe('Studio copilot surfaceContext (cloud#1610 send half)', () => { expect(capturedProps.surfaceContext).toEqual({ pillar: 'access' }); }); }); + +/* + * objectstack#36904 — the object designer opens full-screen on the object's + * metadata address, which carries no `?surface=`: the copilot reads the item + * off the path (`areaDesignerItemOf`), under the area's segment. + */ +describe('Studio copilot surfaceContext on a designer\'s metadata address (objectstack#36904)', () => { + it('the object designer\'s address names the area and the object', () => { + renderAt('/studio/app.k9/metadata/object/k9_task?tab=fields'); + expect(capturedProps.surfaceContext).toEqual({ pillar: 'metadata', artifact: { type: 'object', name: 'k9_task' } }); + }); + + it('its history address names the same object, decoded', () => { + renderAt('/studio/app.k9/metadata/object/k9%20task/history'); + expect(capturedProps.surfaceContext).toEqual({ pillar: 'metadata', artifact: { type: 'object', name: 'k9 task' } }); + }); + + // CONTROLS: the create page, a list and a type with no designer page name no item. + it('the create page, the object list and a generic item page name nothing', () => { + for (const url of ['/studio/app.k9/metadata/object/new', '/studio/app.k9/metadata/object', '/studio/app.k9/metadata/dashboard/sales']) { + cleanup(); + renderAt(url); + expect(capturedProps.surfaceContext, url).toBeUndefined(); + } + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceLabel-8219.test.tsx b/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceLabel-8219.test.tsx index 81b28554b32..11cc5e8ca09 100644 --- a/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceLabel-8219.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/__tests__/studioSurfaceLabel-8219.test.tsx @@ -116,6 +116,8 @@ function renderAt(url: string, surfaceLabel?: { type: string; name: string; labe render( + {/* objectstack#36904 — the area's routes: a designer page names its item in the path. */} + } /> } @@ -155,3 +157,22 @@ describe('Studio copilot display label (objectui#8219 item 3)', () => { expect(capturedProps.surfaceArtifactLabel).toBeUndefined(); }); }); + +/* + * objectstack#36904 — the object designer on its metadata address reports its + * label as the pillar did; the chip shows it when it labels the object the + * path names, and only then. + */ +describe('Studio copilot display label on a designer\'s metadata address (objectstack#36904)', () => { + const TASK = { type: 'object', name: 'k9_task', label: '任务' }; + + it('a label for the object the address names reaches the pane', () => { + renderAt('/studio/app.k9/metadata/object/k9_task', TASK); + expect(capturedProps.surfaceArtifactLabel).toBe('任务'); + }); + + it('a label for another object than the address names is not shown', () => { + renderAt('/studio/app.k9/metadata/object/k9_note', TASK); + expect(capturedProps.surfaceArtifactLabel).toBeUndefined(); + }); +}); diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts index e05647be10c..6d55dca1df0 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.test.ts @@ -11,15 +11,17 @@ import { describe, it, expect } from 'vitest'; import { + AREA_DESIGNER_PAGE_TYPES, AREA_PILLAR_FOR_TYPE, STUDIO_ALL_PACKAGES_SEGMENT, + areaDesignerItemOf, + areaItemAsksGenericPage, + areaItemOpensDesignerPage, areaItemOpensFormEditor, - areaItemOpensObjectDesigner, areaItemPillarPath, areaLocationRedirect, dataPillarRedirect, isStudioAllPackagesScope, - metadataAddressArtifact, studioMetadataAreaPath, } from './metadataArea'; import { STUDIO_ORG_SCOPE_SEGMENT } from './studioScope'; @@ -168,9 +170,10 @@ describe('areaItemOpensFormEditor — a read-only package’s dataset opens its describe('the object designer on its address, and the retired Data pillar (objectstack#36904)', () => { const at = (q = '', packageId: string | null = PKG, type = 'object') => - areaItemOpensObjectDesigner({ packageId, type, search: new URLSearchParams(q) }); + areaItemOpensDesignerPage({ packageId, type }) && !areaItemAsksGenericPage(new URLSearchParams(q)); it("an object opens its designer on a package's leg", () => { + expect(AREA_DESIGNER_PAGE_TYPES).toContain('object'); expect(at()).toBe(true); expect(at('package=' + PKG + '&tab=hooks')).toBe(true); }); @@ -199,15 +202,25 @@ describe('the object designer on its address, and the retired Data pillar (objec }); }); -describe('metadataAddressArtifact — the item an address names, for the copilot (objectstack#36904)', () => { - it('names the item of an item address, its history page included', () => { - expect(metadataAddressArtifact(`/studio/${PKG}/metadata/object/account`)).toEqual({ type: 'object', name: 'account' }); - expect(metadataAddressArtifact(`/studio/${PKG}/metadata/object/a%2Fb/history`)).toEqual({ type: 'object', name: 'a/b' }); - }); - - it('names nothing on a list, the directory, diagnostics or another page', () => { - for (const path of [`/studio/${PKG}/metadata/object`, `/studio/${PKG}/metadata`, `/studio/${PKG}/metadata/_diagnostics/x`, `/studio/${PKG}/automations`]) { - expect(metadataAddressArtifact(path), path).toBeUndefined(); +describe('areaDesignerItemOf — the item a designer page\'s address names, for the copilot (objectstack#36904)', () => { + it('names the object of its designer address, its history page included', () => { + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/object/account`, PKG)).toEqual({ type: 'object', name: 'account' }); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/object/a%2Fb/history`, PKG)).toEqual({ type: 'object', name: 'a/b' }); + }); + + it('names nothing on the create page, a list, the directory, diagnostics, a generic item or another leg', () => { + for (const path of [ + `/studio/${PKG}/metadata/object/new`, + `/studio/${PKG}/metadata/object`, + `/studio/${PKG}/metadata`, + `/studio/${PKG}/metadata/_diagnostics/x`, + `/studio/${PKG}/metadata/dashboard/sales`, + `/studio/${PKG}/automations`, + ]) { + expect(areaDesignerItemOf(path, PKG), path).toBeNull(); } + const all = `/studio/${STUDIO_ALL_PACKAGES_SEGMENT}/metadata/object/account`; + expect(areaDesignerItemOf(all, STUDIO_ALL_PACKAGES_SEGMENT)).toBeNull(); + expect(areaDesignerItemOf(`/studio/${PKG}/metadata/object/account`, undefined)).toBeNull(); }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts index 388ee6e5e64..c5cf852d860 100644 --- a/ui/packages/app-shell/src/views/studio-design/metadataArea.ts +++ b/ui/packages/app-shell/src/views/studio-design/metadataArea.ts @@ -110,22 +110,60 @@ export function areaItemPillarPath(input: { }): string | null { const pillar = studioItemPillar(input.type); if (!pillar || !input.packageId) return null; - if (input.search.get(CATALOG_SCOPE_PARAM) === ENVIRONMENT_SCOPE) return null; - if (input.search.get(STUDIO_ITEM_REVIEW_PARAM) === STUDIO_ITEM_REVIEW_VALUE) return null; + if (areaItemAsksGenericPage(input.search)) return null; return studioPillarItemPath(input.packageId, pillar, { type: input.type, name: input.name }); } /** - * objectstack#36904 (ADR-0146 D1 as amended) — whether an item of the area - * opens the object designer, full-screen on its own address: an object, on a - * package's leg, under the same exceptions as {@link areaItemPillarPath} (the - * cross-package leg and the environment scope name no package to design in, - * and `?review=1` opens the generic page's draft review). + * The query that asks an item's generic page on a package's leg, whatever its + * type opens otherwise: the environment scope (its catalog item is the + * environment's, by name) and `?review=1` (the draft review the console's + * review links name). */ -export function areaItemOpensObjectDesigner(input: { packageId: string | null; type: string; search: URLSearchParams }): boolean { - if (input.type !== 'object' || !input.packageId) return false; - if (input.search.get(CATALOG_SCOPE_PARAM) === ENVIRONMENT_SCOPE) return false; - return input.search.get(STUDIO_ITEM_REVIEW_PARAM) !== STUDIO_ITEM_REVIEW_VALUE; +export function areaItemAsksGenericPage(search: URLSearchParams): boolean { + return search.get(CATALOG_SCOPE_PARAM) === ENVIRONMENT_SCOPE || search.get(STUDIO_ITEM_REVIEW_PARAM) === STUDIO_ITEM_REVIEW_VALUE; +} + +/** + * objectstack#36905, objectstack#36904 (Studio redesign epic #36890) — the + * types whose item, on a package's leg, opens its designer full-screen in the + * area rather than the generic item page: the object designer (`DataPillar` + * on one object). A designer card adds its type here in the PR that deletes + * the type's row from `STUDIO_ITEM_PILLAR`. + */ +export const AREA_DESIGNER_PAGE_TYPES: readonly string[] = Object.freeze(['object']); + +/** + * Whether an item of the area opens its full-screen designer page: a + * {@link AREA_DESIGNER_PAGE_TYPES} type on a package's leg. The cross-package + * leg names no package to design in, so it keeps the generic item page. + */ +export function areaItemOpensDesignerPage(input: { packageId: string | null; type: string }): boolean { + return input.packageId !== null && AREA_DESIGNER_PAGE_TYPES.includes(input.type); +} + +/** + * The item an area URL opens in its full-screen designer page, read off the + * address (`/studio//metadata//[/…]`), or `null` for any + * other URL. Studio's copilot reads it as it reads a pillar's `?surface=` + * (cloud#1610: the URL is the one source of what is being discussed), so a + * designer that left its pillar keeps the context the pillar gave it. + */ +export function areaDesignerItemOf(pathname: string, segment: string | null | undefined): { type: string; name: string } | null { + if (!segment || isStudioAllPackagesScope(segment) || isStudioOrgScope(segment)) return null; + const root = `${studioMetadataAreaRoot(segment)}/`; + if (!pathname.startsWith(root)) return null; + const [rawType, rawName] = pathname.slice(root.length).split('/'); + // `//new` is the area's create page (it routes before the item), + // never an item called `new`. + if (!rawType || !rawName || rawName === 'new') return null; + try { + const type = decodeURIComponent(rawType); + const name = decodeURIComponent(rawName); + return areaItemOpensDesignerPage({ packageId: segment, type }) ? { type, name } : null; + } catch { + return null; + } } /** @@ -149,22 +187,6 @@ export function dataPillarRedirect(packageId: string, search: string): string { return query ? `${list}?${query}` : list; } -/** - * objectstack#36904 — the item a Studio metadata address names, - * `/studio//metadata//` (a trailing `/history` included), - * or `undefined` for any other path (a list, the directory, diagnostics). The - * copilot reads the open item from it where no `?surface=` names one. - */ -export function metadataAddressArtifact(pathname: string): { type: string; name: string } | undefined { - const m = /^\/studio\/[^/]+\/metadata\/([^/]+)\/([^/]+)/.exec(pathname); - if (!m || m[1].startsWith('_')) return undefined; - try { - return { type: decodeURIComponent(m[1]), name: decodeURIComponent(m[2]) }; - } catch { - return undefined; - } -} - /** * objectstack#28569 (ADR-0146 Consequences) — the types whose item opens the * area's simplified form editor (`StudioBundleItemEditor`): the fields Setup's diff --git a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts index dfcbb76deb8..5d2a2e991af 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioAddressTable.ts @@ -70,7 +70,7 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr builder: 'studioLandingPath', meaning: 'The front door with its create-package dialog open.', }, - { id: 'package', today: '/studio/', builder: 'studioPackagePath', meaning: `A package's Studio; the route lands it on its home pillar, \`${STUDIO_HOME_PILLAR}\`.` }, + { id: 'package', today: '/studio/', builder: 'studioPackagePath', meaning: `A package's Studio; the route lands it on its home, \`${STUDIO_HOME_PILLAR}\`, which redirects to the package's object list (objectstack#36904).` }, { id: 'pillar', today: '/studio//', builder: 'studioPillarPath', meaning: 'One pillar of a package: data, automations or access.' }, { id: 'pillar-item', @@ -109,7 +109,7 @@ export const STUDIO_ADDRESS_FAMILIES: readonly StudioAddressFamily[] = Object.fr id: 'retired-interfaces', today: `/studio//${RETIRED_INTERFACES_SEGMENT}[?…]`, builder: 'retiredInterfacesTarget', - meaning: `The retired Interfaces pillar (objectstack#36502). Redirects to the package's \`${STUDIO_HOME_PILLAR}\` pillar, keeping only STUDIO_RETIRED_INTERFACES_KEPT_PARAMS.`, + meaning: `The retired Interfaces pillar (objectstack#36502). Redirects to the package's home, \`${STUDIO_HOME_PILLAR}\` (and from there to its object list, objectstack#36904), keeping only STUDIO_RETIRED_INTERFACES_KEPT_PARAMS.`, }, ]); diff --git a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts index 92b6d541716..743d640a374 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioInterfacesRetired.ts @@ -9,7 +9,8 @@ * * An old Interfaces URL — `/studio//interfaces`, with or without a * `?surface=` deep link — still opens: it lands on the package's Studio home - * (the Data pillar) and says once, there, where interface editing went, with a + * (the retired Data pillar's address, which redirects to the package's object + * list, objectstack#36904) and says once, there, where interface editing went, with a * link back to the app. A `?changes=review` request travels with it, because * the Changes drawer it opens is the surface's, not the pillar's * (`studioChangesLink.ts`); the retired pillar's own parameters are dropped. From 562d06896efa3b9464a54c2485bdec3b5a1dcaa2 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 03:49:04 +0000 Subject: [PATCH 16/18] test(studio): load the zh catalogue at collection in the tab-order pin The studio namespace fetches its zh catalogue on demand, so the pin read English in a worker where no earlier suite had loaded it (Test UI 5/16). Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QSeKYoFqGdRM9Qmg7M2o2B --- .../src/views/studio-design/objectDesignerTabs.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts index 06e9a9b83e4..9b5debffb9c 100644 --- a/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/objectDesignerTabs.test.ts @@ -22,6 +22,12 @@ import { readObjectDesignerTab, } from './objectDesignerTabs'; import { t } from '../metadata-admin/i18n'; +import { loadStudioCatalogue } from '@object-ui/i18n/namespaces/studio'; + +// The studio namespace's zh catalogue is fetched on demand: loaded here, at +// collection, so the order pin reads Chinese whatever ran before it in this +// worker (unloaded, `t` answers from `en`). +await loadStudioCatalogue('zh'); const TOOLS = OBJECT_DESIGNER_TOOL_TABS; From d09f2b3179f2f66a4687807c732e8e1c3a6e3650 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 05:35:54 +0000 Subject: [PATCH 17/18] fix(studio): the object create publishes pinned; a name this package holds offers Open The list dialog's object create now passes publishCreated (If-None-Match: *), as the flow create does, and a taken identifier the package holds says so and opens that object's designer; one held elsewhere keeps its sentence and no Open. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QSeKYoFqGdRM9Qmg7M2o2B --- ...ListCreateDialog.pairCreate-36897.test.tsx | 52 ++++++++++++++++--- .../MetadataListCreateDialog.tsx | 35 ++++++++++--- .../views/metadata-admin/ResourceListPage.tsx | 4 ++ 3 files changed, 78 insertions(+), 13 deletions(-) diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx index 92a0ee23aa1..e9e1acc080f 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.pairCreate-36897.test.tsx @@ -47,10 +47,10 @@ vi.mock('../studio-design/packages-io.js', async (importOriginal) => ({ { id: 'com.example.bare', namespace: null }, ], })); -const publish = vi.fn(async () => ({ ok: true })); +const publish = vi.fn(async (..._args: unknown[]) => ({ ok: true })); vi.mock('../studio-design/studioSaveBar.js', async (importOriginal) => ({ ...(await importOriginal>()), - publishSavedItem: (...args: unknown[]) => publish(...(args as [])), + publishSavedItem: (...args: unknown[]) => publish(...args), })); const taken = vi.fn(async (..._args: unknown[]): Promise<{ name: string; label: string } | null> => null); vi.mock('../studio-design/StudioPillarKit.js', async (importOriginal) => ({ @@ -63,8 +63,16 @@ vi.mock('../studio-design/newObjectJoinsAppMenu.js', async (importOriginal) => ( addNewObjectToAppMenu: (...args: unknown[]) => joinMenu(...(args as [])), })); +/** objectstack#36904 — the package's own objects, read when an identifier is taken. */ +const surfaces = vi.fn(async (..._args: unknown[]): Promise> => []); +vi.mock('../studio-design/packageSurfaces.js', async (importOriginal) => ({ + ...(await importOriginal>()), + loadPackageSurfaces: (...args: unknown[]) => surfaces(...args), +})); + import { MetadataListCreateDialog } from './MetadataListCreateDialog'; -import { t } from './i18n'; +import { publishCreated } from '../studio-design/studioSaveBar.js'; +import { t, tFormat } from './i18n'; afterEach(() => { cleanup(); @@ -73,7 +81,7 @@ afterEach(() => { const L = 'en-US' as const; -function open(type: 'object' | 'flow', packageId: string, inPair: boolean) { +function open(type: 'object' | 'flow', packageId: string, inPair: boolean, onOpenExisting?: (path: string) => void) { const onCreated = vi.fn(); render( , ); return onCreated; @@ -108,7 +117,7 @@ describe('list 「新建」 lands in the paired .custom package on a read-only b expect([type, name]).toEqual(['object', 'hrx_leave_request']); expect(opts).toMatchObject({ mode: 'draft', packageId: 'com.vendor.hr.custom', ifNoneMatch: '*' }); expect(body).toHaveProperty('sharingModel', 'public_read'); - expect(publish).toHaveBeenCalledWith(expect.anything(), { type: 'object', name: 'hrx_leave_request', packageId: 'com.vendor.hr.custom' }, false); + expect(publish).toHaveBeenCalledWith(expect.anything(), { type: 'object', name: 'hrx_leave_request', packageId: 'com.vendor.hr.custom' }, false, publishCreated); expect(onCreated).toHaveBeenCalledWith({ name: 'hrx_leave_request', packageId: 'com.vendor.hr.custom' }); expect(joinMenu).not.toHaveBeenCalled(); }); @@ -181,9 +190,40 @@ describe('list 「新建」 for an object: the create the object designer no lon const onCreated = open('object', 'com.example.crm', false); fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); await waitFor(() => expect(taken).toHaveBeenCalled()); - expect(await screen.findByTestId('object-create-taken')).toHaveTextContent('crm_visit'); + const notice = await screen.findByTestId('object-create-taken'); + expect(notice).toHaveTextContent('crm_visit'); expect(save).not.toHaveBeenCalled(); expect(publish).not.toHaveBeenCalled(); expect(onCreated).not.toHaveBeenCalled(); + // CONTROL (objectstack#36904): held outside this package, it names the holder and offers no Open. + expect(notice).toHaveTextContent( + tFormat('engine.studio.data.createTakenElsewhere', L, { label: 'Visit', name: 'crm_visit' }), + ); + expect(screen.queryByTestId('object-create-open-existing')).toBeNull(); + }); + + // objectstack#36904 — the in-page create offered to open an object its rail held; the list's does too. + it('an identifier this package holds says so, and Open goes to that object\'s designer', async () => { + taken.mockResolvedValueOnce({ name: 'crm_visit', label: 'Visit' }); + surfaces.mockResolvedValueOnce([{ type: 'object', name: 'crm_visit' }]); + const onOpenExisting = vi.fn(); + const onCreated = open('object', 'com.example.crm', false, onOpenExisting); + fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); + const notice = await screen.findByTestId('object-create-taken'); + expect(notice).toHaveTextContent(tFormat('engine.studio.data.createTaken', L, { label: 'Visit', name: 'crm_visit' })); + expect(surfaces).toHaveBeenCalledWith(expect.anything(), 'object', 'com.example.crm', L); + fireEvent.click(screen.getByTestId('object-create-open-existing')); + expect(onOpenExisting).toHaveBeenCalledWith('/studio/com.example.crm/metadata/object/crm_visit'); + expect(save).not.toHaveBeenCalled(); + expect(onCreated).not.toHaveBeenCalled(); + }); + + // objectstack#36726 — as the flow create: no live row was there at the check, so the publish is `If-None-Match: *`. + it('publishes the created object pinned, so a row published under the name since is refused', async () => { + const onCreated = open('object', 'com.example.crm', false); + fill('engine.studio.data.nameLabel', 'engine.studio.data.idLabel', 'Visit', 'visit'); + await waitFor(() => expect(onCreated).toHaveBeenCalled()); + expect(publish).toHaveBeenCalledTimes(1); + expect(publish.mock.calls[0]?.[3]).toBe(publishCreated); }); }); diff --git a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx index 4d8f1fe4389..bf52ce8519a 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/MetadataListCreateDialog.tsx @@ -31,7 +31,9 @@ import { OWD_CREATE_MODELS, OWD_DEFAULT, type OwdCreateModel } from '../studio-d import { OWD_OPTION_DESC_KEY, OWD_OPTION_LABEL_KEY } from '../studio-design/DataPillarHelpers.js'; import { buildFlowSkeleton, buildObjectSkeleton } from '../studio-design/skeletons.js'; import { ensureCustomizationPackage, fetchPackages, prefixObjectName } from '../studio-design/packages-io.js'; -import { publishSavedItem } from '../studio-design/studioSaveBar.js'; +import { publishCreated, publishSavedItem } from '../studio-design/studioSaveBar.js'; +import { loadPackageSurfaces } from '../studio-design/packageSurfaces.js'; +import { studioItemPath } from '../studio-design/studioAddress.js'; import { plainRefusal, type StudioRefusal } from '../studio-design/metadataError.js'; import { addNewObjectToAppMenu } from '../studio-design/newObjectJoinsAppMenu.js'; import { FLOW_PRESETS, flowPresetTrigger, type FlowPreset } from '../studio-design/flowPresets.js'; @@ -55,6 +57,12 @@ export interface MetadataListCreateDialogProps { locale: SupportedLocale; /** The item is live: where it was created. */ onCreated: (created: { name: string; packageId: string }) => void; + /** + * objectstack#36903, objectstack#36904 — open the item already holding the + * identifier, at its address (`studioItemPath`), when the package the create + * writes to holds it. Without it the notice names the holder and offers no Open. + */ + onOpenExisting?: (path: string) => void; } type Taken = { name: string; label: string }; @@ -80,12 +88,15 @@ async function createTarget(packageId: string, inPair: boolean, namespace: strin return { packageId: pair.packageId, namespace: pair.namespace }; } -function ObjectCreate({ open, onOpenChange, packageId, inPair, locale, onCreated }: MetadataListCreateDialogProps) { +function ObjectCreate({ open, onOpenChange, packageId, inPair, locale, onCreated, onOpenExisting }: MetadataListCreateDialogProps) { const client = useMetadataClient(); const [owd, setOwd] = React.useState(OWD_DEFAULT); const [busy, setBusy] = React.useState(false); const [error, setError] = React.useState(null); - const [taken, setTaken] = React.useState(null); + // objectstack#36904 — `at`: the package the create writes to holds the + // object with that identifier (published or a draft), so the notice offers + // to open it there, as the Data pillar's in-page create did for its rail. + const [taken, setTaken] = React.useState<(Taken & { at: string | null }) | null>(null); // The package's object-name namespace (framework#2694): the dialog previews // the stored name; on a read-only base the pair's, by the spec's pairing // rule, while the save prefixes with the namespace the ensure door answers. @@ -121,14 +132,18 @@ function ObjectCreate({ open, onOpenChange, packageId, inPair, locale, onCreated const name = prefixObjectName(rawName, target.namespace); const held = await findTakenIdentifier(client, 'object', name, locale); if (held) { - setTaken(held); + const own = await loadPackageSurfaces(client, 'object', target.packageId, locale).catch(() => []); + setTaken({ ...held, at: own.some((object) => object.name === name) ? target.packageId : null }); return; } const body = buildObjectSkeleton(name, label, t('engine.studio.data.nameFieldLabel', locale), owd); await client.save('object', name, body, { mode: 'draft', packageId: target.packageId, ifNoneMatch: '*', surface: 'studio' }); - const live = await publishSavedItem(client, { type: 'object', name, packageId: target.packageId }, false); + // objectstack#36726 — pinned `If-None-Match: *`, as the flow create is: + // an object another writer published under the name since the check + // above is refused, not replaced. + const live = await publishSavedItem(client, { type: 'object', name, packageId: target.packageId }, false, publishCreated); if (!live.ok) { - setError(plainRefusal(live.error)); + if ('error' in live) setError(plainRefusal(live.error)); return; } toast.success(tFormat('engine.studio.save.done', locale, { items: label })); @@ -186,7 +201,13 @@ function ObjectCreate({ open, onOpenChange, packageId, inPair, locale, onCreated {taken && ( onOpenExisting(studioItemPath(taken.at!, 'object', taken.name)) : undefined} /> )} {/* The object's record sharing (OWD): without it the object is diff --git a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx index 22c352f8e59..5ef399d9bb6 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx +++ b/ui/packages/app-shell/src/views/metadata-admin/ResourceListPage.tsx @@ -1224,6 +1224,10 @@ function DefaultMetadataList({ type, appName }: { type: string; appName?: string packageId={host.packageId} inPair={createInPair} locale={locale} + onOpenExisting={(path) => { + setCreateOpen(false); + navigate(path); + }} onCreated={({ name, packageId }) => { setCreateOpen(false); refresh(); From 2bf127d47a94407db58df5f2e2c8a7cc9f4fafd7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 05:40:51 +0000 Subject: [PATCH 18/18] docs(changeset): the create dialog's Open on a taken identifier, in user terms Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_01QSeKYoFqGdRM9Qmg7M2o2B --- .changeset/36904-object-designer-fullscreen.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/36904-object-designer-fullscreen.md b/.changeset/36904-object-designer-fullscreen.md index 3c0e22b895d..54ac535aa95 100644 --- a/.changeset/36904-object-designer-fullscreen.md +++ b/.changeset/36904-object-designer-fullscreen.md @@ -9,7 +9,7 @@ Metadata-protocol: none Studio redesign (epic #36890), the object designer's card (#36904); it also delivers #36513's tab order. -- **One object, one page.** Opening an object in Studio opens its designer full-screen beside the left menu, with its own address you can bookmark or share. × goes back to the object list with its filter and sort as you left them, ‹ › open the previous and next object in that list, and Esc closes. The designer no longer has its own column of objects or its own 「新建」 button: you pick another object from the list, and you create one with the object list's 「新建」, which keeps the organization-wide default sharing choice, the option to add the object to the app's menu, and, on a read-only package, the save into its customization package. +- **One object, one page.** Opening an object in Studio opens its designer full-screen beside the left menu, with its own address you can bookmark or share. × goes back to the object list with its filter and sort as you left them, ‹ › open the previous and next object in that list, and Esc closes. The designer no longer has its own column of objects or its own 「新建」 button: you pick another object from the list, and you create one with the object list's 「新建」, which keeps the organization-wide default sharing choice, the option to add the object to the app's menu, and, on a read-only package, the save into its customization package. If the identifier you pick is already used by an object in that package, the dialog says so and offers to open it. - **Tabs in a fixed order.** Records, Field layout, Validations, Actions, Settings, Hooks, API; when the page is narrow, Hooks and API fold into "Advanced" first, then Validations, Actions and Settings. References, History (with the audit log) and Source (with the layer comparison) are now tabs after them, in place of the five header icons. The tab you are on is part of the page's address, so refreshing, sharing the link or moving to the next object keeps it. - **Old links still work.** A bookmark or link to an object in Studio's old Data screen opens that object's designer; a link to the Data screen itself opens the package's object list, and the review link for unpublished changes still opens that review. The app's 「对象设置」, the record page's 「配置页面」, the command palette, links in AI replies and the link to a switched-off action all open the new page. - **Fixed on the way:** when discarding the AI's unpublished changes partly fails, the message saying which items could not be discarded now stays on the page instead of disappearing at once. A link to an object that does not exist (a deleted object's bookmark, a mistyped link) now says the object was not found, instead of offering it as a new object to design.