From c93fadf835fca327c7d0ef640dd07a1b205497f4 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 04:50:10 +0000 Subject: [PATCH 1/4] perf(console): lazy boundaries on the object list route and its record pane (WIP) Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude --- .../app-shell/src/console/AppContent.tsx | 14 +++++++--- .../src/views/objectViewRecordOverlay.tsx | 26 ++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/ui/packages/app-shell/src/console/AppContent.tsx b/ui/packages/app-shell/src/console/AppContent.tsx index cac70ffda9c..5aad87a72da 100644 --- a/ui/packages/app-shell/src/console/AppContent.tsx +++ b/ui/packages/app-shell/src/console/AppContent.tsx @@ -52,10 +52,10 @@ import { ErrorBoundary } from '../chrome/ErrorBoundary.js'; import { LoadingScreen } from '../chrome/LoadingScreen.js'; import { BackToHomeButton, NotFoundState } from '../components/NotFoundState.js'; import { RedirectWithSplash } from '../chrome/RedirectWithSplash.js'; -import { ObjectView } from '../views/ObjectView.js'; -// objectui#13052 — on its own line: the line above is the eager-walk control -// `scripts/__tests__/vite-declared-lazy-views.test.ts` reads verbatim. -import { ObjectNotFoundState } from '../views/ObjectView.js'; +// `ObjectNotFoundState` from its own module, not through `ObjectView`: the +// object list is a lazy route element below, and a by-value import of its +// module here would hold the whole list (and the grid it draws) eager. +import { ObjectNotFoundState } from '../views/objectViewChrome.js'; import { KeyboardShortcutsDialog } from '../chrome/KeyboardShortcutsDialog.js'; import { OnboardingWalkthrough } from '../chrome/OnboardingWalkthrough.js'; import { RouteFader } from '../chrome/RouteFader.js'; @@ -138,6 +138,10 @@ const SearchResultsPage = routeChunk.lazy(() => import('../views/SearchResultsPa const RecordFormPage = routeChunk.lazy(() => import('../views/RecordFormPage.js').then(m => m.RecordFormPage)); const ComponentNavView = routeChunk.lazy(() => import('../views/ComponentNavView.js').then(m => m.ComponentNavView)); const ObjectDataPage = routeChunk.lazy(() => import('../views/ObjectDataPage.js').then(m => m.ObjectDataPage)); +// The object list (the default list and a saved list view): a route element +// like the rest, so a first load that opens a dashboard or a page does not +// download the list, its record pane and the grid they draw. +const ObjectView = routeChunk.lazy(() => import('../views/ObjectView.js').then(m => m.ObjectView)); // Metadata admin — mounted under /apps/:app/metadata for the datasource // alone (objectstack ADR-0146 D1): every other type's URL there opens Studio's @@ -165,6 +169,8 @@ const MarketplacePackagePage = routeChunk.lazy(() => import('./marketplace/Marke * them). A path not listed renders an eagerly bundled element. */ const APP_ROUTE_CHUNKS: ReadonlyArray<{ path: string; chunk: { preload: () => Promise } }> = [ + { path: ':objectName', chunk: ObjectView }, + { path: ':objectName/view/:viewId', chunk: ObjectView }, { path: ':objectName/new', chunk: RecordFormPage }, { path: ':objectName/data', chunk: ObjectDataPage }, { path: ':objectName/record/:recordId', chunk: RecordDetailView }, diff --git a/ui/packages/app-shell/src/views/objectViewRecordOverlay.tsx b/ui/packages/app-shell/src/views/objectViewRecordOverlay.tsx index 72a4e00cb9b..59f0f400acf 100644 --- a/ui/packages/app-shell/src/views/objectViewRecordOverlay.tsx +++ b/ui/packages/app-shell/src/views/objectViewRecordOverlay.tsx @@ -18,15 +18,19 @@ * and its counter names the list's view (`stepScope`). */ -import type { ReactNode } from 'react'; +import { lazy, Suspense, type ReactNode } from 'react'; import type { NavigationOverlayMode } from '@object-ui/components'; -import { RecordDetailView } from './RecordDetailView.js'; +import { SkeletonDetail } from '../skeletons/index.js'; import { RecordStackDrawer, useRecordDrawerStack } from './recordDrawerStack.js'; import type { useObjectViewRecordNavigation } from './objectViewRecordNavigation.js'; import type { ConsoleObjectViewProps } from './ObjectView.js'; type RecordNavigation = ReturnType; +// The record view is fetched the first time a record opens here, not with the +// list: a list that never opens a record never downloads it. +const RecordDetailView = lazy(() => import('./RecordDetailView.js').then((m) => ({ default: m.RecordDetailView }))); + export function ObjectViewRecordOverlay({ navOverlay, mode, @@ -74,14 +78,16 @@ export function ObjectViewRecordOverlay({ storageKey={`drawer-width:${objectDef.name}`} objects={objects} renderRecord={(level) => ( - + }> + + )} /> ); From 385a9735f2277f9317e564a48102d849a73dfba6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 04:58:35 +0000 Subject: [PATCH 2/4] build(console): the eager-walk control and the side-effectful lazy ledger follow the new boundaries (WIP) Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude --- .../vite-declared-lazy-views.test.ts | 2 +- ui/scripts/vite-declared-lazy-views.ts | 92 ++++++++++++++----- 2 files changed, 69 insertions(+), 25 deletions(-) diff --git a/ui/scripts/__tests__/vite-declared-lazy-views.test.ts b/ui/scripts/__tests__/vite-declared-lazy-views.test.ts index aa51c6781b9..f88b9504da2 100644 --- a/ui/scripts/__tests__/vite-declared-lazy-views.test.ts +++ b/ui/scripts/__tests__/vite-declared-lazy-views.test.ts @@ -254,7 +254,7 @@ describe('EAGER_WALK_CONTROL', () => { // means anything while AppContent still imports it outside a `lazy()`. expect(fs.existsSync(path.join(REPO_ROOT, EAGER_WALK_CONTROL))).toBe(true); const appContent = read(APP_CONTENT_PATH); - expect(appContent).toContain("import { ObjectView } from '../views/ObjectView.js';"); + expect(appContent).toContain("import { ConsoleLayout } from '../layout/ConsoleLayout.js';"); expect(parseDeclaredLazyViews(appContent)).not.toContain(EAGER_WALK_CONTROL); }); }); diff --git a/ui/scripts/vite-declared-lazy-views.ts b/ui/scripts/vite-declared-lazy-views.ts index 4edb6a47343..48590c1c538 100644 --- a/ui/scripts/vite-declared-lazy-views.ts +++ b/ui/scripts/vite-declared-lazy-views.ts @@ -76,14 +76,15 @@ import type { Plugin, Rollup } from 'vite'; * * ## Defect 2 — edges the barrel has nothing to do with (three views) * - * `RecordDetailView` is eager for an honest reason and stays eager: - * `packages/app-shell/src/views/ObjectView.tsx` imports it statically, and - * `ObjectView` is in AppContent's own "eagerly loaded — always needed" block. - * Its `lazy()` is defeated by a genuine dependency, not by a barrel. It is - * therefore PINNED in {@link DECLARED_LAZY_VIEWS_STILL_EAGER} rather than - * quietly declared pure — and it is not declared pure for a second, independent - * reason: it carries a bare `import './record-approvals-renderer.js'`, so the - * claim would be false. + * `RecordDetailView` was eager for an honest reason: + * `packages/app-shell/src/views/ObjectView.tsx` imported it statically, and + * `ObjectView` was in AppContent's own "eagerly loaded — always needed" block. + * Its `lazy()` was defeated by a genuine dependency, not by a barrel. Both edges + * are now `lazy()` (objectstack#33581: `ObjectView` is a route element and its + * record pane loads the view on demand), so its pin is gone. It is still not + * declared pure, for a second, independent reason: it carries a bare + * `import './record-approvals-renderer.js'`, so the claim would be false — see + * {@link DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS}. * * `RecordFormPage` and `ReportView` are eager for a third reason, and it is the * one no `grep` over the source will show: CHUNK CO-TENANCY. Rolldown emits each @@ -153,10 +154,11 @@ import type { Plugin, Rollup } from 'vite'; * 1. Every declared view must be found in SOME chunk, eager or lazy. A view * that matches nothing at all means the module-id matcher stopped matching, * not that the bundle improved. - * 2. `ObjectView` — imported statically by AppContent's always-needed block — - * must be found EAGER. It is the positive control in the same query shape: - * if the eager walk cannot see a module that is eager by construction, its - * zeroes are not measurements. + * 2. `ConsoleLayout` — imported statically by AppContent's always-needed + * block — must be found EAGER. It is the positive control in the same query + * shape: if the eager walk cannot see a module that is eager by + * construction, its zeroes are not measurements. (`ObjectView` was the + * control until it became a `lazy()` route element itself, objectstack#33581.) */ /** Repo root — this file lives in `scripts/`, one level below it. */ @@ -170,11 +172,12 @@ export const APP_CONTENT_PATH = 'packages/app-shell/src/console/AppContent.tsx'; /** * The positive control for the eager walk: - * `packages/app-shell/src/views/ObjectView.tsx`, statically imported by - * {@link APP_CONTENT_PATH}'s "eagerly loaded — always needed" block, so it is - * eager by construction. See counter-probe 2 in the header. + * `packages/app-shell/src/layout/ConsoleLayout.tsx`, statically imported by + * {@link APP_CONTENT_PATH}'s "eagerly loaded — always needed" block and drawn + * around every route, so it is eager by construction. See counter-probe 2 in + * the header. */ -export const EAGER_WALK_CONTROL = 'packages/app-shell/src/views/ObjectView.tsx'; +export const EAGER_WALK_CONTROL = 'packages/app-shell/src/layout/ConsoleLayout.tsx'; /** * Declared-`lazy()` modules that are in the eager closure anyway, with the @@ -182,13 +185,11 @@ export const EAGER_WALK_CONTROL = 'packages/app-shell/src/views/ObjectView.tsx'; * (`scripts/__tests__/vite-declared-lazy-views.test.ts` checks that, and that * every entry still names a file that exists). * - * ONE entry stands, and it does not stand for the barrel re-export - * objectui#6535 removed: - * - * - `packages/app-shell/src/views/RecordDetailView.tsx` — a real static edge. - * `packages/app-shell/src/views/ObjectView.tsx` imports it by name, and - * `ObjectView` sits in AppContent's own "eagerly loaded — always needed" - * block. Splitting it would mean giving `ObjectView` a lazy boundary. + NO entry stands. The last one was the record view, held by a real static + * edge: the object list imported it by name, and the list sat in AppContent's + * own "eagerly loaded — always needed" block. objectstack#33581 gave both a + * `lazy()` boundary, the `missing` half below fired on that build, and the line + * was deleted because the build said so. * * ## `views/metadata-admin/index.ts` was the third removal — objectui#6776 * @@ -277,7 +278,23 @@ export const EAGER_WALK_CONTROL = 'packages/app-shell/src/views/ObjectView.tsx'; * became lazy" from "the matcher stopped matching", and it ran green on the * same build. */ -export const DECLARED_LAZY_VIEWS_STILL_EAGER: readonly string[] = Object.freeze([ +export const DECLARED_LAZY_VIEWS_STILL_EAGER: readonly string[] = Object.freeze([]); + +/** + * Declared-`lazy()` modules this plugin weighs like every other declared view + * (one found eager and unpinned still fails the build) but never declares + * `moduleSideEffects: false`, because each carries a side effect of its own. + * Kept sorted and deduplicated; the plugin refuses an entry whose source no + * longer carries a bare side-effect import and that its package's `sideEffects` + * array does not name, so a stale entry cannot keep a pure view undeclared. + * + * - `packages/app-shell/src/views/RecordDetailView.tsx` — bare-imports + * `./record-approvals-renderer.js`, the `record:approvals` registration. + * It is lazy without the declaration: nothing in the eager graph reaches it + * but the package barrel, which the package's own `sideEffects` array + * already leaves shakeable for it. + */ +export const DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS: readonly string[] = Object.freeze([ 'packages/app-shell/src/views/RecordDetailView.tsx', ]); @@ -496,6 +513,8 @@ export interface DeclaredLazyViewsOptions { readonly appContentPath?: string; /** Ledger of declared-lazy views that are eager anyway. */ readonly pinnedEager?: readonly string[]; + /** Ledger of declared-lazy views that carry a side effect, never declared pure. */ + readonly sideEffectfulLazy?: readonly string[]; /** Repo root the repo-relative paths are resolved against. */ readonly repoRoot?: string; } @@ -509,6 +528,7 @@ export function viteDeclaredLazyViews(options: DeclaredLazyViewsOptions = {}): P const repoRoot = options.repoRoot ?? REPO_ROOT; const appContentPath = options.appContentPath ?? APP_CONTENT_PATH; const pinnedEager = options.pinnedEager ?? DECLARED_LAZY_VIEWS_STILL_EAGER; + const sideEffectfulLazy = options.sideEffectfulLazy ?? DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS; /** Repo-relative view paths parsed from AppContent, filled in `buildStart`. */ let declared: string[] = []; @@ -563,10 +583,34 @@ export function viteDeclaredLazyViews(options: DeclaredLazyViewsOptions = {}): P } const pinnedSet = new Set(pinnedEager); + const sideEffectfulSet = new Set(sideEffectfulLazy); const next = new Set(); for (const view of declared) { if (pinnedSet.has(view)) continue; + // A view that carries a side effect is left undeclared, and the entry + // must still be true: a view that lost its side effect is declared pure + // like the rest, never kept out by a stale line. + if (sideEffectfulSet.has(view)) { + const owner = nearestPackage(view, repoRoot); + const arrayClaim = owner + ? declaredSideEffectful( + (JSON.parse(fs.readFileSync(abs(owner.packageJsonPath), 'utf8')) as { sideEffects?: unknown }) + .sideEffects, + owner.packageRelative, + ) + : null; + if (!arrayClaim && !bareSideEffectImport(fs.readFileSync(abs(view), 'utf8'))) { + this.error( + `[declared-lazy-views] \`${view}\` is in DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS but ` + + `carries no bare side-effect import and its package's \`sideEffects\` array does ` + + `not name it, so nothing stops it being declared pure. Delete the line and say so ` + + `in the PR.`, + ); + } + continue; + } + // Guard 1 — the package's own published claim. Checked FIRST because it // is the one that catches a top-level registration CALL, which the // source-reading guard below cannot see (objectui#6681). From 4716ef8985e1449dd6c08bf6db4191e3a07ff732 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 05:00:47 +0000 Subject: [PATCH 3/4] perf(console): the list view and gallery register as lazy stubs (WIP) Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude --- ui/apps/console/src/register-plugins.ts | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/ui/apps/console/src/register-plugins.ts b/ui/apps/console/src/register-plugins.ts index 1b73961dd4e..9e32b27df4b 100644 --- a/ui/apps/console/src/register-plugins.ts +++ b/ui/apps/console/src/register-plugins.ts @@ -25,12 +25,12 @@ import { ComponentRegistry } from '@object-ui/core'; -// Eager imports — core views needed on most pages. These are cheap (no heavy -// 3rd-party deps) so paying their cost upfront is the right tradeoff. +// Eager imports — core views the console shell itself imports by name today +// (the shell's own helpers and record surfaces reach these four packages' +// entries), so a lazy stub here would move nothing out of the first load. import '@object-ui/plugin-grid'; import '@object-ui/plugin-form'; import '@object-ui/plugin-view'; -import '@object-ui/plugin-list'; import '@object-ui/plugin-detail'; // Lazy plugins — registered as deferred loaders. The first time the @@ -42,6 +42,23 @@ import '@object-ui/plugin-detail'; // A lazily-registered tag is still a full member of the public contract: // `getPublicConfigs()` resolves these stubs, so `kind:'react'` pages get them // in scope before the chunk loads (objectui#2953). +// The list view and the gallery: nothing on the first load imports +// `@object-ui/plugin-list` by name, so each tag it registers is a stub that +// loads the package the first time a schema names it. +ComponentRegistry.registerLazy('list-view', () => import('@object-ui/plugin-list'), { + namespace: 'plugin-list', + category: 'Views', +}); +ComponentRegistry.registerLazy('list', () => import('@object-ui/plugin-list'), { + namespace: 'view', + skipFallback: true, + category: 'view', +}); +ComponentRegistry.registerLazy('object-gallery', () => import('@object-ui/plugin-list'), { + namespace: 'plugin-list', + category: 'view', +}); + ComponentRegistry.registerLazy('object-map', () => import('@object-ui/plugin-map'), { namespace: 'plugin-map', category: 'view', From b54299929fa4b10c9f5d5a97a4ea71b3d4c4bc74 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 05:11:47 +0000 Subject: [PATCH 4/4] test(console): registry suites load plugin-list beside its lazy stubs; changeset Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude --- ...1-console-eager-closure-list-and-record.md | 10 ++++ ...erDataSourceInputDeclaration-6678.test.tsx | 5 +- .../src/__tests__/public-contract.test.ts | 1 + .../registry-inputs-spec-parity.test.ts | 4 ++ .../vite-declared-lazy-views.test.ts | 52 +++++++++++++++---- 5 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 .changeset/33581-console-eager-closure-list-and-record.md diff --git a/.changeset/33581-console-eager-closure-list-and-record.md b/.changeset/33581-console-eager-closure-list-and-record.md new file mode 100644 index 00000000000..bc95a4431f7 --- /dev/null +++ b/.changeset/33581-console-eager-closure-list-and-record.md @@ -0,0 +1,10 @@ +--- +'@object-ui/console': patch +--- + +perf(console): the first load no longer downloads the object list, the record view and the list view package + +Clause-②: no +Metadata-protocol: none + +Every Console route, a dashboard included, used to download the object list (the default list and a saved list view), the record view its drawer draws, and `@object-ui/plugin-list` (the list view and the gallery) before the app asked for any data. The object list now loads like the other route pages, its download starting as soon as the route is known; the record view loads the first time a record opens in the drawer; and the `list-view`, `view:list` and `object-gallery` registrations are lazy stubs that load the package the first time a schema names one of them. The Console's eager closure (`dist/eager-closure.json`) goes from 2,165,721 to 2,060,434 bytes gzipped (−105,287). What each route draws is unchanged; a record opened in the drawer shows the detail skeleton while its code arrives. diff --git a/ui/apps/console/src/__tests__/htmlTierDataSourceInputDeclaration-6678.test.tsx b/ui/apps/console/src/__tests__/htmlTierDataSourceInputDeclaration-6678.test.tsx index 2f2f6a2eb7f..1cafc0699fd 100644 --- a/ui/apps/console/src/__tests__/htmlTierDataSourceInputDeclaration-6678.test.tsx +++ b/ui/apps/console/src/__tests__/htmlTierDataSourceInputDeclaration-6678.test.tsx @@ -70,9 +70,12 @@ import type { Diagnostic } from '@objectstack/sdui-parser'; // The full registration graph — the same pair `dev/manifest-dump.tsx` builds the // published artifacts from, and the pair every live-path suite in this directory -// reads. `list-view` and the REAL `object-grid` both arrive through it. +// reads. The REAL `object-grid` arrives through it; `list-view` is a lazy stub +// there, so its package is loaded here too, the way `dev/manifest-registry.ts` +// loads it before reading the published manifest. import '@object-ui/components'; import '../register-plugins'; +import '@object-ui/plugin-list'; const OBJECT = 'opportunity'; diff --git a/ui/apps/console/src/__tests__/public-contract.test.ts b/ui/apps/console/src/__tests__/public-contract.test.ts index a611abe27ff..2ddbf531054 100644 --- a/ui/apps/console/src/__tests__/public-contract.test.ts +++ b/ui/apps/console/src/__tests__/public-contract.test.ts @@ -144,6 +144,7 @@ const EXPECTED_UNIMPLEMENTED: string[] = []; * plugins below, move that tag out of this list — it is still covered. */ const EXPECTED_LAZY = [ + 'list-view', 'object-kanban', 'object-calendar', 'object-gantt', diff --git a/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts b/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts index 33b52fc5c2a..5a94a0d214e 100644 --- a/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts +++ b/ui/apps/console/src/__tests__/registry-inputs-spec-parity.test.ts @@ -310,6 +310,10 @@ import '@object-ui/plugin-tree'; import '@object-ui/plugin-map'; import '@object-ui/plugin-gantt'; import '@object-ui/plugin-timeline'; +// The same remedy for `list-view`, which the console registers as a lazy stub +// since its first load stopped carrying `@object-ui/plugin-list` +// (objectstack#33581): without this import the block leaves `covered`. +import '@object-ui/plugin-list'; /** This block's spec props schema, or `undefined` when this pin has none. */ const specSchema = (type: string): unknown => (ComponentPropsMap as Record)[type]; diff --git a/ui/scripts/__tests__/vite-declared-lazy-views.test.ts b/ui/scripts/__tests__/vite-declared-lazy-views.test.ts index f88b9504da2..87ccd8cff52 100644 --- a/ui/scripts/__tests__/vite-declared-lazy-views.test.ts +++ b/ui/scripts/__tests__/vite-declared-lazy-views.test.ts @@ -5,6 +5,7 @@ import { attachedDocs } from './helpers/attached-docs'; import { APP_CONTENT_PATH, DECLARED_LAZY_VIEWS_STILL_EAGER, + DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS, EAGER_WALK_CONTROL, bareSideEffectImport, declaredSideEffectful, @@ -53,6 +54,28 @@ describe('DECLARED_LAZY_VIEWS_STILL_EAGER', () => { }); }); +describe('DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS', () => { + it('is sorted, free of duplicates, and names declared-lazy files that exist', () => { + const entries = [...DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS]; + expect(entries).toEqual([...new Set(entries)]); + expect(entries).toEqual([...entries].sort()); + const declared = parseDeclaredLazyViews(read(APP_CONTENT_PATH)); + for (const entry of entries) { + expect(fs.existsSync(path.join(REPO_ROOT, entry)), entry).toBe(true); + expect(declared, `${entry} is listed but no longer declared lazy`).toContain(entry); + } + }); + + it('lists only views that really carry a side effect, and none the eager ledger pins', () => { + // The plugin refuses a stale entry at build time; this is the same claim + // read from the sources, so a pure view cannot sit here undeclared. + for (const entry of DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS) { + expect(bareSideEffectImport(read(entry)), entry).not.toBeNull(); + expect(DECLARED_LAZY_VIEWS_STILL_EAGER, entry).not.toContain(entry); + } + }); +}); + describe('parseDeclaredLazyViews', () => { it('finds every relative module AppContent declares, resolved to real files', () => { const declared = parseDeclaredLazyViews(read(APP_CONTENT_PATH)); @@ -61,15 +84,16 @@ describe('parseDeclaredLazyViews', () => { // vacuously. Eight single-file route views (objectui#6535), the // metadata-admin directory barrel that six declarations share, and the two // marketplace pages (objectui#6681 measured three; objectui#12733 retired the - // Installed Apps one), and the app's report index (objectui#13020) = twelve - // distinct files. - expect(declared).toHaveLength(12); + // Installed Apps one), the app's report index (objectui#13020) and the + // object list (objectstack#33581) = thirteen distinct files. + expect(declared).toHaveLength(13); for (const view of declared) { expect(fs.existsSync(path.join(REPO_ROOT, view)), view).toBe(true); } expect(declared).toContain('packages/app-shell/src/views/ObjectDataPage.tsx'); expect(declared).toContain('packages/app-shell/src/views/ComponentNavView.tsx'); expect(declared).toContain('packages/app-shell/src/views/AppReportIndexView.tsx'); + expect(declared).toContain('packages/app-shell/src/views/ObjectView.tsx'); // The three surfaces objectui#6535 deliberately looked away from and // objectui#6681 measured. Named individually: a bare length assertion goes // on passing if the widened matcher swaps one surface for another. @@ -147,8 +171,9 @@ describe('bareSideEffectImport', () => { it('agrees with the real sources: every unpinned declared view is pure', () => { // The plugin declares `moduleSideEffects: false` for exactly the declared - // views it has NOT pinned, so this is the claim it makes about this repo. - const pinned = new Set(DECLARED_LAZY_VIEWS_STILL_EAGER); + // views it has neither pinned nor listed as side-effectful, so this is the + // claim it makes about this repo. + const pinned = new Set([...DECLARED_LAZY_VIEWS_STILL_EAGER, ...DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS]); const declared = parseDeclaredLazyViews(read(APP_CONTENT_PATH)); const unpinned = declared.filter((view) => !pinned.has(view)); expect(unpinned.length).toBeGreaterThan(0); @@ -366,12 +391,14 @@ describe('the prose attached to the exported constants (objectui#7289)', () => { APP_CONTENT_PATH, EAGER_WALK_CONTROL, DECLARED_LAZY_VIEWS_STILL_EAGER, + DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS, } as const; it('locates the block attached to each constant, and only that block', () => { const appContent = attachedDocs(source, 'APP_CONTENT_PATH'); const control = attachedDocs(source, 'EAGER_WALK_CONTROL'); const ledger = attachedDocs(source, 'DECLARED_LAZY_VIEWS_STILL_EAGER'); + const sideEffectful = attachedDocs(source, 'DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS'); // Controls that MUST hit: a phrase verified to be inside each attached // block. A locator that quietly found the wrong span would pass every pin @@ -379,6 +406,7 @@ describe('the prose attached to the exported constants (objectui#7289)', () => { expect(appContent.prose).toContain('declarations are the subject'); expect(control.prose).toContain('The positive control for the eager walk'); expect(ledger.prose).toContain('Deleting a line is a MEASUREMENT'); + expect(sideEffectful.prose).toContain('never declares'); // ...and the neighbours are not swept in. These three declarations sit // consecutively with nothing but their own blocks between them, so an @@ -388,11 +416,14 @@ describe('the prose attached to the exported constants (objectui#7289)', () => { expect(control.prose).not.toContain('declarations are the subject'); expect(ledger.prose).not.toContain('The positive control for the eager walk'); expect(ledger.prose).not.toContain('Pull the modules out of'); + expect(ledger.prose).not.toContain('never declares'); + expect(sideEffectful.prose).not.toContain('Deleting a line is a MEASUREMENT'); + expect(sideEffectful.prose).not.toContain('Pull the modules out of'); // The code is not prose. Without this the positive pin below would be // satisfiable by the ledger's own entry line. - expect(ledger.code).toContain("'packages/app-shell/src/views/RecordDetailView.tsx'"); - expect(ledger.prose).not.toContain("'packages/app-shell/src/views/RecordDetailView.tsx'"); + expect(sideEffectful.code).toContain("'packages/app-shell/src/views/RecordDetailView.tsx'"); + expect(sideEffectful.prose).not.toContain("'packages/app-shell/src/views/RecordDetailView.tsx'"); }); /** @@ -410,8 +441,8 @@ describe('the prose attached to the exported constants (objectui#7289)', () => { /** * What each constant carries AS DATA, recorded so the pin above cannot go - * vacuous in silence. The two controls carry exactly themselves; the ledger - * carries one entry. + * vacuous in silence. The two controls carry exactly themselves; the eager + * ledger is empty and the side-effectful one carries one entry. * * ⚠️ The ledger EMPTYING is a win, not a failure — the block above this * declaration says it in as many words ("Deleting a line is a MEASUREMENT, @@ -424,6 +455,7 @@ describe('the prose attached to the exported constants (objectui#7289)', () => { it('records what each constant carries as data, so the pin cannot go vacuous', () => { expect(pathsCarriedBy(APP_CONTENT_PATH)).toEqual([APP_CONTENT_PATH]); expect(pathsCarriedBy(EAGER_WALK_CONTROL)).toEqual([EAGER_WALK_CONTROL]); - expect(pathsCarriedBy(DECLARED_LAZY_VIEWS_STILL_EAGER)).toHaveLength(1); + expect(pathsCarriedBy(DECLARED_LAZY_VIEWS_STILL_EAGER)).toEqual([]); + expect(pathsCarriedBy(DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS)).toHaveLength(1); }); });