Skip to content

perf(console): the first load no longer downloads spec schemas the Console never reads, nor the whole form package - #37786

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-575qr3
Nov 27, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-575qr3

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

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/spec in 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

维护者速读

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 main ce4d8c7d, and 1,899,348 across 123 on this branch's build commit 003fde60:

chunk ce4d8c7d 003fde60 delta
vendor-objectstack 698,253 647,764 −50,489
plugin-form 48,162 — −48,162
everything else 1,250,545 1,251,584 +1,039
aggregate 1,996,960 1,899,348 −97,612
  • packages/spec/tsup.config.ts: a new pass, wrapModuleScopeInitializers, runs before the existing annotatePureCalls in both onLoad sites. It wraps each module-scope const / let initializer 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 as new 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 only resolveI18nLabel kept 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 hands Object.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_TYPES is built from a plain list of names, TRANSLATED_METADATA_TYPE_NAMES, instead of Object.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 now satisfies a 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-exports createKeepsField from 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 the Clause-② line names. @objectstack/spec's public surface does not change.
  • ui/packages/app-shell/src/views/RelatedRecordActionsBridge.tsx: imports createKeepsField from @object-ui/plugin-form/core instead of the package root, which kept the whole plugin-form group eager. ui/apps/console/vite.config.ts adds createKeepsField to the plugin-form-core group'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 previous BASELINE (cc378e93, 1,982,059) and 003fde60, so the headroom stays 507,889 bytes (0.71x the regression line), as the objectstack#25925 entry did. BASELINE moves to 003fde60. The four per-chunk rows did not move (vendor-objectstack 647,764 under 842,730, 0.27x). The unit test's rendered literal moves from 1935.6 to 1854.8.

No behaviour, string, route or saved document changes. Changeset: patch on @objectstack/spec, @object-ui/plugin-form, @object-ui/app-shell, @object-ui/console and @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:

  1. An initializer that writes into an existing object. Found 13, all export const X = Object.assign(XSchema, { create }) (api/endpoint.zod.ts 1, api/documentation.zod.ts 3, api/plugin-rest-api.zod.ts 2, api/rest-server.zod.ts 2, system/worker.zod.ts 4, system/http-server.zod.ts 1). Dropping one would remove create from the schema itself. The pass detects the whole family (the MUTATES_FIRST_ARGUMENT set) and leaves them unwrapped; a test pins Object.assign(TaskSchema, …) and Object.defineProperty(Target, …) as untouched while Object.assign({}, …) and Object.freeze(Object.keys(…)) are wrapped.

  2. 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 in data/query.zod.ts, puts a refusal constant's one-line head in a process-wide map on globalThis. 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.
    • Every strict object (strictObject, strictObjectError and the schema helpers built on them) pushes its declaration into a process-wide store. Only this package's tests and scripts/build-schemas.ts read it, and they load the sources, never a bundle.

    packages/spec/scripts/pure-schema-construction.test.ts holds 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 as registry().set(…)), 39 entries, each with its reason, and marks the five that are registrations (the two above and the three runtime registerMetadataType* 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-scope registerMetadataTypeSchema('probe', z.string()) reds it with registerMetadataTypeSchema → 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; the wrapModuleScopeInitializers docblock 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, the Object.assign family, 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.
  • Spec: tsc --noEmit, check:scripts-typecheck, check:test-typecheck exit 0; vitest run src/system/i18n* src/data/picklist.test.ts and the pure-construction test: 20 files, 807 tests passed (at c840b723).
  • UI: pluginCoreSubpaths-33581.test.ts and side-effects-declaration-consistency.test.ts: 126 passed; tsc --noEmit exit 0 in ui/packages/plugin-form and ui/packages/app-shell; scripts/__tests__/check-eager-closure-budget.test.ts: 174 passed; pnpm check:eager-closure on 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 start with NODE_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:

    Page h2 main ce4d8c7d h2 this branch delta script KB
    Home 2245 2172 −73 1924 → 1832
    Object list 2718.5 2652 −66 2276 → 2231
    Record page 2646 2640.5 −5 2180 → 2135

    Every report's finalUrl is the page asked for (home, showcase_task list, a showcase_task record). Every https: Script request in all 60 reports went over h2 (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.ts safeParses an action's preflight), FieldSchema (28.4 KB, reference-keys.ts reads its key set), ListViewSchema (22.9 KB, userFilterUrlState.ts reads .shape.sort), ManifestSchema (13.2 KB, packages-io.ts reads .shape.id), FormViewSchema (11.0 KB, submitRedirect.ts safeParses a submitBehavior), 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: wrapModuleScopeInitializers and writesToAnExistingObject in packages/spec/tsup.config.ts (what is excluded from wrapping is the whole safety argument), then MODULE_STATE_WRITTEN_IN_FUNCTIONS, REGISTRATION_STORES and LOAD_TIME_REGISTRATIONS in the test.

