Skip to content

fix(runtime,cli): a newcomer's first boot is quiet — the empty stub declares its protocol range, and a scaffold's os dev composes one MetadataPlugin - #30333

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/project-thread-8igxgg
Nov 5, 2026
Merged

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

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread

domain:server#3 · os-bill · session_01Utp6CZgQTno2oPVD2GLd2n

Fixes #29937
Fixes #29936

Clause-②: no — boot diagnostics only; nothing accepted or published changes
Metadata-protocol: none

维护者速读

  • 改了什么: ① 空内核存根 com.objectstack.empty 现在声明 engines.protocol: ^18(写它的运行时自己的大版本);旧 CLI 写过的存根(无范围、或别的大版本)在下次 os start 时就地补上,只改这一个键,且只改 OS_HOME 下仍是存根的文件。② os serve / os dev 的 dev artifact door 与 host-config door 共用一个 hasMetadataPlugin 判定(先认插件名 com.objectstack.metadata,再认类名),dev door 不再在已有 MetadataPlugin 的栈上再加一个。
  • 为什么改: 文档首页一行命令 npm i -g @objectstack/cli && os start 的首启诊断报「com.objectstack.empty 没声明 engines.protocol」,新人既不能修也找不到这个包;os init -t app 脚手架上 os dev 每次启动都报「Plugin superseded: 'com.objectstack.metadata'」,怪用户配错了一个他没写过的插件。后者的根因:发布的 @objectstack/metadata 打包产物写成 var MetadataPlugin = class _MetadataPlugin,constructor.name 是 _MetadataPlugin,dev door 只比类名,所以认不出 standalone stack 已组好的那个;源码跑的测试看不到这个改名。
  • 风险与回滚: 只动启动组装与存根文件。存根刷新只在 OS_HOME 的 dist/objectstack.json 且 manifest.id 仍是 com.objectstack.empty 时发生,别处的同形文件、非 JSON 文件一律不碰(有 pin)。dev door 的判定只比原来多认一种已有插件的写法,host config 没有自己的 MetadataPlugin 时照旧组 dev door。两个包各一条 patch changeset。回滚即撤 PR。
  • 先看: packages/runtime/src/default-host.ts 的 ensureEmptyBootStub 与 createDefaultHostConfig 里按路径传入时的刷新分支;packages/cli/src/utils/stack-collections.ts 的 hasMetadataPlugin;packages/cli/src/commands/serve.ts 两处门控。
  • 两分钟验证: 空目录、空 HOME 下跑 os start:首启诊断里不再出现 declares no engines.protocol range,~/.objectstack/dist/objectstack.json 带 "engines": { "protocol": "^18" }。
  • 需要你做的: 无,席位落地。

What changes

#29937 — the empty kernel's stub declares its range (@objectstack/runtime, commits 4a5bb32 and 8e3cead)

  • ensureEmptyBootStub(stubPath) (new, in default-host.ts; not re-exported from the package index) owns the stub. Absent: it is written with manifest.engines.protocol = ^PROTOCOL_MAJOR (from @objectstack/spec/kernel), the major of the runtime that writes it, so it is compatible by construction. Present and still the stub (manifest.id is com.objectstack.empty) with no range or another major's: only manifest.engines.protocol is rewritten. Present and not the stub, or not JSON: left alone; the loader reports it.
  • The re-stamp of another major's range is deliberate: a stub stamped ^18 by this CLI would otherwise be refused as OS_PROTOCOL_INCOMPATIBLE the day the runtime moves to 19, failing the one boot that has nothing in it.
  • Found by the before/after measurement, not in the card: the empty-boot branch of createDefaultHostConfig runs only on the FIRST os start. From the second on, the os start supervisor resolves HOME_DIR/.objectstack/dist/objectstack.json as an artifact rung (resolveArtifactBootSource, rung home-dist) and hands it down as artifactPath, so a stub an older CLI wrote was never reached by the first commit and kept warning (measured, log below). The second commit refreshes the stub on that path too, keyed on the resolved path being exactly the home stub path; a stub-shaped file named anywhere else is left alone.

