feat(spec)!: MetadataWatchEvent.type carries only the values the runtime emits (#4536) - #4545
Merged
Merged
Conversation
…ime emits (#4536) The enum declared six values but three of them — the raw chokidar vocabulary add/change/unlink — had zero producers (declared-but- unenforced, Prime Directive #10). Both event construction sites normalize before the event exists: - packages/metadata/src/node-metadata-manager.ts translates chokidar's add/change/unlink in the watcher callbacks (handleFileEvent accepts only 'added' | 'changed' | 'deleted') - packages/metadata/src/metadata-manager.ts normalizes repository ops (create/update/delete -> added/changed/deleted) so the raw values never reached the event surface and no consumer branches on them (three-repo scan on the parent issue; re-verified here: the only other raw-vocabulary hits are chokidar-level wiring in cli/dev.ts, metadata/plugin.ts and metadata-fs/repository.ts, which emit different types entirely). Changes: - system/metadata-persistence.zod.ts: MetadataWatchEventSchema.type narrows to z.enum(['added', 'changed', 'deleted']), with a comment pointing at the translation site - contracts/metadata-service.ts: subscribe? TSDoc (and the import-site comment) stop mixing the two vocabularies - system/metadata-persistence.test.ts: canonical three parse; new pin test asserts add/change/unlink are rejected - generated references docs regenerated (enum cell only); api-surface.json unchanged (no export added or removed) - changeset (major): breaking only for an external implementor constructing events with the raw values — emit the canonical three; readers may delete branches on the raw values (they were unreachable). No tombstone / ADR-0087 conversion: runtime event envelope, not authorable metadata (the #4411 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
|
os-zhuang
enabled auto-merge
August 2, 2026 02:07
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:
|
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.
Closes #4536(#4535 主单 A1 项)。
MetadataWatchEvent.type从 6 值收紧到'added' | 'changed' | 'deleted'。原始 chokidar 词汇(add/change/unlink)在NodeMetadataManager的监听回调里就被翻译(node-metadata-manager.tshandleFileEvent),另一处构造点metadata-manager.ts:1663把 repo op 归一 —— 三个原始值零生产者,declared ≠ enforced(Prime Directive #10)。#4411 当时拒绝收紧的理由(「它确实发 add/change/unlink」)经查不成立。改动
system/metadata-persistence.zod.ts:枚举收窄 + 注释说明原始词汇为何到不了事件面contracts/metadata-service.ts:subscribe?TSDoc 与 import 处注释的混用词汇修正(后者是 brief 外同性质的顺带修)metadata-persistence.test.ts:三值通过 + pin 三个原始值被拒;fixture 移离原始值major,FROM → TO 齐备;不带 tombstone / conversion(运行时信封类型,spec 同名双源:两个MetadataWatchEvent形状不同、分挂两个子路径入口,其中 kernel 版零消费方(ADR-0049 enforce-or-remove) #4411 路线)验证(开发 agent 执行,调度已复核 diff)
MetadataEvent这个不同事件类型、或无关词汇)check:generated八件套 up to date;api-surface 未动(无导出增删)pnpm typecheck122 tasks、pnpm test132 tasks 全绿关联:#4535(主单)、#4411、#4404
Generated by Claude Code