You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(spec)!: MetadataWatchEvent.type carries only the values the runtime emits (#4536) (#4545)
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).
Claude-Session: https://claude.ai/code/session_01M9uWvoEp9CoLzYjNExj9sL
Co-authored-by: Claude <noreply@anthropic.com>
`MetadataWatchEvent.type` now carries only the values the runtime emits: the enum narrows FROM `'add' | 'change' | 'unlink' | 'added' | 'changed' | 'deleted'` TO `'added' | 'changed' | 'deleted'` (#4536, follow-up to #4411).
6
+
7
+
The three raw chokidar values had zero producers: both emit sites normalize before constructing the event — `packages/metadata/src/node-metadata-manager.ts` translates chokidar's `add`/`change`/`unlink` in the watcher callbacks (`handleFileEvent` accepts only the canonical three), and `packages/metadata/src/metadata-manager.ts` normalizes repository ops (`create`/`update`/`delete` → `added`/`changed`/`deleted`). Consumers parsing events therefore never received the raw values, and no runtime behavior changes.
8
+
9
+
- FROM: an external implementor could construct events typed `'add'`/`'change'`/`'unlink'` and readers had to (needlessly) branch on six values.
10
+
- TO: an implementor constructing events with the raw values must emit `added`/`changed`/`deleted` instead; readers may delete any branches on `add`/`change`/`unlink` — they were unreachable.
11
+
12
+
No tombstone / ADR-0087 conversion: this is a runtime event envelope type, not authorable metadata — nothing parses it on a load path (the #4411 route).
0 commit comments