From b52ab4d1f7b835c23345c4bffd1e55b9290b6b10 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 05:59:51 +0000 Subject: [PATCH 01/10] wip(console): boot frame for app routes; the chrome no longer waits for the route's reads Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- ui/apps/console/src/AppContent.tsx | 7 +- .../app-shell/src/console/AppContent.tsx | 58 ++++---- .../src/console/ConsoleBootShell.tsx | 124 ++++++++++++++++++ .../app-shell/src/console/ConsoleShell.tsx | 8 +- ...pContent.splashCriticalPath-12809.test.tsx | 15 +++ .../__tests__/ConsoleBootShell-35981.test.tsx | 103 +++++++++++++++ 6 files changed, 282 insertions(+), 33 deletions(-) create mode 100644 ui/packages/app-shell/src/console/ConsoleBootShell.tsx create mode 100644 ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx diff --git a/ui/apps/console/src/AppContent.tsx b/ui/apps/console/src/AppContent.tsx index 16a61d4011d..00a9c8c6949 100644 --- a/ui/apps/console/src/AppContent.tsx +++ b/ui/apps/console/src/AppContent.tsx @@ -11,7 +11,7 @@ import { lazy, Suspense, useEffect, useMemo, type ReactNode } from 'react'; import { Route, useParams, useLocation, Navigate } from 'react-router-dom'; -import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingScreen, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell'; +import { DefaultAppContent, ENVIRONMENT_SCOPE_QUERY, LauncherAppsProvider, LoadingFallback, LoadingScreen, setupMetadataStudioPath, useAdapter } from '@object-ui/app-shell'; import { AdapterCtx } from '@object-ui/react'; import { MePermissionsProvider, ServerReadScope, releaseMePermissionsRequest, startMePermissionsRequest } from '@object-ui/permissions'; import { createAuthenticatedFetch, useAuth } from '@object-ui/auth'; @@ -456,7 +456,10 @@ export function ConsolePermissionsScope({ children }: { children: ReactNode }) { endpoint={endpoint} fetcher={authFetch} requestKey={requestKey} - loadingFallback={} + // objectstack#35981 — the console's boot fallback: on an app route, the + // chrome's empty frame while the answer is out (it draws no navigation + // entry, which is what the answer decides); the splash on `/home`. + loadingFallback={} // Without this, the provider's error state renders `loadingFallback` too — // an eternal spinner with a `retry` nobody can reach. The provider already // re-attempts a transient failure (a cold environment kernel answers 503 + diff --git a/ui/packages/app-shell/src/console/AppContent.tsx b/ui/packages/app-shell/src/console/AppContent.tsx index 9e115400ed1..9f864b4d1b0 100644 --- a/ui/packages/app-shell/src/console/AppContent.tsx +++ b/ui/packages/app-shell/src/console/AppContent.tsx @@ -49,6 +49,7 @@ import { ConsoleLayout } from '../layout/ConsoleLayout.js'; import { CommandPalette } from '../chrome/CommandPalette.js'; import { ErrorBoundary } from '../chrome/ErrorBoundary.js'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; +import { ConsoleBootShell, RouteMetadataSkeleton } from './ConsoleBootShell.js'; import { BackToHomeButton, NotFoundState } from '../components/NotFoundState.js'; import { RedirectWithSplash } from '../chrome/RedirectWithSplash.js'; // `ObjectNotFoundState` from its own module, not through `ObjectView`: the @@ -67,7 +68,7 @@ import { navEntriesShownOncePendingReadsShow, } from '../hooks/useNavMemberGates.js'; import { resolveSetupAppPath } from './ConsoleShell.js'; -import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute, type LazyMetadataType } from './appRouteMetadataReads.js'; +import { APP_ROUTE_METADATA_READS, collectRoutePaths, metadataReadsForAppRoute } from './appRouteMetadataReads.js'; import { enterAppBundle, objectViewRouteObject, prefetchObjectViewRows, readAppObjectScope } from './appObjectScope.js'; import { preferLocal } from '../utils/preferLocal.js'; import { @@ -77,7 +78,7 @@ import { setupMetadataStudioPath, } from '../views/studio-design/setupMetadataRedirect.js'; import { NO_RECORD_DRAWERS_OPENING, NO_RECORD_PAGE_DRAWERS_OPEN, RecordDrawerOpeningProvider, RecordPageDrawerOpenProvider, useRecordFormOpensOverDrawers, type RecordDrawersOpening, type RecordPageDrawersOpen } from '../views/recordDrawerStack.js'; -import { SkeletonDashboard, SkeletonDetail, SkeletonGrid } from '../skeletons/index.js'; +import { SkeletonGrid } from '../skeletons/index.js'; // Route-based code splitting — lazy-load less-frequently-used routes. // @@ -604,10 +605,11 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = if (!viewReadObject || !viewReadReady || !bundleAppName || previewDrafts) return; prefetchObjectViewRows(dataSource, viewReadObject); }, [dataSource, viewReadObject, viewReadReady, bundleAppName, previewDrafts]); - // Set once the first frame past the splash has rendered. After it, a route - // waiting on its buckets draws its skeleton inside the console chrome rather - // than taking the whole console back to the splash. - const firstPaintDone = useRef(false); + // objectstack#35981 — set once this page load's first route has drawn. Until + // then the route slot's skeleton is the boot wait (`RouteMetadataSkeleton`'s + // `boot`), so what waits for the first paint past the splash still waits for + // the route (objectui#12980), while the chrome is already on screen. + const firstRouteDrawn = useRef(false); // A normal app was requested but isn't present in the loaded metadata — the // post-publish readiness lag, or a genuinely-missing app. Applies in BOTH @@ -1200,17 +1202,18 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // `positions[]` leg, which is every admin on a session minted with an active // organization stamped) waits exactly zero extra frames. What does wait is // the viewer whose verdict genuinely is not known yet — and for them a - // LoadingScreen is the honest frame, not a screen built on a guess. + // frame that decides nothing is the honest one, not a screen built on a guess. // - // objectui#12809 — of the lazy metadata, the splash waits only for what the - // current route reads (`routeReadsSettled`), and only until the first paint. - if ( - !dataSource || - metadataLoading || - !isWorkspaceAdminResolved || - (!firstPaintDone.current && !routeReadsSettled) - ) return ; - firstPaintDone.current = true; + // objectui#12809 — the lazy metadata the current route reads does not hold + // the gate at all (objectstack#35981): the chrome decides nothing from it, + // so it mounts once the inputs above are in, and the route slot draws the + // route's skeleton until its reads land (`routeReadsSettled`, below). + // + // objectstack#35981 — while the gate holds, the console chrome's empty frame + // (`ConsoleBootShell`), not the full-screen splash: it names no app and draws + // no navigation entry, which is exactly what the inputs above decide. + if (!dataSource || metadataLoading || !isWorkspaceAdminResolved) return ; + if (routeReadsSettled) firstRouteDrawn.current = true; // ADR-0037 — preview mode renders its OWN empty/error states and never // falls through to the generic "No Apps Configured" guard below: inside a @@ -1282,7 +1285,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // page; `denied` is the screen above, and every other verdict falls through // to the pseudo-route rendering below, unchanged. if (appSurfaceAwaitsVerdict && !previewDrafts) { - if (accessVerdict === null) return ; + if (accessVerdict === null) return ; if (accessVerdict === 'denied') return renderAppAccessDenied(); } @@ -1291,7 +1294,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // different app, and don't show the misleading "no apps configured" screen // below (there ARE apps). requestedAppMissing already excludes pseudo-routes. if (requestedAppMissing) { - if (missingRecheck !== 'done' || accessVerdict === null) return ; + if (missingRecheck !== 'done' || accessVerdict === null) return ; if (accessVerdict === 'denied') return renderAppAccessDenied(); // objectui#9262 — the remaining verdicts, each saying only what the probe // obtained. The screen this replaced asserted ONE transient deploy state @@ -1402,7 +1405,7 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // guard reads only the per-user-filtered list that ships today. if (!activeApp && !isCreateAppRoute && !isSystemRoute && !isMetadataRoute && !isWorkspaceAdmin) { // `RedirectWithSplash`, not a bare `` (objectui#6378 / #6507). - // Every readiness gate above this branch renders `LoadingScreen`, and the + // Every readiness gate above this branch renders a boot frame, and the // branch returns ABOVE the single `ConsoleLayout` mount — so a bare // redirect, which renders null, hands the WHOLE viewport back to the page // background while `/home` renders at transition priority. Measured on the @@ -1557,11 +1560,15 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = - }> + {/* objectstack#35981 — a route element whose chunk is still loading + draws the route's skeleton in the slot, not the full-screen + splash inside the chrome. It is the boot wait as that splash + was (`data-boot-splash`), whenever it shows. */} + }> {/* objectui#12809 — the route's metadata has not landed: its skeleton, never its empty or "not found" state. */} - {!routeReadsSettled ? : objectScope && routeObjectReadsFailed.length > 0 ? ( + {!routeReadsSettled ? : objectScope && routeObjectReadsFailed.length > 0 ? ( // objectui#13052 — the route's object read failed (a 5xx, a // network drop, a code this build does not know): say so in // the shell, and let Retry ask those names once more. @@ -2309,12 +2316,3 @@ function useLazyMetadataSettled( return settled; } -/** The route slot while its metadata loads, shaped like what will land there. */ -function RouteMetadataSkeleton({ reads }: { reads: string }) { - const types = reads.split(',') as LazyMetadataType[]; - return ( -
- {types[0] === 'dashboard' ? : types.includes('page') ? : } -
- ); -} diff --git a/ui/packages/app-shell/src/console/ConsoleBootShell.tsx b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx new file mode 100644 index 00000000000..8b6851b51fb --- /dev/null +++ b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx @@ -0,0 +1,124 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#35981 — the frame an app route boots in once the session is + * confirmed, and the route slot's skeleton while its metadata loads. + * + * Between the session answer and the console chrome, an `/apps/:app/*` open + * waits on four more gates in a row: the data adapter, the organization list, + * `/auth/me/permissions` (seconds, server-side, on a hosted environment) and + * `AppContent`'s readiness gate (the app list and the admin verdict, + * objectui#5619). Each used to draw the full-screen splash. They now draw + * {@link ConsoleBootShell}: the chrome's frame (the 48 px top bar, the sidebar + * at the width the reader left it, the route slot) with grey blocks in it and + * the skeleton of the route the URL names in the slot. The real chrome takes + * its place when the gates pass, at the same geometry. + * + * ⭐ What the frame withholds is what the gates exist for. It draws no app + * name, icon or colour (the app list decides which app this is, and a URL can + * name one the session may not open), no navigation entry (the permission + * answer and the admin verdict decide which exist), and it decides nothing: it + * never navigates, so the redirects the gates own still happen from the same + * inputs, once. + * + * THE MARKER. The frame carries `data-boot-splash`, the splash's + * language-independent marker (`LoadingScreen`): it is still the boot wait. + * Readiness waits and the reads deferred to the first paint past the splash + * (objectui#12980: the chrome's feeds, the locale list) keep meaning what they + * meant. `data-boot-shell` tells the frame from the splash. + */ + +import { useState } from 'react'; +import { useInRouterContext, useLocation } from 'react-router-dom'; +import { useAuth } from '@object-ui/auth'; +import { Sidebar, SidebarContent, SidebarGroup, SidebarMenu, Skeleton } from '@object-ui/components'; +import { AppShell } from '@object-ui/layout'; +import { LoadingScreen } from '../chrome/LoadingScreen.js'; +import { CONSOLE_BELOW_TOP_BAR } from '../layout/consoleTopBar.js'; +import { primeConsoleSidebarOpen } from '../layout/consoleSidebarRail.js'; +import { SkeletonDashboard, SkeletonDetail, SkeletonGrid } from '../skeletons/index.js'; +import { metadataReadsForAppRoute } from './appRouteMetadataReads.js'; + +/** An app route: `/apps/:app` and everything under it. */ +const APP_ROUTE = /^\/apps\/[^/]+(?:\/|$)/; + +/** + * The route slot while its metadata loads, shaped like what will land there + * (objectui#12809). `boot` marks it as the boot wait (see the file header): + * set while the first route of this page load has not drawn yet. + */ +export function RouteMetadataSkeleton({ reads, boot = false }: { reads: string; boot?: boolean }) { + const types = reads.split(','); + return ( +
+ {types[0] === 'dashboard' ? : types.includes('page') ? : } +
+ ); +} + +/** Widths of the sidebar's grey rows, fixed so two frames draw the same rows. */ +const SIDEBAR_ROWS = ['72%', '58%', '80%', '64%', '50%', '68%']; + +/** + * The console chrome's frame, empty: see the file header. Drawn on an app + * route only, after the session answer. + */ +export function ConsoleBootShell() { + // Before the sidebar provider reads its cookie, as `ConsoleLayout` does + // (objectstack#28077): a narrow window's first frame is already the rail, + // so the frame and the chrome draw the sidebar at the same width. + useState(primeConsoleSidebarOpen); + const { pathname } = useLocation(); + const appSubPath = pathname.split('/').filter(Boolean).slice(2).join('/'); + const reads = metadataReadsForAppRoute(appSubPath, []); + return ( +
+ + + + +
+ } + sidebar={ + + + + + {SIDEBAR_ROWS.map((width, i) => ( +
+ + +
+ ))} +
+
+
+
+ } + className="!p-0 overflow-y-auto overflow-x-hidden bg-muted/5 lg:flex lg:flex-col" + > +
+ +
+ + + ); +} + +/** + * The console's boot-gate fallback: {@link ConsoleBootShell} on an app route + * once the session has answered with a user, the splash everywhere else (the + * session read itself, `/home`, the auth surfaces, a host with no router). + */ +export function ConsoleBootFallback() { + return useInRouterContext() ? : ; +} + +function RoutedBootFallback() { + const { pathname } = useLocation(); + const { isLoading, user } = useAuth(); + if (isLoading || !user || !APP_ROUTE.test(pathname)) return ; + return ; +} diff --git a/ui/packages/app-shell/src/console/ConsoleShell.tsx b/ui/packages/app-shell/src/console/ConsoleShell.tsx index abe7433388a..6b1bb158af9 100644 --- a/ui/packages/app-shell/src/console/ConsoleShell.tsx +++ b/ui/packages/app-shell/src/console/ConsoleShell.tsx @@ -56,6 +56,7 @@ import { import { ThemeProvider } from '../chrome/ThemeProvider.js'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; import { RedirectWithSplash } from '../chrome/RedirectWithSplash.js'; +import { ConsoleBootFallback } from './ConsoleBootShell.js'; import { RemediationOverlay } from './RemediationOverlay.js'; import { HostNavigationBridge } from './HostNavigationBridge.js'; import { ConsoleElementApiOpen } from './ConsoleElementApiOpen.js'; @@ -70,8 +71,13 @@ import { getRuntimeConfig } from '../runtime-config.js'; // /_console load (framework#2615 P3). Delegate to the branded, boot-safe // splash (logo + product name + step list) that the rest of the shell already // uses, so the cold load looks like the product from the first frame. +// +// objectstack#35981 — on an app route, once the session has answered with a +// user, the console chrome's empty frame instead (`ConsoleBootShell`): the +// gates after the session read (the adapter, the organization list, the +// permission answer) decide nothing the frame shows. export function LoadingFallback() { - return ; + return ; } /** diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx index 3deacd92ded..7cfcba0cc85 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx @@ -19,6 +19,12 @@ * `apps/console`), mounted above `AppContent`; it stays on the critical path * and is outside this harness. * + * objectstack#35981 — the route's own bucket no longer holds the chrome: while + * the session's gates are out the console draws its empty frame + * (`data-boot-shell`), then the chrome with the route's skeleton in its slot. + * That skeleton is still the boot wait (`data-boot-splash`) until the route + * draws, so `splashUp()` below reads the same steps as before. + * * CONTROL: after the first paint, a route whose buckets have not landed draws * its skeleton inside the console chrome, then its content; and a bucket that * refetches keeps the route mounted. @@ -183,6 +189,7 @@ function boot(client: AuthClient, url: string) { } const splashUp = () => document.querySelector('[data-boot-splash]') !== null; +const bootShellUp = () => document.querySelector('[data-boot-shell]') !== null; const askedTypes = () => new Set(meta.ensureType.mock.calls.map((c) => c[0] as string)); beforeEach(() => { @@ -214,8 +221,16 @@ describe('the console splash waits for the critical path only (objectui#12809)', await answerList(); expect(splashUp()).toBe(true); // the member row has not answered + // objectstack#35981 — the chrome's empty frame, not the chrome: the admin + // verdict decides which navigation exists. + expect(bootShellUp()).toBe(true); + expect(screen.queryByTestId('console-layout')).not.toBeInTheDocument(); await answerMember(); expect(splashUp()).toBe(true); // the route's `object` bucket has not answered + // objectstack#35981 — the chrome is up, the route's skeleton in its slot. + expect(bootShellUp()).toBe(false); + expect(screen.getByTestId('console-layout')).toBeInTheDocument(); + expect(screen.getByTestId('route-metadata-skeleton')).toHaveAttribute('data-boot-splash'); await settle('object', [{ name: 'account' }]); await waitFor(() => expect(screen.getByTestId('object-view')).toHaveTextContent('account')); diff --git a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx new file mode 100644 index 00000000000..9fd59ebf178 --- /dev/null +++ b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx @@ -0,0 +1,103 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#35981 — the console's boot fallback draws the chrome's empty + * frame on an app route once the session has answered with a user, and the + * splash everywhere else. + * + * The frame is what a full-page open of an app route shows while the gates + * after the session read are out (the adapter, the organization list, the + * permission answer, the app list and the admin verdict). What those gates + * exist for is pinned here as what the frame does NOT draw: no app name, no + * navigation entry, nothing to press. It also stays the boot wait + * (`data-boot-splash`), so what waits for the first paint past the splash + * still waits. + */ + +import '@testing-library/jest-dom/vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; +import React from 'react'; +import { cleanup, render } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; + +const authState = vi.hoisted(() => ({ + isLoading: false, + user: { id: 'u_35981', name: 'Ada Admin' } as { id: string; name: string } | null, +})); +vi.mock('@object-ui/auth', async (importOriginal) => { + const actual = await importOriginal(); + return { ...actual, useAuth: () => authState }; +}); + +import { ConsoleBootFallback, ConsoleBootShell } from '../ConsoleBootShell'; +import { LoadingFallback } from '../ConsoleShell'; + +const RECORD = '/apps/crm/account/record/acc_1'; + +afterEach(() => { + cleanup(); + authState.isLoading = false; + authState.user = { id: 'u_35981', name: 'Ada Admin' }; +}); + +function at(path: string, element: React.ReactNode) { + return render({element}); +} + +const shell = () => document.querySelector('[data-boot-shell]'); +const splashMarker = () => document.querySelector('[data-boot-splash]'); + +describe('the console boot fallback (objectstack#35981)', () => { + it('draws the chrome frame on an app route once the session has a user', () => { + at(RECORD, ); + expect(shell()).not.toBeNull(); + // Still the boot wait: readiness waits and first-paint-deferred reads key on it. + expect(shell()).toHaveAttribute('data-boot-splash'); + // The top bar and the route slot, the slot shaped like a record page. + expect(document.querySelector('header')).not.toBeNull(); + expect(document.querySelector('[data-testid="route-metadata-skeleton"]')).not.toBeNull(); + }); + + it('is what the shared LoadingFallback draws', () => { + at(RECORD, ); + expect(shell()).not.toBeNull(); + }); + + it('draws no app, no navigation entry and nothing to press', () => { + at(RECORD, ); + const frame = shell()!; + // The app list decides which app this is, the permission answer and the + // admin verdict which entries exist: the frame shows none of it. + expect(frame.textContent?.trim()).toBe(''); + expect(frame.querySelectorAll('a, button, input, [role="menuitem"], [role="link"]')).toHaveLength(0); + }); + + it('keeps the splash while the session read is out, off an app route, and with no user', () => { + authState.isLoading = true; + at(RECORD, ); + expect(shell()).toBeNull(); + expect(splashMarker()).not.toBeNull(); + cleanup(); + + authState.isLoading = false; + authState.user = null; + at(RECORD, ); + expect(shell()).toBeNull(); + expect(splashMarker()).not.toBeNull(); + cleanup(); + + authState.user = { id: 'u_35981', name: 'Ada Admin' }; + for (const path of ['/home', '/login', '/forms/intake', '/apps']) { + at(path, ); + expect(shell(), path).toBeNull(); + expect(splashMarker(), path).not.toBeNull(); + cleanup(); + } + }); + + it('keeps the splash outside a router (a host that mounts the shell bare)', () => { + render(); + expect(shell()).toBeNull(); + expect(splashMarker()).not.toBeNull(); + }); +}); From 9ae75adfd38df2ffe6e87392faad1a99e62c2dc7 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 06:06:56 +0000 Subject: [PATCH 02/10] wip(console): boot redirects paint the same frame; changeset Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .changeset/35981-app-route-boot-frame.md | 15 ++++++++ .../src/chrome/RedirectWithSplash.tsx | 14 +++++--- .../app-shell/src/console/ConsoleShell.tsx | 3 +- .../__tests__/ConsoleBootShell-35981.test.tsx | 34 ++++++++++++++++++- 4 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 .changeset/35981-app-route-boot-frame.md diff --git a/.changeset/35981-app-route-boot-frame.md b/.changeset/35981-app-route-boot-frame.md new file mode 100644 index 00000000000..aec24868e85 --- /dev/null +++ b/.changeset/35981-app-route-boot-frame.md @@ -0,0 +1,15 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +--- + +perf(console): an app route draws the console's frame right after the session read, and the chrome no longer waits for the route's own metadata + +Clause-②: no +Metadata-protocol: none + +Opening an app page by its URL (a reload, a pasted link) showed the full-screen splash until the permission answer, the app list, the admin verdict and the page's own metadata reads had all arrived. On a hosted environment the permission answer alone takes seconds. + +- `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the top bar, the sidebar at the width the reader left it, the route's skeleton in the slot), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. +- `AppContent` mounts the console chrome once the app list, the permission answer and the admin verdict are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome. +- The frame and the first route skeleton carry `data-boot-splash`, so readiness waits and the reads deferred to the first paint past the splash wait exactly as before; `data-boot-shell` tells the frame apart. diff --git a/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx b/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx index 57b2b700c6b..c9fc7534d1b 100644 --- a/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx +++ b/ui/packages/app-shell/src/chrome/RedirectWithSplash.tsx @@ -36,8 +36,10 @@ * * ## Why the splash, and why it cannot itself flicker * - * The component renders the SAME `LoadingScreen` the gate one line above was - * already rendering, so the handoff changes no pixels: the transition now runs + * The component renders the SAME fallback the gate one line above was + * already rendering (`ConsoleBootFallback`: the splash, or on an app route + * after the session read the console's frame, objectstack#35981), so the + * handoff changes no pixels: the transition now runs * underneath an unchanged screen instead of underneath a blank one. That is * also why this is not "add a spinner" — a different holding image would * introduce a visual change where today there is a blank, and the goal is for @@ -52,7 +54,7 @@ */ import { Navigate } from 'react-router-dom'; -import { LoadingScreen } from './LoadingScreen.js'; +import { ConsoleBootFallback } from '../console/ConsoleBootShell.js'; export interface RedirectWithSplashProps { /** Where to go — the same value a bare `` would take. */ @@ -66,8 +68,10 @@ export function RedirectWithSplash({ to, replace }: RedirectWithSplashProps) { <> {/* Order is not load-bearing — `` renders null — but the splash is written first so the element that OCCUPIES the screen reads - first at every call site. */} - + first at every call site. objectstack#35981 — the boot gates' own + fallback, so on an app route after the session read it is the + console's frame those gates were showing, and the splash elsewhere. */} + ); diff --git a/ui/packages/app-shell/src/console/ConsoleShell.tsx b/ui/packages/app-shell/src/console/ConsoleShell.tsx index 6b1bb158af9..d2b0ecbbcb8 100644 --- a/ui/packages/app-shell/src/console/ConsoleShell.tsx +++ b/ui/packages/app-shell/src/console/ConsoleShell.tsx @@ -54,7 +54,6 @@ import { RecordPreferencesProvider, } from '../context/RecordPreferencesProvider.js'; import { ThemeProvider } from '../chrome/ThemeProvider.js'; -import { LoadingScreen } from '../chrome/LoadingScreen.js'; import { RedirectWithSplash } from '../chrome/RedirectWithSplash.js'; import { ConsoleBootFallback } from './ConsoleBootShell.js'; import { RemediationOverlay } from './RemediationOverlay.js'; @@ -492,7 +491,7 @@ export function RequireOrganization({ children }: { children: ReactNode }) { // looking at is dropped and nothing replaces it until `/organizations` // renders at transition priority. Measured on the three sibling gates #6506 // fixed: 41-147 ms of empty `#root`, a white flash on 67/87 boots. The - // replacement paints the SAME `LoadingScreen` this gate was already showing, + // replacement paints the SAME fallback this gate was already showing, // so the handoff changes no pixels. if (orgFeatureEnabled && !activeOrganization) return ; diff --git a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx index 9fd59ebf178..13b7be30dfe 100644 --- a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx @@ -18,7 +18,7 @@ import '@testing-library/jest-dom/vitest'; import { afterEach, describe, expect, it, vi } from 'vitest'; import React from 'react'; import { cleanup, render } from '@testing-library/react'; -import { MemoryRouter } from 'react-router-dom'; +import { MemoryRouter, Route, Routes } from 'react-router-dom'; const authState = vi.hoisted(() => ({ isLoading: false, @@ -31,6 +31,7 @@ vi.mock('@object-ui/auth', async (importOriginal) => { import { ConsoleBootFallback, ConsoleBootShell } from '../ConsoleBootShell'; import { LoadingFallback } from '../ConsoleShell'; +import { RedirectWithSplash } from '../../chrome/RedirectWithSplash'; const RECORD = '/apps/crm/account/record/acc_1'; @@ -63,6 +64,37 @@ describe('the console boot fallback (objectstack#35981)', () => { expect(shell()).not.toBeNull(); }); + it('is what a boot redirect paints during its hand-off, so the hand-off changes no pixels', () => { + // The redirect fires from inside a gate that was drawing the frame + // (`RequireOrganization` -> `/organizations`, `AppContent` -> home): it + // paints the same frame until the destination renders. + render( + + + } /> + } /> + + , + ); + expect(document.querySelector('[data-testid="organizations"]')).not.toBeNull(); + cleanup(); + // Measured at its first commit, before its navigation runs. + let frameAtCommit: Element | null = null; + function Probe() { + React.useLayoutEffect(() => { + frameAtCommit = shell(); + }); + return null; + } + render( + + + + , + ); + expect(frameAtCommit).not.toBeNull(); + }); + it('draws no app, no navigation entry and nothing to press', () => { at(RECORD, ); const frame = shell()!; From f328b16bfe7b2af247c18c33f061258c0df34ede Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 06:57:26 +0000 Subject: [PATCH 03/10] wip(console): tests read the boot frame where the splash was Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .../App.homePermissions-12700.test.tsx | 3 +++ .../FormPage.routePermissions-29187.test.tsx | 3 +++ ...ppContent.routeChunkPreload-12980.test.tsx | 21 +++++++++++++++---- .../__tests__/bootRedirectCoverage.test.tsx | 8 +++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx b/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx index e065bfdfa39..61db402a297 100644 --- a/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx +++ b/ui/apps/console/src/__tests__/App.homePermissions-12700.test.tsx @@ -163,6 +163,9 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ RequireOrganization: ({ children }: { children?: ReactNode }) => <>{children}, ConsoleToaster: () => null, LoadingScreen: () =>
, + // objectstack#35981 — the permission scope's loading fallback is the console's + // boot fallback, which is the splash off an app route. + LoadingFallback: () =>
, DefaultHomePage: () => , DefaultAppContent: () => , BuilderLanding: () => , diff --git a/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx b/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx index b033d4e026d..820b1c332cf 100644 --- a/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx +++ b/ui/apps/console/src/components/FormPage.routePermissions-29187.test.tsx @@ -124,6 +124,9 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ RequireOrganization: ({ children }: { children?: ReactNode }) => <>{children}, ConsoleToaster: () => null, LoadingScreen: () =>
, + // objectstack#35981 — the permission scope's loading fallback is the console's + // boot fallback, which is the splash off an app route. + LoadingFallback: () =>
, DefaultHomePage: () => , DefaultAppContent: () => null, BuilderLanding: () => null, diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx index 951876c16e5..76b244515bc 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx @@ -21,6 +21,11 @@ * with the chrome and no splash is ever drawn inside the chrome. * (b) CONTROL: a route whose chunk is still in flight when its metadata * lands keeps a splash in the route slot (never a blank), then renders. + * + * objectstack#35981 — the chrome no longer waits for the route's reads, and + * the route slot's fallback while a chunk loads is the route's skeleton, not + * the full-screen splash: both still carry the boot marker (`splashUp()`), and + * `watchSplashInsideChrome` counts the full-screen splash only. */ import '@testing-library/jest-dom/vitest'; @@ -198,7 +203,10 @@ function watchSplashInsideChrome() { for (const record of records) { record.addedNodes.forEach((node) => { if (!(node instanceof Element)) return; - const splashes = node.matches('[data-boot-splash]') ? [node] : [...node.querySelectorAll('[data-boot-splash]')]; + // The full-screen splash, not the route skeleton that also carries the + // boot marker (objectstack#35981). + const FULL = '[data-boot-splash]:not([data-testid="route-metadata-skeleton"])'; + const splashes = node.matches(FULL) ? [node] : [...node.querySelectorAll(FULL)]; for (const splash of splashes) { if (splash.closest('[data-testid="console-layout"]')) seen.count += 1; } @@ -244,7 +252,9 @@ describe('the route element chunk loads beside the route reads (objectui#12980)' await waitFor(() => expect(chunks.page.requested).toBe(true)); expect(chunks.page.splashUpWhenRequested).toBe(true); expect(splashUp()).toBe(true); - expect(screen.queryByTestId('console-layout')).not.toBeInTheDocument(); + // objectstack#35981 — the chrome is up; the route's skeleton is the boot wait. + expect(screen.getByTestId('console-layout')).toBeInTheDocument(); + expect(screen.getByTestId('route-metadata-skeleton')).toHaveAttribute('data-boot-splash'); expect(meta.status.page).toBe('loading'); // The chunk answers while the reads are still in flight; then the reads. @@ -268,9 +278,12 @@ describe('the route element chunk loads beside the route reads (objectui#12980)' await waitFor(() => expect(chunks.dashboard.requested).toBe(true)); expect(screen.getByTestId('console-layout')).toBeInTheDocument(); expect(screen.queryByTestId('dashboard-view')).not.toBeInTheDocument(); - // Never a blank: the route slot draws the splash while its chunk loads. + // Never a blank: the route slot draws the route's skeleton while its chunk + // loads (objectstack#35981: no longer the full-screen splash inside the + // chrome), and it is still the boot wait. expect(splashUp()).toBe(true); - expect(watch.seen.count).toBeGreaterThan(0); + expect(screen.getByTestId('route-metadata-skeleton')).toHaveAttribute('data-boot-splash'); + expect(watch.seen.count).toBe(0); await act(async () => { chunks.dashboard.release(); }); await waitFor(() => expect(screen.getByTestId('dashboard-view')).toBeInTheDocument()); diff --git a/ui/packages/app-shell/src/console/__tests__/bootRedirectCoverage.test.tsx b/ui/packages/app-shell/src/console/__tests__/bootRedirectCoverage.test.tsx index ca2f5cb5624..3c161c076d8 100644 --- a/ui/packages/app-shell/src/console/__tests__/bootRedirectCoverage.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/bootRedirectCoverage.test.tsx @@ -139,7 +139,9 @@ async function coverageAt(initialPath: string, ui: ReactNode) { /** * The invariant, phrased so a failure prints the reading that produced it. * `LoadingScreen` renders a full-viewport root (`div.h-screen.bg-background`), - * which is what "covered" has to mean — a stray text node would not do. + * which is what "covered" has to mean — a stray text node would not do. On an + * app route after the session read the gates draw the console's boot frame + * instead (`[data-boot-shell]`, objectstack#35981), full-viewport too. */ function expectCovered(reading: { covered: boolean; html: string }, site: string) { expect( @@ -149,7 +151,9 @@ function expectCovered(reading: { covered: boolean; html: string }, site: string `flash. Hand off with RedirectWithSplash, not a bare .`, ).toBe(true); expect( - screen.getByTestId(APP_ROOT).querySelector('div.h-screen.bg-background'), + // objectstack#35981 — or the console's boot frame (`ConsoleBootShell`), which + // an app route draws after the session read: the full-viewport chrome frame. + screen.getByTestId(APP_ROOT).querySelector('div.h-screen.bg-background, [data-boot-shell]'), `${site}: something rendered, but not the full-viewport splash — the page ` + `background still shows around it.`, ).toBeTruthy(); From a7138d5132b2e6071cedd81b96a5cd8f584b41bc Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 07:09:33 +0000 Subject: [PATCH 04/10] test(console): pay the chrome's lint load during collection in the boot-path test Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .../__tests__/AppContent.splashCriticalPath-12809.test.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx index 7cfcba0cc85..add82a57d07 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx @@ -31,6 +31,10 @@ */ import '@testing-library/jest-dom/vitest'; +// The chrome mounts here (ConsoleLayout -> DraftPreviewBar), whose lint +// helpers load `@objectstack/lint` lazily: pay that load during collection, +// not inside a case's clocked window (scripts/check-test-source-alias.mjs). +import '@objectstack/lint'; import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import React, { useEffect } from 'react'; import { act, cleanup, render, screen, waitFor } from '@testing-library/react'; From 759b08f6e5a550659ea00dbae3a28dd79ff240a2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Nov 2026 07:59:29 +0000 Subject: [PATCH 05/10] fix(console): the boot frame draws the chrome's shape on docs pages and phone record pages; static width utilities Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .changeset/35981-app-route-boot-frame.md | 2 +- .../src/console/ConsoleBootShell.tsx | 16 +++++++-- .../__tests__/ConsoleBootShell-35981.test.tsx | 36 +++++++++++++++++++ .../app-shell/src/layout/ConsoleLayout.tsx | 20 ++--------- .../app-shell/src/layout/consoleRoutePaths.ts | 26 ++++++++++++++ 5 files changed, 80 insertions(+), 20 deletions(-) create mode 100644 ui/packages/app-shell/src/layout/consoleRoutePaths.ts diff --git a/.changeset/35981-app-route-boot-frame.md b/.changeset/35981-app-route-boot-frame.md index aec24868e85..ce80e4f8365 100644 --- a/.changeset/35981-app-route-boot-frame.md +++ b/.changeset/35981-app-route-boot-frame.md @@ -10,6 +10,6 @@ Metadata-protocol: none Opening an app page by its URL (a reload, a pasted link) showed the full-screen splash until the permission answer, the app list, the admin verdict and the page's own metadata reads had all arrived. On a hosted environment the permission answer alone takes seconds. -- `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the top bar, the sidebar at the width the reader left it, the route's skeleton in the slot), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. +- `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the top bar, the sidebar at the width the reader left it, the route's skeleton in the slot; no sidebar on an app's docs pages and no top bar on a phone record page, as the chrome draws them), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. - `AppContent` mounts the console chrome once the app list, the permission answer and the admin verdict are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome. - The frame and the first route skeleton carry `data-boot-splash`, so readiness waits and the reads deferred to the first paint past the splash wait exactly as before; `data-boot-shell` tells the frame apart. diff --git a/ui/packages/app-shell/src/console/ConsoleBootShell.tsx b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx index 8b6851b51fb..7e727c01554 100644 --- a/ui/packages/app-shell/src/console/ConsoleBootShell.tsx +++ b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx @@ -36,6 +36,8 @@ import { AppShell } from '@object-ui/layout'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; import { CONSOLE_BELOW_TOP_BAR } from '../layout/consoleTopBar.js'; import { primeConsoleSidebarOpen } from '../layout/consoleSidebarRail.js'; +import { isAppDocsPath, isRecordPagePath } from '../layout/consoleRoutePaths.js'; +import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; import { SkeletonDashboard, SkeletonDetail, SkeletonGrid } from '../skeletons/index.js'; import { metadataReadsForAppRoute } from './appRouteMetadataReads.js'; @@ -57,7 +59,7 @@ export function RouteMetadataSkeleton({ reads, boot = false }: { reads: string; } /** Widths of the sidebar's grey rows, fixed so two frames draw the same rows. */ -const SIDEBAR_ROWS = ['72%', '58%', '80%', '64%', '50%', '68%']; +const SIDEBAR_ROWS = ['w-[72%]', 'w-[58%]', 'w-[80%]', 'w-[64%]', 'w-[50%]', 'w-[68%]']; /** * The console chrome's frame, empty: see the file header. Drawn on an app @@ -71,9 +73,17 @@ export function ConsoleBootShell() { const { pathname } = useLocation(); const appSubPath = pathname.split('/').filter(Boolean).slice(2).join('/'); const reads = metadataReadsForAppRoute(appSubPath, []); + // The shape the chrome will have on this route, from the same predicates + // `ConsoleLayout` reads, so nothing the frame draws is removed when the + // chrome lands: no app menu beside a docs page (objectstack#35424), no app + // bar on a phone record page, which draws its own (objectstack#28483). + const phone = usePhoneViewport(); + const docsPage = isAppDocsPath(pathname); + const recordPageOwnsTopBar = phone && isRecordPagePath(pathname); return (
@@ -82,6 +92,7 @@ export function ConsoleBootShell() {
} sidebar={ + docsPage ? undefined : ( @@ -89,13 +100,14 @@ export function ConsoleBootShell() { {SIDEBAR_ROWS.map((width, i) => (
- +
))}
+ ) } className="!p-0 overflow-y-auto overflow-x-hidden bg-muted/5 lg:flex lg:flex-col" > diff --git a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx index 13b7be30dfe..97e1118f47b 100644 --- a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx @@ -104,6 +104,42 @@ describe('the console boot fallback (objectstack#35981)', () => { expect(frame.querySelectorAll('a, button, input, [role="menuitem"], [role="link"]')).toHaveLength(0); }); + it('draws the shape the chrome will have: no app menu on a docs page, no app bar on a phone record page', () => { + // The frame reads the same predicates as `ConsoleLayout`, so nothing it + // draws is taken away when the chrome lands (objectstack#35424, #28483). + const width = window.innerWidth; + const setWidth = (w: number) => + Object.defineProperty(window, 'innerWidth', { value: w, configurable: true, writable: true }); + const sidebar = () => shell()!.querySelector('[data-sidebar="sidebar"]'); + const header = () => shell()!.querySelector('header'); + try { + setWidth(1440); + at('/apps/crm/docs/manual/intro', ); + expect(sidebar()).toBeNull(); + expect(header()).not.toBeNull(); + cleanup(); + + setWidth(390); + at(RECORD, ); + expect(header()).toBeNull(); + cleanup(); + + // Control: the app menu and the app bar wherever the chrome draws them. + at('/apps/crm/account', ); + expect(header()).not.toBeNull(); + cleanup(); + setWidth(1440); + for (const path of [RECORD, '/apps/crm/account', '/apps/crm/docsearch']) { + at(path, ); + expect(sidebar(), path).not.toBeNull(); + expect(header(), path).not.toBeNull(); + cleanup(); + } + } finally { + setWidth(width); + } + }); + it('keeps the splash while the session read is out, off an app route, and with no user', () => { authState.isLoading = true; at(RECORD, ); diff --git a/ui/packages/app-shell/src/layout/ConsoleLayout.tsx b/ui/packages/app-shell/src/layout/ConsoleLayout.tsx index b21e2bf15fd..b3e616d065a 100644 --- a/ui/packages/app-shell/src/layout/ConsoleLayout.tsx +++ b/ui/packages/app-shell/src/layout/ConsoleLayout.tsx @@ -32,6 +32,7 @@ import { AppHeader } from './AppHeader.js'; import { useResponsiveSidebar } from '../hooks/useResponsiveSidebar.js'; import { usePhoneNavDrawerHistory } from './usePhoneNavDrawerHistory.js'; import { usePhoneViewport } from '../hooks/usePhoneViewport.js'; +import { isAppDocsPath, isRecordPagePath } from './consoleRoutePaths.js'; import { primeConsoleSidebarOpen } from './consoleSidebarRail.js'; import { useAiSurfaceEnabled } from '../hooks/useAiSurface.js'; import { servedObjectLabel } from '../hooks/servedObjectLabel.js'; @@ -126,23 +127,8 @@ function SkipToContentLink({ targetRef }: { targetRef: React.RefObject Date: Sun, 22 Nov 2026 00:50:44 +0000 Subject: [PATCH 06/10] fix(console): the boot frame draws the chrome's new shape: no top bar from 768 px up, the sidebar's head and foot Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .changeset/35981-app-route-boot-frame.md | 2 +- .../src/console/ConsoleBootShell.tsx | 53 ++++++++++++++++--- .../__tests__/ConsoleBootShell-35981.test.tsx | 47 +++++++++------- 3 files changed, 75 insertions(+), 27 deletions(-) diff --git a/.changeset/35981-app-route-boot-frame.md b/.changeset/35981-app-route-boot-frame.md index ce80e4f8365..a0d16559d2f 100644 --- a/.changeset/35981-app-route-boot-frame.md +++ b/.changeset/35981-app-route-boot-frame.md @@ -10,6 +10,6 @@ Metadata-protocol: none Opening an app page by its URL (a reload, a pasted link) showed the full-screen splash until the permission answer, the app list, the admin verdict and the page's own metadata reads had all arrived. On a hosted environment the permission answer alone takes seconds. -- `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the top bar, the sidebar at the width the reader left it, the route's skeleton in the slot; no sidebar on an app's docs pages and no top bar on a phone record page, as the chrome draws them), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. +- `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the sidebar at the width the reader left it, from 768 px up with grey blocks where its head and foot put the app menu, the search, the bell and the account; the top bar on a phone, except on a record page, and on an app's docs pages, which have no sidebar; the route's skeleton in the slot: the shape the chrome draws on that route), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. - `AppContent` mounts the console chrome once the app list, the permission answer and the admin verdict are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome. - The frame and the first route skeleton carry `data-boot-splash`, so readiness waits and the reads deferred to the first paint past the splash wait exactly as before; `data-boot-shell` tells the frame apart. diff --git a/ui/packages/app-shell/src/console/ConsoleBootShell.tsx b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx index 7e727c01554..5b4ef4be673 100644 --- a/ui/packages/app-shell/src/console/ConsoleBootShell.tsx +++ b/ui/packages/app-shell/src/console/ConsoleBootShell.tsx @@ -9,8 +9,9 @@ * `/auth/me/permissions` (seconds, server-side, on a hosted environment) and * `AppContent`'s readiness gate (the app list and the admin verdict, * objectui#5619). Each used to draw the full-screen splash. They now draw - * {@link ConsoleBootShell}: the chrome's frame (the 48 px top bar, the sidebar - * at the width the reader left it, the route slot) with grey blocks in it and + * {@link ConsoleBootShell}: the chrome's frame (the sidebar at the width the + * reader left it, with its head and foot from 768 px up; the 48 px top bar on + * a phone and on a docs page; the route slot) with grey blocks in it and * the skeleton of the route the URL names in the slot. The real chrome takes * its place when the gates pass, at the same geometry. * @@ -31,7 +32,15 @@ import { useState } from 'react'; import { useInRouterContext, useLocation } from 'react-router-dom'; import { useAuth } from '@object-ui/auth'; -import { Sidebar, SidebarContent, SidebarGroup, SidebarMenu, Skeleton } from '@object-ui/components'; +import { + Sidebar, + SidebarContent, + SidebarFooter, + SidebarGroup, + SidebarHeader, + SidebarMenu, + Skeleton, +} from '@object-ui/components'; import { AppShell } from '@object-ui/layout'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; import { CONSOLE_BELOW_TOP_BAR } from '../layout/consoleTopBar.js'; @@ -75,15 +84,19 @@ export function ConsoleBootShell() { const reads = metadataReadsForAppRoute(appSubPath, []); // The shape the chrome will have on this route, from the same predicates // `ConsoleLayout` reads, so nothing the frame draws is removed when the - // chrome lands: no app menu beside a docs page (objectstack#35424), no app - // bar on a phone record page, which draws its own (objectstack#28483). + // chrome lands. From 768 px up an app draws no top bar: the app menu, the + // search and the bell sit in the sidebar's head and the account at its foot + // (objectstack#36112). A phone keeps the bar, except on a record page, + // which draws its own (objectstack#28483). A docs page mounts no sidebar + // and keeps the bar at every width (objectstack#35424). const phone = usePhoneViewport(); const docsPage = isAppDocsPath(pathname); const recordPageOwnsTopBar = phone && isRecordPagePath(pathname); + const desktopSidebar = !phone && !docsPage; return (
@@ -93,8 +106,23 @@ export function ConsoleBootShell() { } sidebar={ docsPage ? undefined : ( - - + + {desktopSidebar && ( + // Where the app menu (and the collapse button), the search and + // the bell will be: grey, since the app list decides the app. + +
+ + + +
+
+ + +
+
+ )} + {SIDEBAR_ROWS.map((width, i) => ( @@ -106,6 +134,15 @@ export function ConsoleBootShell() { + {desktopSidebar && ( + // Where the account menu will be. + +
+ + +
+
+ )}
) } diff --git a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx index 97e1118f47b..bc7a43a354a 100644 --- a/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/ConsoleBootShell-35981.test.tsx @@ -54,8 +54,8 @@ describe('the console boot fallback (objectstack#35981)', () => { expect(shell()).not.toBeNull(); // Still the boot wait: readiness waits and first-paint-deferred reads key on it. expect(shell()).toHaveAttribute('data-boot-splash'); - // The top bar and the route slot, the slot shaped like a record page. - expect(document.querySelector('header')).not.toBeNull(); + // The sidebar and the route slot, the slot shaped like a record page. + expect(document.querySelector('[data-sidebar="sidebar"]')).not.toBeNull(); expect(document.querySelector('[data-testid="route-metadata-skeleton"]')).not.toBeNull(); }); @@ -104,37 +104,48 @@ describe('the console boot fallback (objectstack#35981)', () => { expect(frame.querySelectorAll('a, button, input, [role="menuitem"], [role="link"]')).toHaveLength(0); }); - it('draws the shape the chrome will have: no app menu on a docs page, no app bar on a phone record page', () => { + it('draws the shape the chrome will have on each route and width', () => { // The frame reads the same predicates as `ConsoleLayout`, so nothing it - // draws is taken away when the chrome lands (objectstack#35424, #28483). + // draws is taken away when the chrome lands: from 768 px up no top bar, + // and the sidebar's head (app menu, search, bell) and foot (account) + // (objectstack#36112); a phone keeps the bar, but not on a record page + // (objectstack#28483); a docs page has no sidebar and keeps the bar at + // every width (objectstack#35424). const width = window.innerWidth; const setWidth = (w: number) => Object.defineProperty(window, 'innerWidth', { value: w, configurable: true, writable: true }); const sidebar = () => shell()!.querySelector('[data-sidebar="sidebar"]'); const header = () => shell()!.querySelector('header'); + const head = () => shell()!.querySelector('[data-boot-sidebar-head]'); + const foot = () => shell()!.querySelector('[data-boot-sidebar-foot]'); try { setWidth(1440); - at('/apps/crm/docs/manual/intro', ); - expect(sidebar()).toBeNull(); - expect(header()).not.toBeNull(); - cleanup(); + for (const path of [RECORD, '/apps/crm/account', '/apps/crm/docsearch']) { + at(path, ); + expect(header(), path).toBeNull(); + expect(sidebar(), path).not.toBeNull(); + expect(head(), path).not.toBeNull(); + expect(foot(), path).not.toBeNull(); + cleanup(); + } + for (const w of [1440, 375]) { + setWidth(w); + at('/apps/crm/docs/manual/intro', ); + expect(sidebar(), `docs @${w}`).toBeNull(); + expect(header(), `docs @${w}`).not.toBeNull(); + cleanup(); + } - setWidth(390); + setWidth(375); at(RECORD, ); expect(header()).toBeNull(); cleanup(); - - // Control: the app menu and the app bar wherever the chrome draws them. at('/apps/crm/account', ); expect(header()).not.toBeNull(); + // The phone drawer has no head or foot: the bar carries those. + expect(head()).toBeNull(); + expect(foot()).toBeNull(); cleanup(); - setWidth(1440); - for (const path of [RECORD, '/apps/crm/account', '/apps/crm/docsearch']) { - at(path, ); - expect(sidebar(), path).not.toBeNull(); - expect(header(), path).not.toBeNull(); - cleanup(); - } } finally { setWidth(width); } From 91efd0920aada4beff469aba698d6911ce1a7a35 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 01:27:16 +0000 Subject: [PATCH 07/10] fix(console): the chrome waits for the deployment flags its navigation gates read A navigation predicate naming a flag faulted and withheld its entry when /auth/config answered after the chrome mounted, which the chrome no longer waiting for the route's own reads made possible. Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .changeset/35981-app-route-boot-frame.md | 2 +- .../app-shell/src/console/AppContent.tsx | 19 +++++++++++++- ...tent.emptyNavigationLanding-12079.test.tsx | 11 +++++++- ...pContent.splashCriticalPath-12809.test.tsx | 26 +++++++++++++++++-- .../AppContent.unresolvedAdmin-5619.test.tsx | 21 ++++++++++----- 5 files changed, 67 insertions(+), 12 deletions(-) diff --git a/.changeset/35981-app-route-boot-frame.md b/.changeset/35981-app-route-boot-frame.md index a0d16559d2f..776b416f1b0 100644 --- a/.changeset/35981-app-route-boot-frame.md +++ b/.changeset/35981-app-route-boot-frame.md @@ -11,5 +11,5 @@ Metadata-protocol: none Opening an app page by its URL (a reload, a pasted link) showed the full-screen splash until the permission answer, the app list, the admin verdict and the page's own metadata reads had all arrived. On a hosted environment the permission answer alone takes seconds. - `LoadingFallback` (the console's boot-gate fallback) and `AppContent`'s readiness gate now draw `ConsoleBootShell` on an `/apps/:app/*` route once the session has answered with a user: the chrome's frame (the sidebar at the width the reader left it, from 768 px up with grey blocks where its head and foot put the app menu, the search, the bell and the account; the top bar on a phone, except on a record page, and on an app's docs pages, which have no sidebar; the route's skeleton in the slot: the shape the chrome draws on that route), with no app name, no navigation entry and nothing to press, because those are what the gates still decide. The splash stays for the session read itself and for every other route. The console's permission scope uses the same fallback. -- `AppContent` mounts the console chrome once the app list, the permission answer and the admin verdict are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome. +- `AppContent` mounts the console chrome once the app list, the permission answer, the admin verdict and the deployment flags (`/auth/config`, which the chrome's navigation gates read) are in; the route's own metadata reads no longer hold it on the first paint. The route slot draws the route's skeleton until they land, and a route element whose chunk is still loading draws the same skeleton instead of the full-screen splash inside the chrome. - The frame and the first route skeleton carry `data-boot-splash`, so readiness waits and the reads deferred to the first paint past the splash wait exactly as before; `data-boot-shell` tells the frame apart. diff --git a/ui/packages/app-shell/src/console/AppContent.tsx b/ui/packages/app-shell/src/console/AppContent.tsx index 0a562450364..e91f7ce69a5 100644 --- a/ui/packages/app-shell/src/console/AppContent.tsx +++ b/ui/packages/app-shell/src/console/AppContent.tsx @@ -332,15 +332,29 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // it empty until the fetch resolves so predicates default to "visible" // and we don't briefly hide UI on slow networks. const [features, setFeatures] = useState>({}); + // objectstack#35981 — whether that answer (or its failure) is in. The + // readiness gate below holds the chrome on it: the chrome's navigation + // gates bind `features`, and a navigation predicate that names a flag not + // bound yet FAULTS and withholds its entry (objectui#12700), so a chrome + // mounted before the answer would hide a flag-gated entry and then draw it. + // Until the chrome stopped waiting for the route's own reads, that answer + // was in first only by timing. + const [featuresSettled, setFeaturesSettled] = useState(false); useEffect(() => { let cancelled = false; + if (typeof getAuthConfig !== 'function') { + setFeaturesSettled(true); + return; + } getAuthConfig() .then((cfg) => { if (cancelled) return; setFeatures((cfg?.features as Record) ?? {}); + setFeaturesSettled(true); }) .catch(() => { /* leave empty — predicates default to visible */ + if (!cancelled) setFeaturesSettled(true); }); return () => { cancelled = true; @@ -1226,7 +1240,10 @@ export function AppContent({ extraRoutes, extraRoutesNoApp }: AppContentProps = // objectstack#35981 — while the gate holds, the console chrome's empty frame // (`ConsoleBootShell`), not the full-screen splash: it names no app and draws // no navigation entry, which is exactly what the inputs above decide. - if (!dataSource || metadataLoading || !isWorkspaceAdminResolved) return ; + // + // objectstack#35981 — and the deployment flags (`featuresSettled`, above): + // the chrome's navigation gates read them. + if (!dataSource || metadataLoading || !isWorkspaceAdminResolved || !featuresSettled) return ; if (routeReadsSettled) firstRouteDrawn.current = true; // ADR-0037 — preview mode renders its OWN empty/error states and never diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx index c171be81905..3e0e5366bde 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.emptyNavigationLanding-12079.test.tsx @@ -25,6 +25,10 @@ * are stubbed, as in `AppContent.inaccessibleAppStrand.test.tsx`. */ +// The chrome's lint helpers load `@objectstack/lint` lazily: pay that load +// during collection, not inside a case's clocked window +// (scripts/check-test-source-alias.mjs). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; @@ -79,11 +83,16 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({ /** The viewer under test: a `member` by default, a workspace admin where stated. */ let isWorkspaceAdmin = false; +// One function for every render, as `AuthProvider`'s `useCallback` gives: +// `AppContent` re-reads the deployment flags whenever it changes, and since +// objectstack#35981 its chrome waits for that answer, so a fresh function per +// render would re-ask on every render and starve the landing's redirects. +const getAuthConfig = vi.hoisted(() => async () => ({ features: {} })); vi.mock('@object-ui/auth', async (importOriginal) => ({ ...(await importOriginal>()), useAuth: () => ({ user: { id: 'u_1', name: 'Dev Admin', email: 'admin@objectos.ai', role: 'member' }, - getAuthConfig: async () => ({ features: {} }), + getAuthConfig, activeOrganization: { id: 'org_1', name: 'Org' }, }), useWorkspaceAdminStatus: () => ({ isAdmin: isWorkspaceAdmin, isResolved: true }), diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx index add82a57d07..0dba7e37297 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.splashCriticalPath-12809.test.tsx @@ -140,9 +140,11 @@ function deferred() { return { promise, resolve }; } -function createServer() { +function createServer({ holdConfig = false }: { holdConfig?: boolean } = {}) { const list = deferred(); const member = deferred(); + const config = deferred<{ features: Record }>(); + if (!holdConfig) config.resolve({ features: {} }); const client = { getSession: vi.fn(async () => ({ // `role: 'user'`, no positions: the verdict needs the member row. @@ -150,7 +152,7 @@ function createServer() { session: { token: 'tok-12809', activeOrganizationId: ORG.id }, })), signOut: vi.fn(async () => undefined), - getConfig: vi.fn(async () => ({ features: {} })), + getConfig: vi.fn(() => config.promise), listOrganizations: vi.fn(() => list.promise), // `get-full-organization`: never answers. The splash must not wait on it. getActiveOrganization: vi.fn(() => new Promise(() => {})), @@ -163,6 +165,7 @@ function createServer() { answerMember: () => act(async () => { member.resolve({ id: 'm1', organizationId: ORG.id, userId: USER, role: 'member' }); }), + answerConfig: () => act(async () => { config.resolve({ features: { cloudManaged: false } }); }), }; } @@ -246,6 +249,25 @@ describe('the console splash waits for the critical path only (objectui#12809)', for (const type of ['dashboard', 'report', 'page']) expect(meta.status[type]).toBeUndefined(); }); + it('objectstack#35981 — the chrome also waits for the deployment flags its navigation gates read', async () => { + // A navigation predicate naming a flag (`features.cloudManaged != true`) + // faults while no flags are bound and withholds its entry (objectui#12700): + // a chrome mounted before `/auth/config` answers would hide such an entry + // and then draw it. Once the chrome stopped waiting for the route's own + // reads, nothing but timing had put that answer first. + const { client, answerList, answerMember, answerConfig } = createServer({ holdConfig: true }); + boot(client, '/apps/crm/account'); + await waitFor(() => expect(client.listOrganizations).toHaveBeenCalledTimes(1)); + await answerList(); + await answerMember(); + expect(bootShellUp()).toBe(true); + expect(screen.queryByTestId('console-layout')).not.toBeInTheDocument(); + + await answerConfig(); + expect(bootShellUp()).toBe(false); + expect(screen.getByTestId('console-layout')).toBeInTheDocument(); + }); + it('CONTROL: a later route whose bucket has not landed shows its skeleton inside the chrome, then its content', async () => { const { client, answerList, answerMember } = createServer(); boot(client, '/apps/crm/account'); diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx index 89491a337f2..aa5f1b92ce6 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx @@ -40,6 +40,10 @@ * and the lazily-imported pages are stubbed. */ +// The chrome's lint helpers load `@objectstack/lint` lazily: pay that load +// during collection, not inside a case's clocked window +// (scripts/check-test-source-alias.mjs). +import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; @@ -176,7 +180,7 @@ describe('AppContent holds every admin-dependent decision until the verdict land expect(isHolding()).toBe(true); }); - it('lands the admin on the first-run surface once the verdict resolves', () => { + it('lands the admin on the first-run surface once the verdict resolves', async () => { viewer.isResolved = false; const { rerender } = renderConsoleAt('/apps/setup'); expect(isHolding()).toBe(true); @@ -193,11 +197,11 @@ describe('AppContent holds every admin-dependent decision until the verdict land , ); - expect(screen.getByTestId('create-first-app-btn')).toBeInTheDocument(); + expect(await screen.findByTestId('create-first-app-btn')).toBeInTheDocument(); expect(pathname()).toBe('/apps/setup'); }); - it('withholds the chrome — and the admin nav it carries — until the verdict lands', () => { + it('withholds the chrome — and the admin nav it carries — until the verdict lands', async () => { // The hide-affordance shape, at the mount point that owns it. `UnifiedSidebar` // and `AppHeader` build their admin cluster from this verdict; rendering them // during the window is what dropped the entry and added it back. @@ -219,7 +223,7 @@ describe('AppContent holds every admin-dependent decision until the verdict land , ); - expect(screen.getByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); + expect(await screen.findByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); expect(screen.getByTestId('app-chrome')).toBeInTheDocument(); }); @@ -234,14 +238,17 @@ describe('AppContent holds every admin-dependent decision until the verdict land expect(pathname()).toBe('/home'); }); - it('MUST NOT CHANGE — a resolved viewer with an accessible app enters it with no extra wait', () => { + it('MUST NOT CHANGE — a resolved viewer with an accessible app enters it with no extra wait', async () => { // The cost boundary: resolution gates the surface, it does not delay a - // viewer whose verdict is already in hand. + // viewer whose verdict is already in hand. objectstack#35981 — the chrome + // also waits for the deployment flags (`/auth/config`), which its + // navigation gates read; the mock answers them at once, so the only wait + // left is that answer's promise, never the admin verdict. metadataApps = [{ name: 'crm', label: 'CRM', navigation: [] }]; viewer.isAdmin = true; viewer.isResolved = true; renderConsoleAt('/apps/crm'); - expect(screen.getByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); + expect(await screen.findByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); }); }); From 423bf5b71899f9f6de0c9e230115d0fe9f3ae34a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 01:46:09 +0000 Subject: [PATCH 08/10] test(console): the system-hub redirects wait for the chrome, which waits for the deployment flags Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .../AppContent.systemHubRoutes.test.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx b/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx index 502037fa1c4..600e40dbc98 100644 --- a/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx +++ b/ui/apps/console/src/__tests__/AppContent.systemHubRoutes.test.tsx @@ -91,7 +91,7 @@ import '@testing-library/jest-dom/vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; -import { render, screen, fireEvent } from '@testing-library/react'; +import { render, screen, fireEvent, waitFor } from '@testing-library/react'; import { MemoryRouter, Routes, Route, Navigate, useLocation, useParams } from 'react-router-dom'; // AGENTS.md §测试纪律 — the lazily-imported page modules are stubbed so no @@ -187,11 +187,14 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({ // on that chrome-less screen (pinned in // `packages/app-shell/src/console/__tests__/AppContent.inaccessibleAppStrand.test.tsx`). // The legacy `/system/*` redirect targets this file measures are unchanged. +// One function for every render, as `AuthProvider`'s `useCallback` gives +// (objectstack#35981: the chrome waits for its answer). +const getAuthConfig = vi.hoisted(() => async () => ({ features: {} })); vi.mock('@object-ui/auth', async (importOriginal) => ({ ...(await importOriginal>()), useAuth: () => ({ user: null, - getAuthConfig: async () => ({ features: {} }), + getAuthConfig, activeOrganization: null, }), useWorkspaceAdminStatus: () => ({ isAdmin: true, isResolved: true }), @@ -287,20 +290,22 @@ describe('system-hub entries reach the framework system objects (objectui#3655)' expect(screen.queryByText('Page not found')).not.toBeInTheDocument(); }); - it('preserves the app prefix rather than stripping to the root', () => { + it('preserves the app prefix rather than stripping to the root', async () => { // `prefix` is cut with a regex off `location.pathname`; every case above // uses the same two-segment prefix, so a mistake there is invisible in them. renderConsoleAt('/apps/my-app/system/users'); - expect(chain).toEqual(['/apps/my-app/system/users', '/apps/my-app/sys_user']); + // objectstack#35981 — the chrome (and the routes under it) mount once the + // deployment flags have answered, a promise even when answered at once. + await waitFor(() => expect(chain).toEqual(['/apps/my-app/system/users', '/apps/my-app/sys_user'])); }); - it('an app segment spelled `system` survives the rewrite', () => { + it('an app segment spelled `system` survives the rewrite', async () => { // The regex is end-anchored precisely so the LAST `/system/` is the // one removed. An unanchored cut would leave `/apps` here. renderConsoleAt('/apps/system/system/users'); - expect(chain).toEqual(['/apps/system/system/users', '/apps/system/sys_user']); + await waitFor(() => expect(chain).toEqual(['/apps/system/system/users', '/apps/system/sys_user'])); }); /** From 0865f613ed2b5972ae4b267eb819f76a5d33fa57 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 01:58:19 +0000 Subject: [PATCH 09/10] test(console): the chunk-preload case waits for the chrome, which waits for the deployment flags Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .../__tests__/AppContent.routeChunkPreload-12980.test.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx index 76b244515bc..d052c09351a 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.routeChunkPreload-12980.test.tsx @@ -252,8 +252,10 @@ describe('the route element chunk loads beside the route reads (objectui#12980)' await waitFor(() => expect(chunks.page.requested).toBe(true)); expect(chunks.page.splashUpWhenRequested).toBe(true); expect(splashUp()).toBe(true); - // objectstack#35981 — the chrome is up; the route's skeleton is the boot wait. - expect(screen.getByTestId('console-layout')).toBeInTheDocument(); + // objectstack#35981 — the chrome comes up (once the deployment flags have + // answered, a promise apart from the chunk's); the route's skeleton is the + // boot wait. + await waitFor(() => expect(screen.getByTestId('console-layout')).toBeInTheDocument()); expect(screen.getByTestId('route-metadata-skeleton')).toHaveAttribute('data-boot-splash'); expect(meta.status.page).toBe('loading'); From d261997ae0095675f4d57d5c93187bbf3e17e92e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 02:26:01 +0000 Subject: [PATCH 10/10] test(console): the no-extra-wait pin admits one flush for the deployment flags, then reads the chrome synchronously Claude-Session: https://claude.ai/code/session_01L6bhgWwKdjqiYQSujUXhn7 Co-authored-by: Claude --- .../AppContent.unresolvedAdmin-5619.test.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx b/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx index aa5f1b92ce6..760cf37f315 100644 --- a/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx +++ b/ui/packages/app-shell/src/console/__tests__/AppContent.unresolvedAdmin-5619.test.tsx @@ -47,7 +47,7 @@ import '@objectstack/lint'; import '@testing-library/jest-dom/vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import React from 'react'; -import { render, screen } from '@testing-library/react'; +import { act, render, screen } from '@testing-library/react'; import { MemoryRouter, Routes, Route, Navigate, useLocation } from 'react-router-dom'; vi.mock('@object-ui/plugin-designer', async (importOriginal) => ({ @@ -85,11 +85,14 @@ vi.mock('@object-ui/i18n', async (importOriginal) => ({ /** The verdict AND its resolution — the axis this suite exists for. */ const viewer = vi.hoisted(() => ({ isAdmin: false, isResolved: true })); +// One function for every render, as `AuthProvider`'s `useCallback` gives +// (objectstack#35981: the chrome waits for its answer, asked once). +const getAuthConfig = vi.hoisted(() => async () => ({ features: {} })); vi.mock('@object-ui/auth', async (importOriginal) => ({ ...(await importOriginal>()), useAuth: () => ({ user: { id: 'u_owner', name: 'Owner', email: 'owner@example.com', role: 'user' }, - getAuthConfig: async () => ({ features: {} }), + getAuthConfig, activeOrganization: { id: 'org_1', name: 'Acme' }, }), useWorkspaceAdminStatus: () => ({ isAdmin: viewer.isAdmin, isResolved: viewer.isResolved }), @@ -242,13 +245,15 @@ describe('AppContent holds every admin-dependent decision until the verdict land // The cost boundary: resolution gates the surface, it does not delay a // viewer whose verdict is already in hand. objectstack#35981 — the chrome // also waits for the deployment flags (`/auth/config`), which its - // navigation gates read; the mock answers them at once, so the only wait - // left is that answer's promise, never the admin verdict. + // navigation gates read; the mock answers them at once, so the one wait + // admitted is that answer's promise: a single flush, then the chrome must + // be there. metadataApps = [{ name: 'crm', label: 'CRM', navigation: [] }]; viewer.isAdmin = true; viewer.isResolved = true; renderConsoleAt('/apps/crm'); + await act(async () => {}); - expect(await screen.findByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); + expect(screen.getByTestId('console-layout')).toHaveAttribute('data-active-app', 'crm'); }); });