Repository navigation
perf(console): the first load stops downloading the object list, the record view and the list view package - #33677
Conversation
…d pane (WIP) Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude <noreply@anthropic.com>
…dger follow the new boundaries (WIP) Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude <noreply@anthropic.com>
…; changeset Claude-Session: https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a Co-Authored-By: Claude <noreply@anthropic.com>
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD 席位核对Verdict: ACCEPT · head
|
|
domain:ui#1 · os-project-manager · session_01FEkQ5nWoa1Ze1QzjRTSYXD Landing · head
State: ready + auto-merge. |
…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>
…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>
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 threadsession_01FEkQ5mBsWKVFHwHpfLNx3a· claim 6889356674维护者速读
@object-ui/plugin-list(列表视图与画廊)。列表页改为和其它路由页一样按需加载(路由一确定就开始下载);记录详情在抽屉里第一次打开记录时才下载;list-view、view:list、object-gallery三个标签改为懒加载注册。首屏脚本从 2,165,721 字节(gzip)降到 2,060,434 字节,少了约 105 KB(4.9%)。RecordDetailView与plugins-views两块整块离开首屏,五块合计 287,260 → 220,463 字节。plugin-grid、plugin-form、plugin-view仍在首屏:它们被控制台外壳按名字导入的辅助函数拉住(拆它们要给共享包新增无副作用子路径,属 PR 2),详见 Acceptance notes。回滚即还原本 PR。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/main3c0033f9, with #33580's instrument (the console's ownvite.config.tsrun through Vite'sbuild()with one read-only plugin dumping the module graph; sameeager-closure.jsonas a plain build): 107 eager chunks, 2,165,721 B gzip. The five chunks the card names:plugin-grid160,144 ·plugin-form44,267 ·RecordDetailView27,317 ·plugins-views(plugin-list + plugin-detail group) 39,465 ·plugin-view16,067 = 287,260 B.Three cuts, in the order the order lists them:
ObjectViewis a route element.console/AppContent.tsxdeclared it in its always-eager block; it is nowrouteChunk.lazy(() => import('../views/ObjectView.js'))like the other route views, and its two paths (:objectName,:objectName/view/:viewId) joinAPP_ROUTE_CHUNKS, so its chunk starts downloading as soon as the route is known, in parallel with the route's metadata reads (the existingpreloadableLazypath).ObjectNotFoundState, which AppContent also draws, is imported from its own module (views/objectViewChrome.js) instead of throughObjectView.js.ObjectView.tsxitself is not touched.RecordDetailViewis lazy in the record pane.views/objectViewRecordOverlay.tsximported it statically; it is nowlazy()inside aSuspensewhose fallback is the existingSkeletonDetail. With cut 1 alone the view already leaves the first load (the overlay rides in theObjectViewchunk); this boundary keeps it out of the list route too, so a list that never opens a record never downloads it (probe below:listrequests noRecordDetailViewchunk,list-drawerdoes).plugin-listregisters lazily.apps/console/src/register-plugins.tsbare-imported five plugins. Measured one at a time by dropping each import: only@object-ui/plugin-listmoves the closure (−40,068 B, the wholeplugins-viewschunk). It now registerslist-view,view:list(skipFallback) andobject-galleryasregisterLazystubs with the namespaces the package itself registers.plugin-grid,plugin-form,plugin-viewandplugin-detailstay 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.tsfollows the graph:EAGER_WALK_CONTROL, counter-probe 2's positive control, wasObjectView.tsx, which is no longer eager. It is nowpackages/app-shell/src/layout/ConsoleLayout.tsx, imported by the same always-eager block and drawn around every route.missinghalf fired on the cut build forRecordDetailView.tsx(pinned, no longer eager), so its line leavesDECLARED_LAZY_VIEWS_STILL_EAGER, which is now empty.RecordDetailView.tsxwould be declaredmoduleSideEffects: 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'ssideEffectsarray).RecordDetailViewis lazy without the declaration, measured: nothing in the eager graph reaches it but the package barrel, which the package's ownsideEffectsarray 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.RecordDetailViewplugins-views(plugin-list + detail group)plugin-gridplugin-formplugin-viewAlso left:
objectViewTitleSwitcher(16,825), most ofindex(137,209 → 108,359),newViewSpec,PageHeader,createDerive,recordDetailSections,MetadataInspector,useDatasetCatalog,deriveRelatedListsand a few small ones. Seven small chunks appear (largeststudioScope12,223,objectViewChrome5,298,recordDrawerStack4,760): modules that were already eager insideindexand 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;
BASELINEis untouched.Changeset
.changeset/33581-console-eager-closure-list-and-record.md:@object-ui/consolepatch (app-shell is private; the console'sdistships it, andregister-plugins.tsis the console's own).Tests
scripts/__tests__/vite-declared-lazy-views.test.ts(34 tests, pass): the control is read from AppContent'sConsoleLayoutimport line;ObjectView.tsxis 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.list-viewfrom its package now that the console registers a stub:public-contract.test.tslistslist-viewamong the tags reached through a pending stub;registry-inputs-spec-parity.test.tsandhtmlTierDataSourceInputDeclaration-6678.test.tsximport@object-ui/plugin-listbesideregister-plugins, the remedyregistry-inputs-spec-parityalready uses for kanban, calendar, tree, map, gantt and timeline, and the waydev/manifest-registry.tsloads it before writing the published manifest.ui/under the lock: everyAppContent.*suite (app-shell and console), everyObjectView.*suite (the record drawer opens through the lazy pane inObjectView.recordDrawer-27545and the record-open pins), the fourRecordDetailViewsuites that mount the overlay, and all 22 suites that importregister-plugins: 178 files, 1886 tests. First run: 175 files passed, 3 failed (the three registry suites above, 8 tests, all readinglist-viewas eagerly loaded); after the fix the three pass (285 tests).pnpm --filter @object-ui/app-shell run type-check: exit 0. ESLint--no-inline-configon 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 HEADempty):EAGER_WALK_CONTROLpointed back at the lazyObjectView.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.RecordDetailView.tsxreplaced by the pureObjectView.tsx⇒ the build fails,ObjectView.tsx is in DECLARED_LAZY_VIEWS_WITH_SIDE_EFFECTS but carries no bare side-effect import ....RecordDetailViewas a static import of theObjectViewchunk. 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.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 fromConsoleShell→useUserLocale/useHomeInbox) imports@object-ui/plugin-detail, which theplugin-gridgroup captures; dropping every bare import inregister-plugins.tsand thedev/DevRowActionsedge too still leaves it eager. The elevenplugin-detailreach-ins are PR 2's.plugin-form:providers/MetadataProvider.tsx,console/AppContent.tsxandapps/console/src/components/FormPage.tsximport named helpers from the package entry, which keeps the whole registering entry (PR 2's side-effect-free subpaths).plugin-view:console/AppContent.tsximportsderiveRecordSurface/deriveRecordFlowSurfacefrom the entry (PR 2).apps/console/src/App.tsximportsdev/DevRowActions.tsx(a dev-only/dev/row-actionsharness) statically, anObjectGridedge intoplugin-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.list-view/object-gallerystub carries only the namespace and category until the package loads, soComponentRegistry.getConfiganswers noinputsfor them before first use, the same as every other lazy plugin (kanban, calendar, dashboard). The published manifest is built bydev/manifest-registry.ts, which imports the package eagerly, sosdui.manifest.jsonis unchanged (node scripts/check-sdui-manifest.mjsexit 0).React.lazyat the boundary and not a second lazy wrapper is followed: the record pane usesReact.lazy, the route uses AppContent's ownrouteChunk.lazy; no sharedlazyPagehelper 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'sui/packages/app-shell/src,ui/apps/console/src,ui/scripts) and once at head, each served bypnpm dev --freshfromexamples/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.showcase_ops_dashboardshowcase_task?recordId=/record/IDview/cards(gallery,object-gallerystub)view/board(kanban)/studioNo 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 (
--freshseeds new ids), so their lengths differ by the record. Screenshots,routes.jsonfor both runs, the probe and botheager-closure.jsonfiles are in the project folderpm-orders/ui/33581-probe/.Verification
All on head
b5429992.node scripts/pm/dispatch-gates.mjs --rananswers: 44 derived families accounted for, 44 run, 0 NOT-MEASURED.ui/scriptssuites 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.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:
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5mBsWKVFHwHpfLNx3a
Generated by Claude Code