Skip to content

feat(platform-objects,service-storage,cli): sys_migration 账本改由平台基础设施注册 (#4243) - #4258

Merged
os-zhuang merged 2 commits into
mainfrom
claude/sys-migration-ledger-infra-c3e8gr
Jul 31, 2026
Merged

feat(platform-objects,service-storage,cli): sys_migration 账本改由平台基础设施注册 (#4243)#4258
os-zhuang merged 2 commits into
mainfrom
claude/sys-migration-ledger-infra-c3e8gr

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Closes #4243

改了什么

注册点从 service-storage 挪到 PlatformObjectsPlugin@objectstack/platform-objects/plugin):

  • PlatformObjectsPlugin.init() 现在通过 manifest 服务注册 SysMigration(scope: system),并声明 optionalDependencies: ['com.objectstack.engine.objectql'] —— 两者同在时保证在 ObjectQL 的 manifest 服务之后 init,不在时(纯翻译内核)照常降级启动。os serve 本来就自动注入这个插件(5c),所以每个被服务的内核都带账本。
  • 从空创建记账(feat(migrate): 从空创建的数据库在创建时刻自我认证数据迁移 — ADR-0104 fresh-datastore attestation (#3438) #4215 的 attestation)随注册一起搬家。它在 storage 里的存在理由原文就是「This service owns the call because it registers sys_migration」——前提搬走,调用跟着走。storage 侧只留读者(isDataMigrationVerified,file-references 门禁),reap guard 行为不变。
  • sys-migration.object.ts 头注释同步改写(不再是「第一个消费者注册」)。

buildDataMigrationPlugins() 的约束按 issue 建议放松

  • 默认只注册 PlatformObjectsPlugin(账本随之而来)——os migrate value-shapes 走这条路,不再为一张表启动整个 storage。
  • { storage: true } 才加 settings + storage(走 resolveStorageCapabilityArg,与 os serve 同一解析器)——只有 os migrate files-to-references 传它,因为只有它真的要对着部署的真实存储树做对账。

测试:attestation 的四个用例从 storage-service-plugin.test.ts 迁到新的 packages/platform-objects/src/plugin.test.ts,并新增 manifest 注册断言、无 manifest 降级断言和 memo 失效(invalidateDataMigrationFlags)断言。

关于「没有账本」与「有账本但没跑过」的区分

这次挪动之后,所有受支持的组装路径(os serve 自动注入、两条 migrate 命令、cloud 走 serve 的宿主内核)都必然携带账本,「没有账本」收缩为刻意不组 platform-objects 的裸内核 —— 那正是引擎「不知道一律答 false」要兜住的场景。所以没有为它建模一个可分辨状态;如果以后出现真实需要,readDataMigrationFlag 返回 null 的三种含义可以在那时拆开。

验证

  • platform-objects 253 / service-storage 252 / cli 622 / objectql 1277 / runtime 956 个用例全绿;改动文件 eslint 干净。
  • 端到端一:pnpm dev -- --fresh 起 showcase,登录后 GET /api/v1/data/sys_migration 返回两条 {"attested":"datastore-created-empty"} 记账行(注册 + attestation 都在新家生效)。
  • 端到端二:os migrate value-shapes 冷启动,日志同时出现 Optional service not present: file-storage[migration] new datastore attested at creation: …——无 storage 的内核也有账本并完成记账,这正是 sys_migration 由 service-storage 注册——账本是平台基础设施,不该由一个可选服务持有 #4243 要的性质;扫描 15 对象 111 行通过。

兼容性

os serve 路径行为不变(此前 storage 注册、现在 platform-objects 注册,结果同一张表)。唯一语义变化面:手工组装 StorageServicePlugin 而不组 PlatformObjectsPlugin 的嵌入式内核不再获得账本 —— 方向安全(fail toward retention),changeset 里已写明迁移句。cloud 仓库的宿主内核走 serve 装配,不受影响。

🤖 Generated with Claude Code

https://claude.ai/code/session_01UDj5U2VTHJE5eSyiDuqfUS


Generated by Claude Code

…n ledger as platform infrastructure (#4243)

The deployment-level data-migration flag ledger (sys_migration, #3617) was
registered by service-storage as its first consumer. The ledger now gates
storage-independent behaviour too (os migrate value-shapes #4235, creation
attestation #4215), so the registration moves to PlatformObjectsPlugin —
present on every supported assembly path — and the fresh-datastore
attestation moves with it. buildDataMigrationPlugins() no longer boots
storage for every gated migration: PlatformObjectsPlugin always, settings +
storage only for the file migration ({ storage: true }).

Verified end-to-end: a fresh `os serve` boot carries the ledger and both
attestation rows; `os migrate value-shapes` now boots without file-storage
and still finds (and attests) the ledger.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDj5U2VTHJE5eSyiDuqfUS
@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Jul 31, 2026 1:24am

Request Review

@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling labels Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 3 package(s): @objectstack/cli, @objectstack/platform-objects, @objectstack/service-storage.

20 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/plugin-endpoints.mdx (via @objectstack/service-storage)
  • content/docs/automation/hook-bodies.mdx (via packages/cli)
  • content/docs/deployment/backup-restore.mdx (via @objectstack/cli)
  • content/docs/deployment/cli.mdx (via @objectstack/cli)
  • content/docs/deployment/self-hosting.mdx (via @objectstack/cli)
  • content/docs/getting-started/your-first-project.mdx (via @objectstack/cli)
  • 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)
  • content/docs/plugins/packages.mdx (via @objectstack/cli, @objectstack/platform-objects, @objectstack/service-storage)
  • 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/service-storage)
  • content/docs/releases/v16.mdx (via @objectstack/cli)
  • content/docs/ui/setup-app.mdx (via @objectstack/platform-objects)

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 31, 2026 01:24
@os-zhuang
os-zhuang merged commit 68dea0b into main Jul 31, 2026
17 checks passed
@os-zhuang
os-zhuang deleted the claude/sys-migration-ledger-infra-c3e8gr branch July 31, 2026 01:32
os-zhuang added a commit that referenced this pull request Jul 31, 2026
…施注册 (#4270) (#4275)

feat(platform-objects,service-settings,verify): sys_secret 密文库改由平台基础设施注册 (#4270)

sys_secret(ADR-0066 D2/④ 的环境加密密钥库)此前由 service-settings 注册,但它有三类生产者且只有一类是 settings:SettingsService 的加密设置项、ObjectQL 引擎自身的 secret 字段加解密(encryptSecretFields/resolveSecret——任何带 Field.secret() 的业务对象的通用写路径)、service-datasource 的凭证 binder。与 #4243 不同,这里的失败姿态是 fail-closed:没这张表时任何 secret 字段写入直接抛错,且报错文案指认 platform-objects——一个此前并不注册它的包。

注册点改为 PlatformObjectsPlugin(与 #4258 对 SysMigration 的处理一致):init 经 manifest 服务注册 [SysMigration, SysSecret]。os serve 本就自动注入该插件,每个被服务的内核都带密文库,与是否装 settings 无关;引擎那句报错从此为真。settingsObjects 摘除 SysSecret(移除而非并存,#4236)——settings 仍是生产者/消费者,只是不再是注册者。定义归属不变(sys_secret 仍在 platform-objects 与 PLATFORM_OBJECTS_BY_PACKAGE)。

verify harness 补组 PlatformObjectsPlugin,对齐 serve 装配(该漂移自 #4258 起存在);harness 内核随之首次带上 sys_migration 账本 + 空库 attestation,dogfood 全套在该姿态下通过。同步修掉两处失真注释:sys-secret.object.ts 的「All writes flow through SettingsService」与 manifest.ts 的「Objects owned by service-settings」。

语义变化面:手工组装 SettingsServicePlugin 而不组 PlatformObjectsPlugin 的嵌入式内核不再获得 sys_secret 表(secret 写入 fail-closed 抛错,永不落明文);changeset 已写明迁移句。

Closes #4270

Co-Authored-By: Claude Fable 5 <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/l tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sys_migration 由 service-storage 注册——账本是平台基础设施,不该由一个可选服务持有

2 participants