Skip to content

feat(runtime,cli): surface seed / marketplace-heal outcomes in the boot summary (#3430)#3444

Merged
os-zhuang merged 1 commit into
mainfrom
claude/boot-summary-seed-outcomes-m9sath
Jul 24, 2026
Merged

feat(runtime,cli): surface seed / marketplace-heal outcomes in the boot summary (#3430)#3444
os-zhuang merged 1 commit into
mainfrom
claude/boot-summary-seed-outcomes-m9sath

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

背景 / Why

Closes #3430.

os dev 转发给 serve 的默认 log-level 是 warn,而种子链路最关键的结果行全是 logger.info,再加上 serve 的 boot-quiet 窗口会吞掉 stdout。后果:默认 dev 环境下,「marketplace 包装了但 0 行」「换库自愈(heal)」「行级 seed 失败」这类状态在启动输出里完全不可见——只能靠直接查库确认。

#3415 已经把 config app(AppPlugin)的 seed 结果提为 boot 摘要行;本 PR 把它扩展到 marketplace 的 rehydrate/heal 路径,并改成按来源的摘要。

What changed

  • seed-summary kernel 服务改为「按来源」的列表。 新增 @objectstack/runtime 的共享写入器 recordSeedOutcome(ctx, outcome)——一个契约,两端都用,避免 producer 各写各的 shape。registerService 对重复名会抛错,故写入器只在首次注册、之后原地 mutate 同一引用(getService 返回的是同一数组)。

  • AppPlugin(config apps) 现在通过 recordSeedOutcome 记录一条带标签的条目(source = appId),取代原先跨 app 累加的单聚合对象。

  • MarketplaceInstallLocalPlugin 的 rehydrate/heal 路径 现在也记录一条 marketplace: true 的条目:heal 落库成功 → healed;声明了 seed 数据却 0 行落库 → emptyInstall(⚠ 升级)。经守卫式动态 import 解析,旧 runtime / mock 缺失该 helper 时安全跳过,不影响 heal 主流程。

  • CLI ready banner 读取该列表并打印一行合并的 Seeds:,不受 log-level 影响:

    Seeds:   showcase 162 rows · hotcrm(marketplace) 157 ok / 5 errors ⚠
    

    fresh-DB 自愈标注 (healed on fresh db);errored > 0 或「装了包但 0 行」升级为黄色 行,不再静默。

对应 issue 的四点要求:①两端各自汇总 inserted/updated/skipped/errored;②errored>0 或空装显眼标记;③heal 明确标注;④在 kernel:ready 后于 ready banner 处输出一次,不依赖 --log-level info

Tests

  • packages/runtime/src/seed-summary.test.ts(新增)——锁定 mutate-in-place + 合并语义,尤其是「第二个来源不触发 duplicate-register 抛错」这条关键路径。
  • packages/cli/src/utils/format.seed-summary.test.ts——改为按来源断言:clean / rejected / marketplace-healed / empty-install / 多来源合并 / 静默。
  • packages/cloud-connection/src/marketplace-install-local-heal.test.ts——断言 heal 成功记录 healed:true、无行落库记录 emptyInstall:true

全部通过:runtime 592、cli 632、cloud-connection 63(三个 package 的完整 suite);受影响 package 依赖闭包 build 绿(含 tsc)。已加 changeset。

References

🤖 Generated with Claude Code


Generated by Claude Code

…ot summary (#3430)

`os dev` forwards a default `warn` log level and the serve boot-quiet window
swallows stdout, so the seed pipeline's `logger.info` result lines are invisible:
a marketplace package rehydrating onto a fresh DB with 0 rows, a fresh-DB
self-heal, and row-level seed failures all had zero terminal signal.

Extend the #3415 Seeds banner line to a per-source summary. The `seed-summary`
kernel service is now a list; AppPlugin (config apps) and the marketplace
rehydrate/heal path each record a labelled entry through a shared
`recordSeedOutcome` writer, and the ready banner prints one combined line that
ignores the log level, e.g.:

  Seeds:   showcase 162 rows · hotcrm(marketplace) 157 ok / 5 errors ⚠

Fresh-DB heals are marked `(healed on fresh db)`; a marketplace package that
installed with seed datasets but landed 0 rows, and any run that dropped
records, escalate to a yellow ⚠ line instead of passing silently.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EBziZWgaMBBFdqrrYHwqxc
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Building Building Preview, Comment Jul 24, 2026 2:49pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling labels Jul 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/cloud-connection, @objectstack/runtime.

30 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/ai/skills-reference.mdx (via packages/cli)
  • content/docs/api/client-sdk.mdx (via @objectstack/cli)
  • content/docs/api/data-flow.mdx (via @objectstack/cli)
  • content/docs/api/environment-routing.mdx (via @objectstack/cli)
  • content/docs/api/error-catalog.mdx (via @objectstack/cli)
  • content/docs/api/index.mdx (via @objectstack/runtime)
  • content/docs/api/wire-format.mdx (via @objectstack/runtime)
  • content/docs/automation/hook-bodies.mdx (via packages/cli, @objectstack/runtime)
  • content/docs/concepts/north-star.mdx (via packages/runtime)
  • content/docs/data-modeling/drivers.mdx (via @objectstack/runtime)
  • content/docs/deployment/backup-restore.mdx (via @objectstack/cli)
  • content/docs/deployment/cli.mdx (via @objectstack/cli)
  • content/docs/deployment/index.mdx (via @objectstack/runtime)
  • content/docs/deployment/production-readiness.mdx (via @objectstack/runtime)
  • content/docs/deployment/self-hosting.mdx (via @objectstack/cli)
  • content/docs/deployment/single-project-mode.mdx (via @objectstack/runtime)
  • content/docs/deployment/vercel.mdx (via @objectstack/runtime)
  • content/docs/getting-started/your-first-project.mdx (via @objectstack/cli, @objectstack/runtime)
  • content/docs/kernel/runtime-services/data-service.mdx (via packages/cli)
  • content/docs/kernel/runtime-services/index.mdx (via packages/cli)
  • content/docs/permissions/authentication.mdx (via @objectstack/cli, @objectstack/runtime)
  • content/docs/permissions/authorization.mdx (via packages/runtime)
  • content/docs/plugins/packages.mdx (via @objectstack/cli, @objectstack/runtime)
  • content/docs/protocol/kernel/http-protocol.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/index.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/lifecycle.mdx (via @objectstack/runtime)
  • content/docs/protocol/kernel/plugin-spec.mdx (via @objectstack/cli)
  • content/docs/protocol/kernel/realtime-protocol.mdx (via @objectstack/cli)
  • content/docs/releases/implementation-status.mdx (via @objectstack/cli, @objectstack/runtime)
  • content/docs/releases/v16.mdx (via @objectstack/cli)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang marked this pull request as ready for review July 24, 2026 15:06
@os-zhuang
os-zhuang merged commit d60968c into main Jul 24, 2026
15 of 16 checks passed
@os-zhuang
os-zhuang deleted the claude/boot-summary-seed-outcomes-m9sath branch July 24, 2026 15:06
os-zhuang added a commit that referenced this pull request Jul 25, 2026
…source, not just the first (#3453) (#3478)

In multi-tenant mode a new org replays the kernel's `seed-datasets` list on the
`sys_organization` insert, so that list must hold the union of every seed source
(every config app + every marketplace package). Two framework traps — the same
pair #3444 fixed for seed-summary — shrank it to just the first source:

- the standard PluginContext has no `.kernel` handle, so
  `(ctx as any).kernel?.getService('seed-datasets')` always read undefined and
  each source clobbered the list with only its own datasets; and
- `registerService` throws on a duplicate name, so the second source's
  re-register was swallowed and its datasets (and, for a config app, its
  replayer) were silently lost.

`seed-datasets` is now a single shared array, registered once and mutated in
place by every source via a new `mergeSeedDatasets` helper that reads through the
context's own resolver first. AppPlugin's per-org replayer reads that live list
at invoke time — not a captured snapshot — and is itself registered once and
reused by later config apps, so a new org replays the full union.

Seam-level unit tests only (accumulation across app + marketplace sources; the
replayer reads the live union); true multi-tenant e2e needs the enterprise
`@objectstack/organizations` plugin, which lives in the cloud repo.

Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

os dev: surface seed / sample-data-heal outcomes in the boot summary (info logs are swallowed by the default warn log level)

2 participants