Repository navigation
perf(console): the first load no longer downloads spec schemas the Console never reads, nor the whole form package - #37786
Conversation
…gin-form Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv
…odule-state ledger Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv Co-authored-by: Claude <noreply@anthropic.com>
…he spec initializer change; add changeset Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check14 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 7440791295a1b8ca9438b651fb9e9944bc8b4ab8 && git checkout 7440791295a1b8ca9438b651fb9e9944bc8b4ab8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cac93cc627357bef93b0654b912bb75579415fc7 c840b723e400ca3e9dadebb714528f3d8cb3652f && git checkout -B drift-repro cac93cc627357bef93b0654b912bb75579415fc7 && git merge --no-ff c840b723e400ca3e9dadebb714528f3d8cb3652f
node scripts/docs-audit/affected-docs.mjs --json cac93cc627357bef93b0654b912bb75579415fc7 |
…output changes Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: First round. Inputs: card #37572 (body, 2 comments), #37444 (body, 6 comments, ruling 7205984444), the PR body, its 9 files and the net diff at this head, the check-runs on this head, and the cited code read on Gates: read at 2026-11-27T03:58Z, about 15 minutes into CI on this head. 30 check-runs green, none red: ① Derived judgments
② Semver levelThe declared line,
S2 (should-fix) — the ③ Boundary flags
④ Design judgmentNo must-fix. Two should-fix (S1 here, S2 under ②), both owing a delta review.
S1 (should-fix) — the docblock and the ledger test claim a guard that is not there.
The test is not vacuous: its floor and its exact comparison would red on a new cache. But it guards less than the docblock and the PR body say it does. Fix: make the account and the instrument agree. Name the two families with the reason each may be dropped, and either teach the test what the docblock says (a module-scope initializer calling a writer is refused unless listed) or cut the docblock down to what the test holds. Nits, no effect on correctness or the contract; none is worth moving a file for on its own:
Implemented-by: VERDICT: PASS |
… families, and its test reads module-scope initializers The ledger scan now sees writes through a module-level function's result, globalThis and type-only casts, which adds the refusal-head map and the strict-object declaration store. A new test reads every module-scope initializer and refuses a load-time call that reaches a registration store by a name that store's reason does not cover. Clause-② reads yes (widening) for the new @object-ui/plugin-form/core export. Claude-Session: https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA Contract reviewServed-tier: DELTA review from Gates: read at 2026-11-27T04:11Z, about 4 minutes into CI on this head. 12 check-runs green, none red: both ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNo must-fix. No should-fix.
Nits, no effect on correctness or the contract; none moves a file on its own:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA 席位核对 — ACCEPT · head c840b72 · card #37572 (Part of #37444) · area s2-ux · 2026-11-27T04:35ZL1 checklist
Both cards keep Tier: S. Landing: ready + auto-merge by this stroke. |
…bjectstack-ai#37826) <!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuJyLDyhPTFkFALvgwhFG59d)_ Part of objectstack-ai#37444. Part of objectstack-ai#37572. The follow-up the review of objectstack-ai#37786 asked for: that pull request re-pinned the eager-closure budget's `BASELINE` at its branch commit `003fde60`, and it landed on `main` as the squash `50b4bf82`. This records the squash in `BASELINE.squashMerge`, so the baseline's provenance names a commit that exists on `main`. Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:没有。只改控制台首屏字节门禁脚本里的一条出处记录(基线来自哪个 main 提交),不改任何发布的包。 - 为什么做:objectstack-ai#37786 合并后,审核要求把基线的合并提交补上,免得以后有人按分支提交去找却在 main 上找不到。 - 出错会怎样:最坏是这条出处写错;门禁的数值(上限、基线字节)一个都没动。 ## What changes - `ui/scripts/check-eager-closure-budget.mjs`: `BASELINE.squashMerge: '50b4bf82'`, and the provenance prose says which commit is the branch head and which is the squash. - `ui/scripts/__tests__/check-eager-closure-budget.test.ts`: the ledger case expects both commits (`commitsCarriedBy(BASELINE)` equals `[commit, squashMerge]`) and pins `squashMerge` to `50b4bf82`. No ceiling, baseline byte count or per-chunk row changes. `ui/` is a private workspace script, so this publishes nothing and carries `skip-changeset`. ## Why The seat's ACCEPT on objectstack-ai#37786 asked for the back-fill after merge. ## Verification - `pnpm --dir ui exec vitest run scripts/__tests__/check-eager-closure-budget.test.ts`: 174 passed. - `git cat-file -t 50b4bf8` on `main`: a commit (the squash of objectstack-ai#37786). ## Human Minimum - [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic. (not touched) - [x] 2. Every name I added uses the casing for its kind. - [x] 3. No formatter ran; `pnpm lint` passes. - [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. (publishes nothing: `skip-changeset`) - [x] 6. `packages/spec` touched: its generated artifacts are regenerated and committed. (not touched) - [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. - [x] The *Before Submitting* list in CONTRIBUTING.md is done. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv <!-- signed: repo:objectstack#2 · os-sales · session_01L6bhgUFcdpjgtgSfn3qZuv --> Co-authored-by: Claude <noreply@anthropic.com>
Requested by Sales · project thread
Part of #37444. Part of #37572. This is the first bytes cut of the first-screen card: it takes 97,612 gzipped bytes out of the Console's first load. Both cards stay open: the list page and the record page still miss the 2,500 ms line, and what keeps the rest of
@objectstack/specin the first load is schemas the Console really calls at runtime (listed under Acceptance notes), which needs narrower spec exports and is not this PR.Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
Object.assign(已有 schema, …)不包),另有测试扫描整个 spec 源码,出现新的"加载时注册"写法会红。改动可整笔撤回。What changes
The first load (the chunks every Console page fetches before it can draw) measured 1,996,960 bytes gzipped across 124 chunks on
maince4d8c7d, and 1,899,348 across 123 on this branch's build commit003fde60:ce4d8c7d003fde60vendor-objectstackplugin-formpackages/spec/tsup.config.ts: a new pass,wrapModuleScopeInitializers, runs before the existingannotatePureCallsin bothonLoadsites. It wraps each module-scopeconst/letinitializer in a PURE-annotated arrow called at once,/* @__PURE__ */ (() => (init))(). A PURE annotation only covers the call it marks, not its arguments, receiver or chained calls, so a derived constant such asnew Set([...PageComponentType.options, ...Object.keys(ComponentPropsMap)])was kept by every bundler, with every schema it names. Measured with rolldown 1.2.15 (the Console's bundler): a consumer importing onlyresolveI18nLabelkept 235 KB gzipped of spec before, under 1 KB after. Left unwrapped: initializers that are already trivially pure (literals, names, functions), a marked constructor call whose arguments are trivially pure (its own annotation covers it), and every initializer that handsObject.assign/Object.defineProperty/Object.defineProperties/Object.setPrototypeOf/Reflect.*an object it did not create. Function bodies are not touched.packages/spec/src/system/i18n-resolver.ts:TRANSLATABLE_METADATA_TYPESis built from a plain list of names,TRANSLATED_METADATA_TYPE_NAMES, instead ofObject.keys(METADATA_DOCUMENT_TRANSLATORS), so the Console's metadata client reading the set no longer keeps every translator and the schemas they read. The translator table nowsatisfiesa record keyed by exactly those names, so a translator without its name, or a name without a translator, fails the type check. The exported type (ReadonlySet<string>) and its members are unchanged.ui/packages/plugin-form/src/core.ts: re-exportscreateKeepsFieldfrom the side-effect-free@object-ui/plugin-form/core. That is one new export on a published subpath (the package root already exports it; nothing is removed or renamed), and it is the widening theClause-②line names.@objectstack/spec's public surface does not change.ui/packages/app-shell/src/views/RelatedRecordActionsBridge.tsx: importscreateKeepsFieldfrom@object-ui/plugin-form/coreinstead of the package root, which kept the wholeplugin-formgroup eager.ui/apps/console/vite.config.tsaddscreateKeepsFieldto theplugin-form-coregroup's module list.ui/scripts/check-eager-closure-budget.mjs: the aggregate ceiling is re-pinned from 2,489,948 to 2,407,237, lowered by exactly what the closure lost between the previousBASELINE(cc378e93, 1,982,059) and003fde60, so the headroom stays 507,889 bytes (0.71x the regression line), as the objectstack#25925 entry did.BASELINEmoves to003fde60. The four per-chunk rows did not move (vendor-objectstack647,764 under 842,730, 0.27x). The unit test's rendered literal moves from1935.6to1854.8.No behaviour, string, route or saved document changes. Changeset:
patchon@objectstack/spec,@object-ui/plugin-form,@object-ui/app-shell,@object-ui/consoleand@objectstack/console(the Console's chunk rules and the dist it ships change).What was checked for the module-scope wrapping, and what was found
Wrapping an initializer tells the bundler it has no side effects. That is false for an initializer that writes to something that outlives it, so the spec sources were searched for two kinds of write:
An initializer that writes into an existing object. Found 13, all
export const X = Object.assign(XSchema, { create })(api/endpoint.zod.ts1,api/documentation.zod.ts3,api/plugin-rest-api.zod.ts2,api/rest-server.zod.ts2,system/worker.zod.ts4,system/http-server.zod.ts1). Dropping one would removecreatefrom the schema itself. The pass detects the whole family (theMUTATES_FIRST_ARGUMENTset) and leaves them unwrapped; a test pinsObject.assign(TaskSchema, …)andObject.defineProperty(Target, …)as untouched whileObject.assign({}, …)andObject.freeze(Object.keys(…))are wrapped.An initializer that registers into a store other code reads later. Two families do, and both are wrapped because dropping one loses nothing a reader can ask for (the first contract-review round found both; the first version of this PR missed them):
withRefusalHead(prescription, head), 6 constants indata/query.zod.ts, puts a refusal constant's one-line head in a process-wide map onglobalThis. Only code that raises that same constant reads the map, and that code reads the constant, so a bundle that can raise the text keeps the initializer that registered it.strictObject,strictObjectErrorand the schema helpers built on them) pushes its declaration into a process-wide store. Only this package's tests andscripts/build-schemas.tsread it, and they load the sources, never a bundle.packages/spec/scripts/pure-schema-construction.test.tsholds this account in two cases. The first lists every module-level store a function writes (by name, through a member chain, a type-only cast,globalThis, or a module-level function's result such asregistry().set(…)), 39 entries, each with its reason, and marks the five that are registrations (the two above and the three runtimeregisterMetadataType*overlays). The second reads every module-scope initializer (over 1,000 load-time calls) and refuses one whose load-time calls reach a registration store, directly or through the functions they call (matched by name), by a name that store's reason does not cover. Ablation: a module-scoperegisterMetadataTypeSchema('probe', z.string())reds it withregisterMetadataTypeSchema → kernel/metadata-type-schemas.ts EXTRA_METADATA_TYPE_SCHEMAS. A positive control pins the reach on a fixture. Calls are matched by name, not resolved, and a helper that writes only to its own parameter is not a store, so this guards the known shapes rather than proving the absence of every one; thewrapModuleScopeInitializersdocblock says the same.Tests
packages/spec/scripts/pure-schema-construction.test.ts: 15 tests, 15 passed. New cases: what is wrapped and what is not (literals, marked constructors with pure arguments, theObject.assignfamily, function bodies), the order of the two passes (wrap then annotate, no double annotation), a bundled fixture consumer (an unused derived constant drops its schema; the control that reads it keeps it), the module-state ledger, the load-time registration reach and its positive control.tsc --noEmit,check:scripts-typecheck,check:test-typecheckexit 0;vitest run src/system/i18n* src/data/picklist.test.tsand the pure-construction test: 20 files, 807 tests passed (atc840b723).pluginCoreSubpaths-33581.test.tsandside-effects-declaration-consistency.test.ts: 126 passed;tsc --noEmitexit 0 inui/packages/plugin-formandui/packages/app-shell;scripts/__tests__/check-eager-closure-budget.test.ts: 174 passed;pnpm check:eager-closureon the branch build: pass (aggregate 0.71x, every per-chunk row in range, chunk membership exact).Acceptance notes
Measured effect — production build (
pnpm console:build),objectstack startwithNODE_ENV=production, behind a local HTTP/2 TLS front (the card's acceptance condition, Console first screen: home, object list and record page miss the 2.5 s LCP threshold (baseline 3.6 / 4.6 / 4.2 s); re-measure on a production build first #37444 ruling 7205984444), Lighthouse 13.6.0 desktop preset, headless Chrome, signed in, cold cache. Two rounds of five runs per page and build, the second round in reverse order (branch first), so each figure is a median of 10:maince4d8c7dEvery report's
finalUrlis the page asked for (home,showcase_tasklist, ashowcase_taskrecord). Everyhttps:Script request in all 60 reports went overh2(main 1570 / 2460 / 1940, branch 1560 / 2470 / 1950 requests per page over 10 reports). The HTTP/1.1 control was not re-run for this change. Home stays under 2500 ms; the list page misses by 152 ms and the record page by 141 ms. The record page's gain is inside its noise (each build's 10 runs spread about 200 ms): it needed the form package's code later in its load anyway.What still holds spec in the first load (per-name measurement against this build: for each spec name an eager module imports, the gzipped bytes only that name keeps):
ActionSchema(31.7 KB,actionDialogCompanion.tssafeParses an action'spreflight),FieldSchema(28.4 KB,reference-keys.tsreads its key set),ListViewSchema(22.9 KB,userFilterUrlState.tsreads.shape.sort),ManifestSchema(13.2 KB,packages-io.tsreads.shape.id),FormViewSchema(11.0 KB,submitRedirect.tssafeParses asubmitBehavior),DashboardSchema(7.9 KB). Each reads one sub-schema of a large one; exporting those sub-schemas from spec would let the Console drop the rest, but that is a public spec API addition and a separate change.L2 owed (not self-reviewed):
packages/spec/**is a contract path.Verification
Two-minute check:
cd packages/spec && pnpm exec vitest run --project local scripts/pure-schema-construction.test.ts→ 15 passed.Read first:
wrapModuleScopeInitializersandwritesToAnExistingObjectinpackages/spec/tsup.config.ts(what is excluded from wrapping is the whole safety argument), thenMODULE_STATE_WRITTEN_IN_FUNCTIONS,REGISTRATION_STORESandLOAD_TIME_REGISTRATIONSin the test.Local gates (derived by dispatch-gates.mjs --commands)
Run at
48eab6fd. Later commits up to headc840b723: two change only the changeset (its title, the two console packages); the third is the contract-review fix (spec test, thetsup.config.tsdocblock, comments ini18n-resolver.ts, the changeset'sClause-②). For that one, spectsc --noEmit,check:scripts-typecheck,check:test-typecheck,check:docs,check:api-surface(after a spec rebuild),check:spec-docblock-symbol-anchorsand eslint on the three files exit 0; the rebuilt spec JS differs from the previous build only in those comments and chunk hash names. 85 derived, 85 run, each exit captured before any pipe. Every other family (type-check lanes, Test UI, Build and E2E UI, the eager-closure budget on CI's merge ref) 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-closing-keyword-parity.mjs→ exit 0node scripts/check-closing-keyword-parity.mjs --self-test→ exit 0node scripts/check-comment-mask-adoption.mjs→ exit 0node scripts/check-comment-mask-adoption.mjs --self-test→ exit 0node scripts/check-comment-mask-corpus.mjs→ exit 0node scripts/check-dev-prereqs.mjs --self-test→ exit 0node scripts/check-dts-emitted.mjs --self-test→ exit 0node scripts/check-issue-citations.mjs→ exit 0node scripts/check-plugin-teardown-shape.mjs→ exit 0node scripts/check-plugin-teardown-shape.mjs --self-test→ exit 0 (first run exit 3: this shallow clone lacked its pinned fixture commit; passed after fetching that one commit)node scripts/check-sdui-manifest.mjs→ exit 0node scripts/check-sdui-manifest.mjs --self-test→ exit 0node scripts/ci/assert-turbo-remote-cache.mjs --self-test→ exit 0node scripts/ci/plan-test-core-shards.mjs --self-test→ exit 0node scripts/ci/prune-turbo-cache.mjs --self-test→ exit 0node scripts/docs-audit/check-affected-docs.mjs→ exit 0node scripts/docs-audit/check-drift-comment.mjs→ exit 0pnpm --dir ui exec vitest run scripts/→ exit 0 with--maxWorkers=2(172 files passed, 2 skipped; 5,130 tests passed). The first two runs, with the default worker count, were killed by this container's memory limit (a 10 GB worker), not by a testpnpm --filter @objectstack/lint run check:doc-formula-expressions→ exit 0pnpm --filter @objectstack/spec run check:api-surface→ exit 0pnpm --filter @objectstack/spec run check:authorable-surface→ exit 0pnpm --filter @objectstack/spec run check:browser-reachable-entries→ exit 0pnpm --filter @objectstack/spec run check:docs→ exit 0pnpm --filter @objectstack/spec run check:dual-source-exports→ exit 0pnpm --filter @objectstack/spec run check:duration-unit-keys→ exit 0pnpm --filter @objectstack/spec run check:empty-state→ exit 0pnpm --filter @objectstack/spec run check:entry-nameability→ exit 0pnpm --filter @objectstack/spec run check:export-origins→ exit 0pnpm --filter @objectstack/spec run check:exported-any→ exit 0pnpm --filter @objectstack/spec run check:liveness→ exit 0pnpm --filter @objectstack/spec run check:llms-txt→ exit 0pnpm --filter @objectstack/spec run check:skill-refs→ exit 0pnpm --filter @objectstack/spec run check:strictness-ledger→ exit 0pnpm --filter @objectstack/spec run check:variant-docs→ exit 0pnpm --filter @objectstack/spec run check:yaml-examples→ exit 0pnpm check:adr-anchors→ exit 0pnpm check:adr-symbol-anchors→ exit 0pnpm check:changeset-gate-self-tests→ exit 0pnpm check:ci-filter-parity→ exit 0pnpm check:closed-ceremony-text→ exit 0pnpm check:cross-package-test-inputs→ exit 0pnpm check:dispatcher-error-vocabulary→ exit 0pnpm check:doc-authoring→ exit 0pnpm check:driver-memory-census→ exit 0pnpm check:dts-closure→ exit 0pnpm check:dual-build-cjs-loads→ exit 0pnpm check:engine-double-contract→ exit 0pnpm check:gitlink-declared→ exit 0pnpm check:issue-citations→ exit 0pnpm check:keyed-text-bounds→ exit 0pnpm check:lean-entry-closure→ exit 0pnpm check:logger-receiver-detach→ exit 0pnpm check:merge-driver→ exit 0pnpm check:nul-bytes→ exit 0pnpm check:object-def-param-keys→ exit 0pnpm check:objectql-double-limit→ exit 0pnpm check:org-identifier→ exit 0pnpm check:page-declaration-shape→ exit 0pnpm check:platform-object-tenancy-census→ exit 0pnpm check:pm-expected-skips→ exit 0pnpm check:pm-governed-merges→ exit 0pnpm check:pm-prior-rulings→ exit 0pnpm check:pnpm-flag-spellings→ 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:settings-bind-window→ exit 0pnpm check:skill-identifier-liveness→ exit 0pnpm check:slot-lookup→ exit 0pnpm check:sourcemap-no-sources-content→ exit 0pnpm check:spec-docblock-symbol-anchors→ exit 0pnpm check:spec-parsed-alias→ exit 0pnpm check:system-context-census→ 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:vouch-for-reference-callers→ exit 0pnpm check:watch-hint-literal→ exit 0pnpm check:where-matcher→ exit 0Human Minimum
packages/specholds no runtime logic.pnpm lintpasses. (eslint over the changed files: 0 errors; the warnings inRelatedRecordActionsBridge.tsxpredate this change, which edits one import line there)main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (no generated artifact changed:check:api-surfaceand the other spec generated-file gates pass unchanged)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgUFcdpjgtgSfn3qZuv
Generated by Claude Code