Local gates (derived by dispatch-gates.mjs --commands)

Run at 48eab6fd. Later commits up to head c840b723: two change only the changeset (its title, the two console packages); the third is the contract-review fix (spec test, the tsup.config.ts docblock, comments in i18n-resolver.ts, the changeset's Clause-②). For that one, spec tsc --noEmit, check:scripts-typecheck, check:test-typecheck, check:docs, check:api-surface (after a spec rebuild), check:spec-docblock-symbol-anchors and 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 0
  • node scripts/check-adr-0087-registration.mjs --self-test → 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-adoption.mjs → exit 0
  • node scripts/check-comment-mask-adoption.mjs --self-test → exit 0
  • node scripts/check-comment-mask-corpus.mjs → exit 0
  • node scripts/check-dev-prereqs.mjs --self-test → exit 0
  • node scripts/check-dts-emitted.mjs --self-test → exit 0
  • node scripts/check-issue-citations.mjs → exit 0
  • node scripts/check-plugin-teardown-shape.mjs → exit 0
  • node 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 0
  • node scripts/check-sdui-manifest.mjs --self-test → exit 0
  • node scripts/ci/assert-turbo-remote-cache.mjs --self-test → exit 0
  • node scripts/ci/plan-test-core-shards.mjs --self-test → exit 0
  • node scripts/ci/prune-turbo-cache.mjs --self-test → exit 0
  • node scripts/docs-audit/check-affected-docs.mjs → exit 0
  • node scripts/docs-audit/check-drift-comment.mjs → exit 0
  • pnpm --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 test
  • pnpm --filter @objectstack/lint run check:doc-formula-expressions → exit 0
  • pnpm --filter @objectstack/spec run check:api-surface → exit 0
  • pnpm --filter @objectstack/spec run check:authorable-surface → exit 0
  • pnpm --filter @objectstack/spec run check:browser-reachable-entries → exit 0
  • pnpm --filter @objectstack/spec run check:docs → exit 0
  • pnpm --filter @objectstack/spec run check:dual-source-exports → exit 0
  • pnpm --filter @objectstack/spec run check:duration-unit-keys → exit 0
  • pnpm --filter @objectstack/spec run check:empty-state → exit 0
  • pnpm --filter @objectstack/spec run check:entry-nameability → exit 0
  • pnpm --filter @objectstack/spec run check:export-origins → exit 0
  • pnpm --filter @objectstack/spec run check:exported-any → exit 0
  • pnpm --filter @objectstack/spec run check:liveness → exit 0
  • pnpm --filter @objectstack/spec run check:llms-txt → exit 0
  • pnpm --filter @objectstack/spec run check:skill-refs → exit 0
  • pnpm --filter @objectstack/spec run check:strictness-ledger → exit 0
  • pnpm --filter @objectstack/spec run check:variant-docs → exit 0
  • pnpm --filter @objectstack/spec run check:yaml-examples → 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:ci-filter-parity → 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:doc-authoring → exit 0
  • pnpm check:driver-memory-census → exit 0
  • pnpm check:dts-closure → exit 0
  • pnpm check:dual-build-cjs-loads → exit 0
  • pnpm check:engine-double-contract → exit 0
  • pnpm check:gitlink-declared → exit 0
  • pnpm check:issue-citations → exit 0
  • pnpm check:keyed-text-bounds → exit 0
  • pnpm check:lean-entry-closure → exit 0
  • pnpm check:logger-receiver-detach → exit 0
  • pnpm check:merge-driver → exit 0
  • pnpm check:nul-bytes → exit 0
  • pnpm check:object-def-param-keys → exit 0
  • pnpm check:objectql-double-limit → exit 0
  • pnpm check:org-identifier → exit 0
  • pnpm check:page-declaration-shape → exit 0
  • pnpm check:platform-object-tenancy-census → exit 0
  • pnpm check:pm-expected-skips → exit 0
  • pnpm check:pm-governed-merges → exit 0
  • pnpm check:pm-prior-rulings → exit 0
  • pnpm check:pnpm-flag-spellings → 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:settings-bind-window → exit 0
  • pnpm check:skill-identifier-liveness → exit 0
  • pnpm check:slot-lookup → exit 0
  • pnpm check:sourcemap-no-sources-content → exit 0
  • pnpm check:spec-docblock-symbol-anchors → exit 0
  • pnpm check:spec-parsed-alias → exit 0
  • pnpm check:system-context-census → 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:vouch-for-reference-callers → 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. (eslint over the changed files: 0 errors; the warnings in RelatedRecordActionsBridge.tsx predate this change, which edits one import line there)
  • 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. (no generated artifact changed: check:api-surface and the other spec generated-file gates pass unchanged)
  • 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_01L6bhgUFcdpjgtgSfn3qZuv


Generated by Claude Code

…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>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation protocol:system tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 27, 2026
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

14 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
  • 3 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 177 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json cac93cc627357bef93b0654b912bb75579415fc7 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7440791295a1b8ca9438b651fb9e9944bc8b4ab8 — the merge of head c840b723e400ca3e9dadebb714528f3d8cb3652f into base cac93cc627357bef93b0654b912bb75579415fc7, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# 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

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 04eb2c057302c59f93e2b343a558241b6255e856
Local-runs: probe — read-only static AST scans of packages/spec/src on main (nothing built, tested or re-run): neither the diff nor the check-runs can name which module-scope initializers the wrapper touches or what they call
Scope: packages/spec/src/system/i18n-resolver.ts + packages/spec/tsup.config.ts, packages/spec/scripts/pure-schema-construction.test.ts

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 main at 3ed97b71. The rest of the diff (ui/**, the changeset's prose) is the lane seat's ACCEPT at TIER_DEFAULT.

Gates: read at 2026-11-27T03:58Z, about 15 minutes into CI on this head. 30 check-runs green, none red: Build Core, both Check Changeset runs, Lint & Repo Gates and the Lint families, Lint UI, Type Check · source gates, Type Check · consumer gates, Type Check · debt ledger, Spec property liveness, Live E2E UI, Governed Surface Queue Guard, PR-body guards, Test Core (9/10) and one Test UI shard. 27 still running: Test Core (9 of 10 shards), Test UI (15 of 16), Build & E2E UI, Type Check UI, Type Check · workspace. 12 skipped; the one cancelled PR-body guards run was replaced by a green one. The running ones are not judged here, and two of them carry claims this record leans on: the workspace type check holds the satisfies clause, and a Test Core shard runs the ledger test. Read them before this record is used.

① Derived judgments

  • @objectstack/spec public surface: unchanged. Right. No export is added, removed or retyped. TRANSLATED_METADATA_TYPE_NAMES and the MetadataDocumentTranslator type are module-private.
  • @objectstack/spec accept set: unchanged. Right. No schema is edited; Metadata-protocol: none holds.
  • TRANSLATABLE_METADATA_TYPES: same set, same order. Right. The table on main has 13 keys (view, action, object, app, dashboard, dataset, page, picklist, position, permission, report, book, mapping) and the new list spells the same 13 in the same order. The declared type is still a read-only set of strings. Every reader on main asks .has() or spreads it into another set (packages/rest/src/meta-item-read-gate.ts:3294, the runtime parity test), so none depends on order.
  • @objectstack/spec published JS: shape changes, values do not. Right as described. A replica of the PR's own decision functions over main wraps 2,037 of 5,185 initialised module-scope declarations and leaves 13 alone, the same 13 Object.assign(ExistingSchema, { create }) sites the PR lists. A process that loads the dist unbundled (server, CLI, plugins) still evaluates every initializer: spec's own build can only drop a binding nothing reads, and main has no unexported module-scope variable that nothing else in its file names (0 found).
  • .d.ts: untouched by the transform. Right. The pass is an esbuild onLoad plugin. It runs for the ESM and CJS outputs, the browser/ outputs and the node-side copies (both onLoad sites are changed). The declaration pass (BUILD_DTS=true, dts.only) reads the original sources and never calls it. The only declaration bytes that move are the edited jsdoc on TRANSLATABLE_METADATA_TYPES.
  • @object-ui/plugin-form: its published ./core entry gains one export, createKeepsField. A widening, declared as none. Wrong: see S2.
  • @object-ui/app-shell, @object-ui/console, @objectstack/console: no surface change. Right. One import specifier and one chunk rule.

② Semver level

The declared line, Clause-②: no, is wrong for the change as a whole: it should read Clause-②: yes (widening). no is right for @objectstack/spec (its published JS changes shape; no accept set and no export moves), but the line answers for every package in the changeset, and @object-ui/plugin-form/core gains a member.

patch on all five packages is right: Metadata-protocol: none takes patch, and a non-protocol widening ships patch too (AGENTS.md, Post-Task Checklist 3). Check Changeset is green on this head.

S2 (should-fix) — the Clause-② line is wrong for @object-ui/plugin-form. ui/packages/plugin-form/src/core.ts adds export { createKeepsField } to the published @object-ui/plugin-form/core subpath. The repo's own precedent calls exactly this a widening: changeset 9e6533b ("one new export, relatedCreateSeedOf, on the published @object-ui/plugin-detail/core subpath; nothing is removed or renamed, and the package root exports the same names as before") and the changeset that first put createKeepsField on the package root (ui/packages/plugin-form/CHANGELOG.md:268). Fix: Clause-②: yes (widening) with the one export named, in the PR body and in the changeset. The level stays patch.

③ Boundary flags

④ Design judgment

No must-fix. Two should-fix (S1 here, S2 under ②), both owing a delta review.

packages/spec/src/system/i18n-resolver.ts — holds. Against the code it cites: the table and the list agree today (above). The satisfies clause sits on the object literal, so it checks both directions: a missing name is a missing property, and an extra translator is an excess property. The wider annotation on the table keeps the [type] lookup in translateMetadataDocument as it was. Against its scenario: a reader of the set now reaches the name list only; the list is a literal, the table is a literal of names, and the set's own initializer is wrapped. Tried to break it: order (the type check does not hold order, and no reader needs it), duplicates (a set), a reader that iterates (none).

packages/spec/tsup.config.ts — the transform holds; its safety account does not.

  • Semantics, order and TDZ hold. The arrow is called in place with no arguments, so a kept initializer runs at the same point as before, and closures see the same bindings. A bundler keeps what a kept initializer reads, because the read is a reference. main has no module-scope class expression (whose inferred name would be lost) and no await, this or destructuring pattern in a wrapped declaration. Arrows and function expressions are left unwrapped, so their names survive.
  • Sites that write outside themselves, each read on main:
    • Object.assign(ExistingSchema, { create }), 13 sites: skipped by the wrapper. Right.
    • componentSlot(...) (5 sites) and declare(...), called directly or through requiredOneOf: a WeakMap keyed by the schema or predicate the same initializer just built. Wrapped, safe, in the ledger.
    • zod's .describe() and .meta(): registered against the clone they return; no meta id is used outside a test. Wrapped, safe.
    • withRefusalHead(prescription, head), 6 sites, data/query.zod.ts:104, 111, 241, 429, 448, 462: wrapped, and it registers into a process-wide map on globalThis (shared/refusal-head.ts:59-90). Not in the ledger; the scan cannot see it.
    • strictObjectError pushes every strict object's declaration into a process-wide store (shared/strict-object.ts:242, 383). Not in the ledger either. Its only readers are spec's own tests and scripts/build-schemas.ts, which run from source, and strictObject has been marked since spec: importing one function from a @objectstack/spec subpath pulls its whole module graph — measured +237 KB minified, nothing tree-shakes #10031.
  • Nothing breaks today. Each of the six prescriptions is raised only through the constant that registers it (query.zod.ts:183-184, 322, 617-635, data-engine.zod.ts:157, 207, api/protocol.zod.ts:3403, objectql/src/engine-top-level.ts:654-655), so any bundle that can raise the text keeps the registration.

packages/spec/scripts/pure-schema-construction.test.ts — a real guard, narrower than its account. The wrapper cases pin the transform on synthetic text, the fixture consumer has its control (the reader keeps the schema the helper-only consumer drops), and the ledger case has a floor and an exact comparison. What the ledger case does not do is in S1.

S1 (should-fix) — the docblock and the ledger test claim a guard that is not there. wrapModuleScopeInitializers' docblock says that no call at module scope registers into a table, and that the test "reads every module-scope initializer of this package's sources and refuses one that calls a function writing to a module-level binding". Neither sentence agrees with the tree:

  1. Six module-scope initializers do register (withRefusalHead), and every strictObject does too. The safety argument for them (the registering constant is the one every raiser reads; the store is read only from source) is true but written nowhere.
  2. The test never reads a module-scope initializer. It lists the module-level bindings that some function writes and compares that list to the ledger. A new module-scope call of a writer already in the ledger (registerMetadataTypeSchema(...) at module scope, say) changes nothing in that list and stays green.
  3. The scan sees a write only when its receiver is rooted in a module-level name. It misses a receiver that is a call (registry().set(...), declarationStore().push(...): the two real sites), globalThis, a receiver under an as cast, and a helper that writes to its own parameter.

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:

  • N1 (nit): i18n-resolver.ts still says in unchanged comments that the set "is derived below" and that registering in the table "is the whole wiring" (the dataset comment inside the table at :2045; the dataset translator's docblock at :2748). A new type now takes its name in the list too. The type check asks for it, so nobody can ship the gap.
  • N2 (nit): writesToAnExistingObject stops at every function boundary, so it would not see a callback that runs at load (a LIST.map(...) callback that calls Object.assign(Existing, ...), a source-level IIFE), and isFreshValue takes any call result as fresh. main has no such site: 3 source-level IIFE initializers, none writing module state, and the 3 wrapped Object.assign calls all take a new arrow first.

Implemented-by: claude/project-thread-575qr3
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: c840b723e400ca3e9dadebb714528f3d8cb3652f
Local-runs: none
Scope: packages/spec/src/system/i18n-resolver.ts + packages/spec/tsup.config.ts, packages/spec/scripts/pure-schema-construction.test.ts

DELTA review from 04eb2c057302c59f93e2b343a558241b6255e856 (record 7209422545: PASS, should-fix S1 and S2, nits N1 and N2) to this head. One commit, c840b723, four files: the changeset, the test, i18n-resolver.ts and tsup.config.ts. Inputs: that delta, the PR body at this head, comment 7209516099 on #37444, the check-runs on both heads, and the cited code on main.

Gates: read at 2026-11-27T04:11Z, about 4 minutes into CI on this head. 12 check-runs green, none red: both Check Changeset runs, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Check PR Size, Dogfood Regression Gate, the docs flag, both shard planners, Auto Label, filter. 25 still running: all ten Test Core shards, Build Core, Build UI Deps, the eight Lint families, the four Type Check families and Live E2E UI; no Test UI shard has started. 12 skipped; one cancelled PR-body guards run was replaced by a green one. On the previous head CI finished with 57 green and none red, Type Check · workspace among them; three Test Core shards (3, 5, 6 of 10) were cancelled by this push and never answered. So the ledger test, with its two new cases, has no CI answer on this head yet. Read Test Core and Type Check · workspace here before this record is used.

① Derived judgments

  • No accept set and no public surface moves in the delta. Right. Both hunks in the one published source, i18n-resolver.ts, are inside comments: four line comments in the translator table and one docblock. The tsup.config.ts hunk is inside the wrapModuleScopeInitializers docblock, so the transform does what it did at the previous head. The test file is not published.
  • Published bytes: comments, and what follows from them. Right as the dev describes it. No executable token changes. The docblock on the dataset translator is emitted into the declarations, three lines are added above the rest of i18n-resolver.ts so its source map shifts, and chunk names follow chunk content. Judged from the diff; nothing was built here.
  • The round-1 judgments on TRANSLATABLE_METADATA_TYPES, the transform and the .d.ts pass stand. The delta touches none of that code.

② Semver level

  • S2: closed. The changeset and the PR body now read Clause-②: yes (widening) and name the one export, createKeepsField on the published @object-ui/plugin-form/core subpath, in the words of the 9e6533b precedent. Both say @objectstack/spec's surface does not change. patch on all five packages stands, and Check Changeset is green on this head.

③ Boundary flags

④ Design judgment

No must-fix. No should-fix.

  • S1: closed. All three parts are in the tree.
    1. The scan now reads a write through a type-only cast, through globalThis, and through the result of a module-level function declaration. The ledger gains shared/refusal-head.ts registry() and shared/strict-object.ts declarationStore(), 39 entries. Those are the only two call-result receivers of a writing method in spec's sources on main.
    2. A new case reads the calls each module-scope initializer makes outside the functions it defines, follows them by name to the five stores marked as registrations, and refuses a caller the store does not list: withRefusalHead only for the refusal heads, any caller for the declaration store, none for the three registerMetadataType* stores. It cannot pass empty: it wants more than 1,000 load-time calls and must see both known families reach their store.
    3. The docblock names the two families with the reason each may be dropped, says what the test reads, and says it is a guard on known shapes, not a proof.
  • No module-scope call reaches a registration unlisted today. Every reference to withRefusalHead and to the three registerMetadataType* functions in spec's sources is a definition, a string, or one of the six direct calls in data/query.zod.ts. There is no import alias, no local alias, no callback and no method that reaches them, so the by-name walk misses nothing that exists.
  • N1: closed. The table's four comments and the dataset translator's docblock now say the name list is part of the wiring and that the type check asks for both.
  • packages/spec/src/system/i18n-resolver.ts — holds, comments only.
  • packages/spec/tsup.config.ts — holds. The docblock agrees with the test on every claim about today's tree. Two sentences are looser than the code (N3, N4).
  • packages/spec/scripts/pure-schema-construction.test.ts — a real guard. One step is unpinned (N5).

Nits, no effect on correctness or the contract; none moves a file on its own:

  • N2 (nit, carried): unchanged, as the dev says.
  • N3 (nit): the walk has limits the docblock does not list. A call inside a callback or an IIFE that the initializer runs at load is not read; the fixture pins exactly that (its [1].map(...) callback does call register at load, and the case asserts the call is not counted). Calls made from object-literal methods, class methods and constructors are not attributed to any name, an aliased import or local alias is a different name, and a store handed out by an arrow constant is not seen (only function declarations are). None of these shapes reaches a restricted store today.
  • N4 (nit): "Only code that raises that same constant reads the map" is not literally so. The reader is refusalHeadOf, called by the data doors; the raiser is the schema. What holds is that a lookup can only answer for a message raised from the constant, and the raiser reads the constant. The conclusion drawn from it is right.
  • N5 (nit): the positive control pins what the verdict is computed from (the store found, the reach through a helper, the load-time call) and stops there. The refusal itself runs only on the real sources, where it must find nothing, so the red path rests on the dev's hand ablation.

Implemented-by: claude/project-thread-575qr3
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

席位核对 — ACCEPT · head c840b72 · card #37572 (Part of #37444) · area s2-ux · 2026-11-27T04:35Z

L1 checklist

  • Shape and checks. l1-face.mjs --pr 37786 flags one item, all-checks. The flagged run is a PR-body guards run (140305545886) that was cancelled when the body was edited mid-run. The later run of the same name, 140305744917, is a success on this head. Every other check-run is a success or an expected skip: 60 success, 12 skipped. Test Core, Test UI, TypeScript Type Check and Lint & Repo Gates are all green. mergeable_state is clean. 9 files. Changesets: patch on spec, plugin-form, app-shell, @object-ui/console and @objectstack/console. Clause-②: yes (widening) (createKeepsField on @object-ui/plugin-form/core), Metadata-protocol: none.

  • Contract review at CONTRACT_REVIEW_TIER. The scope was widened to spec's tsup.config.ts, because the build pass changes the JS that @objectstack/spec ships.

    • 7209422545 at 04eb2c0: PASS, with S1 and S2 open.
    • 7209603653 at this head: PASS, clean, with S1, S2 and N1 closed.

    The seat adopts the final record. Its findings:

    • No wrapped initializer has a side effect that a used export relies on.
    • Order and TDZ are preserved, and the pass covers ESM, CJS and browser/.
    • The ledger and load-time-call tests are real guards on today's shapes: they cannot pass empty, and they see both registration families.
    • TRANSLATABLE_METADATA_TYPES has the same 13 members in the same order.
  • Part of on both cards is right. The first load drops 97,612 gzipped bytes. List (2652) and record (2640) are still over 2500, and the readings are on 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 (7209516099).

  • Changeset read sentence by sentence. It matches the diff.

  • Governance. check-governed-merges.mjs on the final 9-file list: not governed, 803 changed lines. Tier S.

  • Follow-ups. N2–N5 go to review follow-ups of PR #37786 #37804. The next byte cut, exporting the sub-schemas the Console reads, is spec: export the sub-schemas the Console reads, so its first load stops pulling whole ActionSchema, FieldSchema and ListViewSchema graphs #37805. The dev back-fills BASELINE.squashMerge after the merge.

Both cards keep pm:dispatched: #37572 stays with its thread, and #37444 stays open.

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

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 27, 2026 04:36
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 50b4bf8 Nov 27, 2026
73 of 74 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-575qr3 branch November 27, 2026 05:16
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…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>
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 protocol:system size/l 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