Skip to content

metadata-protocol: rollbackMetaItem / revertCommit registry write-throughs never emit onMetadataMutation — boot-cached rebinds and (post-#13331) cluster fan-out miss recovery writes #14179

Description

@claude

Found while implementing #13331 (the metadata.mutated cluster fan-out). Out of that card's ruled scope — recorded, not fixed there.

Measurement (worktree at e460193, tree identical to origin/main for these seams)

packages/metadata-protocol/src/protocol.ts has FIVE applyRegistryWriteThrough call sites (traced in protocol.object-registry-write-through-spelling.test.ts) but only THREE emitMetadataMutation sites:

  • saveMetaItem — write-through + emit
  • runPublishSideEffects — write-through + emit
  • deleteMetaItem — heal + emit
  • rollbackMetaItem — write-through, no emit
  • revertCommit — write-through (per item), no emit

So a rollback or a commit revert is "a live write like any other" for the LOCAL registry (both call sites say so in their own comments), but the post-persistence notification bus documented as "the ONE choke point every authoring surface funnels through" never hears it.

Consequence, both halves

  1. Local (pre-existing): boot-cached consumers wired to onMetadataMutationObjectQLPlugin's authored hook/action re-bind (Authored (Studio) hooks never execute their body — no bodyRunner on the metadata-service bind path #2588/Tracking: Studio-authored metadata that's declared but never wired at runtime (the 'silently does nothing' family) #2605), ADR-0094 projectors are separate — do not re-sync after a rollback/revert. Rolling back a hook row leaves the OLD hook bound until restart, while the registry and the stored row already serve the restored body.
  2. Cross-node (exists once runtime: TS-config boot registers a 'metadata' service without attachClusterPubSub — cross-node invalidation disabled; new object gives OBJECT_NOT_FOUND on non-writing replicas, never heals #13331's fix lands): the metadata.mutated publisher rides emitMetadataMutation, so recovery writes will not fan out to peer replicas either — a rollback converges the writer and leaves peers on the rolled-back-FROM body until an unrelated mutation or restart.

Suggested shape

One edit at each recovery door: emit the mutation event (state active) after the write-through, with the same org scope the write-through received. That single seam repairs both halves at once — the local listener bus and the cluster fan-out inherit together, which is exactly the argument the choke-point docblock makes.

Blocked-by: #13331

Dedup: REST open-issues sweep (443 open issues, 5 pages, positive control attachClusterPubSub hit 3) — no card names these two seams' missing emit.


Generated by Claude Code

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions