Skip to content

Commit 9c86ed7

Browse files
os-zhuangclaude
andcommitted
docs(changeset): state the register() notify change as a contract fix, not a bug fix
unregisterPackage()/bulkUnregister() have no production caller in framework or cloud today, so their announce is correct-but-latent. The one live behavior change is runtime datasource writes reaching the HMR SSE stream. Say so instead of advertising two 'concrete fixes'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 56b5baa commit 9c86ed7

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

.changeset/metadata-register-notifies-watchers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
**`MetadataManager.register()` / `unregister()` now announce to `subscribe()` watchers.** Both updated the registry, persisted to writable loaders and published to realtime, but never fired the watch callbacks — so `subscribe()` looked like it covered every write while silently missing all of them. Only the `saveMetaItem` path (via the repository watch stream) and the filesystem watcher ever reached a subscriber. Runtime consumers that cache metadata — notably ObjectQL's SchemaRegistry bridge, the component that decides what is queryable — went stale on every other write until the process restarted.
88

9-
Announcing is now the **default**, so a new call site is correct without knowing this contract exists. Two concrete fixes fall out: uninstalling a package (`unregisterPackage`) now tells cached consumers to drop the removed objects instead of serving them until restart, and runtime datasource writes reach watchers.
9+
Announcing is now the **default**, so a new call site is correct without knowing this contract exists. This is a contract fix rather than a bug fix: the one live behavior change is that runtime datasource writes (`datasource-admin`) now reach the HMR SSE stream, which subscribes to every registered type. `unregisterPackage()` / `bulkUnregister()` also announce their deletes now — correct, but latent, since neither has a production caller today.
1010

1111
Bulk ingest opts out explicitly with the new `MetadataWriteOptions` (`{ notify: false }`) — boot-time filesystem priming, artifact ingest, and ObjectQL's registry bridge, each of which either runs before consumers cache anything or announces the whole batch once (as the artifact reload path does via `metadata:reloaded`). The bridge in particular MUST stay silent: it copies objects out of the SchemaRegistry, and announcing would feed them back through a handler that re-registers under `_packageId ?? 'metadata-service'`, overwriting the true package provenance of every object whose body carries no `_packageId`.
1212

packages/metadata/src/register-notifies-watchers.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,10 +227,10 @@ describe('#3112 — register()/unregister() notify subscribe() watchers', () =>
227227

228228
describe('unregisterPackage()', () => {
229229
it('announces every removed item, so cached consumers drop the uninstalled schemas', async () => {
230-
// The concrete bug the silent write path caused: uninstalling a package
231-
// tore the objects out of the registry, but ObjectQL's SchemaRegistry
232-
// bridge never heard a 'deleted' event and kept resolving the removed
233-
// objects until the process restarted.
230+
// Latent today — nothing calls unregisterPackage() in production — but it
231+
// is the shape the silent write path would have broken: the objects leave
232+
// the registry while ObjectQL's SchemaRegistry bridge, never hearing a
233+
// 'deleted' event, keeps resolving them until the process restarts.
234234
await manager.register('object', 'crm_account', { name: 'crm_account', packageId: 'com.acme.crm' }, { notify: false });
235235
await manager.register('object', 'crm_contact', { name: 'crm_contact', packageId: 'com.acme.crm' }, { notify: false });
236236
await manager.register('object', 'other', { name: 'other', packageId: 'com.other' }, { notify: false });

0 commit comments

Comments
 (0)