feat(platform-objects,service-storage,cli): sys_migration 账本改由平台基础设施注册 (#4243) - #4258
Merged
Merged
Conversation
…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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 20 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…ledger-infra-c3e8gr
os-zhuang
marked this pull request as ready for review
July 31, 2026 01:24
This was referenced Jul 31, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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),所以每个被服务的内核都带账本。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-objects253 /service-storage252 /cli622 /objectql1277 /runtime956 个用例全绿;改动文件 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