Dependent-doc-changed hook

When any document is published, this post-commit hook finds every document that sdg:dependsOn the newly-published document and emits a sdg:dependentDocChanged event for each.

Why

The event is the access point for two downstream concerns that mature in later phases:

  • Re-verification of claims and queries. A version's claims were verified against a source at publish time; when that source advances, its dependents may need re-verification. Phase 4 attaches a verifier to this event; Phase 1 only logs.
  • Author notifications. The owner of a document that depends on something that changed should see it. Phase 4 routes notifications; Phase 1 surfaces the event in the demo log.

Phase 1 behaviour

On each match:

  1. Query the latest Version graph of every other Document in the Index for ?dep sdg:dependsOn <changed-doc>.
  2. For each ?dep, emit a structured sdg:dependentDocChanged event to the in-process event bus and to the demo console.
  3. No re-verification, no notification, no follow-up transaction. The event exists; consumers arrive in Phase 4.

Why a hook and not a script

The dependency computation is incremental: it only needs to consider the newly-published Document, not rescan the whole graph. Event-driven fits. A Script that ran on a schedule and recomputed the full graph would be wasteful for this concern, though Phase 4 adds a companion Script that heals drift if the hook fails to fire.

Failure mode

Post-commit hooks fire after the atomic commit; a failure here does not retroactively decline the publish. Phase 1 logs and moves on. Phase 4 adds retry with exponential backoff.

Dependent-doc-changed hook — Sparqdown Docs