Skip to content

perf(console): an object list and a record page no longer load the Studio designer's string table on first paint - #37589

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-xtck3b
Nov 26, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-xtck3b

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Part of #37444. This is slice C of that card: route-level JS an object list and a record page load before first paint that they do not need. The card stays open: the production re-measure (card comment 7193730951) shows no single seam brings the three pages under 2.5 s, and the other slices (eager-closure diet, boot waterfall, render CPU) are filed by the seat as their own cards.

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:所有用户打开对象列表页和记录页时,少下载约 94 KB 用不到的 Studio 设计器文字;页面内容和保存行为都不变。
  • 为什么做:属于「首屏加载 2.5 秒」这张卡拆出的第一刀(C)。记录页首屏中位数从 4223 降到 4066 毫秒,列表页和首页的变化在测量误差内。
  • 出错会怎样:最坏情况是设计器打开时某段文字显示慢一拍,或某个保存入口找不到辅助函数而报错;改动只是搬家加转出口,可以整笔撤回。
  • 要你做什么:无。

What changes

Two component modules in @object-ui/app-shell held small pure helpers next to React components that import the designer's t() (views/metadata-admin/i18n.ts) and, through it, the studio namespace's English catalogue (@object-ui/i18n/namespaces/studio, its own 69 KB gzipped chunk). The running app's save paths that load with a list or record page import those helpers, so the static import pulled the whole designer table, the Studio header and the Customize controls into both pages' first load.

  • views/studio-design/customizeOverride.ts (new): the Customize door's pure half, moved verbatim out of StudioCustomizeControls.tsx (STUDIO_CUSTOMIZE_TYPES, isStudioCustomizeType, declaredOverrideOf, overrideDraftBody, customizeDoorWalled, useCustomizeDoorWalled, OBJECT_EXTENSION_TYPE, extensionFieldName, objectExtensionBodyOf, ObjectExtensionBody).
  • views/metadata-admin/draftVersionGuard.ts (new): the draft-version guard's pure half, moved verbatim out of DraftConflictDialog.tsx (the conflict predicates, the pins, readDraftForSave, DraftVersionGuard, heldDraftVersionOf and their types). useDraftSaveGuard and the dialog, which render and translate, stay where they were.
  • Both old modules re-export every moved name, so every other importer (the designer's pillars, inspectors and editors) is unchanged.
  • The runtime importers now read the new modules: runtime-metadata-persistence.ts, recordTabsConfigSave.ts, objectExtensionArrangementSave.ts, RecordTabsConfig.tsx, ReportView.tsx, DashboardView.tsx, metadata-admin/PageShell.tsx, setup/publicForms.ts, objectViewViewCrud.tsx, metadata-admin/detailSaveAtOnce.ts, layout/designModeMenuSave.ts, layout/designModeHeaderPinsSave.ts. Three tests that mocked useCustomizeDoorWalled on StudioCustomizeControls now mock it on customizeOverride, where the hook lives.

No behaviour, string, route or saved document changes. Changeset: patch on @object-ui/app-shell, @object-ui/console, @objectstack/console (the Console dist ships the change).

Tests

  • New views/__tests__/firstScreenStudioCatalogue-37444.test.ts: walks each first-screen save path's static relative imports in source (type-only imports and import() excluded) and asserts none reaches the designer string table; the walk proves it sees the edge by requiring DraftConflictDialog.tsx and StudioCustomizeControls.tsx to reach it, and the two new modules import no component module. Ablation: pointing recordTabsConfigSave.ts back at DraftConflictDialog.js reds views/recordTabsConfigSave.ts reaches no designer string table through static imports (1 failed, 5 passed); restored with git checkout HEAD --.
  • @object-ui/app-shell tests touching any moved name or edited importer: 85 files, 977 tests passed (pnpm exec vitest run --maxWorkers=2 over the 85 files, from ui/); the new file 6/6.
  • tsc --noEmit in ui/packages/app-shell exit 0; tsc -p tsconfig.test.json exit 0.
  • eslint over the 20 changed ui/ files: 0 errors (181 warnings, all react-refresh/only-export-components of the kind these files already carried).

Acceptance notes

  • Measured effect (production build, the card's conditions) — tree: this branch (688b77ff source; Console rebuilt with pnpm console:build), objectstack start with NODE_ENV=production, Lighthouse 13.6.0 desktop preset, Chrome for Testing 158 headless, 4-core container, 5 runs per page, every run on the requested page, signed in, cold cache:

    Page Before (main 021524cd) After (this branch)
    Home 3626 (3639, 3626, 3538, 3509, 3685) 3669 (3688, 3643, 3735, 3669, 3662)
    Object list 4611 (4595, 4611, 4483, 4664, 4771) 4644 (4563, 4784, 4644, 4508, 4651)
    Record page 4223 (4223, 4238, 4285, 4168, 4188) 4066 (4201, 4187, 4042, 4066, 4051)

    Script bytes before LCP: list 2443 → 2349 KB, record 2340 → 2246 KB, home unchanged (1976 KB). The record page gains 157 ms; the list page's bytes drop by the same 94 KB but its LCP does not move, because its critical path is the serial API chain that the chunk loaded beside; home does not load these chunks. All three pages still miss 2500 ms, as the card's reading predicted for any single slice.

  • Static route closures read off the built Console (ObjectView / RecordDetailView, non-eager chunks reachable by static import): 441 → 347 KB and 347 → 254 KB gzipped. The eager closure is unchanged (1,991,173 → 1,991,266 bytes gzipped; check:eager-closure reads it in CI).

  • The record page's other large route chunk, plugin-grid (192 KB gzipped), was looked at and left: rolldown groups plugin-detail (the record page's own renderer: DetailView, RelatedList, the activity timeline) into it, so it is the page's own code, not a stray. Splitting ImportWizard / bulk-action code out of it is a possible later cut inside the eager/route diet slices.

  • layout/designModeMenuSave.ts also now reads the new modules, but still reaches the designer table through the app-nav canvas it imports; it loads with design mode, not with a list or record page, so the pin does not list it.

  • L2 owed (not self-reviewed): a contract-tier read is not needed (no governed path; no spec, no protocol change); the seat's L1 reads the CI check-runs.

Verification

Two-minute check: cd ui && pnpm exec vitest run packages/app-shell/src/views/__tests__/firstScreenStudioCatalogue-37444.test.ts → 6 passed. In a built Console, the RecordDetailView-*.js and ObjectView-*.js chunks no longer import i18n-ns-studio-en-*.js through any static chain.

Read first: views/metadata-admin/draftVersionGuard.ts (the guard class moved verbatim; check no symbol was left behind that useDraftSaveGuard needs), views/studio-design/StudioCustomizeControls.tsx (the re-export block and the trimmed imports), the three test mocks retargeted to customizeOverride.

Local gates (derived by dispatch-gates.mjs --commands at the final head)

Head 688b77ff. 39 derived, 39 run, each exit captured before any pipe; dispatch-gates.mjs --ran: 39 derived, 39 run, 0 NOT-MEASURED, 0 UNRUN (exit 0). Every other family (lint, type-check lanes, Test UI, Build and E2E UI, the eager-closure budget) is CI's; this PR's check-runs are the record.

  • 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-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/snapshot-next.mjs --self-test → exit 0
  • node scripts/pm/check-governed-queue-guard.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 --dir ui exec vitest run scripts/ → exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys → exit 0
  • pnpm check:adr-anchors → exit 0
  • pnpm check:adr-symbol-anchors → 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:engine-double-contract → exit 0
  • pnpm check:gitlink-declared → 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: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

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgU8Bf564ZGXi4MfHWb


Generated by Claude Code

@github-actions github-actions Bot added size/xl 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 26, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head 688b77f · card #37444 (slice C) · area s2-ux · 2026-11-26T14:46Z

L1 checklist

Tier: S. Landing: ready + auto-merge by this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 26, 2026 14:46
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 4805d83 Nov 26, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-xtck3b branch November 26, 2026 15:13
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…the draft it wrote (objectstack-ai#37637)

<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuBUGgrNWoBUQKbyS4GaX5vM)_

Fixes objectstack-ai#37440

Clause-②: yes (widening: `@objectstack/client` `meta.publishItem`
accepts `draftVersion` and `parentVersion` beside `message` and
`packageId`)
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:管理员在设计器、记录页和导航编辑里点保存时,只会发布自己刚写下的那份草稿;如果有人恰好在这一刻改了同一份草稿,这次保存不会发布,也不会删掉别人的草稿,而是提示草稿待处理。没有冲突时保存和以前完全一样。
-
为什么做:属于「草稿并发写入保护」这条线(替先保存草稿、再立即发布的所有保存入口补上最后一个缺口):服务端早已支持按草稿版本拦截,前端各个保存入口却一直没把自己的版本带上。
-
出错会怎样:最坏情况是某个保存在没有冲突时也被拒,作者看到「草稿待处理」需要再存一次;旧服务端不返回版本号时一切照旧不带锁;整笔可以直接撤回。
- 要你做什么:无。

## What changes

`client.meta.publishItem` takes the two optimistic-concurrency pins the
per-item publish door already judges (ADR-0008,
`PublishMetaItemRequestSchema`). `draftVersion` goes in the body beside
`message` and names the pending draft the publish promotes.
`parentVersion` is sent as `If-Match`, and `null` is sent as
`If-None-Match: *`; it names the live row the publish replaces. With
neither set, the request is byte-identical to before.

Every console Save that writes a draft and publishes it at once now
passes `draftVersion`. The value is the version its OWN draft write
returned: `draftReceiptVersion(receipt)`, or `heldDraftVersion(...)`
right after a guarded save. It is never a fresh re-read, which would pin
another writer's draft. The callers:

- **Studio top-bar Save.** `publishSavedItem` in `studioSaveBar.tsx`
takes `SavedItem.draftVersion`. It is forwarded by DataPillar (objects
and object extensions), AutomationsPillar (flows and the on/off switch),
`objectHooksBuffer`, `pairObjectActions`, PermissionMatrixEditor,
`newAppDoor`, and MetadataListCreateDialog (new object and new flow).
- **Item page Save:** `detailSaveAtOnce` via ResourceEditPage.
- **Sharing-defaults table:** each row of PackageOwdOverviewPanel. This
was deferred in round 1 behind objectstack-ai#37554 and is added now that objectstack-ai#37554 has
landed.
- **Record page:** 「Configure tabs」 (`recordTabsConfigSave`) and an
installed object's field arrangement (`objectExtensionArrangementSave`).
- **Design mode:** the header pins (`designModeHeaderPinsSave`) and the
menu plus menu labels (`designModeMenuSave`).

A door refusal under the draft pin is `409 METADATA_CONFLICT`, the same
code the live-row pin gets, and the body does not say which pin refused.
The draft-version guard (`draftVersionGuard.ts`, new rule 10 in the
`DraftConflictDialog.tsx` header) tells the two apart with one draft
read after the refusal:

- If the draft is still at the pinned version, the live row moved, and
the existing reload-or-overwrite dialog asks (rule 8).
- If the draft moved, is gone, or cannot be read, the refusal is the
draft's. Nothing is asked, and the error is thrown marked
`isPublishDraftMoved`.

Every caller treats a moved draft the same way: nothing is published and
the draft is **kept**, because it now holds the other writer's change.
The Save reads as refused or says a draft is pending. Every take-back of
the Save's own draft is pinned `If-Match` to that same receipt, so a
refused Save never deletes a draft someone else changed.

## Why

objectstack-ai#36350 added `draftVersion` to the publish door, but no caller sent it.
In the window between a Save's draft write and its publish, another
writer's draft write (another tab, the copilot) is promoted live under
the first author's Save. The client test reproduces this at the real
door: the unpinned publish promotes `theirs`.

Read first (risk order):
1.
`ui/packages/app-shell/src/views/metadata-admin/draftVersionGuard.ts`:
the `publish` catch and `draftStillAt`. This is where a refusal is
classified; a misclassification either asks the wrong question or keeps
a draft that should be discarded.
2. `ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx`:
`publishSavedItem`, which holds `draftMoved`, `discardScope`, and the
skipped discard.
3. `ui/packages/app-shell/src/layout/designModeMenuSave.ts`:
`discardOwnDraft`, the pinned take-back whose `409` means "moved, keep
it".

Two-minute verification: run `pnpm --dir ui exec vitest run
packages/app-shell/src/views/studio-design/studioSaveBar.draftPin-37440.test.ts`.
Expect 5 passed. The PIN case shows the other writer's draft still
pending and the live row unchanged.

## Tests

Each caller got one PIN (another writer's draft lands between the Save's
draft write and its publish: nothing goes live, their draft is kept, no
reset) and one CONTROL (no interleave: the Save's draft goes live), in
that caller's existing harness. The PIN asserts `draftVersion` is the
caller's own receipt; the CONTROLs assert the outcome only.

- `packages/client/src/meta-publish-item-package.test.ts`, Part 3, on
the real per-item publish door: the reproduction, PIN, CONTROL, the wire
shape (body `draftVersion`, `If-Match`, `If-None-Match: *` for `null`,
nothing when unset), and `parentVersion` stale or `null` refused.
- New `studioSaveBar.draftPin-37440.test.ts` and
`detailSaveAtOnce-37440.test.ts`, over a stateful door double,
`views/__tests__/draftPublishDoor-37440.ts`.
- Added describes in `recordTabsConfigSave-36499`,
`objectExtensionArrangementSave-36499`,
`designModeHeaderPinsSave-36366`, `designModeMenuSave-36538` (menu and
translation, plus the published-moved distinction),
`DraftConflictDialog.test.tsx` (guard rule 10: PIN, live-row-moved still
asks, overwrite keeps the draft pin, CONTROL), and
`PackageOwdOverviewPanel.draftPinned-37515`.
- Updated exact-argument asserts to carry `draftVersion:
expect.any(String)`: `AutomationsPillar.customizeFlow-28570`,
`DataPillar.pairActions-30088`,
`StudioDesignSurface.draftVersionConflict-11773`.

Ablation: one per pin (rebuild, on-disk mutation via
`scripts/ablation-replace.mjs`, restore). Every PIN went red with its
CONTROL green, and `git diff HEAD` was empty after each restore.

<details><summary>Local test readings at head 046abbb (each under
scripts/pm/os-verify-lock.sh)</summary>

- Client, `pnpm --filter @objectstack/client exec vitest run
--maxWorkers=2 src/meta-publish-item-package.test.ts`: Test Files 1
passed (1), Tests 15 passed (15), VERDICT command-exit 0.
- UI pins, 9 files (the 8 harnesses above plus
`firstScreenStudioCatalogue-37444`): Test Files 9 passed (9), Tests 112
passed (112), VERDICT command-exit 0.
- Affected app-shell set, 346 files: every test file that imports a
changed module, plus the OWD panel suites and the importers of
`draftVersionGuard.ts` / `customizeOverride.ts`. Result: Test Files 346
passed (346), Tests 2658 passed (2658), VERDICT command-exit 0. This ran
at 8192a73; the only later commit is the changeset.
- `pnpm --filter @object-ui/app-shell type-check`: VERDICT command-exit
0.
- The full app-shell suite was not run locally (it runs over 70 min on
the shared box). It is CI's.

</details>

<details><summary>Ablation readings (every PIN red, CONTROL green,
restored)</summary>

| Ablation | Result |
|---|---|
| client | 2 failed, 13 passed |
| studioSaveBar | 2 failed, 3 passed |
| detailSaveAtOnce | 2 failed, 1 passed |
| recordTabs | 1 failed, 6 passed |
| extension arrangement | 1 failed, 7 passed |
| header pins | 1 failed, 14 passed |
| menu | 1 failed, 16 passed |
| menu labels | 1 failed, 16 passed |
| OWD row | 1 failed, 11 passed |
| guard draft pin forwarded | 2 failed, 37 passed |
| guard classification | 1 failed, 38 passed |

After every restore, `git diff HEAD` was empty.

</details>

## Acceptance notes

- **Re-checked and out of scope (not draft-then-publish of an own
draft):**
- `StudioDesignSurface` `publishDraft('flow')` (about line 655),
`usePublishAllDrafts` and PackagesPage `publishDrafts`. These are
publish-all doors with no draft write of their own, so there is no
receipt to pin.
- `runtime-metadata-persistence` `boundToPackage`, which is already
pinned.
- **Nit N6 does not ride.** Its fix site is ViewConfigPanel /
RuntimeDraftBar, outside this card's surface.
- **Merged with objectstack-ai#37589.** objectstack-ai#37589 moved the guard's pure half into
`draftVersionGuard.ts`. Rule 10, `draftStillAt`, `isPublishDraftMoved`
and `draftReceiptVersion` now live there; `DraftConflictDialog.tsx`
re-exports them and keeps the header rule and the hook's stable
`heldDraftVersion`. The objectstack-ai#37444 first-screen import walk
(`firstScreenStudioCatalogue-37444`) stays green: the list and record
save paths import the new names from `draftVersionGuard.ts`, never from
the dialog.
- **Classification read.** The read happens only after a refusal under
both pins, and it is never itself a pin. An unreadable draft is treated
as moved, which fails safe: nothing is asked and nothing is discarded.
- **Forwarders.** Forwarders that only pass a receipt through
(DataPillar, AutomationsPillar, objectHooksBuffer, pairObjectActions,
PermissionMatrixEditor, newAppDoor, MetadataListCreateDialog,
ResourceEditPage) are covered through the door they forward to
(`publishSavedItem` or `detailSaveAtOnce`) and the updated
exact-argument asserts above, not each by its own PIN.
- **Older servers.** Against a server whose draft save returns no
`version`, every caller publishes unpinned, as before.

## Verification

<details><summary>Derived gate families at head 046abbb</summary>

`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` derived 74 families. 73 exited 0, including
`pnpm --dir ui exec vitest run scripts/`, `check:type-check-debt` and
`check:skill-examples`, each after building their prerequisite dist.

`pnpm check:dual-build-cjs-loads` exited 3, PREREQUISITE NOT MET: not
every package has a dist in this container. NOT MEASURED locally; it is
read from this PR's checks.

`--ran` reconciliation: 74 derived, 74 run, 0 UNRUN. `node
scripts/check-nul-bytes.mjs`: OK. `node scripts/pm/overlap-check.mjs`:
VERDICT clean exit 0, against origin/main 54d6726 and 0 open PR
heads.

</details>

Merge, not rebase: origin/main (including objectstack-ai#37589 and objectstack-ai#37554) was merged
into the branch in 6f1e735.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(`packages/spec` untouched.)
- [x] 2. Every name I added uses the casing for its kind.
- [ ] 3. No formatter ran; `pnpm lint` passes. (No formatter ran; `pnpm
lint` is the CI-owned repo scan, read from this PR's checks.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed. (Not touched: n/a.)
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English. (Except the fleet's
required maintainer brief, 维护者速读.)
- [ ] The *Before Submitting* list in CONTRIBUTING.md is done. (Local
targeted subset only; the full farm is CI's, see Verification.)

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

https://claude.ai/code/session_01L6bhgWAbKPqt7vTgX5qgUn

---------

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/xl 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.

2 participants