Repository navigation
chore(ui): raise the eager ui-components ceiling x1.30 to 451,100 on maintainer ruling - #36109
Conversation
…maintainer ruling Ruling 7063869131 (2026-11-21T14:01Z, amends point 2 of 7063116595): PER_CHUNK_GZIP_CEILINGS['ui-components'] 355,000 -> 451,100 (347,000 x 1.30), and its PER_CHUNK_BASELINE row back to its measurement, 265,937, as the 30% and 20% rulings left theirs. Rows from two console builds on one tree are in the comment on the key. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgWSAwkSz6F3eit2Y9u
|
repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4 席位核对 — ACCEPT (L1-b)Head-sha 0e7c5b7 · read 2026-11-21T14:53Z · first L1 record on this PR, full read · base 维护者速读这是您 14:01 说「这个可以大幅放宽」、选了 30% 之后的落地 PR:首屏 Must-fix / Should-fixNone. Nits
Checked
Owed
|
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Seat landing · 2026-11-21T14:54Z · Budget-only follow-up on the maintainer's ruling 7063869131 (#36023, 14:01Z: 「这个可以大幅放宽」, option "raise 30%"). |
…e console's eager chunk (objectstack-ai#36417) <!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} --> _Requested by **Steedos** · [project thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbUq2j5tRRVo3TVY3wcS1Fdg)_ repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ Fixes objectstack-ai#36102 Clause-②: yes (widening) Metadata-protocol: none Ruling-ref: 7063116595 on objectstack-ai#36023 (option B, "a separate card follows to take GridField out of the eager chunk, after which the ceiling can come back down"); seat note 7064483594 on this card, on ruling 7063869131 (lower the ceiling and baseline by the bytes taken out, no more) ## 维护者速读 - 用户无感:控制台首次加载少下载约 6 KB(压缩后),明细表格改为第一次打开带明细的表单时才加载,新建与编辑发票时表格照常出现、输入不丢焦点。 - 这是上次为放行明细表格改动而临时抬高控制台首屏体积上限之后约定的后续工作,把那部分体积收回来。 - 出错时最坏:明细表格的代码要单独下载,如果连续两次下载失败,错误会交给表单的出错处理,整个带明细的表单(不只是明细表格)会换成出错提示;网络正常时只是第一次打开时明细区多停一会儿在「正在加载列」。整个改动可直接撤回。 - 要你做什么:无。 ## What changes The line-item grid's body (`GridField`, about 90 KB of source) sat in the console's eager `ui-components` chunk. The package entry imported it lazily but also exported it statically, so the lazy import did nothing. It now loads the first time a grid is drawn, in a lazy `fields-grid` chunk. No published export was removed or renamed. - **`ui/packages/fields/src/widgets/GridField.ts`** (new, the published face). It keeps the pure helpers (`evalArith`, `computeRow`, `lookupAutofillPatch`, `columnHelpByField`, `UNTOUCHED_NEW_ROW`, `isUntouchedNewRow` and the column types), which stay eager. It also exports `GridField` and `LineItemsField` as a small lazy face with the same props. - Each mount decides once: a grid mounted after the body has loaded renders it directly. A grid mounted before that renders it through `Suspense`, with a busy placeholder (`grid-field-loading`). - A load landing later therefore never remounts the body, and focus is kept. - New export: `preloadGridField()`. It starts the one shared load and never rejects; a failed load is reported by the grid that needs it, through the nearest error boundary. - **`widgets/grid-field/GridFieldWidget.tsx`** is the body, moved from `widgets/GridField.tsx` (git reads it as a rename, R081). Only `loadGridFieldWidget`'s `import()` reaches it. - **The record forms wait for it.** - `MasterDetailForm` starts the load when it mounts. It draws a collection's grid only once the body has settled; until then it shows its existing "Loading columns…" copy. That holds on every path: derived columns, columns authored in full, and authored-but-untyped columns drawn while the derivation is in flight. - The record page's line-item editor (`RecordBodyTableEditor`) waits for the body together with the child schema. - `LineItemsPanel` starts the load when it mounts. - **Console chunking:** - `vite.config.ts` gains a `fields-grid` group (priority 82, ahead of `ui-components`). - `check-eager-closure-budget.mjs` gains its `PER_CHUNK_MEMBERSHIP_CARVE_OUTS` row (`src/widgets/grid-field` → `fields-grid`), following the `fields-date-picker` precedent (objectui#12622). - `vite-ineffective-dynamic-imports.ts` drops GridField from its defeated-lazy list, because the import is now effective. - **Budget:** the `ui-components` ceiling and its baseline come down by the bytes removed (below). The objectstack-ai#36100 and objectstack-ai#36109 entries no longer call this card a payback. - **Tests:** about 30 fields test files import the body by its new path (`GridFieldWidget as GridField`); the helpers stay on `./GridField`. Three plugin-form test files await `preloadGridField()` at module scope. ### The bytes (in the budget file's "Raising it" style) One container, one instrument: `CI=true pnpm exec turbo run build --filter=@object-ui/console...`, reading `apps/console/dist/eager-closure.json`, run twice on one tree. The first build is `main` at `b3bcfefc` alone; the second is the same `main` plus this change, at `3c422050`. Gzipped bytes: | chunk | `b3bcfefc` | `3c422050` | delta | |---|---:|---:|---:| | `vendor-objectstack` | 674,662 | 674,662 | 0 | | `i18n-locale-en` | 66,785 | 66,785 | 0 | | `framework` | 88,559 | 88,559 | 0 | | `ui-components` | 352,359 | 346,403 | −5,956 | | ⇒ aggregate | 1,875,902 | 1,869,974 | −5,928 | - The same 105 eager chunks appear by name in both builds. Total chunks go from 2,577 to 2,578; the new one is `fields-grid`, which is lazy (20,374 raw bytes). - Apart from `ui-components`, no chunk moved by more than 31 bytes (`index` +31). - Raw minified `ui-components`: 1,309,110 → 1,289,869 (−19,241). - Re-read on this PR's final head (`eb102830`, same instrument): `ui-components` is still 346,403, and the aggregate is 1,869,971 (−3 bytes against `3c422050`, spread over `index`, `src`, `relativeTime` and `useConsoleActionRuntime`). - An intermediate read at `4ca78ed1` (before the face became a JSX-free `.ts`) gave 346,399 (−5,960). The ceiling follows the final tree's −5,956. | constant | before | after | delta | |---|---:|---:|---:| | `PER_CHUNK_GZIP_CEILINGS['ui-components']` | 451,100 | 445,144 | −5,956 | | `PER_CHUNK_BASELINE['ui-components']` | 265,937 | 259,981 | −5,956 | The gap between ceiling and baseline is unchanged (185,163). ⛔ Not moved: `MAX_EAGER_CLOSURE_GZIP_BYTES`, `BASELINE`, `REGRESSION_THIS_GATE_MUST_CATCH_BYTES` and the other per-chunk rows. No exemption was added. `pnpm check:eager-closure` on the final build: `✅ chunk ui-components 338.3 KB measured / 434.7 KB ceiling`, plus the membership line `its src/widgets/grid-field subtree 1 in fields-grid, exactly`. ## Tests <details><summary>The first-open pin (live e2e, ui/e2e/live/master-detail.spec.ts)</summary> The new describe is "the line-item grid on a form's first open (objectstack#36102)". The spec is in the required `test:e2e:live:ci` lane. - An init script installs a `MutationObserver` before the document's first byte. It counts every attach of the placeholder (`grid-field-loading`) and of the grid (`line-items`). The grid count is the observer's control. - **Create:** the invoices list → New → the dialog's grid is visible → add a line → type `first-open` into the Description cell. The cell must still be focused after 300 ms and hold the text. Assertions: grid attaches > 0, placeholder attaches = 0. - **Edit:** `INV-1002`'s edit route. Its stored lines are drawn (Description not empty), then the same typing and the same counts. Local live stack: the workspace backend (`ui/e2e/live/ci/start-backend.sh`) and `vite preview` of a root-base console build, as the CI job runs them. - **Red first.** At `e581a9a5`, before `MasterDetailForm` gated the grid, the create case failed: `the grid never mounted on its loading placeholder: Expected: 0, Received: 1`. A trace showed the placeholder attached inside `md-collection` about 0.4 s before the grid, because the collection drew authored-but-untyped columns while the derivation was in flight. - **Then green.** At `51af8021`: `--repeat-each 3 --retries 0` → `15 passed (1.1m)` (the whole spec, 5 tests × 3). </details> <details><summary>Unit: the lazy face, and its ablation</summary> `GridField.test.tsx`, new describe "GridField — the lazy face the package exports (objectstack#36102)", using `vi.resetModules()` and a fresh import: - A mount before the body loads shows the placeholder, then the grid. A focused Description cell is still connected and still `document.activeElement` after a re-render. - After `await preloadGridField()`, `LineItemsField` renders with no placeholder. - `LineItemsField` is `GridField`, the same face. **Ablation** (committed first, through `node scripts/ablation-replace.mjs`): `const [loadedAtMount] = React.useState(() => gridFieldWidgetModule);` was replaced by `const loadedAtMount = gridFieldWidgetModule;`, so the decision is re-read on every render. - Anchor 1 → 0, blob `2e286b33ebdf → 1f484acf48d9`. - Result: `× a mount before the body loads shows the placeholder, then the grid, and a later render keeps the focused cell`, with `Tests 1 failed | 91 passed (92)`. - Restored: blob == HEAD (`2e286b33ebdf`) and `git diff HEAD` empty. </details> <details><summary>Suites</summary> - `pnpm exec vitest run packages/plugin-form/` (from `ui/`): `Test Files 244 passed (244)`, `Tests 2750 passed | 1 skipped`. - `pnpm exec vitest run packages/fields/ scripts/__tests__/check-eager-closure-budget.test.ts scripts/__tests__/vite-ineffective-dynamic-imports.test.ts scripts/__tests__/vite-declared-lazy-views.test.ts`: `Test Files 323 passed | 1 skipped (324)`, `Tests 5064 passed | 7 skipped`. - `pnpm --filter @object-ui/plugin-form run type-check` and `pnpm --filter @object-ui/fields run type-check`: both exit 0, after a rebuilt fields `dist`. - `pnpm --dir ui exec vitest run scripts/`: exit 0 (part of the derived gate list). </details> ## Acceptance notes - **Clause-② is `yes (widening)`, not the claim's `no`.** The new published export `preloadGridField()` widens `@object-ui/fields`'s surface; every existing export keeps its name and shape. It is needed so a host can have the grid's body in its first render, as the record forms do. - **On a cold first open, a master-detail collection shows "Loading columns…" until the child schema and the grid's body are both in.** The body load starts on mount and overlaps the schema fetch. A form that mounts after the body has settled draws its grid at first paint. - Before this PR, a collection with authored, untyped columns drew those columns at once and drew them again when the derivation landed. - **`LineItemsPanel` (the record page's read panel) starts the load but does not gate on it.** It draws its grid after its own fetches. The pin covers the create and edit forms the card names. - **Overlap:** two same-seat drafts conflict with the move of `widgets/GridField.tsx` to `widgets/grid-field/GridFieldWidget.tsx`. - objectstack-ai#36351 conflicts in `GridField.lookupAutofill-28245.test.tsx` and the widget body. - objectstack-ai#36392 conflicts in `GridField.test.tsx` and the widget body. - Whichever lands second re-applies its body hunks to `grid-field/GridFieldWidget.tsx`. The landing order is the seat's call. `origin/main` merges cleanly. - **Outside the claim's file surface:** `packages/spec/liveness/field.json`, whose evidence pointer moved to the helper's new file (`check:liveness` exit 0). - **Out of scope, for the seat to file (L1-d 7078535343):** `React.lazy` caches a first load failure for the whole session, so a host that renders `GridField` without `preloadGridField()` and hits one failed chunk load never recovers until a reload. - **Possible further carve-out, not done here:** `widgets/gridCellPanels.tsx` is imported only by the body and could follow it into `fields-grid` (about 2.5 KB gzip by estimate, not measured). ## Verification Read first, by risk: 1. `ui/packages/fields/src/widgets/GridField.ts`: the face, specifically `GridField`'s `useState(() => gridFieldWidgetModule)` and `loadGridFieldWidget`'s retry-on-failure. 2. `ui/packages/plugin-form/src/MasterDetailForm.tsx`: `useGridBodySettled` and the `!d.columns?.length || !gridBodyReady` arm. 3. `ui/scripts/check-eager-closure-budget.mjs`: the LOWERED entry, the baseline note and the carve-out row. Two-minute check: `cd ui && pnpm exec vitest run packages/fields/src/widgets/GridField.test.tsx`. Expect `Tests 92 passed (92)`, including the three cases of the "lazy face" describe. --- _Generated by [Claude Code](https://claude.ai/code/session_01QsR2jV3scu6UYPb42n5okQ)_ <!-- signed: repo:objectstack#7 · zhuangjianguo · session_01QsR2jV3scu6UYPb42n5okQ --> --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
repo:objectstack#1 · os-sales · session_01L6bhgWSAwkSz6F3eit2Y9u
Refs #36023
Area: b1-L · budget-only, follow-up to #36100. Authorisation: maintainer ruling 7063869131 on #36023 (amends point 2 of 7063116595). At 2026-11-21T14:01Z the maintainer widened the raise on #36100's thread, verbatim: 「这个可以大幅放宽」 (this can be raised by a lot), then picked "raise 30%, to 451,100" on the decision card that followed. #36100 was already in the merge queue at +8,000 and landed as it was so S5 #36039 was not held up; this PR carries the rest.
What changes
One file,
ui/scripts/check-eager-closure-budget.mjs, constants and their comments only:PER_CHUNK_GZIP_CEILINGS['ui-components']PER_CHUNK_BASELINE['ui-components']bbf6b02d9's 265,937). chore(ui): raise the eager ui-components ceiling by 8,000 bytes on maintainer ruling #36100's +8,000 only kept the ceiling-minus-baseline gap; a ruled raise widens the gap instead, as the 2026-11-17 30% ruling oni18n-locale-enand the 20% ruling (objectui#12653) left their baseline rows alone. Both checked constraints hold: 451,100 > 265,937, and the gap 185,163 <REGRESSION_THIS_GATE_MUST_CATCH_BYTES(711,680).MAX_EAGER_CLOSURE_GZIP_BYTES,BASELINE,REGRESSION_THIS_GATE_MUST_CATCH_BYTES, the other three per-chunk rows. No code change, no exemption, no import made lazy.Why
The maintainer wants this line to stop ejecting form and field PRs one at a time. With +8,000 the chunk keeps about 4.8 KB once S5 lands; with ×1.30 about 98.6 KB.
The rows (one container, one instrument)
CI=true pnpm exec turbo run build --filter=@object-ui/console..., readingapps/console/dist/eager-closure.json, twice on one tree:mainat1586ddec(#36100 landed) alone, then thatmainwith #36039's headfbbaaa99merged in (034f0628, local, not pushed). This file is not a console build input, so the branch builds the same bytes asmain. Gzipped bytes:1586ddec034f0628vendor-objectstacki18n-locale-enframeworkui-componentsSame 104 eager chunks by name in both builds; besides
ui-componentsnone moved by more than 21 bytes. Headroom ofui-components:1586ddecWhat the bytes buy
Shared headroom only, so form and field PRs are not ejected on this line one at a time. Not a budget for a new component group; a whole group still belongs behind a lazy boundary. Payback: #36102 takes GridField out of the eager chunk; re-measure when it lands.
Verification
Clause-②: no
Metadata-protocol: none
pnpm --dir ui run check:eager-closureon the034f0628build (S5 merged) with this branch's constants: exit 0;ui-components342.0 KB / 440.5 KB, headroom 98.6 KB; aggregate, membership and sensitivity halves all ✅.pnpm --dir ui exec vitest run scripts/: 172 files passed, 2 skipped (5,121 tests passed), includingcheck-eager-closure-budget.test.ts.eslint ui/scripts/check-eager-closure-budget.mjs: exit 0.node scripts/pm/check-governed-merges.mjs --branch HEAD: NOT governed.dispatch-gates.mjs --commandsall exited 0 on that head; of those, only thevitest run scripts/family reads this file's values, and it was re-run above.skip-changeset:ui/scripts/belongs to the private root packageobject-ui-monorepo, so nothing publishes.Branch is the harness-assigned
claude/project-thread-usk9vf, restarted frommainafter #36100 merged.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (eslinton the one file: exit 0)main, one pull request.skip-changeset)packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgWSAwkSz6F3eit2Y9u