#29936 — one MetadataPlugin on a scaffold's os dev (@objectstack/cli, commit 028a043)

  • hasMetadataPlugin(plugins) (new, utils/stack-collections.ts, beside hasObjectQLPlugin / hasStorageDriverPlugin): a plugin named com.objectstack.metadata, or a class named MetadataPlugin.
  • serve.ts: the dev artifact door's gate was !plugins.some((p) => p?.constructor?.name === 'MetadataPlugin'); the host-config door's was the name-or-class form. Both now read !hasMetadataPlugin(plugins). createStandaloneStack is untouched, as the dispatch asked.
  • Why only the dev door missed: the published bundle (checked on @objectstack/metadata@18.3.0 dist/index.js and on this branch's own build of packages/metadata/dist/index.js and node.js, one hit each) declares var MetadataPlugin = class _MetadataPlugin {. The host-config door already checked the name, so it was immune; the dev door was not.

Tests

  • packages/runtime/src/default-host-empty-stub.test.ts (new, 9 cases): a fresh stub passes the handshake (checkProtocolCompat(...).status === 'ok'); a legacy stub (exactly the 18.3.0 bytes' shape) is refreshed with everything else kept; another major's range is re-stamped; a current stub is left byte for byte; a non-stub artifact and a non-JSON file are untouched; through createDefaultHostConfig: the legacy stub named as artifactPath at the home location is refreshed, the empty boot writes the range, and a stub-shaped file named elsewhere is untouched.
  • packages/cli/src/utils/stack-collections.test.ts: three hasMetadataPlugin cases, one built on the bundle's shape (class _MetadataPlugin { name = 'com.objectstack.metadata' }).
  • Source pins updated: serve-host-config-security-registrar.pin.test.ts (the dev door's gate string) and serve-host-config-metadata-door.pin.test.ts (both doors ask !hasMetadataPlugin(plugins), count 2, and no class-name-only spelling is left in serve.ts).

Verification

All readings on head 2041627 (gates: the 61-family run on 8e3cead, then the 17 families that read the last commit's file re-run on 2041627; the last commit adds one SERVE_ONLY entry to a cli test).

Real boot, before/after (#29937: os start, empty directory, empty HOME)

Built CLI of this branch (node packages/cli/bin/run.js start, HOME a fresh temp dir).

  • Before (default-host.ts restored from a26abbc, runtime rebuilt; ensureEmptyBootStub count in dist 0): Artifact: none (empty kernel …), then ℹ Boot diagnostics — 1 informational: WARN [AppPlugin] [protocol] package 'com.objectstack.empty' declares no engines.protocol range; loading under protocol 18.0.0 without a compatibility check (ADR-0087).
  • After, fresh home: Server is ready, no Boot diagnostics block; the stub on disk carries "engines": { "protocol": "^18" }.
  • After commit 1 only, legacy stub (the 18.3.0 stub bytes pre-seeded): banner Artifact: HOME_DIR/.objectstack/dist/objectstack.json (the home-dist rung), the same WARN, stub unchanged. This is what commit 8e3cead closes.
  • After commit 2, legacy stub: no Boot diagnostics; the stub now carries "engines": { "protocol": "^18" }.
  • Restore leg: git diff HEAD empty, runtime rebuilt from HEAD (dist ensureEmptyBootStub( count 3).
Real boot, before/after (#29936: os dev on an os init my-app -t app scaffold)
  • Before (serve.ts restored from a26abbc, cli rebuilt): ℹ Boot diagnostics — 1 informational: WARN Plugin superseded: 'com.objectstack.metadata' — the later registration (v1.0.0) REPLACED the earlier one (v1.0.0). …
  • After (cli rebuilt from HEAD): Server is ready, superseded count 0, no Boot diagnostics block; Plugins: 41 loaded lists com.objectstack.metadata once.
  • Restore leg: git diff HEAD empty.
Ablations (scripts/ablation-replace.mjs; each restored, blob == HEAD, git diff HEAD empty)
  • hasMetadataPlugin name clause dropped (return ctor === 'MetadataPlugin';): stack-collections.test.ts 1 failed / 21 passed — finds the plugin by its name when the bundle renamed the class.
  • Stub engines: { protocol: range }, removed: default-host-empty-stub.test.ts 3 failed / 6 passed (fresh stub, current-stub-left-alone, empty boot writes the range).
  • Named-path refresh disabled (path compared to a sentinel): 1 failed / 8 passed — refreshes a legacy stub handed in as artifactPath at the home location.
Tests and typecheck
  • pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2: Test Files 545 passed (545), Tests 9840 passed, 19 skipped (9859); lock VERDICT command-exit 0.
  • pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 on 8e3cead: 1 failed / 5429 passed — boot-preparation-parity.test.ts asked for hasMetadataPlugin to be listed; fixed in 2041627 (SERVE_ONLY entry with its reason), that file then 37/37. The cli integration tier is declared to CI.
  • pnpm --filter @objectstack/runtime typecheck, pnpm --filter @objectstack/cli typecheck: VERDICT command-exit 0 both.
Derived gates (dispatch-gates --commands, 61 families)
  • 59 exit 0. 2 exit 3, NOT MEASURED (prerequisite: a whole-workspace build): check:dual-build-cjs-loads, check:i18n-coverage; left to CI.
  • dispatch-gates --ran: 61 derived, 59 run, 2 NOT-MEASURED, 0 UNRUN.
  • Re-run on 2041627, all exit 0: closing-keyword-parity, comment-mask-adoption, comment-mask-corpus, issue-citations (script and pnpm), closed-ceremony-text, cross-package-test-inputs, keyed-text-bounds, logger-receiver-detach, nul-bytes, refd-timer-probe, registry-log-declared, rest-log-spy-declared, test-source-alias, tier-file-adoption, type-check-debt, undeclared-dep-imports.

Acceptance notes


Generated by Claude Code

…l range

The empty-boot stub (`com.objectstack.empty`) had no `engines.protocol`,
so the ADR-0087 handshake warned about it on the first `os start` in an
empty directory. It now declares `^<PROTOCOL_MAJOR>`, and a stub an older
CLI wrote (no range, or another major) is refreshed in place.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZgQTno2oPVD2GLd2n
… by name

The dev door checked only `constructor.name === 'MetadataPlugin'`, but
the published @objectstack/metadata bundle names the class
`_MetadataPlugin`. On an installed CLI the check missed the standalone
stack's MetadataPlugin and composed a second one, so `os dev` on a fresh
`os init -t app` scaffold warned "Plugin superseded". Both serve doors
now ask one `hasMetadataPlugin` predicate (plugin name, then class name).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZgQTno2oPVD2GLd2n
… path

Once `<home>/dist/objectstack.json` exists, `os start` resolves it as an
artifact rung and passes it as `artifactPath`, so the empty-boot branch
never runs again and a stub an older CLI wrote kept warning. The stub at
the home location is now refreshed on that path too; an app artifact at
the same path, or a stub-shaped file anywhere else, is left alone.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZgQTno2oPVD2GLd2n
…rity census

serve.ts now reads `hasMetadataPlugin` from stack-collections.ts; the
migrate boot composes no MetadataPlugin of its own (the standalone data
stack always holds one), so it is a SERVE_ONLY entry with that reason.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Utp6CZgQTno2oPVD2GLd2n
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/runtime, touching 7 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/deployment/single-project-mode.mdx (via createDefaultHostConfig (symbol, a top-level function))
  • content/docs/getting-started/glossary.mdx (via createDefaultHostConfig (symbol, a top-level function))
What this run could not see
  • 1 anchor(s) matched too much of the corpus to be a work list: os serve (command, 47 pages)
  • 1 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 61 of 219 client-bound route-ledger rows — the other 158 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 158: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 103 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 — 51 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 c1240a38ac2c23c8d526e476a20edeabbbefd6f6 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 13b5a416897db0a56cad182759a29cb0c05dfc64 — the merge of head 2041627b97d9d3f43dac4219676673ac5c1ce2b3 into base c1240a38ac2c23c8d526e476a20edeabbbefd6f6, 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 13b5a416897db0a56cad182759a29cb0c05dfc64 && git checkout 13b5a416897db0a56cad182759a29cb0c05dfc64
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin c1240a38ac2c23c8d526e476a20edeabbbefd6f6 2041627b97d9d3f43dac4219676673ac5c1ce2b3 && git checkout -B drift-repro c1240a38ac2c23c8d526e476a20edeabbbefd6f6 && git merge --no-ff 2041627b97d9d3f43dac4219676673ac5c1ce2b3

node scripts/docs-audit/affected-docs.mjs --json c1240a38ac2c23c8d526e476a20edeabbbefd6f6

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs c1240a38ac2c23c8d526e476a20edeabbbefd6f6 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#3 · os-bill · session_01Utp6CbPxYq1wQmUNWvMZkC

席位核对

ACCEPT · head 2041627b97d9d3f43dac4219676673ac5c1ce2b3 · cards #29937 (claim 6650574489, chain head) + #29936 (claim 6650587373), folded · 2026-11-05T06:46Z

  • Shape: draft PR to main, author objectstack-fleet[bot] (relay), attribution block then Fixes #29937 and Fixes #29936, one per member. 10 files, +345 −37. check-governed-merges.mjs --pr 30333: NOT governed ⇒ ordinary queue landing.
  • Declarations: Clause-②: no, Metadata-protocol: none, matching the claims; changesets @objectstack/runtime patch and @objectstack/cli patch. Neither widening nor narrowing ⇒ the seat's own review of record.
  • Seat review (read against the diff): ensureEmptyBootStub and EMPTY_BOOT_STUB_ID are exported from default-host.ts but not re-exported by packages/runtime/src/index.ts (which names only createDefaultHostConfig, resolveDefaultArtifactPath and their types), and exports maps no deep path, so the public surface is unchanged. The stub refresh touches a file only while its manifest.id is still com.objectstack.empty, rewrites only manifest.engines.protocol to ^PROTOCOL_MAJOR, and leaves unreadable JSON or an operator's artifact alone; the second call site fires only when the resolved artifact IS the home stub path. hasMetadataPlugin identifies by plugin name first, class name as fallback, and both serve doors use it; createStandaloneStack untouched.
  • Proof (dev): before/after once per card on the published-shape build, plus 3 ablations each red and restored; the second os start path (home stub reached as artifactPath) measured and covered.
  • Gates (check-runs on this head): 48 runs, 35 success, 13 skipped, 0 failed; Lint & Repo Gates, TypeScript Type Check, Test Core, Check Changeset, Dogfood Regression Gate, Live E2E UI success. Skips read by name (path-gated, opt-in harnesses incl. Dogfood Verify CLI, the schedule gate): check-expected-skips.mjs cannot run in this container (yaml not installed).
  • Accepted deviation: two commits per card instead of one (os start with no project, the docs' one-line Community quickstart, warns that the platform's own empty-kernel stub com.objectstack.empty declares no engines.protocol range #29937: the second boot path; os dev on an os init -t app scaffold warns "Plugin superseded: 'com.objectstack.metadata'" on every boot, because the platform registers its own metadata plugin twice #29936: the boot-preparation-parity registration the cli unit suite requires).
  • Writes: dev api_writes 2 + push, mcp_calls 3 (read-only issue_read).
  • Landing: ready + auto-merge by the seat.

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/m tests tooling

Projects

None yet

1 participant