Skip to content

perf(console): the first load stops downloading the object list, the record view and the list view package - #33677

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-giaxnd
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-giaxnd

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #33581 (PR 1 of the card: the boundaries; the helper subpaths are PR 2, not this one)

Clause-②: no
Metadata-protocol: none

Seat domain:ui#1 · os-project-manager · card thread session_01FEkQ5mBsWKVFHwHpfLNx3a · claim 6889356674

维护者速读

  • 改了什么:控制台首次加载不再预先下载对象列表页(默认列表与保存的列表视图)、记录详情视图和 @object-ui/plugin-list(列表视图与画廊)。列表页改为和其它路由页一样按需加载(路由一确定就开始下载);记录详情在抽屉里第一次打开记录时才下载;list-view、view:list、object-gallery 三个标签改为懒加载注册。首屏脚本从 2,165,721 字节(gzip)降到 2,060,434 字节,少了约 105 KB(4.9%)。
  • 为什么改:console first load: plugin-grid, plugin-form and RecordDetailView are still in the eager closure (split from #33293) #33581 测得仪表盘等任何路由都要先下载表格、表单、记录详情等约 287 KB 才开始取数。本 PR 去掉其中能在不动共享包接口的前提下去掉的部分:RecordDetailView 与 plugins-views 两块整块离开首屏,五块合计 287,260 → 220,463 字节。
  • 风险与回滚:只改加载时机,不改任何页面画什么;8 条路由在构建好的 showcase 控制台里改前改后各测一遍,全部画出、无页面错误。抽屉里第一次打开记录时多一帧详情骨架屏。plugin-grid、plugin-form、plugin-view 仍在首屏:它们被控制台外壳按名字导入的辅助函数拉住(拆它们要给共享包新增无副作用子路径,属 PR 2),详见 Acceptance notes。回滚即还原本 PR。
  • 先看:ui/packages/app-shell/src/console/AppContent.tsx(ObjectView 改为 routeChunk.lazy 并加入预加载表)、ui/apps/console/src/register-plugins.ts(plugin-list 改为三条 registerLazy)、ui/scripts/vite-declared-lazy-views.ts(新的正控 ConsoleLayout 与新台账 DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS)。
  • 两分钟验证:在 ui/apps/console 跑 CI=true pnpm exec vite build,读 dist/eager-closure.json 的 eagerGzipBytes,应约为 2,060,434;打开任一对象列表点开一条记录,抽屉正常画出详情。
  • 需要你做的:无,席位落地。

What changes

Measured first, on origin/main 3c0033f9, with #33580's instrument (the console's own vite.config.ts run through Vite's build() with one read-only plugin dumping the module graph; same eager-closure.json as a plain build): 107 eager chunks, 2,165,721 B gzip. The five chunks the card names: plugin-grid 160,144 · plugin-form 44,267 · RecordDetailView 27,317 · plugins-views (plugin-list + plugin-detail group) 39,465 · plugin-view 16,067 = 287,260 B.

Three cuts, in the order the order lists them:

  1. ObjectView is a route element. console/AppContent.tsx declared it in its always-eager block; it is now routeChunk.lazy(() => import('../views/ObjectView.js')) like the other route views, and its two paths (:objectName, :objectName/view/:viewId) join APP_ROUTE_CHUNKS, so its chunk starts downloading as soon as the route is known, in parallel with the route's metadata reads (the existing preloadableLazy path). ObjectNotFoundState, which AppContent also draws, is imported from its own module (views/objectViewChrome.js) instead of through ObjectView.js. ObjectView.tsx itself is not touched.
  2. RecordDetailView is lazy in the record pane. views/objectViewRecordOverlay.tsx imported it statically; it is now lazy() inside a Suspense whose fallback is the existing SkeletonDetail. With cut 1 alone the view already leaves the first load (the overlay rides in the ObjectView chunk); this boundary keeps it out of the list route too, so a list that never opens a record never downloads it (probe below: list requests no RecordDetailView chunk, list-drawer does).
  3. plugin-list registers lazily. apps/console/src/register-plugins.ts bare-imported five plugins. Measured one at a time by dropping each import: only @object-ui/plugin-list moves the closure (−40,068 B, the whole plugins-views chunk). It now registers list-view, view:list (skipFallback) and object-gallery as registerLazy stubs with the namespaces the package itself registers. plugin-grid, plugin-form, plugin-view and plugin-detail stay eager imports: each is held by another eager edge (Acceptance notes), so a stub would move nothing; the order's "as far as the measure shows a closure win".

ui/scripts/vite-declared-lazy-views.ts follows the graph:

  • EAGER_WALK_CONTROL, counter-probe 2's positive control, was ObjectView.tsx, which is no longer eager. It is now packages/app-shell/src/layout/ConsoleLayout.tsx, imported by the same always-eager block and drawn around every route.
  • The plugin's missing half fired on the cut build for RecordDetailView.tsx (pinned, no longer eager), so its line leaves DECLARED_LAZY_VIEWS_STILL_EAGER, which is now empty.
  • Unpinned, RecordDetailView.tsx would be declared moduleSideEffects: false, and guard 2 rightly refuses that: it bare-imports ./record-approvals-renderer.js. A new frozen ledger, DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS, lists declared-lazy views the plugin weighs like the rest (eager and unpinned still fails the build) but never declares pure. The plugin refuses a stale entry (no bare side-effect import and not named in its package's sideEffects array). RecordDetailView is lazy without the declaration, measured: nothing in the eager graph reaches it but the package barrel, which the package's own sideEffects array already leaves shakeable.

Result on the same instrument, head b5429992 (sources identical to the measured build): 103 eager chunks, 2,060,434 B gzip, −105,287 B (−4.9%). The real console build (pnpm --filter @object-ui/console build, tsc + vite + manifest) reads 2,165,724 → 2,060,438 on the same two trees; the 3–4 B is build-to-build variance.

chunk (card) before, B gz after status
RecordDetailView 27,317 — left the eager closure
plugins-views (plugin-list + detail group) 39,465 — left the eager closure
plugin-grid 160,144 160,137 eager, held elsewhere (notes)
plugin-form 44,267 44,270 eager, held elsewhere (notes)
plugin-view 16,067 16,056 eager, held elsewhere (notes)
five-chunk sum 287,260 220,463 −66,797

Also left: objectViewTitleSwitcher (16,825), most of index (137,209 → 108,359), newViewSpec, PageHeader, createDerive, recordDetailSections, MetadataInspector, useDatasetCatalog, deriveRelatedLists and a few small ones. Seven small chunks appear (largest studioScope 12,223, objectViewChrome 5,298, recordDrawerStack 4,760): modules that were already eager inside index and the chunks that left, regrouped by rolldown, ⛔ not new first-load bytes (the total is the measure).

The eager-closure gate's ceiling does not move; BASELINE is untouched.

Changeset .changeset/33581-console-eager-closure-list-and-record.md: @object-ui/console patch (app-shell is private; the console's dist ships it, and register-plugins.ts is the console's own).

Tests

  • scripts/__tests__/vite-declared-lazy-views.test.ts (34 tests, pass): the control is read from AppContent's ConsoleLayout import line; ObjectView.tsx is a parsed declaration (13 files, was 12); the new ledger is sorted, exists, is declared lazy, and every entry really carries a bare side-effect import and is not also pinned eager; the "every unpinned declared view is pure" pin excludes it; the attached-prose pins cover the new constant; the eager ledger records empty.
  • Console registry suites read list-view from its package now that the console registers a stub: public-contract.test.ts lists list-view among the tags reached through a pending stub; registry-inputs-spec-parity.test.ts and htmlTierDataSourceInputDeclaration-6678.test.tsx import @object-ui/plugin-list beside register-plugins, the remedy registry-inputs-spec-parity already uses for kanban, calendar, tree, map, gantt and timeline, and the way dev/manifest-registry.ts loads it before writing the published manifest.
  • Affected suites, from ui/ under the lock: every AppContent.* suite (app-shell and console), every ObjectView.* suite (the record drawer opens through the lazy pane in ObjectView.recordDrawer-27545 and the record-open pins), the four RecordDetailView suites that mount the overlay, and all 22 suites that import register-plugins: 178 files, 1886 tests. First run: 175 files passed, 3 failed (the three registry suites above, 8 tests, all reading list-view as eagerly loaded); after the fix the three pass (285 tests).
  • pnpm --filter @object-ui/app-shell run type-check: exit 0. ESLint --no-inline-config on the eight changed source and test files: 0 errors (53 pre-existing warnings, none on a changed line).

Ablations (scripts/ablation-replace.mjs, each restore proven: blob equal to HEAD, git diff HEAD empty):

  • New control: EAGER_WALK_CONTROL pointed back at the lazy ObjectView.tsx ⇒ the console build fails, counter-probe failed: packages/app-shell/src/views/ObjectView.tsx is not in the eager closure. The probe still fires.
  • Stale side-effect entry: the ledger line RecordDetailView.tsx replaced by the pure ObjectView.tsx ⇒ the build fails, ObjectView.tsx is in DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS but carries no bare side-effect import ....
  • Record pane boundary put back to a static import ⇒ build green, closure 2,059,952 (−482 B against head: regrouping), and the graph shows RecordDetailView as a static import of the ObjectView chunk. As stated in cut 2: on the first load the record pane boundary is neutral; it is the list route's saving, which the browser probe reads.
  • Nothing catches the plugin-list import coming back (+40,068 B): check:eager-closure's sensitivity is 695 KiB by ruling, the reading perf(console): the first load stops downloading the Setup pages, the package form and the view config panel #33580 recorded. No pin is added (a new gate).

Acceptance notes

What still holds the three remaining chunks (module graph of the cut build, shortest eager chunk path):

  • plugin-grid: hooks/sharedUserFeeds.ts (reached from ConsoleShell → useUserLocale / useHomeInbox) imports @object-ui/plugin-detail, which the plugin-grid group captures; dropping every bare import in register-plugins.ts and the dev/DevRowActions edge too still leaves it eager. The eleven plugin-detail reach-ins are PR 2's.
  • plugin-form: providers/MetadataProvider.tsx, console/AppContent.tsx and apps/console/src/components/FormPage.tsx import named helpers from the package entry, which keeps the whole registering entry (PR 2's side-effect-free subpaths).
  • plugin-view: console/AppContent.tsx imports deriveRecordSurface / deriveRecordFlowSurface from the entry (PR 2).
  • apps/console/src/App.tsx imports dev/DevRowActions.tsx (a dev-only /dev/row-actions harness) statically, an ObjectGrid edge into plugin-grid. Measured inert today (−934 B when cut, because the edges above hold the chunk); it becomes a real edge once PR 2 lands. carrier: #33581 PR 2.
  • A list-view / object-gallery stub carries only the namespace and category until the package loads, so ComponentRegistry.getConfig answers no inputs for them before first use, the same as every other lazy plugin (kanban, calendar, dashboard). The published manifest is built by dev/manifest-registry.ts, which imports the package eagerly, so sdui.manifest.json is unchanged (node scripts/check-sdui-manifest.mjs exit 0).
  • The seat note to use React.lazy at the boundary and not a second lazy wrapper is followed: the record pane uses React.lazy, the route uses AppContent's own routeChunk.lazy; no shared lazyPage helper is needed.

A built console in a real browser, before and after. Showcase built at this tree (pnpm --filter '@objectstack/example-showcase...' build), the console built for real (pnpm --filter @object-ui/console build && pnpm --filter @objectstack/console build:dist) once with the base sources (3c0033f9's ui/packages/app-shell/src, ui/apps/console/src, ui/scripts) and once at head, each served by pnpm dev --fresh from examples/app-showcase; headless Chromium, a fresh context (cold cache) per route, signed in as the dev admin. "chunks" = which of the watched chunks the route requested.

route before: drew · chunks after: drew · chunks
dashboard showcase_ops_dashboard yes · RecordDetailView, plugins-views yes · none of ObjectView, RecordDetailView, plugins-views
list showcase_task yes (10 rows) · RecordDetailView, plugins-views yes (10 rows) · ObjectView, plugins-views; no RecordDetailView
list + drawer ?recordId= yes, drawer open yes, drawer open · ObjectView, plugins-views, RecordDetailView
record page /record/ID yes yes · RecordDetailView; no ObjectView, plugins-views
saved view view/cards (gallery, object-gallery stub) yes yes · ObjectView, plugins-views
saved view view/board (kanban) yes yes · ObjectView, plugins-views
Studio /studio yes yes
Setup → Packages yes yes · none of the three

No page error, no console error, no failed request on any route, before or after. The page text length is identical before and after on every route that does not show a record (1638, 2092, 1643, 1812, 1147, 1092 characters); the two record routes show a different record on each run (--fresh seeds new ids), so their lengths differ by the record. Screenshots, routes.json for both runs, the probe and both eager-closure.json files are in the project folder pm-orders/ui/33581-probe/.

Verification

All on head b5429992. node scripts/pm/dispatch-gates.mjs --ran answers: 44 derived families accounted for, 44 run, 0 NOT-MEASURED.

  • Affected tests: 178 test files, 1886 tests pass (app-shell, console and ui/scripts suites touching the changed files).
  • pnpm --dir ui exec vitest run scripts/ (under the shared verify lock): 171 files passed, 2 skipped; 5065 tests passed, 2 skipped.
  • ui/scripts/__tests__/vite-declared-lazy-views.test.ts: 34 passed.
  • app-shell type-check exit 0; ESLint on the changed files: 0 errors.
  • pnpm --dir ui check:eager-closure, check:side-effects-array, check:sdui-registration-pins, check:eager-locale-catalogues, check:new-line-citations: exit 0 each.

Every derived gate command and its exit code:

node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
pnpm --dir ui check:eager-closure :: exit 0
pnpm --dir ui check:side-effects-array :: exit 0
pnpm --dir ui check:sdui-registration-pins :: exit 0
pnpm --dir ui check:eager-locale-catalogues :: exit 0
pnpm --dir ui check:new-line-citations :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a


Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

席位核对

Verdict: ACCEPT · head b5429992 · 2026-11-15T06:22Z

  1. Shape. Draft → main, Part of #33581 (PR 1 of the card, no closing keyword). 9 files, +176/−53, all on the claimed surface (6889356674):

    • AppContent loads ObjectView as a routeChunk.lazy route element. Its two paths are in APP_ROUTE_CHUNKS, and ObjectNotFoundState now comes from objectViewChrome so it no longer pulls the list module.
    • objectViewRecordOverlay loads RecordDetailView with React.lazy behind SkeletonDetail.
    • register-plugins.ts turns @object-ui/plugin-list's three tags (list-view, list, object-gallery) into registerLazy stubs.
    • vite-declared-lazy-views gets a new positive control (ConsoleLayout.tsx) and an empty STILL_EAGER list. A new DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS ledger is added.
    • The registry and public-contract tests now list list-view as lazy.
    • One changeset.

    None of the fenced files is touched (ObjectView.tsx, builtinComponents.tsx, the app-shell entry, objectViewRecordNavigation.ts, plugin-grid, plugin-list and plugin-kanban sources).

  2. Measure. Same instrument on both sides, eager-closure.json:

    • The eager closure drops from 2,165,721 B to 2,060,434 B gzip (−105,287 B, −4.9%), and from 107 to 103 eager chunks.
    • The card's five chunks drop from 287,260 B to 220,463 B.
    • RecordDetailView and the list views leave the closure. plugin-grid, plugin-form and plugin-view stay eager because app-shell imports them by name; that is PR 2.
    • All 8 routes drew the same before and after in a built console in a real browser.
    • Pointing the counter-probe control back at ObjectView fails the build, so the probe still fires.
  3. Contract. Clause-②: no, Metadata-protocol: none. No published export or type changes and no published schema is touched, so no contract record is owed. I read the diff myself at TIER_DEFAULT.

  4. Gates on head b5429992.

    • 52 check runs: 41 success, 11 skipped, 0 failed.
    • The dev's local run: 44 derived gate families, all exit 0.
  5. Accepted deviation. Of the four eager core plugins, only plugin-list moved to lazy stubs. The order allowed this ("as far as the measure shows a closure win"): the other three are still held by app-shell's named imports.

  6. K. 23 first-parent commits since base 3c0033f9 ≥ 15, so I synced the base. The merge of main at 36936440 gives new head 1b3f0d7e. The sync is merge-only: patch-id 9187fbec8fe1 is the same on both heads. The landing waits for the rerun to go green.

  7. Out of scope. PR 2 (side-effect-free helper subpaths for plugin-form and plugin-view, and the plugin-detail reach-ins) is not dispatched, since P3 claiming is closed (the maintainer's 「后续只处理 p1 p2」, 2026-11-15T05:05Z). console first load: plugin-grid, plugin-form and RecordDetailView are still in the eager closure (split from #33293) #33581 stays open after this merge.

  8. Authority. Landing under the maintainer's standing authorisation 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD

Landing · head 1b3f0d7e (base sync of the ACCEPTed b5429992, merge of main at 36936440; patch-id 9187fbec8fe1 on both heads) · 2026-11-15T06:43Z

reading value
check runs on 1b3f0d7e 52, all success or skipped
contract record none owed (Clause-②: no, no published schema)
seat ACCEPT 6890308933

State: ready + auto-merge. Part of #33581; the card stays open after the merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 06:43
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 68cee82 Nov 15, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-giaxnd branch November 15, 2026 07:19
scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…ect-free /core subpaths (objectstack-ai#34176)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9QjKmMVoDWtE45ELv1652Kd)_

Part of objectstack-ai#33581

Clause-②: yes (widening) — two new published `exports` subpaths,
`@object-ui/plugin-form/core` and `@object-ui/plugin-view/core`; nothing
removed or renamed, the package roots export the same names as before
Metadata-protocol: none

## 维护者速读

- 做了什么:控制台首屏不再下载表单包和视图包。两个包各新增一个不注册任何东西的 `/core`
子路径,壳层只从它取辅助函数;表单和视图组件在第一次画出时才加载。
- 效果:首屏 eager 闭包 gzip 从 1,961,037 B 降到 1,909,225 B(−51,812 B,约
−2.6%);plugin-form(44 KB)、plugin-view(16 KB)两块离开首屏,换进来两个小块(6.4 KB + 1.8
KB)。
- 用户可见的变化:一个会话里第一次打开记录表单、动作弹窗表单或流程表单步骤时,要等表单块下载完才显示;其余页面画出的内容不变。
- 没做的:卡里第 2 项(plugin-detail 的 11 处直取)不在本 PR。原因是 plugin-detail
有带订阅的模块级缓存,单独打一个 `/core`
包会在发布包里造出第二个实例,种子写不到根入口那一份;要改发布包的构建形状,需要席位定。plugin-grid 因此仍在首屏。
- 风险:公开面只加不减(两个新子路径)。九个测试套件原来顺着首屏图读到表单注册,需要改。另有两个 sideEffects
门禁测试对“无副作用的次入口”自相矛盾,做了窄口对齐,这超出了卡上写的文件范围。以上都逐个列在下面。
- 需要你做的:无;按惯例走契约复审后落地。

## What changes

**Two side-effect-free subpaths.** `@object-ui/plugin-form` and
`@object-ui/plugin-view` register their renderers when their root entry
is evaluated, and each root reaches every surface of its package. One
pure helper imported from a root kept the whole package in the console's
first load. Each package now publishes `/core` (ESM only, built by a
second `vite build --config vite.core.config.ts` pass, the
`@object-ui/plugin-chatbot/core` precedent), and it registers nothing:

- `plugin-form/core` (`src/core.ts`): `filterSystemFields`,
`isAutoGeneratedFieldType`, `isWideFieldType`, `inferColumns`,
`containerGridColsFor`, `resolveInlineMode`,
`omitServerResolvedDefaults`, `optionListDefault`,
`resolveSectionGroupReferences`, `useInitialFieldFocus`, plus their
parameter types.
- `plugin-view/core` (`src/core.ts`): `deriveRecordSurface`,
`deriveRecordFlowSurface`, `overlayWidthFor`, `toFilterGroup`,
`deriveFieldOptions`, `isImageLikeField`, `isGeoLikeField`,
`pickPreferredField`, the three `*_PREFERRED` lists, plus their types.

The roots still export every one of these names, unchanged. Both
`sideEffects` arrays name the new entry form (`./src/core.ts`,
`./dist/core.js`), as `check:side-effects-array` requires of every
entry; its derived walk finds no registering module behind either.

**The shell takes its helpers from `/core`.** Eleven importers moved:
`MetadataProvider`, `ActionParamDialog`, `ObjectFormDesigner`,
`editFormLockedByState`, `SchemaForm`, the console's `FormPage`,
`AppContent`, `objectViewRecordNavigation`, `userFilterUrlState`,
`recordDrawerStack`, `CreateViewDialog`.

**Forms drawn outside a route load on first draw.**
`views/lazyFormSurfaces.tsx` wraps `ModalForm` and `ObjectForm` in
`lazy()` + `Suspense`. `AppContent` (the global record form),
`useActionModal` (the action form) and `ScreenView` (a flow's
object-form screen) draw through it.

**The console registers the two packages' tags as lazy stubs.**
`register-plugins.ts` drops its eager `import '@object-ui/plugin-form'`
/ `'@object-ui/plugin-view'` and registers `object-form`,
`embeddable-form`, `object-master-detail-form`, `view:form`,
`record:line_items`, `object-view`, `view:simple`, `view-switcher`,
`filter-ui`, `sort-ui` with `registerLazy`, each with the namespace,
`skipFallback` and category its real registration declares.
`check:sdui-registration-pins` confirms every promised registration is
still in the built console.

**Bundling.** `apps/console/vite.config.ts` adds `plugin-form-core` and
`plugin-view-core` groups at priority 71 with
`includeDependenciesRecursively: false`, so the core modules do not land
in (and drag in) the priority-70 package chunks. `ui/vitest.config.mts`
aliases both `/core` subpaths to source, ahead of the bare package
aliases.

## Why

Card objectstack-ai#33581 item 1. Measured with objectstack-ai#33677's method: a production build of
the console, `dist/eager-closure.json`, gzip of the closure and of the
five watched chunks (node `zlib.gzipSync`, the report's own level).

| | main `86350e12` | this head |
|:--|--:|--:|
| eager closure (100 chunks) | 1,961,037 B | 1,909,225 B (−51,812) |
| `plugin-grid` | 160,176 eager | 160,190 eager |
| `plugin-form` | 44,205 eager | 39,961 lazy |
| `plugin-view` | 16,051 eager | 19,776 lazy |
| `plugins-views` | lazy | 40,255 lazy |
| `RecordDetailView` | lazy | 23,139 lazy |
| `plugin-form-core` (new) | — | 6,438 eager |
| `plugin-view-core` (new) | — | 1,793 eager |

`check:eager-closure` passes on this head.

## Tests

- **New pin** `app-shell/src/__tests__/pluginCoreSubpaths-33581.test.ts`
(3 tests). It reads the export names from the `/core` subpaths
themselves, scans every non-test source under `app-shell/src` and
`apps/console/src` (floors: >500 files, ≥10 `/core` importers), and
fails when (a) any of them imports a `/core` name from a package entry,
or (b) any of ten always-eager modules imports either entry by value, a
bare import included.
- **Ablation** (`scripts/ablation-replace.mjs`, restore proved by blob
== HEAD and an empty `git diff HEAD`):
- `MetadataProvider.tsx`: `resolveInlineMode` from
`'@object-ui/plugin-form'` → (a) and (b) both red, naming the file and
the name.
- `register-plugins.ts`: `import '@object-ui/plugin-detail'` → `import
'@object-ui/plugin-view'` → (b) red: `bare import from
'@object-ui/plugin-view'`.
- **Forced test edits** (each read a form or view registration through
the old eager graph):
- `apps/console/src/__tests__/masterDetailFormTypeManifest.test.ts`,
`masterDetailFormI18nLabelManifest.test.ts`,
`objectFormI18nLabelManifest.test.ts`,
`registry-inputs-spec-parity.test.ts`: `import '@object-ui/plugin-form'`
beside `../register-plugins`, because a lazy stub carries no `inputs`
and these read the manifest from `inputs` (the plugin-list precedent
from PR 1).
- `apps/console/src/__tests__/record-block-record-reach.test.tsx`: the
same import; it renders `record:line_items` synchronously.
- `apps/console/src/__tests__/public-contract.test.ts`: the same import;
the reverse direction reads `record:line_items`'s `inputs`.
`EXPECTED_LAZY` is unchanged.
-
`app-shell/src/views/RecordDetailView.childWriteRefreshesParent-12244.test.tsx`:
`import '@object-ui/plugin-grid'`. The related list renders through the
registered `object-grid`; this page reached it only through
plugin-view's entry (`ObjectView` imports plugin-grid). The console
registers it in `register-plugins.ts`.
- `app-shell/src/views/__tests__/FlowRunner.suspense.test.tsx`: the
mocked `ObjectForm` was itself a `lazy()`; ScreenView now takes
`ObjectForm` as the resolved value of its own `lazy()`, and React
refuses a lazy that resolves to a lazy. The mock is now a component that
renders an inner lazy body (still suspending on `formLoaded`), and the
mocked package is loaded once before `FlowRunner` so its cold load does
not eat `waitFor`'s budget.
- `app-shell/src/views/metadata-admin/previews/ScreenPreview.test.tsx`:
the two object-form tests `await screen.findByTestId('object-form')`
instead of a synchronous `getByTestId`.
- `ui/scripts/__tests__/side-effects-declaration-consistency.test.ts`:
its phantom direction ("every declared source entry has a load-time side
effect") contradicted `check-side-effects-array.mjs` and its own
coverage direction, which both require every entry form in the array. A
side-effect-free secondary entry (`src/core.ts`) could satisfy one only
by failing the other. The phantom direction now skips secondary entry
forms (exports subpaths other than the barrel) and still judges every
barrel; a new anti-vacuity line pins that the exemption reaches the two
`src/core.ts` and no `src/index.*`. Red before the edit (first gate
run), green after.
- `ui/scripts/__tests__/check-side-effects-array.test.ts`: the
population pin "every package walks from exactly one root" now names the
multi-entry population exactly: plugin-form and plugin-view, each
`['src/core.ts', 'src/index.tsx']`. The gate walks both roots and finds
the same single registrar as before.

## Acceptance notes

- **Item 2 (plugin-detail's eleven reach-ins) is not in this PR**, so it
reads `Part of`. `queueClaim.ts`, `recordFieldAccess.tsx` and
`useRecordEditable.ts` keep module-level caches with
`subscribeDataChanges` subscriptions and sit in plugin-detail's
`sideEffects` array. The shell seeds those caches
(`seedQueueClaimDecision`, `seedRecordFieldAccess`,
`seedRecordVerdict`). A `/core` built as a separate `dist/core.js`
bundle, as here and in plugin-chatbot, would carry a second copy of each
cache in the published package, so a seed written through core would
never reach the hooks the root entry reads. Routing them needs a
different published build shape (ES multi-entry with shared chunks, plus
`sideEffects` globs), which is a package-shape choice for the seat. Item
2 would also need lazy stubs for plugin-grid's and plugin-detail's tags
and a lazy `DevRowActions` (imported statically by `App.tsx`); only then
does plugin-grid (160 KB) leave the first load. The detail-core closure
measured at about 20 modules and contains no plugin-grid module.
- **`ModalForm` is not in `plugin-form/core`.** The card listed it with
the helpers, but its closure is most of the form package, so `/core`
would stop being small. The shell loads it from the entry through
`lazy()` instead (`lazyFormSurfaces.tsx`).
- **Changeset is `patch`, not `minor`.** `Metadata-protocol: none` maps
to `patch` under AGENTS.md's Post-Task Checklist step 3, and
`check-changeset-no-major` refuses `minor` with `none`.
- **plugin-form's `/core` duplicates three warning-dedupe sets**
(`reported`, `warnedHeadinglessCollapse`,
`reportedCurrencyColumnScales`) in the published package. The worst case
is a dev warning printed once more. No state the UI reads is duplicated.
In the console, Vite resolves both to one source module, so nothing is
duplicated there.
- **The FlowRunner suspension pin is now also covered by ScreenView's
own boundary.** `LazyObjectForm` carries its own `Suspense`, so a form
screen body's suspension stops inside the dialog even without
FlowRunner's. The pin still proves the route-level fallback never shows.
- **File surface breach: `ui/scripts/__tests__/**`** (two forced edits
above). The card's surface did not name the sideEffects gates' tests,
and the two checks could not both pass on any `/core` subpath of an
array package. The alternative was `sideEffects: true` for both packages
(the plugin-chatbot shape), which gives up tree-shaking for every
consumer of the two packages; I chose the narrow reconciliation. The
seat can ask for the other.
- Surface outside the card's literal list, inside its "importers"
clause: `apps/console/vite.config.ts` (chunk groups),
`ui/vitest.config.mts` (aliases). Untouched per the claim's serial
limits: plugin-view `ObjectView.tsx`, plugin-grid `ObjectGrid` and
`src/index.tsx`.

## Verification

- Type-check: plugin-form, plugin-view, app-shell, console
(`type-check`, including `tsconfig.test.json`) all exit 0.
- Affected suites: 462 files on the first pass; the 9 that went red are
the forced edits above, and they pass after the edits.
- `pnpm --dir ui check:eager-closure`, `check:side-effects-array`,
`check:sdui-registration-pins`, `check:new-line-citations` exit 0.
`eslint` on the changed files: 0 errors.
- `dispatch-gates.mjs --commands` (59 commands) run and reconciled with
`--ran`: `59 derived famil(ies) accounted for — 58 run, 1 NOT-MEASURED`.
The NOT-MEASURED one is `check:dual-build-cjs-loads` (exit 3,
prerequisite: unbuilt server packages; left to CI).
- First-run reds, fixed and rerun on this head: `pnpm --dir ui exec
vitest run scripts/` (the two sideEffects tests above; rerun 171 files
passed), `check:dts-closure` (the console's `plugin.d.ts` was absent
because the measurement build ran `vite build` only; after
`build:plugin`, 228/228 present).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmT5bCDp1MDcReXVCop

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…ackages (objectstack-ai#36336)

<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X1qGnTYLQs3EtmtCmjrcfCe)_
Fixes objectstack-ai#33581
Clause-②: yes (widening) — one new published `exports` subpath,
`@object-ui/plugin-detail/core`; nothing removed or renamed, the package
root exports the same names as before
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:控制台第一次打开任何页面时少下载约 165 KB(压缩后,约为首屏下载量的
8%);首页、仪表盘、列表页、记录页、记录浮层画面和操作都不变。
- 为什么做:控制台首屏提速——过去每个页面都要先下载表格和详情组件,再去读数据。
- 出错会怎样:若某处漏改,表格或详情块第一次出现时会多等一次加载,画面内容不变;本改动可以直接撤回。
- 要你做什么:无。

## What changes

On every route the console used to download the `plugin-grid` chunk (all
of `@object-ui/plugin-grid` plus 77 `@object-ui/plugin-detail` modules,
183 KB gzip) before its first data read. That chunk now leaves the eager
closure; the list and record routes fetch it with their own route
chunks, and any other surface fetches it the first time it draws a grid
or a detail block.

- **`@object-ui/plugin-detail/core`** (new subpath, ESM only, like the
other `/core` subpaths): the pure helpers the console shell needs on
every page, registering nothing. Names: `isRefusedFeedRead`,
`relatedListEntryNames`, `RELATED_ARRANGEMENT_RECORD_VERSION`,
`relatedArrangementFromRecord`, `relatedArrangementToRecord`,
`deriveFieldGroupDetailSections`, `deriveHighlightFields`,
`resolveDetailSections`, `isWideFieldType`, `prefetchRelatedCounts`,
`relatedCountTargetsIn`, `COMPACT_RELATED_ROWS`,
`normalizeRelatedListSort`, `seedQueueClaimDecision`,
`seedRecordFieldAccess`, `seedRecordVerdict`, type `RelatedArrangement`.
The root still exports all of them. `normalizeSortSpec` moved verbatim
from `RelatedList.tsx` to `relatedListSort.ts` so the subpath does not
reach the component.
- **Published ESM build of plugin-detail**: a second pass
(`vite.es.config.ts`) emits `index` and `core` in one pass with
`preserveModules`, so the record-page caches the `/core` seeds write are
the same module instances the root's hooks read. File names match the
package's existing `sideEffects` spellings (`./dist/queueClaim.js` and
friends). The UMD build is unchanged.
- **Console shell** (`@object-ui/app-shell`): eight modules take the
helpers from `/core`. The record pointer card's key fields and the
approval decision's child tables draw `HeaderHighlight` / `RelatedList`
through `lazy()` wrappers (`lazyDetailSurfaces.tsx`); the pointer card
starts the chunk load beside its record read (no timeout raised). A
wrapper mounted after the chunk loaded draws without suspending.
- **Console** (`register-plugins.ts`): the bare `import
'@object-ui/plugin-grid'` / `import '@object-ui/plugin-detail'` become
`registerLazy` stubs for every tag the two packages register, with the
namespaces their registrations declare: `object-grid`, `view:grid`,
`detail-view`, `detail-section`, `view:detail`, and the eleven `record:`
blocks (`details`, `related_list`, `highlights`, `activity`, `chatter`,
`discussion`, `path`, `quick_actions`, `history`, `reference_rail`,
`alert`). `App.tsx` loads the dev-only row-actions page lazily.
`vite.config.ts` gets a `plugin-detail-core` chunk group so the
subpath's closure does not fall into the `plugin-grid` group.

The card's other two slices were already in place on main: `plugin-form`
and `plugin-view` were lazy behind their `/core` subpaths (objectstack-ai#34176), and
`RecordDetailView` / `ObjectView` sat behind the lazy route boundary
(objectstack-ai#33677). Step 1 below shows it.

### Step 1: main `29556850`, what held each package eager

Eager closure 2,042,500 B gzip, 105 of 2551 chunks. Largest eager
chunks: `vendor-objectstack` 673,811 · `ui-components` 351,125 ·
**`plugin-grid` 183,395** · `index` 135,521 · `framework` 88,559 ·
`vendor-react` 81,619 · `i18n-locale-en` 66,610 · `vendor-radix` 59,724
· `src` 43,005 · `infrastructure` 37,749.

| Package | Eager on main? | Edges holding it |
|---|---|---|
| plugin-grid (chunk = 74 grid + 77 detail modules) | yes, 183,395 B |
`register-plugins.ts` bare imports of grid and detail; `App.tsx` to
`dev/DevRowActions.tsx` (ObjectGrid); app-shell named imports from the
plugin-detail root in `sharedUserFeeds`, `deriveRelatedLists`,
`workspacePreference`, `recordDetailSections`, `recordDrawerStack`,
`recordPagePayload`, `SubmittedRecord` (RelatedList),
`RecordPreviewCard` (HeaderHighlight) |
| plugin-form | no (only `plugin-form-core`, 6,652 B) | none; lazy since
objectstack-ai#34176 |
| plugin-view | no (only `plugin-view-core`, 1,789 B) | none; lazy since
objectstack-ai#34176 |
| RecordDetailView | no | none; behind the lazy route boundary since
objectstack-ai#33677 |

### Before / after

| Build | Eager gzip bytes | Eager chunks | grid / form / detail /
RecordDetailView eager |
|---|---|---|---|
| main `337f435c` | 2,043,450 | 105 | `plugin-grid` 183,666 |
| this branch `feb24f53` (same base) | 1,874,495 (**−168,955**) | 105 |
none; `plugin-detail-core` 15,702 joins |
| this branch head `58e12ffd` (main `99fbaa6d` merged) | 1,875,181 | 105
| none (`plugin-detail-core` 15,702, `plugin-form-core` 6,654,
`plugin-view-core` 1,789) |

The head row includes main's own drift between the two merges (for
example `ui-components` +662 B). `check:eager-closure` on head: exit 0,
1831.2 KB, headroom 600.4 KB.

Lazy chunks, gzip (python gzip -6, main `337f435c` vs head `feb24f53`):
`plugin-grid` 183,368 / 188,399 · `plugins-views` 62,376 / 55,420 ·
`plugin-form` 47,198 / 47,212 · `plugin-view` 19,846 / 19,846 ·
`RecordDetailView` 29,554 / 30,003. The grid chunk grows by the detail
renderers that left `plugins-views`.

## Tests

Local, scoped (CI runs the full suites):
- Before the last main merge, head `feb24f53`: 406 test files (app-shell
tests of every touched module, all console `__tests__`, plugin-detail,
the `ui/scripts` side-effects and declared-lazy-views tests): 405
passed, 1 failed (`RecordPreviewCard.test.tsx`, the highlight strip
under the new lazy wrapper). Fixed in `feb24f53`; that file plus the
pins rerun: 13 files / 149 tests passed.
- `type-check` for `@object-ui/plugin-detail`, `@object-ui/app-shell`,
`@object-ui/console`: exit 0 (on `feb24f53` and again on `58e12ffd`).
eslint on the changed files: exit 0. `vitest` over `scripts/`: 5127
tests passed.
- Head `58e12ffd` (after merging main `99fbaa6d`): full turbo build exit
0, eager-closure budget exit 0, type-checks exit 0. The scoped test
rerun on this head (493 files) was still running when this body was
written (handover cut-off): **NOT MEASURED on `58e12ffd`**, CI is the
reading.

Pins:
`ui/packages/app-shell/src/__tests__/pluginCoreSubpaths-33581.test.ts`
now also holds `plugin-detail/core` (names, no registrations) and the
eager modules (App, register-plugins, the eight shell modules,
`lazyDetailSurfaces`) to subpath-or-type-only imports of plugin-detail
and plugin-grid.

Ablations (one-shot, on committed head `feb24f53`, each restored with
`git checkout HEAD --`, blob hash compared, `git diff HEAD` empty):
1. `recordPagePayload.ts` back to the plugin-detail root import: all
three pin tests red (offender listed, importer floor 8 of 9).
2. bare `import "@object-ui/plugin-grid"` added to
`register-plugins.ts`: the bare-import pin red ("bare import from
'@object-ui/plugin-grid'"). The first attempt at this ablation was a
no-op (the replacement contained the anchor; the replace tool refused
it); redone with a different quote spelling.

## Acceptance notes

- Real browser (Chromium, showcase app, signed in as admin; the same
server served the `337f435c` console build and then this branch's), five
routes: home, a dashboard, an object list, a record page, a record
overlay. All five drew on both builds with the same text, no page errors
beyond a 404 the home page shows on both, no failed requests.
- main fetched `plugin-grid` 40–75 ms after navigation on every route,
before the first data read (667–1144 ms).
- this branch: home and dashboard never fetch `plugin-grid`; the list
fetches it at 1032 ms beside `ObjectView` (1050); the record page at 882
ms beside `RecordDetailView` (900); the overlay at 1027 ms.
- JS requests per route (main / head): home 105 / 105, dashboard 143 /
140, list 227 / 201, record 171 / 156, overlay 229 / 203.
- No carve-out naming `plugin-grid` is added to the eager-closure budget
check, and none is owed. New gates are "no" by default unless the
maintainer names one, and this class is already held by two things: the
source pin `pluginCoreSubpaths-33581` (ablation 2 turns it red) and the
total `check:eager-closure` budget.
- `plugin-detail-core` (15,702 B gzip at this head) also holds
`ConcurrentUpdateDialog`, because `isConcurrentUpdateError` is in the
same module. That share of the chunk is not measured on its own.

## Verification

Read first:
1. `ui/apps/console/src/register-plugins.ts` — a tag the two packages
register but the stubs miss would draw an unresolved component on first
use.
2. `ui/packages/plugin-detail/vite.es.config.ts` + `package.json` — the
published ESM layout changes to one file per module; the seed caches
depend on it.
3. `ui/packages/app-shell/src/views/lazyDetailSurfaces.tsx` — first-draw
loading of the two shell detail components.

Two-minute check: `pnpm --filter @object-ui/console build`, then `node
-e 'const
j=require("./ui/apps/console/dist/eager-closure.json");console.log(j.eagerGzipBytes,
j.files.filter(f=>/^(plugin-|RecordDetailView|plugins-)/.test(f.name)).map(f=>f.name))'`
from the repo root. Expected: about 1,875,000, and only
`plugin-chatbot-core`, `plugin-detail-core`, `plugin-form-core`,
`plugin-view-core`, with no `plugin-grid`.

Gates: `node scripts/pm/dispatch-gates.mjs --commands` derived 60
families on `f3214b28`; all 60 ran locally and `--ran` reconciled 60 of
60, 0 NOT MEASURED, exit 0. First runs of four families read wrong and
were rerun after a full build: dts-closure exit 1 (console `.d.ts` not
built yet), dual-build-cjs-loads exit 3 (prerequisite unbuilt),
query-options-erasure 124 (my own 300 s timeout), type-check-debt (I
stopped its lock-held rebuild); all four reran to exit 0. UI extras:
`check:side-effects-array` 0, `check:sdui-registration-pins` 0,
`check:eager-closure` 0, `vite-declared-lazy-views` passed inside the
builds (13 of 13 lazy). The gate set was not rerun on `58e12ffd` (a
clean main merge); the PR check-runs are the reading there.

Written by `repo:objectstack#4 · os-project-manager ·
session_01FEkQ5kt9AD1TPLy7Y9oa9D`
(https://claude.ai/code/session_01FEkQ5kt9AD1TPLy7Y9oa9D).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- signed: repo:objectstack#4 · os-project-manager ·
session_01FEkQ5kt9AD1TPLy7Y9oa9D -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant