Repository navigation
perf(console): an object list and a record page no longer load the Studio designer's string table on first paint - #37589
Merged
Conversation
Contributor
Author
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head 688b77f · card #37444 (slice C) · area s2-ux · 2026-11-26T14:46ZL1 checklist
Tier: S. Landing: ready + auto-merge by this stroke. |
This was referenced Nov 26, 2026
Merged
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
维护者速读
What changes
Two component modules in
@object-ui/app-shellheld small pure helpers next to React components that import the designer'st()(views/metadata-admin/i18n.ts) and, through it, thestudionamespace'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 ofStudioCustomizeControls.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 ofDraftConflictDialog.tsx(the conflict predicates, the pins,readDraftForSave,DraftVersionGuard,heldDraftVersionOfand their types).useDraftSaveGuardand the dialog, which render and translate, stay where they were.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 mockeduseCustomizeDoorWalledonStudioCustomizeControlsnow mock it oncustomizeOverride, where the hook lives.No behaviour, string, route or saved document changes. Changeset:
patchon@object-ui/app-shell,@object-ui/console,@objectstack/console(the Console dist ships the change).Tests
views/__tests__/firstScreenStudioCatalogue-37444.test.ts: walks each first-screen save path's static relative imports in source (type-only imports andimport()excluded) and asserts none reaches the designer string table; the walk proves it sees the edge by requiringDraftConflictDialog.tsxandStudioCustomizeControls.tsxto reach it, and the two new modules import no component module. Ablation: pointingrecordTabsConfigSave.tsback atDraftConflictDialog.jsredsviews/recordTabsConfigSave.ts reaches no designer string table through static imports(1 failed, 5 passed); restored withgit checkout HEAD --.@object-ui/app-shelltests touching any moved name or edited importer: 85 files, 977 tests passed (pnpm exec vitest run --maxWorkers=2over the 85 files, fromui/); the new file 6/6.tsc --noEmitinui/packages/app-shellexit 0;tsc -p tsconfig.test.jsonexit 0.eslintover the 20 changedui/files: 0 errors (181 warnings, allreact-refresh/only-export-componentsof the kind these files already carried).Acceptance notes
Measured effect (production build, the card's conditions) — tree: this branch (
688b77ffsource; Console rebuilt withpnpm console:build),objectstack startwithNODE_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:021524cd)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-closurereads it in CI).The record page's other large route chunk,
plugin-grid(192 KB gzipped), was looked at and left: rolldown groupsplugin-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. SplittingImportWizard/ bulk-action code out of it is a possible later cut inside the eager/route diet slices.layout/designModeMenuSave.tsalso 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, theRecordDetailView-*.jsandObjectView-*.jschunks no longer importi18n-ns-studio-en-*.jsthrough any static chain.Read first:
views/metadata-admin/draftVersionGuard.ts(the guard class moved verbatim; check no symbol was left behind thatuseDraftSaveGuardneeds),views/studio-design/StudioCustomizeControls.tsx(the re-export block and the trimmed imports), the three test mocks retargeted tocustomizeOverride.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 0node scripts/check-adr-0087-registration.mjs --self-test→ exit 0node scripts/check-changeset-no-major.mjs --base origin/main→ exit 0node scripts/check-closing-keyword-parity.mjs→ exit 0node scripts/check-closing-keyword-parity.mjs --self-test→ exit 0node scripts/check-comment-mask-corpus.mjs→ exit 0node scripts/check-empty-changeset.mjs --base origin/main→ exit 0node scripts/check-empty-changeset.mjs --self-test→ exit 0node scripts/check-sdui-manifest.mjs→ exit 0node scripts/check-sdui-manifest.mjs --self-test→ exit 0node scripts/ci/snapshot-next.mjs --self-test→ exit 0node scripts/pm/check-governed-queue-guard.mjs --self-test→ exit 0node scripts/pm/release-rehearsal-clone.mjs --self-test→ exit 0node scripts/release-pending-publish.mjs --self-test→ exit 0pnpm --dir ui exec vitest run scripts/→ exit 0pnpm --filter @objectstack/spec run check:duration-unit-keys→ exit 0pnpm check:adr-anchors→ exit 0pnpm check:adr-symbol-anchors→ exit 0pnpm check:changeset-gate-self-tests→ exit 0pnpm check:closed-ceremony-text→ exit 0pnpm check:cross-package-test-inputs→ exit 0pnpm check:dispatcher-error-vocabulary→ exit 0pnpm check:driver-memory-census→ exit 0pnpm check:engine-double-contract→ exit 0pnpm check:gitlink-declared→ exit 0pnpm check:nul-bytes→ exit 0pnpm check:published-files→ exit 0pnpm check:query-options-erasure→ exit 0pnpm check:refd-timer-probe→ exit 0pnpm check:registry-log-declared→ exit 0pnpm check:rest-log-spy-declared→ exit 0pnpm check:skill-identifier-liveness→ exit 0pnpm check:test-source-alias→ exit 0pnpm check:tier-file-adoption→ exit 0pnpm check:type-check-coverage→ exit 0pnpm check:type-check-debt→ exit 0pnpm check:undeclared-dep-imports→ exit 0pnpm check:watch-hint-literal→ exit 0pnpm check:where-matcher→ exit 0Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.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_01L6bhgU8Bf564ZGXi4MfHWb
Generated by Claude Code