feat(spec)!: converge the dual-source MetadataFormat and CacheStrategy enum declarations (#4537) - #4557
Merged
Conversation
…y enum declarations (#4537) Two enum vocabularies were declared on both ./shared and ./system and had diverged on their VALUES — which accepted value set you got depended on nothing but the import path (the #4411 trap; #4535 A2, #4506 baseline). Value-level divergence is the silent kind: a mismatched value never fails to compile. MetadataFormat / MetadataFormatSchema — shared declaration is the single source: - system/metadata-persistence.zod.ts no longer declares its own 7-member copy; it re-exports shared/metadata-types.zod (the MetadataManagerConfig pattern, in reverse). The extension-style aliases yml/ts/js it carried had zero producers in this repo, objectui and cloud: FilesystemLoader.detectFormat normalizes at the boundary (.yml -> 'yaml', .ts -> 'typescript', .js -> 'javascript') and the database/remote/memory loaders always emit 'json'. - Direction: shared, not system — kernel/metadata-loader.zod has imported the shared schema since #4411 (MetadataManagerConfig.formats needs no change), and system already re-exports MetadataManagerConfigSchema FROM kernel, so a system-side source would close a module cycle (shared -> system -> kernel -> shared). CacheStrategy — system/cache.zod.ts (CacheStrategySchema) is the single declaration: - shared/enums.zod.ts CacheStrategyEnum (+ its CacheStrategy type export) removed: zero importers in all three repos, while the system schema is the one CacheTier.strategy gates on. Same disposition as AggregationFunctionEnum in the same file (objectui#2945): removed rather than reconciled. - 'adaptive', declared only on the system side with zero producers, is dropped — the enum carries the four values both declarations agreed on (lru | lfu | fifo | ttl). Bookkeeping: - dual-source-exports.baseline.json: the three converged rows deleted (shrink-only ratchet). - json-schema.manifest.json: shared/CacheStrategyEnum key deleted (deliberate retirement, #2978 flow). - Pin tests: yml/ts/js rejected on the system entry; 'adaptive' rejected on CacheStrategySchema. - api-surface.json, references docs, skill refs regenerated via check:generated --fix. - Changeset (major) carries the FROM -> TO migration lines. - No ADR-0087 conversion / tombstone: loader envelope + config vocabulary with no authorable-metadata producers (the #4411/#4536 route). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M9uWvoEp9CoLzYjNExj9sL
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 107 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
os-zhuang
marked this pull request as ready for review
August 2, 2026 04:07
This was referenced Aug 2, 2026
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.
Fixes #4537
#4535 A2 项:
MetadataFormat/MetadataFormatSchema/CacheStrategy在./shared与./system各有一份声明,且分歧在枚举值上——值不匹配不会编译错,是比形状分歧更易出静默 bug 的一类(#4411 陷阱)。三条基线行全部收敛并删除。前置核查结论(三仓扫描:本仓 + cloud + objectui)
yml/ts/js三个别名:零生产者 ⇒ A1 同款收窄。packages/metadata/src/loaders/filesystem-loader.ts的detectFormat在边界处归一化:.yml→'yaml'、.ts→'typescript'、.js→'javascript'——扩展名别名从不进入format字段;'json';--format旗标是输出格式(json/yaml/table),不同域。CacheStrategy分歧 ='adaptive'(仅 system 侧声明,零生产者)。shared/enums.zod.ts的CacheStrategyEnum(4 值)三仓零 importer;system/cache.zod.ts的CacheStrategySchema(5 值)是CacheTier.strategy实际引用的一份。真源侧判定(import 语句级)
MetadataFormat:shared 为真源,system 收敛为 re-export(MetadataManagerConfig模式、反向)。运行时消费者(packages/metadata 的 4 个 serializer + filesystem-loader)从@objectstack/spec/system导入——re-export 后符号同一,零改动;kernel/metadata-loader.zod自 spec 同名双源:两个MetadataWatchEvent形状不同、分挂两个子路径入口,其中 kernel 版零消费方(ADR-0049 enforce-or-remove) #4411 起从 shared 导入,无需回改。方向不能选 system:system 已从 kernel re-exportMetadataManagerConfigSchema(system → kernel → shared 依赖链),真源放 system 会闭环成模块循环。CacheStrategy:system/cache.zod成为唯一声明。shared 侧零 importer,按同文件AggregationFunctionEnum先例(objectui#2945)删除而非调和——为一个概念保留第二个名字正是词汇当初漂移的成因;'adaptive'一并收窄,枚举保留两份声明曾共同认可的 4 值(lru | lfu | fifo | ttl)。变更清单
system/metadata-persistence.zod.ts:删除本地 7 值MetadataFormatSchema,re-export shared 声明(4 值);类型同步 re-export;单一来源注释更新。shared/enums.zod.ts:删除CacheStrategyEnum+CacheStrategy类型(附与AggregationFunctionEnum同款的处置注释)。system/cache.zod.ts:CacheStrategySchema收窄掉'adaptive'。yml/ts/js拒绝 pin;cache 侧'adaptive'拒绝 pin;shared enums 测试删除对应块。dual-source-exports.baseline.json:删除 3 条基线行(shrink-only ratchet 点名的正是这 3 条,无额外 stale 行)。json-schema.manifest.json:删除shared/CacheStrategyEnum(deliberate retirement,gen:schema silently drops PageTabsProps since #2967 — references regen would delete real docs #2978 流程)。api-surface.json(./shared 少 2 个导出)、references 文档、skill refs 均由check:generated --fix再生。'yml'→'yaml'、'ts'→'typescript'、'js'→'javascript';CacheStrategyEnum→@objectstack/spec/system的CacheStrategySchema;'adaptive'→ 4 值之一)。无 ADR-0087 conversion / tombstone:loader envelope + 无 authorable 生产者的配置词汇,同 #4536/#4411 路线(
authorable-surface.json无涉及;存量sys_metadata行不携带别名值——DB loader 恒写'json')。验证
check:dual-source-exports:✅ 无新增,49 条 accepted(3 条已删)check:generated:✅ 8/8 artifacts up to datepnpm --filter @objectstack/spec test:285 files / 7246 tests 全绿pnpm --filter @objectstack/spec typecheck(tsc --noEmit):✅pnpm build:71/71 ✅pnpm test:132/132 turbo tasks ✅(exit 0)关联:#4535(主单)、#4506(基线)、#4411、#4536(同款处置先例)
Generated by Claude Code